Feat: Batch operations on documents in a dataset #3221 (#7352)

### What problem does this PR solve?

Feat: Batch operations on documents in a dataset #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-04-27 17:00:41 +08:00
committed by GitHub
parent 43e507d554
commit 6a45d93005
12 changed files with 181 additions and 203 deletions

View File

@ -1,7 +1,7 @@
import { useSelectedIds } from '@/hooks/logic-hooks/use-row-selection';
import { IFile } from '@/interfaces/database/file-manager';
import { OnChangeFn, RowSelectionState } from '@tanstack/react-table';
import { FolderInput, Trash2 } from 'lucide-react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useHandleDeleteFile } from './use-delete-file';
import { UseMoveDocumentShowType } from './use-move-file';
@ -18,12 +18,7 @@ export function useBulkOperateFile({
} & UseMoveDocumentShowType) {
const { t } = useTranslation();
const selectedIds = useMemo(() => {
const indexes = Object.keys(rowSelection);
return files
.filter((x, idx) => indexes.some((y) => Number(y) === idx))
.map((x) => x.id);
}, [files, rowSelection]);
const { selectedIds } = useSelectedIds(rowSelection, files);
const { handleRemoveFile } = useHandleDeleteFile();