@pisell/utils 1.0.71 → 1.0.73

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 (202) hide show
  1. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
  2. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
  3. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
  4. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
  5. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
  6. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +11 -0
  7. package/es/arrayUtils.d.ts +4 -1
  8. package/es/arrayUtils.js +15 -24
  9. package/es/common/stateHelper.d.ts +6 -2
  10. package/es/common/stateHelper.js +22 -24
  11. package/es/common/types.d.ts +13 -10
  12. package/es/componentStorage.d.ts +27 -25
  13. package/es/componentStorage.js +94 -130
  14. package/es/constants/index.js +7 -9
  15. package/es/date.d.ts +6 -3
  16. package/es/date.js +36 -53
  17. package/es/document.d.ts +6 -3
  18. package/es/document.js +43 -67
  19. package/es/escPosPrinter/EscPosPrinter.js +353 -490
  20. package/es/escPosPrinter/index.d.ts +9 -9
  21. package/es/escPosPrinter/index.js +37 -52
  22. package/es/format.d.ts +12 -11
  23. package/es/format.js +90 -116
  24. package/es/image.d.ts +13 -10
  25. package/es/image.js +48 -60
  26. package/es/index.d.ts +38 -23
  27. package/es/index.js +39 -34
  28. package/es/jsBridge/index.d.ts +8 -4
  29. package/es/jsBridge/index.js +57 -56
  30. package/es/jsBridge/regDeviceApi.js +107 -149
  31. package/es/jsBridge/types.d.ts +95 -115
  32. package/es/locales.d.ts +11 -8
  33. package/es/locales.js +77 -96
  34. package/es/log.d.ts +11 -6
  35. package/es/log.js +37 -59
  36. package/es/miniRedux.d.ts +20 -13
  37. package/es/miniRedux.js +42 -78
  38. package/es/number-input/hooks/useNumberInputState.d.ts +6 -2
  39. package/es/number-input/hooks/useNumberInputState.js +71 -128
  40. package/es/number-input/types.d.ts +88 -88
  41. package/es/number-input/utils/formatter.d.ts +13 -10
  42. package/es/number-input/utils/formatter.js +51 -77
  43. package/es/number-input/utils/validation.d.ts +7 -2
  44. package/es/number-input/utils/validation.js +51 -66
  45. package/es/otherUtils.d.ts +12 -9
  46. package/es/otherUtils.js +71 -129
  47. package/es/platform.d.ts +17 -9
  48. package/es/platform.js +78 -85
  49. package/es/select/hooks/useDebouncedSearch.d.ts +4 -1
  50. package/es/select/hooks/useDebouncedSearch.js +39 -53
  51. package/es/select/hooks/useSelectState.d.ts +7 -7
  52. package/es/select/hooks/useSelectState.js +56 -113
  53. package/es/select/index.d.ts +7 -8
  54. package/es/select/types.d.ts +211 -211
  55. package/es/select/utils/filterOptions.d.ts +7 -6
  56. package/es/select/utils/filterOptions.js +26 -31
  57. package/es/select/utils/helpers.d.ts +10 -9
  58. package/es/select/utils/helpers.js +42 -52
  59. package/es/select/utils/index.d.ts +4 -7
  60. package/es/select/utils/sortOptions.d.ts +6 -5
  61. package/es/select/utils/sortOptions.js +19 -31
  62. package/es/select/utils/tagAggregation.d.ts +6 -6
  63. package/es/select/utils/tagAggregation.js +34 -47
  64. package/es/text-input/hooks/useTextInputState.d.ts +6 -2
  65. package/es/text-input/hooks/useTextInputState.js +69 -126
  66. package/es/text-input/types.d.ts +48 -48
  67. package/es/text-input/utils/validation.d.ts +7 -2
  68. package/es/text-input/utils/validation.js +50 -70
  69. package/es/typeUtils.d.ts +11 -8
  70. package/es/typeUtils.js +61 -84
  71. package/es/walletValidity.d.ts +36 -34
  72. package/es/walletValidity.js +332 -456
  73. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
  74. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
  75. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
  76. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
  77. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
  78. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +16 -0
  79. package/lib/_virtual/_rolldown/runtime.js +23 -0
  80. package/lib/arrayUtils.d.ts +4 -1
  81. package/lib/arrayUtils.js +14 -39
  82. package/lib/common/stateHelper.d.ts +6 -2
  83. package/lib/common/stateHelper.js +21 -32
  84. package/lib/common/types.d.ts +13 -10
  85. package/lib/componentStorage.d.ts +27 -25
  86. package/lib/componentStorage.js +96 -126
  87. package/lib/constants/index.js +7 -36
  88. package/lib/date.d.ts +6 -3
  89. package/lib/date.js +43 -65
  90. package/lib/document.d.ts +6 -3
  91. package/lib/document.js +46 -62
  92. package/lib/escPosPrinter/EscPosPrinter.js +327 -403
  93. package/lib/escPosPrinter/index.d.ts +9 -9
  94. package/lib/escPosPrinter/index.js +38 -84
  95. package/lib/format.d.ts +12 -11
  96. package/lib/format.js +91 -99
  97. package/lib/image.d.ts +13 -10
  98. package/lib/image.js +48 -74
  99. package/lib/index.d.ts +38 -23
  100. package/lib/index.js +115 -78
  101. package/lib/jsBridge/index.d.ts +8 -4
  102. package/lib/jsBridge/index.js +58 -77
  103. package/lib/jsBridge/regDeviceApi.js +106 -153
  104. package/lib/jsBridge/types.d.ts +95 -115
  105. package/lib/locales.d.ts +11 -8
  106. package/lib/locales.js +79 -90
  107. package/lib/log.d.ts +11 -6
  108. package/lib/log.js +37 -61
  109. package/lib/miniRedux.d.ts +20 -13
  110. package/lib/miniRedux.js +43 -92
  111. package/lib/number-input/hooks/useNumberInputState.d.ts +6 -2
  112. package/lib/number-input/hooks/useNumberInputState.js +71 -81
  113. package/lib/number-input/types.d.ts +88 -88
  114. package/lib/number-input/utils/formatter.d.ts +13 -10
  115. package/lib/number-input/utils/formatter.js +52 -49
  116. package/lib/number-input/utils/validation.d.ts +7 -2
  117. package/lib/number-input/utils/validation.js +50 -52
  118. package/lib/otherUtils.d.ts +12 -9
  119. package/lib/otherUtils.js +86 -98
  120. package/lib/platform.d.ts +17 -9
  121. package/lib/platform.js +85 -122
  122. package/lib/select/hooks/useDebouncedSearch.d.ts +4 -1
  123. package/lib/select/hooks/useDebouncedSearch.js +40 -41
  124. package/lib/select/hooks/useSelectState.d.ts +7 -7
  125. package/lib/select/hooks/useSelectState.js +58 -93
  126. package/lib/select/index.d.ts +7 -8
  127. package/lib/select/types.d.ts +211 -211
  128. package/lib/select/utils/filterOptions.d.ts +7 -6
  129. package/lib/select/utils/filterOptions.js +26 -37
  130. package/lib/select/utils/helpers.d.ts +10 -9
  131. package/lib/select/utils/helpers.js +45 -41
  132. package/lib/select/utils/index.d.ts +4 -7
  133. package/lib/select/utils/sortOptions.d.ts +6 -5
  134. package/lib/select/utils/sortOptions.js +18 -39
  135. package/lib/select/utils/tagAggregation.d.ts +6 -6
  136. package/lib/select/utils/tagAggregation.js +33 -41
  137. package/lib/text-input/hooks/useTextInputState.d.ts +6 -2
  138. package/lib/text-input/hooks/useTextInputState.js +69 -79
  139. package/lib/text-input/types.d.ts +48 -48
  140. package/lib/text-input/utils/validation.d.ts +7 -2
  141. package/lib/text-input/utils/validation.js +49 -58
  142. package/lib/typeUtils.d.ts +11 -8
  143. package/lib/typeUtils.js +68 -73
  144. package/lib/walletValidity.d.ts +36 -34
  145. package/lib/walletValidity.js +345 -317
  146. package/package.json +1 -2
  147. package/es/common/index.d.ts +0 -5
  148. package/es/common/index.js +0 -5
  149. package/es/common/types.js +0 -1
  150. package/es/constants/index.d.ts +0 -7
  151. package/es/firebase/config/index.d.ts +0 -13
  152. package/es/firebase/config/index.js +0 -54
  153. package/es/firebase/index.d.ts +0 -28
  154. package/es/firebase/index.js +0 -232
  155. package/es/jsBridge/types.js +0 -1
  156. package/es/number-input/hooks/index.d.ts +0 -4
  157. package/es/number-input/hooks/index.js +0 -5
  158. package/es/number-input/index.d.ts +0 -14
  159. package/es/number-input/index.js +0 -21
  160. package/es/number-input/types.js +0 -1
  161. package/es/number-input/utils/index.d.ts +0 -7
  162. package/es/number-input/utils/index.js +0 -8
  163. package/es/select/hooks/index.d.ts +0 -5
  164. package/es/select/hooks/index.js +0 -6
  165. package/es/select/index.js +0 -13
  166. package/es/select/types.js +0 -1
  167. package/es/select/utils/index.js +0 -8
  168. package/es/text-input/hooks/index.d.ts +0 -4
  169. package/es/text-input/hooks/index.js +0 -5
  170. package/es/text-input/index.d.ts +0 -14
  171. package/es/text-input/index.js +0 -20
  172. package/es/text-input/types.js +0 -1
  173. package/es/text-input/utils/index.d.ts +0 -5
  174. package/es/text-input/utils/index.js +0 -7
  175. package/lib/common/index.d.ts +0 -5
  176. package/lib/common/index.js +0 -29
  177. package/lib/common/types.js +0 -17
  178. package/lib/constants/index.d.ts +0 -7
  179. package/lib/firebase/config/index.d.ts +0 -13
  180. package/lib/firebase/config/index.js +0 -79
  181. package/lib/firebase/index.d.ts +0 -28
  182. package/lib/firebase/index.js +0 -180
  183. package/lib/jsBridge/types.js +0 -17
  184. package/lib/number-input/hooks/index.d.ts +0 -4
  185. package/lib/number-input/hooks/index.js +0 -29
  186. package/lib/number-input/index.d.ts +0 -14
  187. package/lib/number-input/index.js +0 -41
  188. package/lib/number-input/types.js +0 -17
  189. package/lib/number-input/utils/index.d.ts +0 -7
  190. package/lib/number-input/utils/index.js +0 -39
  191. package/lib/select/hooks/index.d.ts +0 -5
  192. package/lib/select/hooks/index.js +0 -34
  193. package/lib/select/index.js +0 -53
  194. package/lib/select/types.js +0 -17
  195. package/lib/select/utils/index.js +0 -48
  196. package/lib/text-input/hooks/index.d.ts +0 -4
  197. package/lib/text-input/hooks/index.js +0 -29
  198. package/lib/text-input/index.d.ts +0 -14
  199. package/lib/text-input/index.js +0 -35
  200. package/lib/text-input/types.js +0 -17
  201. package/lib/text-input/utils/index.d.ts +0 -5
  202. package/lib/text-input/utils/index.js +0 -32
@@ -1,36 +1,34 @@
1
- /**
2
- * Select 组件公共类型定义
3
- * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
4
- */
5
- import React from 'react';
6
- export type { DisplayState } from '../common';
1
+ import { DisplayState } from "../common/types.js";
2
+ import React from "react";
3
+
4
+ //#region src/select/types.d.ts
7
5
  /**
8
6
  * 选项基础类型
9
7
  * @template T 选项值的类型,默认为 string | number
10
8
  */
11
- export interface SelectOption<T = string | number> {
12
- /**
13
- * 选项值(唯一标识)
14
- */
15
- value: T;
16
- /**
17
- * 选项显示文本
18
- */
19
- label: string;
20
- /**
21
- * 是否禁用该选项
22
- * @default false
23
- */
24
- disabled?: boolean;
25
- /**
26
- * 选项图标(可选)
27
- */
28
- icon?: React.ReactNode;
29
- /**
30
- * 标签背景色(多选时用于自定义标签颜色)
31
- * @example '#61dafb'
32
- */
33
- color?: string;
9
+ interface SelectOption<T = string | number> {
10
+ /**
11
+ * 选项值(唯一标识)
12
+ */
13
+ value: T;
14
+ /**
15
+ * 选项显示文本
16
+ */
17
+ label: string;
18
+ /**
19
+ * 是否禁用该选项
20
+ * @default false
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * 选项图标(可选)
25
+ */
26
+ icon?: React.ReactNode;
27
+ /**
28
+ * 标签背景色(多选时用于自定义标签颜色)
29
+ * @example '#61dafb'
30
+ */
31
+ color?: string;
34
32
  }
35
33
  /**
36
34
  * 选项过滤函数类型
@@ -39,218 +37,220 @@ export interface SelectOption<T = string | number> {
39
37
  * @param option 当前选项对象
40
38
  * @returns 是否保留该选项
41
39
  */
42
- export declare type FilterOptionFunc<T = string | number> = (input: string, option: SelectOption<T>) => boolean;
40
+ type FilterOptionFunc<T = string | number> = (input: string, option: SelectOption<T>) => boolean;
43
41
  /**
44
42
  * 排序方向
45
43
  */
46
- export declare type SortDirection = 'asc' | 'desc';
44
+ type SortDirection = 'asc' | 'desc';
47
45
  /**
48
46
  * Select 状态 Hook 返回值(单选)
49
47
  * @template T 值的类型
50
48
  */
51
- export interface SelectState<T = string | number> {
52
- /**
53
- * 当前选中值
54
- */
55
- value: T | null | undefined;
56
- /**
57
- * 设置选中值
58
- */
59
- setValue: (value: T | null) => void;
60
- /**
61
- * 清空选中值
62
- */
63
- clearValue: () => void;
49
+ interface SelectState<T = string | number> {
50
+ /**
51
+ * 当前选中值
52
+ */
53
+ value: T | null | undefined;
54
+ /**
55
+ * 设置选中值
56
+ */
57
+ setValue: (value: T | null) => void;
58
+ /**
59
+ * 清空选中值
60
+ */
61
+ clearValue: () => void;
64
62
  }
65
63
  /**
66
64
  * Multiple Select 状态 Hook 返回值(多选)
67
65
  * @template T 值的类型
68
66
  */
69
- export interface MultipleSelectState<T = string | number> {
70
- /**
71
- * 当前选中值数组
72
- */
73
- value: T[];
74
- /**
75
- * 设置选中值数组
76
- */
77
- setValue: (value: T[]) => void;
78
- /**
79
- * 添加一个选中值
80
- */
81
- addValue: (value: T) => void;
82
- /**
83
- * 移除一个选中值
84
- */
85
- removeValue: (value: T) => void;
86
- /**
87
- * 清空所有选中值
88
- */
89
- clearValue: () => void;
67
+ interface MultipleSelectState<T = string | number> {
68
+ /**
69
+ * 当前选中值数组
70
+ */
71
+ value: T[];
72
+ /**
73
+ * 设置选中值数组
74
+ */
75
+ setValue: (value: T[]) => void;
76
+ /**
77
+ * 添加一个选中值
78
+ */
79
+ addValue: (value: T) => void;
80
+ /**
81
+ * 移除一个选中值
82
+ */
83
+ removeValue: (value: T) => void;
84
+ /**
85
+ * 清空所有选中值
86
+ */
87
+ clearValue: () => void;
90
88
  }
91
89
  /**
92
90
  * 标签显示信息(多选专用)
93
91
  * @template T 选项值的类型
94
92
  */
95
- export interface TagDisplayInfo<T = string | number> {
96
- /**
97
- * 可见的标签列表
98
- */
99
- visibleTags: SelectOption<T>[];
100
- /**
101
- * 隐藏的标签列表
102
- */
103
- hiddenTags: SelectOption<T>[];
104
- /**
105
- * 隐藏的标签数量
106
- */
107
- hiddenCount: number;
93
+ interface TagDisplayInfo<T = string | number> {
94
+ /**
95
+ * 可见的标签列表
96
+ */
97
+ visibleTags: SelectOption<T>[];
98
+ /**
99
+ * 隐藏的标签列表
100
+ */
101
+ hiddenTags: SelectOption<T>[];
102
+ /**
103
+ * 隐藏的标签数量
104
+ */
105
+ hiddenCount: number;
108
106
  }
109
107
  /**
110
108
  * useSelectState Hook 的配置选项(单选)
111
109
  * @template T 值的类型
112
110
  */
113
- export interface UseSelectStateOptions<T = string | number> {
114
- /**
115
- * 受控模式:当前值
116
- */
117
- value?: T | null;
118
- /**
119
- * 非受控模式:默认值
120
- */
121
- defaultValue?: T;
122
- /**
123
- * 值变化回调
124
- */
125
- onChange?: (value: T | null, option: SelectOption<T> | null) => void;
126
- /**
127
- * 模式(用于类型区分)
128
- */
129
- mode: 'single';
111
+ interface UseSelectStateOptions<T = string | number> {
112
+ /**
113
+ * 受控模式:当前值
114
+ */
115
+ value?: T | null;
116
+ /**
117
+ * 非受控模式:默认值
118
+ */
119
+ defaultValue?: T;
120
+ /**
121
+ * 值变化回调
122
+ */
123
+ onChange?: (value: T | null, option: SelectOption<T> | null) => void;
124
+ /**
125
+ * 模式(用于类型区分)
126
+ */
127
+ mode: 'single';
130
128
  }
131
129
  /**
132
130
  * useMultipleSelectState Hook 的配置选项(多选)
133
131
  * @template T 值的类型
134
132
  */
135
- export interface UseMultipleSelectStateOptions<T = string | number> {
136
- /**
137
- * 受控模式:当前值数组
138
- */
139
- value?: T[];
140
- /**
141
- * 非受控模式:默认值数组
142
- */
143
- defaultValue?: T[];
144
- /**
145
- * 值变化回调
146
- */
147
- onChange?: (value: T[], options: SelectOption<T>[]) => void;
148
- /**
149
- * 模式(用于类型区分)
150
- */
151
- mode: 'multiple';
133
+ interface UseMultipleSelectStateOptions<T = string | number> {
134
+ /**
135
+ * 受控模式:当前值数组
136
+ */
137
+ value?: T[];
138
+ /**
139
+ * 非受控模式:默认值数组
140
+ */
141
+ defaultValue?: T[];
142
+ /**
143
+ * 值变化回调
144
+ */
145
+ onChange?: (value: T[], options: SelectOption<T>[]) => void;
146
+ /**
147
+ * 模式(用于类型区分)
148
+ */
149
+ mode: 'multiple';
152
150
  }
153
151
  /**
154
152
  * 基础 Select Props(公共属性)
155
153
  * @template T 值的类型
156
154
  */
157
- export interface BaseSelectProps<T = string | number> {
158
- /**
159
- * 选项列表(必填)
160
- */
161
- options: SelectOption<T>[];
162
- /**
163
- * 占位符文本
164
- * @default '请选择'
165
- */
166
- placeholder?: string;
167
- /**
168
- * 是否显示搜索框
169
- * @default false
170
- */
171
- showSearch?: boolean;
172
- /**
173
- * 是否显示清空按钮
174
- * @default false
175
- */
176
- allowClear?: boolean;
177
- /**
178
- * 是否禁用
179
- * @default false
180
- */
181
- disabled?: boolean;
182
- /**
183
- * 是否只读
184
- * @default false
185
- */
186
- readOnly?: boolean;
187
- /**
188
- * 尺寸
189
- * @default 'middle'
190
- */
191
- size?: 'small' | 'middle' | 'large';
192
- /**
193
- * 自定义类名
194
- */
195
- className?: string;
196
- /**
197
- * 自定义样式
198
- */
199
- style?: React.CSSProperties;
200
- /**
201
- * 标签文本
202
- */
203
- label?: string;
204
- /**
205
- * 辅助提示文本
206
- */
207
- helperText?: string;
208
- /**
209
- * 是否必填
210
- * @default false
211
- */
212
- required?: boolean;
213
- /**
214
- * 是否显示错误状态
215
- * @default false
216
- */
217
- error?: boolean;
218
- /**
219
- * 错误提示文本
220
- */
221
- errorText?: string;
222
- /**
223
- * 是否启用过滤
224
- * @default false
225
- */
226
- filterable?: boolean;
227
- /**
228
- * 自定义过滤函数
229
- */
230
- filterOption?: FilterOptionFunc<T>;
231
- /**
232
- * 是否启用排序
233
- * @default false
234
- */
235
- sortable?: boolean;
236
- /**
237
- * 排序方向
238
- */
239
- sortDirection?: SortDirection;
240
- /**
241
- * 搜索输入回调
242
- */
243
- onSearch?: (value: string) => void;
244
- /**
245
- * 获得焦点回调
246
- */
247
- onFocus?: (event: React.FocusEvent) => void;
248
- /**
249
- * 失去焦点回调
250
- */
251
- onBlur?: (event: React.FocusEvent) => void;
252
- /**
253
- * 下拉框显隐回调
254
- */
255
- onDropdownVisibleChange?: (visible: boolean) => void;
155
+ interface BaseSelectProps<T = string | number> {
156
+ /**
157
+ * 选项列表(必填)
158
+ */
159
+ options: SelectOption<T>[];
160
+ /**
161
+ * 占位符文本
162
+ * @default '请选择'
163
+ */
164
+ placeholder?: string;
165
+ /**
166
+ * 是否显示搜索框
167
+ * @default false
168
+ */
169
+ showSearch?: boolean;
170
+ /**
171
+ * 是否显示清空按钮
172
+ * @default false
173
+ */
174
+ allowClear?: boolean;
175
+ /**
176
+ * 是否禁用
177
+ * @default false
178
+ */
179
+ disabled?: boolean;
180
+ /**
181
+ * 是否只读
182
+ * @default false
183
+ */
184
+ readOnly?: boolean;
185
+ /**
186
+ * 尺寸
187
+ * @default 'middle'
188
+ */
189
+ size?: 'small' | 'middle' | 'large';
190
+ /**
191
+ * 自定义类名
192
+ */
193
+ className?: string;
194
+ /**
195
+ * 自定义样式
196
+ */
197
+ style?: React.CSSProperties;
198
+ /**
199
+ * 标签文本
200
+ */
201
+ label?: string;
202
+ /**
203
+ * 辅助提示文本
204
+ */
205
+ helperText?: string;
206
+ /**
207
+ * 是否必填
208
+ * @default false
209
+ */
210
+ required?: boolean;
211
+ /**
212
+ * 是否显示错误状态
213
+ * @default false
214
+ */
215
+ error?: boolean;
216
+ /**
217
+ * 错误提示文本
218
+ */
219
+ errorText?: string;
220
+ /**
221
+ * 是否启用过滤
222
+ * @default false
223
+ */
224
+ filterable?: boolean;
225
+ /**
226
+ * 自定义过滤函数
227
+ */
228
+ filterOption?: FilterOptionFunc<T>;
229
+ /**
230
+ * 是否启用排序
231
+ * @default false
232
+ */
233
+ sortable?: boolean;
234
+ /**
235
+ * 排序方向
236
+ */
237
+ sortDirection?: SortDirection;
238
+ /**
239
+ * 搜索输入回调
240
+ */
241
+ onSearch?: (value: string) => void;
242
+ /**
243
+ * 获得焦点回调
244
+ */
245
+ onFocus?: (event: React.FocusEvent) => void;
246
+ /**
247
+ * 失去焦点回调
248
+ */
249
+ onBlur?: (event: React.FocusEvent) => void;
250
+ /**
251
+ * 下拉框显隐回调
252
+ */
253
+ onDropdownVisibleChange?: (visible: boolean) => void;
256
254
  }
255
+ //#endregion
256
+ export { BaseSelectProps, FilterOptionFunc, MultipleSelectState, SelectOption, SelectState, SortDirection, TagDisplayInfo, UseMultipleSelectStateOptions, UseSelectStateOptions };
@@ -1,7 +1,6 @@
1
- /**
2
- * 选项过滤工具函数
3
- */
4
- import type { SelectOption, FilterOptionFunc } from '../types';
1
+ import { FilterOptionFunc, SelectOption } from "../types.js";
2
+
3
+ //#region src/select/utils/filterOptions.d.ts
5
4
  /**
6
5
  * 默认的选项过滤函数
7
6
  * 根据 label 进行模糊匹配(不区分大小写)
@@ -10,7 +9,7 @@ import type { SelectOption, FilterOptionFunc } from '../types';
10
9
  * @param option 选项对象
11
10
  * @returns 是否保留该选项
12
11
  */
13
- export declare function defaultFilterOption<T = string | number>(input: string, option: SelectOption<T>): boolean;
12
+ declare function defaultFilterOption<T = string | number>(input: string, option: SelectOption<T>): boolean;
14
13
  /**
15
14
  * 过滤选项列表
16
15
  * @template T 选项值的类型
@@ -19,4 +18,6 @@ export declare function defaultFilterOption<T = string | number>(input: string,
19
18
  * @param filterFunc 自定义过滤函数(可选)
20
19
  * @returns 过滤后的选项列表
21
20
  */
22
- export declare function filterOptions<T = string | number>(options: SelectOption<T>[], searchText: string, filterFunc?: FilterOptionFunc<T>): SelectOption<T>[];
21
+ declare function filterOptions<T = string | number>(options: SelectOption<T>[], searchText: string, filterFunc?: FilterOptionFunc<T>): SelectOption<T>[];
22
+ //#endregion
23
+ export { defaultFilterOption, filterOptions };
@@ -1,34 +1,29 @@
1
+ //#region src/select/utils/filterOptions.ts
1
2
  /**
2
- * 选项过滤工具函数
3
- */
4
-
5
- /**
6
- * 默认的选项过滤函数
7
- * 根据 label 进行模糊匹配(不区分大小写)
8
- * @template T 选项值的类型
9
- * @param input 搜索输入文本
10
- * @param option 选项对象
11
- * @returns 是否保留该选项
12
- */
13
- export function defaultFilterOption(input, option) {
14
- if (!input) return true;
15
- var searchText = input.toLowerCase();
16
- var labelText = option.label.toLowerCase();
17
- return labelText.includes(searchText);
3
+ * 默认的选项过滤函数
4
+ * 根据 label 进行模糊匹配(不区分大小写)
5
+ * @template T 选项值的类型
6
+ * @param input 搜索输入文本
7
+ * @param option 选项对象
8
+ * @returns 是否保留该选项
9
+ */
10
+ function defaultFilterOption(input, option) {
11
+ if (!input) return true;
12
+ const searchText = input.toLowerCase();
13
+ return option.label.toLowerCase().includes(searchText);
18
14
  }
19
-
20
15
  /**
21
- * 过滤选项列表
22
- * @template T 选项值的类型
23
- * @param options 原始选项列表
24
- * @param searchText 搜索文本
25
- * @param filterFunc 自定义过滤函数(可选)
26
- * @returns 过滤后的选项列表
27
- */
28
- export function filterOptions(options, searchText, filterFunc) {
29
- if (!searchText) return options;
30
- var filterFn = filterFunc || defaultFilterOption;
31
- return options.filter(function (opt) {
32
- return filterFn(searchText, opt);
33
- });
34
- }
16
+ * 过滤选项列表
17
+ * @template T 选项值的类型
18
+ * @param options 原始选项列表
19
+ * @param searchText 搜索文本
20
+ * @param filterFunc 自定义过滤函数(可选)
21
+ * @returns 过滤后的选项列表
22
+ */
23
+ function filterOptions(options, searchText, filterFunc) {
24
+ if (!searchText) return options;
25
+ const filterFn = filterFunc || defaultFilterOption;
26
+ return options.filter((opt) => filterFn(searchText, opt));
27
+ }
28
+ //#endregion
29
+ export { defaultFilterOption, filterOptions };
@@ -1,7 +1,6 @@
1
- /**
2
- * Select 组件辅助函数
3
- */
4
- import type { SelectOption } from '../types';
1
+ import { SelectOption } from "../types.js";
2
+
3
+ //#region src/select/utils/helpers.d.ts
5
4
  /**
6
5
  * 根据值查找选项对象
7
6
  * @template T 选项值的类型
@@ -9,7 +8,7 @@ import type { SelectOption } from '../types';
9
8
  * @param options 选项列表
10
9
  * @returns 找到的选项对象,如果没找到返回 undefined
11
10
  */
12
- export declare function findOptionByValue<T = string | number>(value: T, options: SelectOption<T>[]): SelectOption<T> | undefined;
11
+ declare function findOptionByValue<T = string | number>(value: T, options: SelectOption<T>[]): SelectOption<T> | undefined;
13
12
  /**
14
13
  * 根据值数组查找选项对象数组
15
14
  * @template T 选项值的类型
@@ -17,7 +16,7 @@ export declare function findOptionByValue<T = string | number>(value: T, options
17
16
  * @param options 选项列表
18
17
  * @returns 找到的选项对象数组
19
18
  */
20
- export declare function findOptionsByValues<T = string | number>(values: T[], options: SelectOption<T>[]): SelectOption<T>[];
19
+ declare function findOptionsByValues<T = string | number>(values: T[], options: SelectOption<T>[]): SelectOption<T>[];
21
20
  /**
22
21
  * 判断选项是否被选中(单选)
23
22
  * @template T 选项值的类型
@@ -25,7 +24,7 @@ export declare function findOptionsByValues<T = string | number>(values: T[], op
25
24
  * @param selectedValue 当前选中值
26
25
  * @returns 是否选中
27
26
  */
28
- export declare function isOptionSelected<T = string | number>(optionValue: T, selectedValue: T | null | undefined): boolean;
27
+ declare function isOptionSelected<T = string | number>(optionValue: T, selectedValue: T | null | undefined): boolean;
29
28
  /**
30
29
  * 判断选项是否被选中(多选)
31
30
  * @template T 选项值的类型
@@ -33,10 +32,12 @@ export declare function isOptionSelected<T = string | number>(optionValue: T, se
33
32
  * @param selectedValues 当前选中值数组
34
33
  * @returns 是否选中
35
34
  */
36
- export declare function isOptionSelectedInMultiple<T = string | number>(optionValue: T, selectedValues: T[]): boolean;
35
+ declare function isOptionSelectedInMultiple<T = string | number>(optionValue: T, selectedValues: T[]): boolean;
37
36
  /**
38
37
  * 生成唯一 ID
39
38
  * @param prefix ID 前缀
40
39
  * @returns 唯一 ID
41
40
  */
42
- export declare function generateId(prefix?: string): string;
41
+ declare function generateId(prefix?: string): string;
42
+ //#endregion
43
+ export { findOptionByValue, findOptionsByValues, generateId, isOptionSelected, isOptionSelectedInMultiple };