mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Changed the layout for tables from block layout to flex layout to fix the width of the columns as per the dialog size.
This commit is contained in:
parent
f538546c4d
commit
fc86faf51e
@ -58,7 +58,7 @@ export default class PrivilegeRoleSchema extends BaseUISchema {
|
||||
type: 'text', group: null,
|
||||
cell: ()=>({cell: 'privilege', controlProps: {
|
||||
supportedPrivs: this.supportedPrivs,
|
||||
}}), minWidth: 230,
|
||||
}}),
|
||||
disabled : function(state) {
|
||||
return !(
|
||||
obj.nodeInfo &&
|
||||
@ -69,7 +69,6 @@ export default class PrivilegeRoleSchema extends BaseUISchema {
|
||||
{
|
||||
id: 'grantor', label: gettext('Grantor'), type: 'text', readonly: true,
|
||||
editable: false, cell: ()=>({cell: 'select', options: obj.grantorOptions}),
|
||||
minWidth: 150,
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ import AddIcon from '@material-ui/icons/AddOutlined';
|
||||
import { MappedCellControl } from './MappedControl';
|
||||
import EditRoundedIcon from '@material-ui/icons/EditRounded';
|
||||
import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
|
||||
import { useTable, useBlockLayout, useResizeColumns, useSortBy, useExpanded } from 'react-table';
|
||||
import { useTable, useFlexLayout, useResizeColumns, useSortBy, useExpanded } from 'react-table';
|
||||
import clsx from 'clsx';
|
||||
import PropTypes from 'prop-types';
|
||||
import _ from 'lodash';
|
||||
@ -88,6 +88,9 @@ const useStyles = makeStyles((theme)=>({
|
||||
padding: theme.spacing(1, 0.5),
|
||||
textAlign: 'left',
|
||||
},
|
||||
tableContentWidth: {
|
||||
width: 'calc(100% - 3px)',
|
||||
},
|
||||
btnCell: {
|
||||
padding: theme.spacing(0.5, 0),
|
||||
textAlign: 'center',
|
||||
@ -117,7 +120,7 @@ const useStyles = makeStyles((theme)=>({
|
||||
function DataTableHeader({headerGroups}) {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div>
|
||||
<div className={classes.tableContentWidth}>
|
||||
{headerGroups.map((headerGroup, hi) => (
|
||||
<div key={hi} {...headerGroup.getHeaderGroupProps()}>
|
||||
{headerGroup.headers.map((column, ci) => (
|
||||
@ -253,11 +256,12 @@ export default function DataGridView({
|
||||
Header: <> </>,
|
||||
id: 'btn-edit',
|
||||
accessor: ()=>{},
|
||||
resizable: false,
|
||||
disableResizing: true,
|
||||
sortable: false,
|
||||
dataType: 'edit',
|
||||
width: 26,
|
||||
minWidth: '0',
|
||||
minWidth: 26,
|
||||
maxWidth: 26,
|
||||
Cell: ({row})=>{
|
||||
let canEditRow = true;
|
||||
if(props.canEditRow) {
|
||||
@ -281,11 +285,12 @@ export default function DataGridView({
|
||||
Header: <> </>,
|
||||
id: 'btn-delete',
|
||||
accessor: ()=>{},
|
||||
resizable: false,
|
||||
disableResizing: true,
|
||||
sortable: false,
|
||||
dataType: 'delete',
|
||||
width: 26,
|
||||
minWidth: '0',
|
||||
minWidth: 26,
|
||||
maxWidth: 26,
|
||||
Cell: ({row}) => {
|
||||
let canDeleteRow = true;
|
||||
if(props.canDeleteRow) {
|
||||
@ -332,6 +337,8 @@ export default function DataGridView({
|
||||
sortable: true,
|
||||
...(field.minWidth ? {minWidth: field.minWidth} : {}),
|
||||
...(field.width ? {width: field.width} : {}),
|
||||
...(field.maxWidth ? {maxWidth: field.maxWidth} : {}),
|
||||
...(field.disableResizing ? {disableResizing: field.disableResizing} : {}),
|
||||
Cell: ({value, row, ...other}) => {
|
||||
/* Make sure to take the latest field info from schema */
|
||||
field = _.find(schemaRef.current.fields, (f)=>f.id==field.id) || field;
|
||||
@ -385,12 +392,10 @@ export default function DataGridView({
|
||||
}, [props.canAddRow]);
|
||||
|
||||
const defaultColumn = useMemo(()=>({
|
||||
minWidth: 175,
|
||||
width: 0,
|
||||
}), []);
|
||||
|
||||
let tablePlugins = [
|
||||
useBlockLayout,
|
||||
useFlexLayout,
|
||||
useResizeColumns,
|
||||
useSortBy,
|
||||
useExpanded,
|
||||
@ -445,7 +450,7 @@ export default function DataGridView({
|
||||
{(props.label || props.canAdd) && <DataGridHeader label={props.label} canAdd={props.canAdd} onAddClick={onAddClick} />}
|
||||
<div {...getTableProps()} className={classes.table}>
|
||||
<DataTableHeader headerGroups={headerGroups} />
|
||||
<div {...getTableBodyProps()}>
|
||||
<div {...getTableBodyProps()} className={classes.tableContentWidth}>
|
||||
{rows.map((row, i) => {
|
||||
prepareRow(row);
|
||||
return <React.Fragment key={i}>
|
||||
|
Loading…
Reference in New Issue
Block a user