0
0
Fork 0

feat: refs #8078 add shortcut multi selection

This commit is contained in:
Jorge Penadés 2024-10-27 14:48:44 +01:00
parent 0537213a58
commit 0cc0e82aaa
1 changed files with 11 additions and 0 deletions

View File

@ -331,6 +331,16 @@ function handleScroll() {
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
}
function handleSelection({ evt, added, rows: selectedRows }, rows) {
if (evt?.shiftKey && added) {
const rowIndex = selectedRows[0].$index;
for (const row of rows) {
if (row.$index > rowIndex) break;
selected.value.push(row);
}
}
}
</script>
<template>
<QDrawer
@ -431,6 +441,7 @@ function handleScroll() {
@virtual-scroll="handleScroll"
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
@update:selected="emit('update:selected', $event)"
@selection="(details) => handleSelection(details, rows)"
>
<template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"></slot>