svelte-select-5 6.0.2 → 6.0.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/Select.svelte +21 -0
- package/no-styles/Select.svelte +21 -0
- package/package.json +1 -1
package/Select.svelte
CHANGED
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
let isScrolling = $state(false);
|
|
123
123
|
let prefloat = $state(true);
|
|
124
124
|
let _inputAttributes = $state({});
|
|
125
|
+
let prevJustValue = $state(undefined);
|
|
125
126
|
let isScrollingTimer;
|
|
126
127
|
|
|
127
128
|
// Floating UI config - using closure for listOffset to capture current value
|
|
@@ -719,6 +720,26 @@
|
|
|
719
720
|
justValue = computeJustValue();
|
|
720
721
|
});
|
|
721
722
|
|
|
723
|
+
// Handle external changes to justValue (allows setting value via justValue)
|
|
724
|
+
$effect(() => {
|
|
725
|
+
const computed = computeJustValue();
|
|
726
|
+
const isExternalChange = justValue !== prevJustValue &&
|
|
727
|
+
JSON.stringify(justValue) !== JSON.stringify(computed);
|
|
728
|
+
|
|
729
|
+
if (isExternalChange && items) {
|
|
730
|
+
if (multiple) {
|
|
731
|
+
value = justValue
|
|
732
|
+
? items.filter(item => justValue.includes(item[itemId]))
|
|
733
|
+
: null;
|
|
734
|
+
} else {
|
|
735
|
+
value = justValue != null
|
|
736
|
+
? items.find(item => item[itemId] === justValue) ?? null
|
|
737
|
+
: null;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
prevJustValue = justValue;
|
|
741
|
+
});
|
|
742
|
+
|
|
722
743
|
$effect(() => {
|
|
723
744
|
if (!multiple && prev_value && !value) oninput?.(value);
|
|
724
745
|
});
|
package/no-styles/Select.svelte
CHANGED
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
let isScrolling = $state(false);
|
|
123
123
|
let prefloat = $state(true);
|
|
124
124
|
let _inputAttributes = $state({});
|
|
125
|
+
let prevJustValue = $state(undefined);
|
|
125
126
|
let isScrollingTimer;
|
|
126
127
|
|
|
127
128
|
// Floating UI config - using closure for listOffset to capture current value
|
|
@@ -719,6 +720,26 @@
|
|
|
719
720
|
justValue = computeJustValue();
|
|
720
721
|
});
|
|
721
722
|
|
|
723
|
+
// Handle external changes to justValue (allows setting value via justValue)
|
|
724
|
+
$effect(() => {
|
|
725
|
+
const computed = computeJustValue();
|
|
726
|
+
const isExternalChange = justValue !== prevJustValue &&
|
|
727
|
+
JSON.stringify(justValue) !== JSON.stringify(computed);
|
|
728
|
+
|
|
729
|
+
if (isExternalChange && items) {
|
|
730
|
+
if (multiple) {
|
|
731
|
+
value = justValue
|
|
732
|
+
? items.filter(item => justValue.includes(item[itemId]))
|
|
733
|
+
: null;
|
|
734
|
+
} else {
|
|
735
|
+
value = justValue != null
|
|
736
|
+
? items.find(item => item[itemId] === justValue) ?? null
|
|
737
|
+
: null;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
prevJustValue = justValue;
|
|
741
|
+
});
|
|
742
|
+
|
|
722
743
|
$effect(() => {
|
|
723
744
|
if (!multiple && prev_value && !value) oninput?.(value);
|
|
724
745
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-select-5",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "A <Select> component for Svelte 5 apps (fork of svelte-select)",
|
|
5
5
|
"repository": "https://github.com/Dbone29/svelte-select-5.git",
|
|
6
6
|
"author": "Robert Balfré <rob.balfre@gmail.com> (https://github.com/rob-balfre)",
|