sortDirection: SortDirection.NONE,
filters: [],
key: "context-actions",
- render: this.renderContextMenuTrigger,
- width: "auto"
+ render: this.renderContextMenuTrigger
};
}
);
filters: F[];
render: (item: T) => React.ReactElement<any>;
renderHeader?: () => React.ReactElement<any>;
- width?: string;
}
export enum SortDirection {
defaultView?: React.ReactNode;
}
-type CssRules = "tableBody" | "root" | "content" | "noItemsInfo";
+type CssRules = "tableBody" | "root" | "content" | "noItemsInfo" | 'tableCell';
const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
root: {
textAlign: "center",
padding: theme.spacing.unit
},
+ tableCell: {
+ wordWrap: 'break-word'
+ }
});
type DataTableProps<T> = DataTableDataProps<T> & WithStyles<CssRules>;
renderHeadCell = (column: DataColumn<T>, index: number) => {
const { name, key, renderHeader, filters, sortDirection } = column;
const { onSortToggle, onFiltersChange } = this.props;
- return <TableCell key={key || index} style={{ width: column.width, minWidth: column.width }}>
+ return <TableCell key={key || index}>
{renderHeader ?
renderHeader() :
filters.length > 0
}
renderBodyRow = (item: T, index: number) => {
- const { onRowClick, onRowDoubleClick, extractKey } = this.props;
+ const { onRowClick, onRowDoubleClick, extractKey, classes } = this.props;
return <TableRow
hover
key={extractKey ? extractKey(item) : index}
onContextMenu={this.handleRowContextMenu(item)}
onDoubleClick={event => onRowDoubleClick && onRowDoubleClick(event, item)}>
{this.mapVisibleColumns((column, index) => (
- <TableCell key={column.key || index}>
+ <TableCell key={column.key || index} className={classes.tableCell}>
{column.render(item)}
</TableCell>
))}
{renderIcon(item)}
</Grid>
<Grid item>
- <Typography color="primary">
+ <Typography color="primary" style={{ width: '450px' }}>
{item.name}
</Typography>
</Grid>
};
export const renderDate = (date?: string) => {
- return <Typography noWrap>{formatDate(date)}</Typography>;
+ return <Typography noWrap style={{ minWidth: '100px' }}>{formatDate(date)}</Typography>;
};
export const ResourceLastModifiedDate = connect(
})((props: { date: string }) => renderDate(props.date));
export const renderFileSize = (fileSize?: number) =>
- <Typography noWrap>
+ <Typography noWrap style={{ minWidth: '45px' }}>
{formatFileSize(fileSize)}
</Typography>;
configurable: true,
sortDirection: SortDirection.ASC,
filters: [],
- render: uuid => <ResourceName uuid={uuid} />,
- width: "450px"
+ render: uuid => <ResourceName uuid={uuid} />
},
{
name: "Status",
selected: true,
configurable: true,
filters: [],
- render: uuid => <ProcessStatus uuid={uuid} />,
- width: "75px"
+ render: uuid => <ProcessStatus uuid={uuid} />
},
{
name: FavoritePanelColumnNames.TYPE,
type: ResourceKind.PROJECT
}
],
- render: uuid => <ResourceType uuid={uuid} />,
- width: "125px"
+ render: uuid => <ResourceType uuid={uuid} />
},
{
name: FavoritePanelColumnNames.OWNER,
selected: true,
configurable: true,
filters: [],
- render: uuid => <ResourceOwner uuid={uuid} />,
- width: "200px"
+ render: uuid => <ResourceOwner uuid={uuid} />
},
{
name: FavoritePanelColumnNames.FILE_SIZE,
selected: true,
configurable: true,
filters: [],
- render: uuid => <ResourceFileSize uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceFileSize uuid={uuid} />
},
{
name: FavoritePanelColumnNames.LAST_MODIFIED,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceLastModifiedDate uuid={uuid} />,
- width: "150px"
+ render: uuid => <ResourceLastModifiedDate uuid={uuid} />
}
];
configurable: true,
sortDirection: SortDirection.ASC,
filters: [],
- render: uuid => <ResourceName uuid={uuid} />,
- width: "450px"
+ render: uuid => <ResourceName uuid={uuid} />
},
{
name: "Status",
configurable: true,
filters: [],
render: uuid => <ProcessStatus uuid={uuid} />,
- width: "75px"
},
{
name: ProjectPanelColumnNames.TYPE,
type: ResourceKind.PROJECT
}
],
- render: uuid => <ResourceType uuid={uuid} />,
- width: "125px"
+ render: uuid => <ResourceType uuid={uuid} />
},
{
name: ProjectPanelColumnNames.OWNER,
selected: true,
configurable: true,
filters: [],
- render: uuid => <ResourceOwner uuid={uuid} />,
- width: "200px"
+ render: uuid => <ResourceOwner uuid={uuid} />
},
{
name: ProjectPanelColumnNames.FILE_SIZE,
selected: true,
configurable: true,
filters: [],
- render: uuid => <ResourceFileSize uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceFileSize uuid={uuid} />
},
{
name: ProjectPanelColumnNames.LAST_MODIFIED,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceLastModifiedDate uuid={uuid} />,
- width: "150px"
+ render: uuid => <ResourceLastModifiedDate uuid={uuid} />
}
];
configurable: true,
sortDirection: SortDirection.ASC,
filters: [],
- render: uuid => <ResourceName uuid={uuid} />,
- width: "450px"
+ render: uuid => <ResourceName uuid={uuid}/>
},
{
name: TrashPanelColumnNames.TYPE,
type: ResourceKind.PROJECT
}
],
- render: uuid => <ResourceType uuid={uuid} />,
- width: "125px"
+ render: uuid => <ResourceType uuid={uuid}/>,
},
{
name: TrashPanelColumnNames.FILE_SIZE,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceFileSize uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceFileSize uuid={uuid} />
},
{
name: TrashPanelColumnNames.TRASHED_DATE,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceTrashDate uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceTrashDate uuid={uuid} />
},
{
name: TrashPanelColumnNames.TO_BE_DELETED,
configurable: true,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceDeleteDate uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceDeleteDate uuid={uuid} />
},
{
name: '',
configurable: false,
sortDirection: SortDirection.NONE,
filters: [],
- render: uuid => <ResourceRestore uuid={uuid} />,
- width: "50px"
+ render: uuid => <ResourceRestore uuid={uuid}/>
}
];