svelte-select-5 6.1.3 → 6.1.4
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 +19 -8
- package/no-styles/Select.svelte +19 -8
- package/package.json +1 -1
package/Select.svelte
CHANGED
|
@@ -286,12 +286,8 @@
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
function setupMulti() {
|
|
289
|
-
if (value) {
|
|
290
|
-
|
|
291
|
-
value = [...value];
|
|
292
|
-
} else {
|
|
293
|
-
value = [value];
|
|
294
|
-
}
|
|
289
|
+
if (value && !Array.isArray(value)) {
|
|
290
|
+
value = [value];
|
|
295
291
|
}
|
|
296
292
|
}
|
|
297
293
|
|
|
@@ -389,9 +385,24 @@
|
|
|
389
385
|
if (!value || (multiple ? value.some((selection) => !selection || !selection[itemId]) : !value[itemId])) return;
|
|
390
386
|
|
|
391
387
|
if (Array.isArray(value)) {
|
|
392
|
-
|
|
388
|
+
// Only update if items actually changed
|
|
389
|
+
let needsUpdate = false;
|
|
390
|
+
const newValue = value.map((selection) => {
|
|
391
|
+
const found = findItem(selection);
|
|
392
|
+
if (found && found !== selection) {
|
|
393
|
+
needsUpdate = true;
|
|
394
|
+
return found;
|
|
395
|
+
}
|
|
396
|
+
return selection;
|
|
397
|
+
});
|
|
398
|
+
if (needsUpdate) {
|
|
399
|
+
value = newValue;
|
|
400
|
+
}
|
|
393
401
|
} else {
|
|
394
|
-
|
|
402
|
+
const found = findItem();
|
|
403
|
+
if (found && found !== value) {
|
|
404
|
+
value = found;
|
|
405
|
+
}
|
|
395
406
|
}
|
|
396
407
|
}
|
|
397
408
|
|
package/no-styles/Select.svelte
CHANGED
|
@@ -286,12 +286,8 @@
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
function setupMulti() {
|
|
289
|
-
if (value) {
|
|
290
|
-
|
|
291
|
-
value = [...value];
|
|
292
|
-
} else {
|
|
293
|
-
value = [value];
|
|
294
|
-
}
|
|
289
|
+
if (value && !Array.isArray(value)) {
|
|
290
|
+
value = [value];
|
|
295
291
|
}
|
|
296
292
|
}
|
|
297
293
|
|
|
@@ -389,9 +385,24 @@
|
|
|
389
385
|
if (!value || (multiple ? value.some((selection) => !selection || !selection[itemId]) : !value[itemId])) return;
|
|
390
386
|
|
|
391
387
|
if (Array.isArray(value)) {
|
|
392
|
-
|
|
388
|
+
// Only update if items actually changed
|
|
389
|
+
let needsUpdate = false;
|
|
390
|
+
const newValue = value.map((selection) => {
|
|
391
|
+
const found = findItem(selection);
|
|
392
|
+
if (found && found !== selection) {
|
|
393
|
+
needsUpdate = true;
|
|
394
|
+
return found;
|
|
395
|
+
}
|
|
396
|
+
return selection;
|
|
397
|
+
});
|
|
398
|
+
if (needsUpdate) {
|
|
399
|
+
value = newValue;
|
|
400
|
+
}
|
|
393
401
|
} else {
|
|
394
|
-
|
|
402
|
+
const found = findItem();
|
|
403
|
+
if (found && found !== value) {
|
|
404
|
+
value = found;
|
|
405
|
+
}
|
|
395
406
|
}
|
|
396
407
|
}
|
|
397
408
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-select-5",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.4",
|
|
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)",
|