@snmt-react-ui/async-select 1.11.2 → 1.12.0
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.
- package/dist/AsyncSelect.d.ts +43 -10
- package/dist/async-select.js +7538 -2435
- package/dist/index.css +1 -1
- package/package.json +3 -3
package/dist/AsyncSelect.d.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommonSelectProps, OptionProps, BadgeOptionProps } from '@snmt-react-ui/select';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
3
|
+
interface AsyncBadgeSelectedItemVariantProps {
|
|
4
|
+
selectedItemVariant: 'badge';
|
|
5
|
+
/** Function for load options asynchronously */
|
|
6
|
+
loadOptions: (params: {
|
|
7
|
+
offset: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
search?: string;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
options: BadgeOptionProps[];
|
|
12
|
+
count: number;
|
|
13
|
+
limit: number;
|
|
14
|
+
}>;
|
|
15
|
+
extraOptions?: BadgeOptionProps[];
|
|
16
|
+
}
|
|
17
|
+
interface AsyncDefaultSelectedItemVariantProps {
|
|
18
|
+
selectedItemVariant?: 'default';
|
|
12
19
|
/** Function for load options asynchronously */
|
|
13
20
|
loadOptions: (params: {
|
|
14
21
|
offset: number;
|
|
@@ -19,6 +26,32 @@ interface BaseAsyncSelectProps {
|
|
|
19
26
|
count: number;
|
|
20
27
|
limit: number;
|
|
21
28
|
}>;
|
|
29
|
+
extraOptions?: OptionProps[];
|
|
30
|
+
}
|
|
31
|
+
export type BaseAsyncSelectProps = CommonSelectProps & (AsyncBadgeSelectedItemVariantProps | AsyncDefaultSelectedItemVariantProps);
|
|
32
|
+
export type SingleAsyncSelectProps = BaseAsyncSelectProps & {
|
|
33
|
+
mode?: 'single';
|
|
34
|
+
value?: string | null;
|
|
35
|
+
onChange?: (value: string | null) => void;
|
|
36
|
+
};
|
|
37
|
+
export type MultiAsyncSelectProps = BaseAsyncSelectProps & {
|
|
38
|
+
mode: 'multiple' | 'tags' | 'filter';
|
|
39
|
+
/** Responsive sets fixed select height and display overflow button, static displays
|
|
40
|
+
* overflow items by adding rows.
|
|
41
|
+
*/
|
|
42
|
+
overflowBehaviour?: 'responsive' | 'static';
|
|
43
|
+
value?: string[] | null;
|
|
44
|
+
onChange?: (value: string[] | null) => void;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* AsyncSelect is a flexible select component that loads its options asynchronously.
|
|
48
|
+
* It is suitable for large or remote datasets, supporting both single and multiple selection modes.
|
|
49
|
+
*/
|
|
50
|
+
export type AsyncSelectProps = CommonAsyncSelectProps & (SingleAsyncSelectProps | MultiAsyncSelectProps);
|
|
51
|
+
export type AsyncSelectRef = {
|
|
52
|
+
refetchOptions: () => Promise<void>;
|
|
53
|
+
};
|
|
54
|
+
interface CommonAsyncSelectProps {
|
|
22
55
|
/**
|
|
23
56
|
* If true, options are loaded when the dropdown is closed (e.g., in the background).
|
|
24
57
|
* If false, options are reloaded every time the dropdown
|