inputElementID param
This commit is contained in:
parent
1386b80d0c
commit
4d79589903
@ -1,6 +1,11 @@
|
||||
<script>
|
||||
import { createEventDispatcher, onMount, tick } from "svelte";
|
||||
|
||||
// Generate a default unique ID
|
||||
function generateDefaultID() {
|
||||
return "virtual-select-" + Math.random().toString(36).slice(2);
|
||||
}
|
||||
|
||||
// Props
|
||||
export let options = [];
|
||||
export let selected = null;
|
||||
@ -11,6 +16,7 @@
|
||||
export let clearAriaLabel = "Clear selection";
|
||||
export let filterFn = null; // Custom filter function
|
||||
export let autofocus = false; // Autofocus input
|
||||
export let inputElementID = generateDefaultID(); // Input element ID
|
||||
|
||||
// Internal state
|
||||
let searchTerm = "";
|
||||
@ -191,6 +197,7 @@
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id={inputElementID}
|
||||
bind:value={searchTerm}
|
||||
bind:this={inputElement}
|
||||
placeholder={getDisplayText()}
|
||||
|
Loading…
x
Reference in New Issue
Block a user