plane/web/components/gantt-chart/root.tsx

75 lines
2.2 KiB
TypeScript
Raw Normal View History

import { FC } from "react";
// components
2024-03-18 07:42:10 +00:00
import { ChartDataType, ChartViewRoot, IBlockUpdateData, IGanttBlock } from "components/gantt-chart";
// context
import { GanttStoreProvider } from "components/gantt-chart/contexts";
type GanttChartRootProps = {
2023-05-21 14:08:33 +00:00
border?: boolean;
title: string;
loaderTitle: string;
2024-03-18 07:42:10 +00:00
blockIds: string[];
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
blockToRender: (data: any) => React.ReactNode;
sidebarToRender: (props: any) => React.ReactNode;
quickAdd?: React.JSX.Element | undefined;
2024-03-18 07:42:10 +00:00
getBlockById: (id: string, currentViewData?: ChartDataType | undefined) => IGanttBlock;
canLoadMoreBlocks?: boolean;
2024-03-18 07:42:10 +00:00
loadMoreBlocks?: () => void;
enableBlockLeftResize?: boolean;
enableBlockRightResize?: boolean;
enableBlockMove?: boolean;
enableReorder?: boolean;
enableAddBlock?: boolean;
bottomSpacing?: boolean;
showAllBlocks?: boolean;
};
export const GanttChartRoot: FC<GanttChartRootProps> = (props) => {
const {
border = true,
title,
2024-03-18 07:42:10 +00:00
blockIds,
loaderTitle = "blocks",
blockUpdateHandler,
sidebarToRender,
blockToRender,
2024-03-18 07:42:10 +00:00
getBlockById,
loadMoreBlocks,
canLoadMoreBlocks,
enableBlockLeftResize = false,
enableBlockRightResize = false,
enableBlockMove = false,
enableReorder = false,
enableAddBlock = false,
bottomSpacing = false,
showAllBlocks = false,
quickAdd,
} = props;
return (
<GanttStoreProvider>
<ChartViewRoot
border={border}
title={title}
2024-03-18 07:42:10 +00:00
blockIds={blockIds}
getBlockById={getBlockById}
loadMoreBlocks={loadMoreBlocks}
canLoadMoreBlocks={canLoadMoreBlocks}
loaderTitle={loaderTitle}
blockUpdateHandler={blockUpdateHandler}
sidebarToRender={sidebarToRender}
blockToRender={blockToRender}
enableBlockLeftResize={enableBlockLeftResize}
enableBlockRightResize={enableBlockRightResize}
enableBlockMove={enableBlockMove}
enableReorder={enableReorder}
enableAddBlock={enableAddBlock}
bottomSpacing={bottomSpacing}
showAllBlocks={showAllBlocks}
quickAdd={quickAdd}
/>
</GanttStoreProvider>
);
};