2023-05-20 12:00:15 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
// components
|
|
|
|
import { ChartViewRoot } from "./chart";
|
|
|
|
// context
|
|
|
|
import { ChartContextProvider } from "./contexts";
|
2023-08-11 10:29:13 +00:00
|
|
|
// types
|
|
|
|
import { IBlockUpdateData, IGanttBlock } from "./types";
|
2023-05-20 12:00:15 +00:00
|
|
|
|
|
|
|
type GanttChartRootProps = {
|
2023-05-21 14:08:33 +00:00
|
|
|
border?: boolean;
|
2023-05-20 12:00:15 +00:00
|
|
|
title: null | string;
|
|
|
|
loaderTitle: string;
|
2023-08-11 10:29:13 +00:00
|
|
|
blocks: IGanttBlock[] | null;
|
|
|
|
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
|
2023-05-20 12:00:15 +00:00
|
|
|
sidebarBlockRender: FC<any>;
|
|
|
|
blockRender: FC<any>;
|
2023-08-11 10:29:13 +00:00
|
|
|
enableLeftDrag?: boolean;
|
|
|
|
enableRightDrag?: boolean;
|
|
|
|
enableReorder?: boolean;
|
2023-05-20 12:00:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const GanttChartRoot: FC<GanttChartRootProps> = ({
|
2023-05-21 13:57:08 +00:00
|
|
|
border = true,
|
2023-05-20 12:00:15 +00:00
|
|
|
title = null,
|
|
|
|
blocks,
|
|
|
|
loaderTitle = "blocks",
|
|
|
|
blockUpdateHandler,
|
|
|
|
sidebarBlockRender,
|
|
|
|
blockRender,
|
2023-08-11 10:29:13 +00:00
|
|
|
enableLeftDrag = true,
|
|
|
|
enableRightDrag = true,
|
|
|
|
enableReorder = true,
|
2023-05-20 12:00:15 +00:00
|
|
|
}) => (
|
|
|
|
<ChartContextProvider>
|
|
|
|
<ChartViewRoot
|
2023-05-21 13:57:08 +00:00
|
|
|
border={border}
|
2023-05-20 12:00:15 +00:00
|
|
|
title={title}
|
|
|
|
blocks={blocks}
|
|
|
|
loaderTitle={loaderTitle}
|
|
|
|
blockUpdateHandler={blockUpdateHandler}
|
|
|
|
sidebarBlockRender={sidebarBlockRender}
|
|
|
|
blockRender={blockRender}
|
2023-08-11 10:29:13 +00:00
|
|
|
enableLeftDrag={enableLeftDrag}
|
|
|
|
enableRightDrag={enableRightDrag}
|
|
|
|
enableReorder={enableReorder}
|
2023-05-20 12:00:15 +00:00
|
|
|
/>
|
|
|
|
</ChartContextProvider>
|
|
|
|
);
|