mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
removeMissingItem disabled
This commit is contained in:
@@ -8,8 +8,9 @@
|
|||||||
@change="new_value = $event.val"
|
@change="new_value = $event.val"
|
||||||
@remove="new_value = undefined"
|
@remove="new_value = undefined"
|
||||||
:initial_selection="initialSelection"
|
:initial_selection="initialSelection"
|
||||||
|
:initial_single_selection="initialSingleSelection"
|
||||||
:model="model"
|
:model="model"
|
||||||
:multiple="useMultiple"
|
:multiple="useMultiple || false"
|
||||||
:sticky_options="sticky_options"
|
:sticky_options="sticky_options"
|
||||||
:allow_create="form.allow_create"
|
:allow_create="form.allow_create"
|
||||||
:create_placeholder="createPlaceholder"
|
:create_placeholder="createPlaceholder"
|
||||||
@@ -76,25 +77,21 @@ export default {
|
|||||||
return this.form?.multiple || this.form?.ordered || false
|
return this.form?.multiple || this.form?.ordered || false
|
||||||
},
|
},
|
||||||
initialSelection() {
|
initialSelection() {
|
||||||
if (!this.new_value) {
|
if (!this.new_value || !this.useMultiple) {
|
||||||
return
|
return undefined
|
||||||
}
|
|
||||||
let this_value = this.new_value
|
|
||||||
let arrayValues = undefined
|
|
||||||
// multiselect is expect to get an array of objects - make sure it gets one
|
|
||||||
if (Array.isArray(this_value)) {
|
|
||||||
arrayValues = this_value
|
|
||||||
} else if (!this_value) {
|
|
||||||
arrayValues = []
|
|
||||||
} else if (typeof this_value === "object") {
|
|
||||||
arrayValues = [this_value]
|
|
||||||
} else {
|
|
||||||
arrayValues = [{ id: -1, name: this_value }]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.form?.ordered && this.first_run) {
|
if (this.form?.ordered && this.first_run) {
|
||||||
return this.flattenItems(arrayValues)
|
return this.flattenItems(this.new_value)
|
||||||
} else {
|
} else {
|
||||||
return arrayValues
|
return this.new_value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initialSingleSelection() {
|
||||||
|
if (this.useMultiple) {
|
||||||
|
return undefined
|
||||||
|
} else {
|
||||||
|
return this.new_value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createPlaceholder() {
|
createPlaceholder() {
|
||||||
|
|||||||
Reference in New Issue
Block a user