forked from verdnatura/salix-front
feat: refs #8078 add shortcut multi selection
This commit is contained in:
parent
0537213a58
commit
0cc0e82aaa
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue