Skip to content

Commit eb4ca21

Browse files
anaisbergSimonClo
authored andcommitted
💄 min width on columns
1 parent 1d5c528 commit eb4ca21

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/DatabaseBlock/DatabaseGrid.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111

1212
import { AddButtonComponent } from './AddColumnButton';
1313
import { useColumns, useRows } from './hooks';
14-
import { addRowCellRenderer, createNewRow } from './utils';
14+
import { addRowCellRenderer, autoSizeStrategy, createNewRow } from './utils';
1515

1616
export const DatabaseGrid = ({
1717
documentId,
@@ -102,6 +102,8 @@ export const DatabaseGrid = ({
102102
filter: true,
103103
editable: true,
104104
unSortIcon: true,
105+
suppressSizeToFit: true,
106+
minWidth: 200,
105107
};
106108

107109
const addColumn = (columnName: string) => {
@@ -139,6 +141,7 @@ export const DatabaseGrid = ({
139141
defaultColDef={defaultColDef}
140142
domLayout="autoHeight"
141143
enableCellSpan={true}
144+
autoSizeStrategy={autoSizeStrategy}
142145
/>
143146
</Box>
144147
);

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/DatabaseBlock/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
import { ICellRendererParams } from 'ag-grid-community';
1+
import {
2+
ICellRendererParams,
3+
SizeColumnsToContentStrategy,
4+
} from 'ag-grid-community';
25
import { Dispatch, SetStateAction } from 'react';
36

47
import { AddRowButton } from './AddRowButton';
58

9+
export const autoSizeStrategy: SizeColumnsToContentStrategy = {
10+
type: 'fitCellContents',
11+
};
12+
613
export const createNewRow = (
714
value: string | undefined,
815
columnNames: string[] | undefined,

0 commit comments

Comments
 (0)