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-08-28 07:55:47 +00:00
|
|
|
title: string;
|
2023-05-20 12:00:15 +00:00
|
|
|
loaderTitle: string;
|
2023-08-11 10:29:13 +00:00
|
|
|
blocks: IGanttBlock[] | null;
|
|
|
|
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
|
2023-08-28 07:55:47 +00:00
|
|
|
SidebarBlockRender: FC<any>;
|
|
|
|
BlockRender: FC<any>;
|
|
|
|
enableBlockLeftResize?: boolean;
|
|
|
|
enableBlockRightResize?: boolean;
|
|
|
|
enableBlockMove?: boolean;
|
2023-08-11 10:29:13 +00:00
|
|
|
enableReorder?: boolean;
|
2023-08-28 07:55:47 +00:00
|
|
|
bottomSpacing?: 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-08-28 07:55:47 +00:00
|
|
|
title,
|
2023-05-20 12:00:15 +00:00
|
|
|
blocks,
|
|
|
|
loaderTitle = "blocks",
|
|
|
|
blockUpdateHandler,
|
2023-08-28 07:55:47 +00:00
|
|
|
SidebarBlockRender,
|
|
|
|
BlockRender,
|
|
|
|
enableBlockLeftResize = true,
|
|
|
|
enableBlockRightResize = true,
|
|
|
|
enableBlockMove = true,
|
2023-08-11 10:29:13 +00:00
|
|
|
enableReorder = true,
|
2023-08-28 07:55:47 +00:00
|
|
|
bottomSpacing = false,
|
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}
|
2023-08-28 07:55:47 +00:00
|
|
|
SidebarBlockRender={SidebarBlockRender}
|
|
|
|
BlockRender={BlockRender}
|
|
|
|
enableBlockLeftResize={enableBlockLeftResize}
|
|
|
|
enableBlockRightResize={enableBlockRightResize}
|
|
|
|
enableBlockMove={enableBlockMove}
|
2023-08-11 10:29:13 +00:00
|
|
|
enableReorder={enableReorder}
|
2023-08-28 07:55:47 +00:00
|
|
|
bottomSpacing={bottomSpacing}
|
2023-05-20 12:00:15 +00:00
|
|
|
/>
|
|
|
|
</ChartContextProvider>
|
|
|
|
);
|