@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,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
  // 导出所有类型
@@ -1,256 +1,256 @@
1
- /**
2
- * Select 组件公共类型定义
3
- * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
4
- */
5
- import React from 'react';
6
- export type { DisplayState } from '../common';
7
- /**
8
- * 选项基础类型
9
- * @template T 选项值的类型,默认为 string | number
10
- */
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;
34
- }
35
- /**
36
- * 选项过滤函数类型
37
- * @template T 选项值的类型
38
- * @param input 用户输入的搜索文本
39
- * @param option 当前选项对象
40
- * @returns 是否保留该选项
41
- */
42
- export declare type FilterOptionFunc<T = string | number> = (input: string, option: SelectOption<T>) => boolean;
43
- /**
44
- * 排序方向
45
- */
46
- export declare type SortDirection = 'asc' | 'desc';
47
- /**
48
- * Select 状态 Hook 返回值(单选)
49
- * @template T 值的类型
50
- */
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;
64
- }
65
- /**
66
- * Multiple Select 状态 Hook 返回值(多选)
67
- * @template T 值的类型
68
- */
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;
90
- }
91
- /**
92
- * 标签显示信息(多选专用)
93
- * @template T 选项值的类型
94
- */
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;
108
- }
109
- /**
110
- * useSelectState Hook 的配置选项(单选)
111
- * @template T 值的类型
112
- */
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';
130
- }
131
- /**
132
- * useMultipleSelectState Hook 的配置选项(多选)
133
- * @template T 值的类型
134
- */
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';
152
- }
153
- /**
154
- * 基础 Select Props(公共属性)
155
- * @template T 值的类型
156
- */
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;
256
- }
1
+ /**
2
+ * Select 组件公共类型定义
3
+ * 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
4
+ */
5
+ import React from 'react';
6
+ export type { DisplayState } from '../common';
7
+ /**
8
+ * 选项基础类型
9
+ * @template T 选项值的类型,默认为 string | number
10
+ */
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;
34
+ }
35
+ /**
36
+ * 选项过滤函数类型
37
+ * @template T 选项值的类型
38
+ * @param input 用户输入的搜索文本
39
+ * @param option 当前选项对象
40
+ * @returns 是否保留该选项
41
+ */
42
+ export declare type FilterOptionFunc<T = string | number> = (input: string, option: SelectOption<T>) => boolean;
43
+ /**
44
+ * 排序方向
45
+ */
46
+ export declare type SortDirection = 'asc' | 'desc';
47
+ /**
48
+ * Select 状态 Hook 返回值(单选)
49
+ * @template T 值的类型
50
+ */
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;
64
+ }
65
+ /**
66
+ * Multiple Select 状态 Hook 返回值(多选)
67
+ * @template T 值的类型
68
+ */
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;
90
+ }
91
+ /**
92
+ * 标签显示信息(多选专用)
93
+ * @template T 选项值的类型
94
+ */
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;
108
+ }
109
+ /**
110
+ * useSelectState Hook 的配置选项(单选)
111
+ * @template T 值的类型
112
+ */
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';
130
+ }
131
+ /**
132
+ * useMultipleSelectState Hook 的配置选项(多选)
133
+ * @template T 值的类型
134
+ */
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';
152
+ }
153
+ /**
154
+ * 基础 Select Props(公共属性)
155
+ * @template T 值的类型
156
+ */
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;
256
+ }
@@ -1,22 +1,22 @@
1
- /**
2
- * 选项过滤工具函数
3
- */
4
- import type { SelectOption, FilterOptionFunc } from '../types';
5
- /**
6
- * 默认的选项过滤函数
7
- * 根据 label 进行模糊匹配(不区分大小写)
8
- * @template T 选项值的类型
9
- * @param input 搜索输入文本
10
- * @param option 选项对象
11
- * @returns 是否保留该选项
12
- */
13
- export declare function defaultFilterOption<T = string | number>(input: string, option: SelectOption<T>): boolean;
14
- /**
15
- * 过滤选项列表
16
- * @template T 选项值的类型
17
- * @param options 原始选项列表
18
- * @param searchText 搜索文本
19
- * @param filterFunc 自定义过滤函数(可选)
20
- * @returns 过滤后的选项列表
21
- */
22
- export declare function filterOptions<T = string | number>(options: SelectOption<T>[], searchText: string, filterFunc?: FilterOptionFunc<T>): SelectOption<T>[];
1
+ /**
2
+ * 选项过滤工具函数
3
+ */
4
+ import type { SelectOption, FilterOptionFunc } from '../types';
5
+ /**
6
+ * 默认的选项过滤函数
7
+ * 根据 label 进行模糊匹配(不区分大小写)
8
+ * @template T 选项值的类型
9
+ * @param input 搜索输入文本
10
+ * @param option 选项对象
11
+ * @returns 是否保留该选项
12
+ */
13
+ export declare function defaultFilterOption<T = string | number>(input: string, option: SelectOption<T>): boolean;
14
+ /**
15
+ * 过滤选项列表
16
+ * @template T 选项值的类型
17
+ * @param options 原始选项列表
18
+ * @param searchText 搜索文本
19
+ * @param filterFunc 自定义过滤函数(可选)
20
+ * @returns 过滤后的选项列表
21
+ */
22
+ export declare function filterOptions<T = string | number>(options: SelectOption<T>[], searchText: string, filterFunc?: FilterOptionFunc<T>): SelectOption<T>[];