ui
This commit is contained in:
@@ -21,6 +21,7 @@ import { useManagementModals } from './useManagementModals';
|
||||
import { api, useAppDispatch, useAppState } from './appState';
|
||||
import { useDetailPanel } from './useDetailPanel';
|
||||
import { useDocumentSelection } from './useDocumentSelection';
|
||||
import { useEntryPointerHandler } from '../documents/useEntryPointer';
|
||||
import { isTagTransferEvent } from '../documents/tagTransfer';
|
||||
|
||||
const ASSET_PRESIGN_TTL_MS = 240 * 1000; // backend issues 5 min tokens; refresh slightly early
|
||||
@@ -4383,6 +4384,29 @@ const AppLayout = () => {
|
||||
close: closeDetailPanel,
|
||||
};
|
||||
|
||||
const handleEntryPointer = useEntryPointerHandler({
|
||||
resolveDocumentRowKey,
|
||||
resolveFolderRowKey,
|
||||
onSelectDocument: (documentId, event, { modifierClick, primaryClick, rowKey }) => {
|
||||
const key = rowKey || resolveDocumentRowKey(documentId);
|
||||
if (key) {
|
||||
handleEntrySelection(key, event);
|
||||
}
|
||||
if (!modifierClick && primaryClick) {
|
||||
openDetailPanel({ documentIds: [documentId] });
|
||||
}
|
||||
},
|
||||
onSelectFolder: (folderId, event, { modifierClick, primaryClick, rowKey }) => {
|
||||
const key = rowKey || resolveFolderRowKey(folderId);
|
||||
if (key) {
|
||||
handleEntrySelection(key, event);
|
||||
}
|
||||
if (!modifierClick && primaryClick) {
|
||||
selectFolder(folderId);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const { breadcrumbs, missingBreadcrumbAncestors } = useMemo(() => {
|
||||
const chain = [];
|
||||
const seen = new Set();
|
||||
@@ -4715,9 +4739,8 @@ const AppLayout = () => {
|
||||
viewMode: documentsViewMode,
|
||||
onViewModeChange: handleDocumentsViewModeChange,
|
||||
onClearSelection: clearDocumentSelection,
|
||||
onEntrySelection: handleEntrySelection,
|
||||
onDeleteSelection: handleDeleteSelection,
|
||||
onOpenDetailPanel: openDetailPanel,
|
||||
onEntryPointer: handleEntryPointer,
|
||||
tags,
|
||||
correspondents,
|
||||
documentLookup,
|
||||
@@ -4749,10 +4772,8 @@ const AppLayout = () => {
|
||||
handleFolderDragEnd,
|
||||
handleFolderDragStart,
|
||||
handleFolderRename,
|
||||
handleEntrySelection,
|
||||
handleDeleteSelection,
|
||||
isFilterActive,
|
||||
openDetailPanel,
|
||||
openDocumentPreview,
|
||||
refreshCurrentFolder,
|
||||
searchLoading,
|
||||
@@ -4764,6 +4785,7 @@ const AppLayout = () => {
|
||||
tagLookupById,
|
||||
toggleCorrespondentFilter,
|
||||
toggleTagFilter,
|
||||
handleEntryPointer,
|
||||
ensureAssetUrl,
|
||||
getDocumentAsset,
|
||||
tags,
|
||||
@@ -4928,20 +4950,6 @@ const AppLayout = () => {
|
||||
[applySelection, openDetailPanel],
|
||||
);
|
||||
|
||||
const handleDeskDocumentPointerSelect = useCallback(
|
||||
(docId, event) => {
|
||||
if (!docId) {
|
||||
return;
|
||||
}
|
||||
const rowKey = resolveDocumentRowKey(docId);
|
||||
if (!rowKey) {
|
||||
return;
|
||||
}
|
||||
handleEntrySelection(rowKey, event);
|
||||
},
|
||||
[handleEntrySelection],
|
||||
);
|
||||
|
||||
const handleDeskDocumentStackSelect = useCallback(
|
||||
(docIds) => {
|
||||
if (!Array.isArray(docIds) || docIds.length === 0) {
|
||||
@@ -4956,12 +4964,21 @@ const AppLayout = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
applySelection(rowKeys, {
|
||||
anchor: rowKeys[0],
|
||||
const nextKeys = [...selectedEntries];
|
||||
rowKeys.forEach((key) => {
|
||||
if (!nextKeys.includes(key)) {
|
||||
nextKeys.push(key);
|
||||
}
|
||||
});
|
||||
|
||||
const anchor = rowKeys[0] || selectionAnchorRef.current || nextKeys[nextKeys.length - 1];
|
||||
|
||||
applySelection(nextKeys, {
|
||||
anchor,
|
||||
interactedKeys: rowKeys,
|
||||
});
|
||||
},
|
||||
[applySelection],
|
||||
[applySelection, selectedEntries, selectionAnchorRef],
|
||||
);
|
||||
|
||||
const handleDeskHelpOpen = useCallback(() => {
|
||||
@@ -5001,8 +5018,9 @@ const AppLayout = () => {
|
||||
onRefresh: refreshCurrentFolder,
|
||||
onDocumentOpen: openDocumentPreview,
|
||||
onInspectDocument: handleDeskInspectDocument,
|
||||
onDocumentPointerSelect: handleDeskDocumentPointerSelect,
|
||||
onEntryPointer: handleEntryPointer,
|
||||
onDocumentStackSelect: handleDeskDocumentStackSelect,
|
||||
onPromoteSelection: promoteSelectionOrder,
|
||||
onOpenHelp: handleDeskHelpOpen,
|
||||
helpOpen: deskHelpOpen,
|
||||
onHelpClose: handleDeskHelpClose,
|
||||
@@ -5041,8 +5059,9 @@ const AppLayout = () => {
|
||||
refreshCurrentFolder,
|
||||
openDocumentPreview,
|
||||
handleDeskInspectDocument,
|
||||
handleDeskDocumentPointerSelect,
|
||||
handleDeskDocumentStackSelect,
|
||||
handleEntryPointer,
|
||||
promoteSelectionOrder,
|
||||
handleDeskHelpOpen,
|
||||
handleDeskHelpClose,
|
||||
currentTenantId,
|
||||
|
||||
Reference in New Issue
Block a user