@bagelink/vue 1.7.45 → 1.7.49
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/package.json
CHANGED
|
@@ -160,7 +160,7 @@ function select(option: Option) {
|
|
|
160
160
|
|
|
161
161
|
function emitUpdate() {
|
|
162
162
|
if (props.multiselect) {
|
|
163
|
-
emit('update:modelValue', selectedItems.value.map(getValue).filter(
|
|
163
|
+
emit('update:modelValue', selectedItems.value.map(getValue).filter(v => v != null))
|
|
164
164
|
} else {
|
|
165
165
|
// selectedItems.value.splice(1, selectedItemCount.value - 1);
|
|
166
166
|
const [item] = selectedItems.value
|
|
@@ -170,8 +170,8 @@ function emitUpdate() {
|
|
|
170
170
|
|
|
171
171
|
function compareArrays(arr1: Option[], arr2: Option[]) {
|
|
172
172
|
if (arr1.length !== arr2.length) { return false }
|
|
173
|
-
const s1 = arr1.map(getValue).filter(
|
|
174
|
-
const s2 = arr2.map(getValue).filter(
|
|
173
|
+
const s1 = arr1.map(getValue).filter(v => v != null).map(String).sort()
|
|
174
|
+
const s2 = arr2.map(getValue).filter(v => v != null).map(String).sort()
|
|
175
175
|
return s1.every((v, i) => v === s2[i])
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -182,7 +182,7 @@ watch(
|
|
|
182
182
|
const newOption = Array.isArray(props.options)
|
|
183
183
|
? (props.options.find(o => getValue(o) === newVal) ?? newVal)
|
|
184
184
|
: newVal
|
|
185
|
-
if (newOption && !isSelected(newOption)) { selectedItems.value = [newOption] }
|
|
185
|
+
if (newOption != null && !isSelected(newOption)) { selectedItems.value = [newOption] }
|
|
186
186
|
} else {
|
|
187
187
|
const newData = [newVal].flat()
|
|
188
188
|
const isSame = compareArrays(newData, selectedItems.value)
|
|
@@ -233,7 +233,7 @@ watch(
|
|
|
233
233
|
const fullOption = newResults.find(
|
|
234
234
|
(o: Option) => getValue(o) === optionValue,
|
|
235
235
|
)
|
|
236
|
-
if (fullOption) {
|
|
236
|
+
if (fullOption !== undefined) {
|
|
237
237
|
selectedItems.value.splice(i, 1, fullOption)
|
|
238
238
|
}
|
|
239
239
|
}
|