refactoring
This commit is contained in:
parent
a7da2ab3c9
commit
3cab2fee8b
@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
<span slot="infoBlock" class="absolute right-8 top-3 bg-green text-white px-2 py-1 rounded-md text-xs" v-if="new_options[selected]">{{ addNew.new_text }}</span>
|
<span slot="infoBlock" class="absolute right-8 top-3 bg-green text-white px-2 py-1 rounded-md text-xs" v-if="new_options[selected]">{{ addNew.new_text }}</span>
|
||||||
|
|
||||||
<select :name="name" :id="name" v-model="selected" class="d-none">
|
<select :name="name" :id="name" class="hidden">
|
||||||
<option v-for="option in sortedOptions" :key="option.key" :value="option.key">{{ option.value }}</option>
|
<option v-for="option in sortedOptions" :key="option.key" :value="option.key">{{ option.value }}</option>
|
||||||
</select>
|
</select>
|
||||||
</base-input>
|
</base-input>
|
||||||
@ -355,7 +355,6 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.sorted_options.sort(this.sortBy(this.option_sortable));
|
this.sorted_options.sort(this.sortBy(this.option_sortable));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.sorted_options;
|
return this.sorted_options;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -959,7 +958,7 @@ export default {
|
|||||||
|
|
||||||
if (this.group) {
|
if (this.group) {
|
||||||
// Option set sort_option data
|
// Option set sort_option data
|
||||||
if (!Array.isArray(options)) {
|
if (! Array.isArray(options)) {
|
||||||
for (const [index, _options] of Object.entries(options)) {
|
for (const [index, _options] of Object.entries(options)) {
|
||||||
let values = [];
|
let values = [];
|
||||||
|
|
||||||
@ -997,7 +996,7 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Option set sort_option data
|
// Option set sort_option data
|
||||||
if (!Array.isArray(options)) {
|
if (! Array.isArray(options)) {
|
||||||
for (const [key, value] of Object.entries(options)) {
|
for (const [key, value] of Object.entries(options)) {
|
||||||
this.sorted_options.push({
|
this.sorted_options.push({
|
||||||
key: key.toString(),
|
key: key.toString(),
|
||||||
@ -1025,31 +1024,26 @@ export default {
|
|||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.selectedControl) {
|
if (this.selectedControl) {
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
let selected = this.selected;
|
let selected = this.selected;
|
||||||
this.selected = [];
|
this.selected = [];
|
||||||
|
|
||||||
if (selected !== undefined) {
|
|
||||||
selected.forEach(function (select, index) {
|
selected.forEach(function (select, index) {
|
||||||
if (this.sorted_options.find(option => option.key == select)) {
|
if (this.sorted_options.find(option => option.key == select)) {
|
||||||
this.selected.push(select);
|
this.selected.push(select);
|
||||||
} else {
|
|
||||||
this.selected = [];
|
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (! options.find(option => option == this.selected)) {
|
if (! options.find(option => option == this.selected)) {
|
||||||
this.selected = [];
|
this.selected = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.selected = [];
|
this.selected = [];
|
||||||
} else {
|
} else {
|
||||||
this.selected = '';
|
this.selected = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user