From 881b49d223d3bd265a29d38342259895aff5d135 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Thu, 15 Oct 2020 10:16:13 +0100 Subject: [PATCH] Started working on the fixed height/width and dynamic support for autosizer --- src/gridContainer/GridContainer.tsx | 10 ++++++---- src/gridWrapper/GridWrapper.tsx | 2 +- src/index.tsx | 8 +++++++- stories/Basic.stories.tsx | 6 +++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/gridContainer/GridContainer.tsx b/src/gridContainer/GridContainer.tsx index 17e0a37..28c5f4b 100644 --- a/src/gridContainer/GridContainer.tsx +++ b/src/gridContainer/GridContainer.tsx @@ -13,7 +13,8 @@ import shallowDiffers from '../helpers/shallowDiffers' const useStyles = makeStyles(() => ({ root: { - // height: '100%', + height: '100%', + width: '100%', // overflowY: 'hidden', // overflowX: 'hidden', /** @todo Margin remove **/ @@ -140,6 +141,7 @@ export const GridContainer = React.memo( function render(containerWidth: number, containerHeight = 400) { const remainingWidth = buildColumnTotalWidth(containerWidth) + console.log({ containerWidth, containerHeight }) return ( - {({ width }) => render(width)} - +
+ {({ width, height }) => render(width, height)} +
) }, ) diff --git a/src/gridWrapper/GridWrapper.tsx b/src/gridWrapper/GridWrapper.tsx index a65de82..6144e7e 100644 --- a/src/gridWrapper/GridWrapper.tsx +++ b/src/gridWrapper/GridWrapper.tsx @@ -86,7 +86,7 @@ const GridWrapper = forwardRef((props: GridWrapperProps, componentRef: React.Ref useEffect(() => { cache.clearAll() gridRef.current?.recomputeGridSize() - }, [props.data]) + }, [props.data, props.width, props.height]) const onCellDoubleClick = ({ event, cell, columnIndex, rowIndex }: CellEventParams>) => { diff --git a/src/index.tsx b/src/index.tsx index 3967d51..3010ac3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -39,6 +39,12 @@ const useStyles = makeStyles(() => ({ display: 'none', }, }, + apolloRoot: { + height: '100%', + width: '100%', + flex: 1, + display: 'flex' + }, bodyContainer: { outline: 'none', // 'scrollbar-width': 'none', @@ -246,7 +252,7 @@ export const ApolloSpreadSheet = forwardRef( // }, [props.outsideClickDeselects, focused]) return ( -
+
{ } return ( - <> + @@ -286,7 +286,7 @@ const MainTable = () => { : undefined } /> - + ) } storiesOf('VirtualizedTable (DEMOS)', module)