feat: refs #8038 added new functionality in VnSelect and refactor styles
gitea/salix-front/pipeline/pr-dev Build queued... Details

This commit is contained in:
Jon Elias 2024-10-25 07:01:58 +02:00
parent 3cbd294168
commit e13090bb3b
3 changed files with 25 additions and 2 deletions

View File

@ -379,7 +379,7 @@ function handleScroll() {
:name="col.orderBy ?? col.name" :name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
:search-url="searchUrl" :search-url="searchUrl"
:vertical="true" :vertical="false"
/> />
</div> </div>
<slot <slot

View File

@ -230,6 +230,28 @@ function nullishToTrue(value) {
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
defineExpose({ opts: myOptions }); 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> </script>
<template> <template>
@ -250,6 +272,7 @@ defineExpose({ opts: myOptions });
:option-value="optionValue" :option-value="optionValue"
v-bind="$attrs" v-bind="$attrs"
@filter="filterHandler" @filter="filterHandler"
@keydown="handleKeyDown"
:emit-value="nullishToTrue($attrs['emit-value'])" :emit-value="nullishToTrue($attrs['emit-value'])"
:map-options="nullishToTrue($attrs['map-options'])" :map-options="nullishToTrue($attrs['map-options'])"
:use-input="nullishToTrue($attrs['use-input'])" :use-input="nullishToTrue($attrs['use-input'])"

View File

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