#8038 added new functionality in VnSelect and refactored styles #871

Merged
jon merged 7 commits from 8038-ImproveAndCorrectVnTable into dev 2024-11-21 07:08:14 +00:00
3 changed files with 27 additions and 4 deletions

View File

@ -394,7 +394,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
:vertical="true"
:vertical="false"
/>
</div>
<slot

View File

@ -138,8 +138,6 @@ onMounted(() => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
defineExpose({ opts: myOptions });
const arrayDataKey =
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
@ -259,6 +257,30 @@ async function onScroll({ to, direction, from, index }) {
isLoading.value = false;
}
}
defineExpose({ opts: myOptions });
function handleKeyDown(event) {
if (event.key === 'Tab') {
event.preventDefault();
const inputValue = vnSelectRef.value?.inputValue;
if (inputValue) {
const matchingOption = myOptions.value.find(
(option) =>
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
);
if (matchingOption) {
emit('update:modelValue', matchingOption[optionValue.value]);
} else {
emit('update:modelValue', inputValue);
}
vnSelectRef.value?.hidePopup();
}
}
}
</script>
<template>
@ -269,6 +291,7 @@ async function onScroll({ to, direction, from, index }) {
:option-value="optionValue"
v-bind="$attrs"
@filter="filterHandler"
@keydown="handleKeyDown"
:emit-value="nullishToTrue($attrs['emit-value'])"
:map-options="nullishToTrue($attrs['map-options'])"
:use-input="nullishToTrue($attrs['use-input'])"

View File

@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
th,
td {
padding: 1px 10px 1px 10px;
max-width: 100px;
max-width: 130px;
div span {
overflow: hidden;
white-space: nowrap;