@pisell/utils 1.0.70 → 1.0.71

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.d.ts +28 -28
  19. package/es/format.js +14 -14
  20. package/es/image.d.ts +11 -11
  21. package/es/image.js +5 -5
  22. package/es/index.d.ts +25 -25
  23. package/es/jsBridge/index.d.ts +22 -22
  24. package/es/jsBridge/index.js +15 -15
  25. package/es/jsBridge/regDeviceApi.d.ts +15 -15
  26. package/es/jsBridge/regDeviceApi.js +3 -3
  27. package/es/jsBridge/types.d.ts +149 -149
  28. package/es/locales.d.ts +9 -9
  29. package/es/locales.js +15 -15
  30. package/es/log.d.ts +10 -10
  31. package/es/miniRedux.d.ts +16 -16
  32. package/es/number-input/hooks/index.d.ts +4 -4
  33. package/es/number-input/hooks/index.js +2 -2
  34. package/es/number-input/hooks/useNumberInputState.d.ts +25 -25
  35. package/es/number-input/hooks/useNumberInputState.js +39 -39
  36. package/es/number-input/index.d.ts +14 -14
  37. package/es/number-input/index.js +8 -8
  38. package/es/number-input/types.d.ts +96 -96
  39. package/es/number-input/utils/formatter.d.ts +53 -53
  40. package/es/number-input/utils/formatter.js +37 -37
  41. package/es/number-input/utils/index.d.ts +7 -7
  42. package/es/number-input/utils/index.js +2 -2
  43. package/es/number-input/utils/validation.d.ts +27 -27
  44. package/es/number-input/utils/validation.js +24 -24
  45. package/es/otherUtils.d.ts +48 -48
  46. package/es/otherUtils.js +32 -32
  47. package/es/platform.d.ts +9 -9
  48. package/es/select/hooks/index.d.ts +5 -5
  49. package/es/select/hooks/index.js +2 -2
  50. package/es/select/hooks/useDebouncedSearch.d.ts +20 -20
  51. package/es/select/hooks/useDebouncedSearch.js +17 -17
  52. package/es/select/hooks/useSelectState.d.ts +19 -19
  53. package/es/select/hooks/useSelectState.js +13 -13
  54. package/es/select/index.d.ts +8 -8
  55. package/es/select/index.js +3 -3
  56. package/es/select/types.d.ts +256 -256
  57. package/es/select/utils/filterOptions.d.ts +22 -22
  58. package/es/select/utils/filterOptions.js +16 -16
  59. package/es/select/utils/helpers.d.ts +42 -42
  60. package/es/select/utils/helpers.js +30 -30
  61. package/es/select/utils/index.d.ts +7 -7
  62. package/es/select/utils/index.js +2 -2
  63. package/es/select/utils/sortOptions.d.ts +12 -12
  64. package/es/select/utils/sortOptions.js +8 -8
  65. package/es/select/utils/tagAggregation.d.ts +25 -25
  66. package/es/select/utils/tagAggregation.js +21 -21
  67. package/es/text-input/hooks/index.d.ts +4 -4
  68. package/es/text-input/hooks/index.js +2 -2
  69. package/es/text-input/hooks/useTextInputState.d.ts +24 -24
  70. package/es/text-input/hooks/useTextInputState.js +38 -38
  71. package/es/text-input/index.d.ts +14 -14
  72. package/es/text-input/index.js +9 -9
  73. package/es/text-input/types.d.ts +56 -56
  74. package/es/text-input/utils/index.d.ts +5 -5
  75. package/es/text-input/utils/index.js +2 -2
  76. package/es/text-input/utils/validation.d.ts +23 -23
  77. package/es/text-input/utils/validation.js +20 -20
  78. package/es/typeUtils.d.ts +42 -42
  79. package/es/typeUtils.js +26 -26
  80. package/es/walletValidity.d.ts +44 -44
  81. package/es/walletValidity.js +85 -85
  82. package/lib/arrayUtils.d.ts +1 -1
  83. package/lib/common/index.d.ts +5 -5
  84. package/lib/common/stateHelper.d.ts +18 -18
  85. package/lib/common/types.d.ts +28 -28
  86. package/lib/componentStorage.d.ts +36 -36
  87. package/lib/constants/index.d.ts +7 -7
  88. package/lib/date.d.ts +28 -28
  89. package/lib/document.d.ts +13 -13
  90. package/lib/escPosPrinter/index.d.ts +9 -9
  91. package/lib/firebase/config/index.d.ts +13 -13
  92. package/lib/firebase/index.d.ts +28 -28
  93. package/lib/format.d.ts +28 -28
  94. package/lib/image.d.ts +11 -11
  95. package/lib/index.d.ts +25 -25
  96. package/lib/jsBridge/index.d.ts +22 -22
  97. package/lib/jsBridge/regDeviceApi.d.ts +15 -15
  98. package/lib/jsBridge/types.d.ts +149 -149
  99. package/lib/locales.d.ts +9 -9
  100. package/lib/log.d.ts +10 -10
  101. package/lib/miniRedux.d.ts +16 -16
  102. package/lib/number-input/hooks/index.d.ts +4 -4
  103. package/lib/number-input/hooks/useNumberInputState.d.ts +25 -25
  104. package/lib/number-input/index.d.ts +14 -14
  105. package/lib/number-input/types.d.ts +96 -96
  106. package/lib/number-input/utils/formatter.d.ts +53 -53
  107. package/lib/number-input/utils/index.d.ts +7 -7
  108. package/lib/number-input/utils/validation.d.ts +27 -27
  109. package/lib/otherUtils.d.ts +48 -48
  110. package/lib/platform.d.ts +9 -9
  111. package/lib/select/hooks/index.d.ts +5 -5
  112. package/lib/select/hooks/useDebouncedSearch.d.ts +20 -20
  113. package/lib/select/hooks/useSelectState.d.ts +19 -19
  114. package/lib/select/index.d.ts +8 -8
  115. package/lib/select/types.d.ts +256 -256
  116. package/lib/select/utils/filterOptions.d.ts +22 -22
  117. package/lib/select/utils/helpers.d.ts +42 -42
  118. package/lib/select/utils/index.d.ts +7 -7
  119. package/lib/select/utils/sortOptions.d.ts +12 -12
  120. package/lib/select/utils/tagAggregation.d.ts +25 -25
  121. package/lib/text-input/hooks/index.d.ts +4 -4
  122. package/lib/text-input/hooks/useTextInputState.d.ts +24 -24
  123. package/lib/text-input/index.d.ts +14 -14
  124. package/lib/text-input/types.d.ts +56 -56
  125. package/lib/text-input/utils/index.d.ts +5 -5
  126. package/lib/text-input/utils/validation.d.ts +23 -23
  127. package/lib/typeUtils.d.ts +42 -42
  128. package/lib/walletValidity.d.ts +44 -44
  129. package/package.json +1 -1
@@ -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
  // 实时值(用户输入)
@@ -1,19 +1,19 @@
1
- /**
2
- * Select 状态管理 Hook
3
- * 处理受控/非受控模式,适用于单选和多选
4
- */
5
- import type { UseSelectStateOptions, UseMultipleSelectStateOptions, SelectState, MultipleSelectState } from '../types';
6
- /**
7
- * 单选状态管理 Hook
8
- * @template T 值的类型
9
- * @param options Hook 配置选项
10
- * @returns 状态管理对象
11
- */
12
- export declare function useSelectState<T = string | number>(options: UseSelectStateOptions<T>): SelectState<T>;
13
- /**
14
- * 多选状态管理 Hook
15
- * @template T 值的类型
16
- * @param options Hook 配置选项
17
- * @returns 状态管理对象
18
- */
19
- export declare function useMultipleSelectState<T = string | number>(options: UseMultipleSelectStateOptions<T>): MultipleSelectState<T>;
1
+ /**
2
+ * Select 状态管理 Hook
3
+ * 处理受控/非受控模式,适用于单选和多选
4
+ */
5
+ import type { UseSelectStateOptions, UseMultipleSelectStateOptions, SelectState, MultipleSelectState } from '../types';
6
+ /**
7
+ * 单选状态管理 Hook
8
+ * @template T 值的类型
9
+ * @param options Hook 配置选项
10
+ * @returns 状态管理对象
11
+ */
12
+ export declare function useSelectState<T = string | number>(options: UseSelectStateOptions<T>): SelectState<T>;
13
+ /**
14
+ * 多选状态管理 Hook
15
+ * @template T 值的类型
16
+ * @param options Hook 配置选项
17
+ * @returns 状态管理对象
18
+ */
19
+ export declare function useMultipleSelectState<T = string | number>(options: UseMultipleSelectStateOptions<T>): MultipleSelectState<T>;
@@ -8,17 +8,17 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- /**
12
- * Select 状态管理 Hook
13
- * 处理受控/非受控模式,适用于单选和多选
11
+ /**
12
+ * Select 状态管理 Hook
13
+ * 处理受控/非受控模式,适用于单选和多选
14
14
  */
15
15
 
16
16
  import { useState, useCallback } from 'react';
17
- /**
18
- * 单选状态管理 Hook
19
- * @template T 值的类型
20
- * @param options Hook 配置选项
21
- * @returns 状态管理对象
17
+ /**
18
+ * 单选状态管理 Hook
19
+ * @template T 值的类型
20
+ * @param options Hook 配置选项
21
+ * @returns 状态管理对象
22
22
  */
23
23
  export function useSelectState(options) {
24
24
  var controlledValue = options.value,
@@ -57,11 +57,11 @@ export function useSelectState(options) {
57
57
  };
58
58
  }
59
59
 
60
- /**
61
- * 多选状态管理 Hook
62
- * @template T 值的类型
63
- * @param options Hook 配置选项
64
- * @returns 状态管理对象
60
+ /**
61
+ * 多选状态管理 Hook
62
+ * @template T 值的类型
63
+ * @param options Hook 配置选项
64
+ * @returns 状态管理对象
65
65
  */
66
66
  export function useMultipleSelectState(options) {
67
67
  var controlledValue = options.value,
@@ -1,8 +1,8 @@
1
- /**
2
- * Select 组件相关工具和类型导出
3
- * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
4
- */
5
- export type { SelectOption, FilterOptionFunc, SortDirection, SelectState, MultipleSelectState, TagDisplayInfo, UseSelectStateOptions, UseMultipleSelectStateOptions, BaseSelectProps, } from './types';
6
- export { useSelectState, useMultipleSelectState } from './hooks/useSelectState';
7
- export { useDebouncedSearch } from './hooks/useDebouncedSearch';
8
- export { filterOptions, defaultFilterOption, sortOptions, calculateTagDisplay, findOptionByValue, findOptionsByValues, isOptionSelected, isOptionSelectedInMultiple, generateId, } from './utils';
1
+ /**
2
+ * Select 组件相关工具和类型导出
3
+ * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
4
+ */
5
+ export type { SelectOption, FilterOptionFunc, SortDirection, SelectState, MultipleSelectState, TagDisplayInfo, UseSelectStateOptions, UseMultipleSelectStateOptions, BaseSelectProps, } from './types';
6
+ export { useSelectState, useMultipleSelectState } from './hooks/useSelectState';
7
+ export { useDebouncedSearch } from './hooks/useDebouncedSearch';
8
+ export { filterOptions, defaultFilterOption, sortOptions, calculateTagDisplay, findOptionByValue, findOptionsByValues, isOptionSelected, isOptionSelectedInMultiple, generateId, } from './utils';
@@ -1,6 +1,6 @@
1
- /**
2
- * Select 组件相关工具和类型导出
3
- * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
1
+ /**
2
+ * Select 组件相关工具和类型导出
3
+ * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
4
4
  */
5
5
 
6
6
  // 导出所有类型