@likable-hair/svelte 4.0.28 → 4.0.30
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.
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import debounceStore from "../../../stores/debounce";
|
|
6
6
|
import { writable } from 'svelte/store';
|
|
7
7
|
import Menu from "../../simple/common/Menu.svelte";
|
|
8
|
-
let { items = [], values = $bindable(), multiple = false, searcher, placeholder, searchThreshold = 2, debounceTimeout = 500, searching = false, search = false, searchText = $bindable(),
|
|
8
|
+
let { items = [], values = $bindable(), multiple = false, searcher, placeholder, searchThreshold = 2, debounceTimeout = 500, searching = false, search = false, searchText = $bindable(), maxVisibleChips, menuOpened = $bindable(false), mobileDrawer = false, closeOnSelect = false, disabled = false, menuAnchor, menuWidth, onchange, ...restProps } = $props();
|
|
9
9
|
const searchTextValue = writable(searchText);
|
|
10
10
|
let searchTextDebounce = $derived(debounceStore(searchTextValue, debounceTimeout));
|
|
11
11
|
$effect(() => {
|
|
@@ -41,7 +41,6 @@ $effect(() => {
|
|
|
41
41
|
{multiple}
|
|
42
42
|
{maxVisibleChips}
|
|
43
43
|
bind:menuOpened
|
|
44
|
-
{emptySearchTextOnMenuClose}
|
|
45
44
|
{mobileDrawer}
|
|
46
45
|
{placeholder}
|
|
47
46
|
{closeOnSelect}
|
|
@@ -50,7 +49,5 @@ $effect(() => {
|
|
|
50
49
|
{menuAnchor}
|
|
51
50
|
searchFunction={() => true}
|
|
52
51
|
{onchange}
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
>
|
|
56
|
-
</Autocomplete>
|
|
52
|
+
{...restProps}
|
|
53
|
+
></Autocomplete>
|
|
@@ -22,14 +22,69 @@ declare class __sveltets_Render<Data> {
|
|
|
22
22
|
closeOnSelect?: boolean;
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
menuWidth?: string;
|
|
25
|
+
menuAnchor?: ComponentProps<typeof Menu>["anchor"];
|
|
26
|
+
} & {
|
|
27
|
+
values?: Item<Data>[] | undefined;
|
|
28
|
+
items?: Item<Data>[] | undefined;
|
|
29
|
+
searchFunction?: ((item: Item<Data>, searchText: string | undefined) => boolean) | undefined;
|
|
30
|
+
multiple?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
mandatory?: boolean;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
width?: string;
|
|
35
|
+
height?: string;
|
|
36
|
+
maxWidth?: string;
|
|
37
|
+
minWidth?: string;
|
|
38
|
+
openingId?: string;
|
|
39
|
+
searchText?: string;
|
|
40
|
+
maxVisibleChips?: number;
|
|
41
|
+
menuOpened?: boolean;
|
|
42
|
+
closeOnSelect?: boolean;
|
|
25
43
|
emptySearchTextOnMenuClose?: boolean;
|
|
44
|
+
menuBoxShadow?: string;
|
|
45
|
+
menuBorderRadius?: string;
|
|
46
|
+
mobileDrawer?: boolean;
|
|
47
|
+
menuWidth?: string | null;
|
|
26
48
|
menuAnchor?: ComponentProps<typeof Menu>["anchor"];
|
|
49
|
+
class?: {
|
|
50
|
+
activator?: string;
|
|
51
|
+
menu?: string;
|
|
52
|
+
simpleTextfield?: ComponentProps<typeof import("../../..").SimpleTextField>["class"];
|
|
53
|
+
} | undefined;
|
|
54
|
+
selectionContainerSnippet?: import("svelte").Snippet<[{
|
|
55
|
+
values: Item<Data>[];
|
|
56
|
+
searchText: string | undefined;
|
|
57
|
+
disabled: boolean;
|
|
58
|
+
openMenu: () => void;
|
|
59
|
+
handleKeyDown: (event: {
|
|
60
|
+
key: string;
|
|
61
|
+
}) => void;
|
|
62
|
+
unselect: (item: Item<Data>) => void;
|
|
63
|
+
select: (item: Item<Data>) => void;
|
|
64
|
+
}]> | undefined;
|
|
65
|
+
selectionSnippet?: import("svelte").Snippet<[{
|
|
66
|
+
selection: Item<Data>;
|
|
67
|
+
unselect: (item: Item<Data>) => void;
|
|
68
|
+
}]> | undefined;
|
|
27
69
|
chipLabelSnippet?: import("svelte").Snippet<[{
|
|
28
70
|
selection: Item<Data>;
|
|
29
71
|
}]> | undefined;
|
|
72
|
+
exceedCounterSnippet?: import("svelte").Snippet<[{
|
|
73
|
+
notVisibleChipNumber: number;
|
|
74
|
+
maxVisibleChips: number;
|
|
75
|
+
values: Item<Data>[];
|
|
76
|
+
searchText: string | undefined;
|
|
77
|
+
disabled: boolean;
|
|
78
|
+
}]> | undefined;
|
|
79
|
+
menuSnippet?: import("svelte").Snippet<[]>;
|
|
30
80
|
itemLabelSnippet?: import("svelte").Snippet<[{
|
|
31
81
|
item: Item<Data>;
|
|
32
82
|
}]> | undefined;
|
|
83
|
+
itemSnippet?: import("svelte").Snippet<[{
|
|
84
|
+
item: Item<Data>;
|
|
85
|
+
index: number;
|
|
86
|
+
selected: boolean;
|
|
87
|
+
}]> | undefined;
|
|
33
88
|
onchange?: ((event: {
|
|
34
89
|
detail: {
|
|
35
90
|
unselect: Item<Data> | undefined;
|
|
@@ -37,6 +92,10 @@ declare class __sveltets_Render<Data> {
|
|
|
37
92
|
selection: Item<Data>[];
|
|
38
93
|
};
|
|
39
94
|
}) => void) | undefined;
|
|
95
|
+
onfocus?: (() => void) | undefined;
|
|
96
|
+
onblur?: (() => void) | undefined;
|
|
97
|
+
onkeydown?: (() => void) | undefined;
|
|
98
|
+
onclose?: ComponentProps<typeof import("../common/MenuOrDrawer.svelte").default>["onclose"];
|
|
40
99
|
};
|
|
41
100
|
events(): {};
|
|
42
101
|
slots(): {};
|
|
@@ -182,7 +182,7 @@ $effect(() => {
|
|
|
182
182
|
});
|
|
183
183
|
$effect(() => {
|
|
184
184
|
if (!!input) {
|
|
185
|
-
if (
|
|
185
|
+
if ((values || []).length !== 0) {
|
|
186
186
|
input.style.width =
|
|
187
187
|
Math.max(searchText?.length || placeholder?.length, 1) + "ch";
|
|
188
188
|
}
|
|
@@ -259,7 +259,7 @@ import MenuOrDrawer from "../../composed/common/MenuOrDrawer.svelte";
|
|
|
259
259
|
<div class="not-visible-chip-number">+ {notVisibleChipNumber}</div>
|
|
260
260
|
{/if}
|
|
261
261
|
{/if}
|
|
262
|
-
|
|
262
|
+
|
|
263
263
|
<input
|
|
264
264
|
class="autocomplete-input"
|
|
265
265
|
bind:value={searchText}
|