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; const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate(); 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> </script>
<template> <template>
<QDrawer <QDrawer
@ -431,6 +441,7 @@ function handleScroll() {
@virtual-scroll="handleScroll" @virtual-scroll="handleScroll"
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)" @row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
@update:selected="emit('update:selected', $event)" @update:selected="emit('update:selected', $event)"
@selection="(details) => handleSelection(details, rows)"
> >
<template #top-left v-if="!$props.withoutHeader"> <template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"></slot> <slot name="top-left"></slot>