simplesvelte 2.4.1 → 2.4.3
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/Select.svelte +38 -37
- package/package.json +1 -1
package/dist/Select.svelte
CHANGED
|
@@ -474,6 +474,7 @@
|
|
|
474
474
|
tabindex="0"
|
|
475
475
|
class="btn btn-sm btn-circle btn-ghost bg-base-100 absolute top-1 right-1"
|
|
476
476
|
onclick={(e) => {
|
|
477
|
+
e.preventDefault()
|
|
477
478
|
e.stopPropagation()
|
|
478
479
|
clearAll()
|
|
479
480
|
}}
|
|
@@ -495,46 +496,46 @@
|
|
|
495
496
|
id={popoverId}
|
|
496
497
|
popover
|
|
497
498
|
role="listbox"
|
|
498
|
-
class="dropdown menu bg-base-100 rounded-box z-50 mt-2 flex flex-col flex-nowrap gap-1 p-2 shadow outline m-0"
|
|
499
|
+
class="dropdown menu bg-base-100 rounded-box z-50 mt-2 flex flex-col flex-nowrap gap-1 p-2 shadow outline m-0 {!dropdownOpen ? 'pointer-events-none' : ''}"
|
|
499
500
|
style="position-anchor: {anchorName}; position: absolute; top: anchor(bottom); left: anchor(left); width: anchor-size(width)"
|
|
500
501
|
ontoggle={handlePopoverToggle}>
|
|
501
502
|
{#if multiple && filteredItems.length > 1}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
503
|
+
<!-- Select All / Clear All options for multi-select -->
|
|
504
|
+
<div class="flex gap-2">
|
|
505
|
+
<button
|
|
506
|
+
type="button"
|
|
507
|
+
class="btn btn-sm hover:bg-base-content/10 grow"
|
|
508
|
+
onclick={() => {
|
|
509
|
+
const allValues = filteredItems.map((item) => item.value)
|
|
510
|
+
value = [...allValues]
|
|
511
|
+
if (onchange) onchange(value)
|
|
512
|
+
}}>
|
|
513
|
+
Select All
|
|
514
|
+
</button>
|
|
515
|
+
<button
|
|
516
|
+
type="button"
|
|
517
|
+
class="btn btn-sm hover:bg-base-content/10 grow"
|
|
518
|
+
onclick={() => {
|
|
519
|
+
value = []
|
|
520
|
+
if (onchange) onchange(value)
|
|
521
|
+
}}>
|
|
522
|
+
Clear All
|
|
523
|
+
</button>
|
|
524
|
+
</div>
|
|
525
|
+
{/if}
|
|
526
|
+
{#if isLoading}
|
|
527
|
+
<li class="m-2 flex items-center justify-center gap-2 text-sm text-gray-500">
|
|
528
|
+
<span class="loading loading-spinner loading-sm"></span>
|
|
529
|
+
Loading...
|
|
530
|
+
</li>
|
|
531
|
+
{:else if fetchError}
|
|
532
|
+
<li class="m-2 text-center text-sm text-error">{fetchError}</li>
|
|
533
|
+
{:else if filteredItems.length === 0}
|
|
534
|
+
<li class="m-2 text-center text-sm text-gray-500">No items found</li>
|
|
535
|
+
{/if}
|
|
535
536
|
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
{#if flatList.length > 0}
|
|
538
|
+
<div class="relative max-h-80 overflow-y-auto pr-2" use:scrollToSelected onscroll={handleScroll}>
|
|
538
539
|
<!-- Virtual spacer for items before visible range -->
|
|
539
540
|
{#if visibleItems.startIndex > 0}
|
|
540
541
|
<div style="height: {visibleItems.startIndex * itemHeight}px;"></div>
|
|
@@ -562,7 +563,7 @@
|
|
|
562
563
|
onclick={(e) => {
|
|
563
564
|
e.stopPropagation()
|
|
564
565
|
toggleItemSelection(item.value)
|
|
565
|
-
searchEL?.focus()
|
|
566
|
+
if (multiple) searchEL?.focus()
|
|
566
567
|
}}>
|
|
567
568
|
{#if multiple}
|
|
568
569
|
<input
|