2023-05-20 12:00:15 +00:00
|
|
|
import { FC } from "react";
|
|
|
|
// components
|
2024-02-12 09:38:17 +00:00
|
|
|
import { ChartViewRoot, IBlockUpdateData, IGanttBlock } from "components/gantt-chart";
|
2023-05-20 12:00:15 +00:00
|
|
|
// context
|
2024-02-23 13:40:45 +00:00
|
|
|
import { GanttStoreProvider } from "components/gantt-chart/contexts";
|
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-11-02 10:32:34 +00:00
|
|
|
blockToRender: (data: any) => React.ReactNode;
|
2023-11-09 12:27:41 +00:00
|
|
|
sidebarToRender: (props: any) => React.ReactNode;
|
2024-02-14 12:45:13 +00:00
|
|
|
quickAdd?: React.JSX.Element | undefined;
|
2023-08-28 07:55:47 +00:00
|
|
|
enableBlockLeftResize?: boolean;
|
|
|
|
enableBlockRightResize?: boolean;
|
|
|
|
enableBlockMove?: boolean;
|
2023-08-11 10:29:13 +00:00
|
|
|
enableReorder?: boolean;
|
2024-02-12 13:40:07 +00:00
|
|
|
enableAddBlock?: boolean;
|
2023-08-28 07:55:47 +00:00
|
|
|
bottomSpacing?: boolean;
|
2024-01-30 08:55:15 +00:00
|
|
|
showAllBlocks?: boolean;
|
2023-05-20 12:00:15 +00:00
|
|
|
};
|
|
|
|
|
2024-01-30 08:55:15 +00:00
|
|
|
export const GanttChartRoot: FC<GanttChartRootProps> = (props) => {
|
|
|
|
const {
|
|
|
|
border = true,
|
|
|
|
title,
|
|
|
|
blocks,
|
|
|
|
loaderTitle = "blocks",
|
|
|
|
blockUpdateHandler,
|
|
|
|
sidebarToRender,
|
|
|
|
blockToRender,
|
2024-02-12 13:40:07 +00:00
|
|
|
enableBlockLeftResize = false,
|
|
|
|
enableBlockRightResize = false,
|
|
|
|
enableBlockMove = false,
|
|
|
|
enableReorder = false,
|
|
|
|
enableAddBlock = false,
|
2024-01-30 08:55:15 +00:00
|
|
|
bottomSpacing = false,
|
|
|
|
showAllBlocks = false,
|
2024-02-14 12:45:13 +00:00
|
|
|
quickAdd,
|
2024-01-30 08:55:15 +00:00
|
|
|
} = props;
|
|
|
|
|
|
|
|
return (
|
2024-02-23 13:40:45 +00:00
|
|
|
<GanttStoreProvider>
|
2024-01-30 08:55:15 +00:00
|
|
|
<ChartViewRoot
|
|
|
|
border={border}
|
|
|
|
title={title}
|
|
|
|
blocks={blocks}
|
|
|
|
loaderTitle={loaderTitle}
|
|
|
|
blockUpdateHandler={blockUpdateHandler}
|
|
|
|
sidebarToRender={sidebarToRender}
|
|
|
|
blockToRender={blockToRender}
|
|
|
|
enableBlockLeftResize={enableBlockLeftResize}
|
|
|
|
enableBlockRightResize={enableBlockRightResize}
|
|
|
|
enableBlockMove={enableBlockMove}
|
|
|
|
enableReorder={enableReorder}
|
2024-02-12 13:40:07 +00:00
|
|
|
enableAddBlock={enableAddBlock}
|
2024-01-30 08:55:15 +00:00
|
|
|
bottomSpacing={bottomSpacing}
|
|
|
|
showAllBlocks={showAllBlocks}
|
2024-02-14 12:45:13 +00:00
|
|
|
quickAdd={quickAdd}
|
2024-01-30 08:55:15 +00:00
|
|
|
/>
|
2024-02-23 13:40:45 +00:00
|
|
|
</GanttStoreProvider>
|
2024-01-30 08:55:15 +00:00
|
|
|
);
|
|
|
|
};
|