Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brightsoftware/table",
"version": "0.1.0",
"version": "0.1.1",
"description": "A React table library by bright office system.",
"license": "MIT",
"author": {
Expand Down
10 changes: 6 additions & 4 deletions src/utils/useTableDimension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ const useTableDimension = <Row extends RowDataType, Key>(props: TableDimensionPr
getRowHeight,
data,
onTableScroll,
onTableResizeChange
onTableResizeChange,
tableHeight.current
]);

const setOffsetByAffix = useCallback(() => {
Expand Down Expand Up @@ -254,7 +255,7 @@ const useTableDimension = <Row extends RowDataType, Key>(props: TableDimensionPr

if (tableOffset !== undefined) {
const maxTableHeight = innerHeight - tableOffset - bottomPadding;
tableHeight.current = Math.min(maxTableHeight, contentHeight.current - bottomPadding - tableOffset);
tableHeight.current = Math.min(maxTableHeight, contentHeight.current+ headerHeight);
}
}

Expand Down Expand Up @@ -321,6 +322,7 @@ const useTableDimension = <Row extends RowDataType, Key>(props: TableDimensionPr
calculateTableWidth();
calculateTableHeight();
calculateTableContentWidth();
calculateTableContextHeight();
}
}, [isVisible]);

Expand All @@ -332,7 +334,7 @@ const useTableDimension = <Row extends RowDataType, Key>(props: TableDimensionPr
scrollX.current = value;
}, []);

const getTableHeight = () => {
const getTableHeight = useCallback(() => {
if (data?.length === 0) {
return props.height;
}
Expand All @@ -350,7 +352,7 @@ const useTableDimension = <Row extends RowDataType, Key>(props: TableDimensionPr
}

return height;
};
}, [tableHeight.current]);

return {
contentHeight,
Expand Down
6 changes: 3 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const prependUseClient = () => {
};
};

/* // Read package.json to get all dependencies
// Read package.json to get all dependencies
const packageJson = JSON.parse(readFileSync('./package.json', 'utf8'));
const external = [
...Object.keys(packageJson.dependencies || {}),
...Object.keys(packageJson.peerDependencies || {}),
];
*/

// NOTE: due to some reason vite is not adding the import statement for transpiled css file
// that is why this function(plugin) exists.
// This is not a good way, but it works and it's fine for now.
Expand Down Expand Up @@ -80,7 +80,7 @@ export default defineConfig({
},

rollupOptions: {
external: ['react', 'react-dom'],
external: external,
output: {
preserveModules: true,
entryFileNames: '[name].js',
Expand Down