forked from github/plane
785a6e8871
* chore: gantt chart resizable blocks * chore: right scroll added * chore: left scroll added * fix: build errors * chore: remove unnecessary console logs * chore: add block type and remove info toggle * feat: gantt chart blocks y-axis drag and drop * chore: disable drag flag * fix: y-axis drag mutation * fix: scroll container undefined error * fix: negative scroll * fix: negative scroll * style: blocks tooltip consistency
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { FC } from "react";
|
|
// components
|
|
import { ChartViewRoot } from "./chart";
|
|
// context
|
|
import { ChartContextProvider } from "./contexts";
|
|
// types
|
|
import { IBlockUpdateData, IGanttBlock } from "./types";
|
|
|
|
type GanttChartRootProps = {
|
|
border?: boolean;
|
|
title: null | string;
|
|
loaderTitle: string;
|
|
blocks: IGanttBlock[] | null;
|
|
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
|
|
sidebarBlockRender: FC<any>;
|
|
blockRender: FC<any>;
|
|
enableLeftDrag?: boolean;
|
|
enableRightDrag?: boolean;
|
|
enableReorder?: boolean;
|
|
};
|
|
|
|
export const GanttChartRoot: FC<GanttChartRootProps> = ({
|
|
border = true,
|
|
title = null,
|
|
blocks,
|
|
loaderTitle = "blocks",
|
|
blockUpdateHandler,
|
|
sidebarBlockRender,
|
|
blockRender,
|
|
enableLeftDrag = true,
|
|
enableRightDrag = true,
|
|
enableReorder = true,
|
|
}) => (
|
|
<ChartContextProvider>
|
|
<ChartViewRoot
|
|
border={border}
|
|
title={title}
|
|
blocks={blocks}
|
|
loaderTitle={loaderTitle}
|
|
blockUpdateHandler={blockUpdateHandler}
|
|
sidebarBlockRender={sidebarBlockRender}
|
|
blockRender={blockRender}
|
|
enableLeftDrag={enableLeftDrag}
|
|
enableRightDrag={enableRightDrag}
|
|
enableReorder={enableReorder}
|
|
/>
|
|
</ChartContextProvider>
|
|
);
|