mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
7a21855ab6
* Pragmatic drag and drop implmentation of Kanban * refactor pragmatic dnd implementation and fix bugs * fix dnd for modules, cycles, draft and project views
71 lines
2.2 KiB
TypeScript
71 lines
2.2 KiB
TypeScript
import { MutableRefObject, memo } from "react";
|
|
//types
|
|
import { TIssue, IIssueDisplayProperties, IIssueMap } from "@plane/types";
|
|
import { KanbanIssueBlock } from "@/components/issues";
|
|
// components
|
|
|
|
interface IssueBlocksListProps {
|
|
sub_group_id: string;
|
|
columnId: string;
|
|
issuesMap: IIssueMap;
|
|
peekIssueId?: string;
|
|
issueIds: string[];
|
|
displayProperties: IIssueDisplayProperties | undefined;
|
|
isDragDisabled: boolean;
|
|
updateIssue: ((projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>) | undefined;
|
|
quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode;
|
|
canEditProperties: (projectId: string | undefined) => boolean;
|
|
scrollableContainerRef?: MutableRefObject<HTMLDivElement | null>;
|
|
}
|
|
|
|
const KanbanIssueBlocksListMemo: React.FC<IssueBlocksListProps> = (props) => {
|
|
const {
|
|
sub_group_id,
|
|
columnId,
|
|
issuesMap,
|
|
peekIssueId,
|
|
issueIds,
|
|
displayProperties,
|
|
isDragDisabled,
|
|
updateIssue,
|
|
quickActions,
|
|
canEditProperties,
|
|
scrollableContainerRef,
|
|
} = props;
|
|
|
|
return (
|
|
<>
|
|
{issueIds && issueIds.length > 0 ? (
|
|
<>
|
|
{issueIds.map((issueId) => {
|
|
if (!issueId) return null;
|
|
|
|
let draggableId = issueId;
|
|
if (columnId) draggableId = `${draggableId}__${columnId}`;
|
|
if (sub_group_id) draggableId = `${draggableId}__${sub_group_id}`;
|
|
|
|
return (
|
|
<KanbanIssueBlock
|
|
key={draggableId}
|
|
peekIssueId={peekIssueId}
|
|
issueId={issueId}
|
|
issuesMap={issuesMap}
|
|
displayProperties={displayProperties}
|
|
updateIssue={updateIssue}
|
|
quickActions={quickActions}
|
|
draggableId={draggableId}
|
|
isDragDisabled={isDragDisabled}
|
|
canEditProperties={canEditProperties}
|
|
scrollableContainerRef={scrollableContainerRef}
|
|
issueIds={issueIds} //passing to force render for virtualization whenever parent rerenders
|
|
/>
|
|
);
|
|
})}
|
|
</>
|
|
) : null}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export const KanbanIssueBlocksList = memo(KanbanIssueBlocksListMemo);
|