fix: refs #7793 restore vnselect
This commit is contained in:
parent
ea5ef91fcc
commit
126cbd3151
|
@ -184,25 +184,7 @@ function findKeyInOptions() {
|
|||
if (!$props.options) return;
|
||||
return filter($props.modelValue, $props.options)?.length;
|
||||
}
|
||||
function sortOptions(data) {
|
||||
return data.sort((a, b) => {
|
||||
const search = lastVal.value?.toString()?.toLowerCase();
|
||||
const aValue = String(a[$props.optionLabel]).toLowerCase();
|
||||
const bValue = String(b[$props.optionLabel]).toLowerCase();
|
||||
|
||||
const aIndex = aValue.indexOf(search);
|
||||
const bIndex = bValue.indexOf(search);
|
||||
|
||||
const aPriority = aIndex === 0 ? 0 : aIndex > 0 ? 1 : 2;
|
||||
const bPriority = bIndex === 0 ? 0 : bIndex > 0 ? 1 : 2;
|
||||
|
||||
if (aPriority !== bPriority) {
|
||||
return aPriority - bPriority;
|
||||
}
|
||||
|
||||
return aValue.localeCompare(bValue);
|
||||
});
|
||||
}
|
||||
function setOptions(data) {
|
||||
data = dataByOrder(data, $props.sortBy);
|
||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||
|
@ -215,8 +197,7 @@ function filter(val, options) {
|
|||
|
||||
if (!search) return options;
|
||||
|
||||
return sortOptions(
|
||||
options.filter((row) => {
|
||||
return options.filter((row) => {
|
||||
if ($props.filterOptions.length) {
|
||||
return $props.filterOptions.some((prop) => {
|
||||
const propValue = String(row[prop]).toLowerCase();
|
||||
|
@ -235,7 +216,7 @@ function filter(val, options) {
|
|||
async function fetchFilter(val) {
|
||||
if (!$props.url) return;
|
||||
|
||||
const { fields, include, limit } = $props;
|
||||
const { fields, include, sortBy, limit } = $props;
|
||||
const key =
|
||||
optionFilterValue.value ??
|
||||
(new RegExp(/\d/g).test(val)
|
||||
|
|
Loading…
Reference in New Issue