fuma 2.0.22 → 2.0.24
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.
|
@@ -44,15 +44,16 @@
|
|
|
44
44
|
let focusIndex = 0
|
|
45
45
|
let searchValue = ''
|
|
46
46
|
|
|
47
|
-
const dispatch = createEventDispatcher<{
|
|
47
|
+
const dispatch = createEventDispatcher<{
|
|
48
|
+
input: { value: RelationItem | null }
|
|
49
|
+
}>()
|
|
48
50
|
|
|
49
|
-
export function clear() {
|
|
51
|
+
export async function clear() {
|
|
50
52
|
searchValue = ''
|
|
51
53
|
item = null
|
|
52
54
|
dispatch('input', { value: item })
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
55
|
+
await tick()
|
|
56
|
+
inputElement.focus()
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export async function select(index = focusIndex) {
|
|
@@ -60,6 +61,10 @@
|
|
|
60
61
|
dispatch('input', { value: item })
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
export function focus() {
|
|
65
|
+
inputElement.focus()
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
export async function searchItems(searchValue = '') {
|
|
64
69
|
try {
|
|
65
70
|
isLoading = true
|
|
@@ -116,7 +121,7 @@
|
|
|
116
121
|
{:else}
|
|
117
122
|
<button
|
|
118
123
|
type="button"
|
|
119
|
-
on:click|stopPropagation={() => clear()
|
|
124
|
+
on:click|stopPropagation={() => clear()}
|
|
120
125
|
class="input h-auto min-h-10 w-full grow items-start pt-2 pr-2"
|
|
121
126
|
>
|
|
122
127
|
{@render slotItem(item)}
|
|
@@ -27,10 +27,9 @@ declare class __sveltets_Render<RelationItem extends {
|
|
|
27
27
|
class?: string;
|
|
28
28
|
classList?: string;
|
|
29
29
|
inputElement: HTMLInputElement;
|
|
30
|
-
clear?: (() =>
|
|
31
|
-
focus: () => void;
|
|
32
|
-
}) | undefined;
|
|
30
|
+
clear?: (() => Promise<void>) | undefined;
|
|
33
31
|
select?: ((index?: number) => Promise<void>) | undefined;
|
|
32
|
+
focus?: (() => void) | undefined;
|
|
34
33
|
searchItems?: ((searchValue?: string) => Promise<void>) | undefined;
|
|
35
34
|
};
|
|
36
35
|
events(): {
|
|
@@ -43,10 +42,9 @@ declare class __sveltets_Render<RelationItem extends {
|
|
|
43
42
|
slots(): {};
|
|
44
43
|
bindings(): string;
|
|
45
44
|
exports(): {
|
|
46
|
-
clear: () =>
|
|
47
|
-
focus: () => void;
|
|
48
|
-
};
|
|
45
|
+
clear: () => Promise<void>;
|
|
49
46
|
select: (index?: number) => Promise<void>;
|
|
47
|
+
focus: () => void;
|
|
50
48
|
searchItems: (searchValue?: string) => Promise<void>;
|
|
51
49
|
};
|
|
52
50
|
}
|