chore: make all datagrids resizable by default

This commit is contained in:
Matthew Russell
2023-08-09 17:47:13 +01:00
parent 39962a0246
commit bb76fcead3
13 changed files with 22 additions and 21 deletions
@@ -281,7 +281,6 @@ const ClosedMarketsDataGrid = ({
columnDefs={colDefs}
getRowId={({ data }) => data.id}
defaultColDef={{
resizable: true,
minWidth: 100,
flex: 1,
}}
-1
View File
@@ -311,7 +311,6 @@ export const AccountTable = ({
tooltipShowDelay={500}
rowData={data}
defaultColDef={{
resizable: true,
tooltipComponent: TooltipCellComponent,
sortable: true,
comparator: accountValuesComparator,
@@ -130,7 +130,6 @@ const BreakdownTable = forwardRef<AgGridReact, BreakdownTableProps>(
tooltipShowDelay={500}
defaultColDef={{
flex: 1,
resizable: true,
sortable: true,
}}
columnDefs={coldefs}
@@ -4,6 +4,19 @@ import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
import { t } from '@vegaprotocol/i18n';
import classNames from 'classnames';
const defaultProps: AgGridReactProps = {
rowHeight: 22,
headerHeight: 22,
enableCellTextSelection: true,
overlayLoadingTemplate: t('Loading...'),
overlayNoRowsTemplate: t('No data'),
suppressCellFocus: true,
};
const defaultColDef = {
resizable: true,
};
export const AgGridThemed = ({
style,
gridRef,
@@ -13,14 +26,6 @@ export const AgGridThemed = ({
gridRef?: React.ForwardedRef<AgGridReact>;
}) => {
const { theme } = useThemeSwitcher();
const defaultProps = {
rowHeight: 22,
headerHeight: 22,
enableCellTextSelection: true,
overlayLoadingTemplate: t('Loading...'),
overlayNoRowsTemplate: t('No data'),
suppressCellFocus: true,
};
const wrapperClasses = classNames('vega-ag-grid', {
'ag-theme-balham': theme === 'light',
@@ -29,7 +34,15 @@ export const AgGridThemed = ({
return (
<div className={wrapperClasses} style={style}>
<AgGridReact {...defaultProps} {...props} ref={gridRef} />
<AgGridReact
{...defaultProps}
{...props}
defaultColDef={{
...defaultColDef,
...props.defaultColDef,
}}
ref={gridRef}
/>
</div>
);
};
@@ -14,7 +14,6 @@ const gridProps = {
{
field: 'id',
width: 100,
resizable: true,
filter: 'agNumberColumnFilter',
},
],
-1
View File
@@ -124,7 +124,6 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
ref={ref}
columnDefs={columnDefs}
overlayNoRowsTemplate={t('No fills')}
defaultColDef={{ resizable: true }}
style={{ width: '100%', height: '100%' }}
getRowId={({ data }) => data?.id}
tooltipShowDelay={0}
-1
View File
@@ -187,7 +187,6 @@ export const LedgerTable = (props: LedgerEntryProps) => {
style={{ width: '100%', height: '100%' }}
tooltipShowDelay={500}
defaultColDef={{
resizable: true,
sortable: true,
tooltipComponent: TransferTooltipCellComponent,
filterParams: {
@@ -188,7 +188,6 @@ export const LiquidityTable = ({
getRowId={({ data }: { data: LiquidityProvisionData }) => data.id || ''}
tooltipShowDelay={500}
defaultColDef={{
resizable: true,
minWidth: 100,
tooltipComponent: TooltipCellComponent,
sortable: true,
@@ -35,7 +35,6 @@ const MarketName = (props: MarketNameCellProps) => (
);
const defaultColDef = {
resizable: true,
sortable: true,
filter: true,
filterParams: { buttons: ['reset'] },
@@ -337,7 +337,6 @@ export const OrderListTable = memo<
<AgGrid
ref={ref}
defaultColDef={{
resizable: true,
sortable: true,
filterParams: { buttons: ['reset'] },
}}
@@ -250,7 +250,6 @@ export const StopOrdersTable = memo<
return (
<AgGrid
defaultColDef={{
resizable: true,
sortable: true,
filterParams: { buttons: ['reset'] },
}}
@@ -103,7 +103,6 @@ export const PositionsTable = ({
getRowId={getRowId}
tooltipShowDelay={500}
defaultColDef={{
resizable: true,
sortable: true,
filter: true,
filterParams: { buttons: ['reset'] },
@@ -163,7 +163,6 @@ export const useColumnDefs = () => {
const defaultColDef: ColDef = useMemo(() => {
return {
sortable: true,
resizable: true,
filter: true,
filterParams: { buttons: ['reset'] },
minWidth: 100,