feat: Add shift-click additive selection for documents in grid view

This commit is contained in:
2025-11-28 20:50:24 +01:00
parent 0b45eeb2d4
commit 41555bb57d
3 changed files with 15 additions and 3 deletions
@@ -9,6 +9,7 @@ import type { Identifier } from '../../types/identifiers';
interface UseDocumentItemLogicProps extends DocumentsViewProps {
doc: Document;
viewLogic: DocumentViewLogic;
onEntryPointer?: (entry: any, event: any) => void;
}
export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
@@ -55,8 +56,12 @@ export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
const handlers = {
onClick: (event: React.MouseEvent) => {
const key = createDocumentEntryKey(doc.id);
handleEntrySelection(key, event);
if (props.onEntryPointer) {
props.onEntryPointer({ type: 'document', id: doc.id, key: createDocumentEntryKey(doc.id), document: doc }, event);
} else {
const key = createDocumentEntryKey(doc.id);
handleEntrySelection(key, event);
}
},
onDoubleClick: (event: React.MouseEvent) => onDocumentActivate?.(doc, event),
onDragStart: (event: DragEvent<HTMLElement>) => onDocumentDragStart?.(event, doc),
@@ -465,6 +465,7 @@ const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
onCorrespondentClick: toggleCorrespondentFilter,
tenantId: currentTenantId,
viewId,
onEntryPointer,
};
const renderBody = () => {
@@ -1141,7 +1141,13 @@ const useDocumentsWorkspace = ({
const key = rowKey
|| (type === EntryType.document ? createDocumentEntryKey(id) : createFolderEntryKey(id));
if (key) {
handleEntrySelection(key, event);
if (documentsViewMode === 'grid' && (event as any).shiftKey) {
// Additive selection for Shift+Click in Grid View
const newSelection = Array.from(new Set([...selectedEntries, key]));
applySelection(newSelection, { anchor: key, interactedKeys: [key] });
} else {
handleEntrySelection(key, event);
}
}
if (type === EntryType.folder && !modifierClick && primaryClick) {
selectFolder(id);