This commit is contained in:
Cüneyt Şentürk 2022-10-11 09:20:37 +03:00
parent d75cdef8ff
commit 43cbffe56a
3 changed files with 37 additions and 33 deletions

View File

@ -300,7 +300,7 @@ export default {
description: "Selectbox input search placeholder text" description: "Selectbox input search placeholder text"
}, },
dynamicOptionsValueCheck: { forceDynamicOptionValue: {
type: [Boolean, String], type: [Boolean, String],
default: false, default: false,
}, },
@ -871,25 +871,27 @@ export default {
}, },
dynamicOptionsValue(options) { dynamicOptionsValue(options) {
if (this.dynamicOptionsValueCheck) { if (! this.forceDynamicOptionValue) {
if (this.multiple) { if (this.multiple) {
let selected = this.selected;
this.selected = []; this.selected = [];
selected.forEach(function (select, index) {
if (this.sorted_options.find((option) => option.key == select)) {
this.selected.push(select);
}
}, this);
} else { } else {
if (!options.find((option) => option == this.selected)) { this.selected = null;
this.selected = null;
}
} }
return;
}
if (this.multiple) {
let selected = this.selected;
this.selected = [];
selected.forEach(function (select, index) {
if (this.sorted_options.find((option) => option.key == select)) {
this.selected.push(select);
}
}, this);
} else { } else {
if (this.multiple) { if (! options.find((option) => option == this.selected)) {
this.selected = [];
} else {
this.selected = null; this.selected = null;
} }
} }

View File

@ -1090,25 +1090,27 @@ export default {
}, },
dynamicOptionsValue(options) { dynamicOptionsValue(options) {
if (this.dynamicOptionsValueCheck) { if (! this.forceDynamicOptionValue) {
if (this.multiple) { if (this.multiple) {
let selected = this.selected;
this.selected = []; this.selected = [];
selected.forEach(function (select, index) {
if (this.sorted_options.find((option) => option.key == select)) {
this.selected.push(select);
}
}, this);
} else { } else {
if (!options.find((option) => option == this.selected)) { this.selected = null;
this.selected = null;
}
} }
return;
}
if (this.multiple) {
let selected = this.selected;
this.selected = [];
selected.forEach(function (select, index) {
if (this.sorted_options.find((option) => option.key == select)) {
this.selected.push(select);
}
}, this);
} else { } else {
if (this.multiple) { if (! options.find((option) => option == this.selected)) {
this.selected = [];
} else {
this.selected = null; this.selected = null;
} }
} }

View File

@ -65,10 +65,10 @@
search-text="{{ $searchText }}" search-text="{{ $searchText }}"
@endif @endif
@if (! empty($attributes['dynamic-options-value-check'])) @if (! empty($attributes['force-dynamic-option-value']))
dynamic-options-value-check force-dynamic-option-value
@elseif (! empty($dynamicOptionsValueCheck)) @elseif (! empty($forceDynamicOptionValue))
dynamic-options-value-check force-dynamic-option-value
@endif @endif
@if (empty($multiple)) @if (empty($multiple))