feat: Add shift-click additive selection for documents in grid view
This commit is contained in:
@@ -9,6 +9,7 @@ import type { Identifier } from '../../types/identifiers';
|
|||||||
interface UseDocumentItemLogicProps extends DocumentsViewProps {
|
interface UseDocumentItemLogicProps extends DocumentsViewProps {
|
||||||
doc: Document;
|
doc: Document;
|
||||||
viewLogic: DocumentViewLogic;
|
viewLogic: DocumentViewLogic;
|
||||||
|
onEntryPointer?: (entry: any, event: any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
|
export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
|
||||||
@@ -55,8 +56,12 @@ export const useDocumentItemLogic = (props: UseDocumentItemLogicProps) => {
|
|||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
onClick: (event: React.MouseEvent) => {
|
onClick: (event: React.MouseEvent) => {
|
||||||
const key = createDocumentEntryKey(doc.id);
|
if (props.onEntryPointer) {
|
||||||
handleEntrySelection(key, event);
|
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),
|
onDoubleClick: (event: React.MouseEvent) => onDocumentActivate?.(doc, event),
|
||||||
onDragStart: (event: DragEvent<HTMLElement>) => onDocumentDragStart?.(event, doc),
|
onDragStart: (event: DragEvent<HTMLElement>) => onDocumentDragStart?.(event, doc),
|
||||||
|
|||||||
@@ -465,6 +465,7 @@ const DocumentsPanelInner: React.FC<DocumentsPanelInnerProps> = ({
|
|||||||
onCorrespondentClick: toggleCorrespondentFilter,
|
onCorrespondentClick: toggleCorrespondentFilter,
|
||||||
tenantId: currentTenantId,
|
tenantId: currentTenantId,
|
||||||
viewId,
|
viewId,
|
||||||
|
onEntryPointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderBody = () => {
|
const renderBody = () => {
|
||||||
|
|||||||
@@ -1141,7 +1141,13 @@ const useDocumentsWorkspace = ({
|
|||||||
const key = rowKey
|
const key = rowKey
|
||||||
|| (type === EntryType.document ? createDocumentEntryKey(id) : createFolderEntryKey(id));
|
|| (type === EntryType.document ? createDocumentEntryKey(id) : createFolderEntryKey(id));
|
||||||
if (key) {
|
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) {
|
if (type === EntryType.folder && !modifierClick && primaryClick) {
|
||||||
selectFolder(id);
|
selectFolder(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user