Skip to content

Commit

Permalink
Fix #5597: TreeTable body align (#5598)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Dec 13, 2023
1 parent 7ceda37 commit a82ba1e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions components/lib/treetable/TreeTableBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,11 @@ const classes = {
tbody: 'p-treetable-tbody',
tfoot: 'p-treetable-tfoot',
emptyMessage: 'p-treetable-emptymessage',
bodyCell: ({ bodyProps: props, editingState }) =>
bodyCell: ({ bodyProps: props, editingState, align }) =>
classNames({
'p-editable-column': props.editor,
'p-cell-editing': props.editor ? editingState : false
'p-cell-editing': props.editor ? editingState : false,
[`p-align-${align}`]: !!align
}),
sortBadge: 'p-sortable-column-badge',
headerTitle: 'p-column-title',
Expand Down
3 changes: 2 additions & 1 deletion components/lib/treetable/TreeTableBodyCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ export const TreeTableBodyCell = (props) => {
<span {...editorKeyHelperLabelProps}></span>
</a>
);
const align = getColumnProp('align');
/* eslint-enable */
const bodyCellProps = mergeProps(
{
className: classNames(bodyClassName || props.className, cx('bodyCell', { bodyProps: props, editingState })),
className: classNames(bodyClassName || props.className, cx('bodyCell', { bodyProps: props, editingState, align })),
style,
onClick: (e) => onClick(e),
onKeyDown: (e) => onKeyDown(e)
Expand Down
2 changes: 1 addition & 1 deletion components/lib/treetable/TreeTableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const TreeTableHeader = React.memo((props) => {
const multipleSorted = multiSortMetaData !== null;
const sorted = getColumnProp(column, 'sortable') && (singleSorted || multipleSorted);
const frozen = getColumnProp(column, 'frozen');
const align = getColumnProp(column, 'alignHeader') || getColumnProp(column, 'align');
const align = getColumnProp(column, 'alignHeader');
let sortOrder = 0;

if (singleSorted) sortOrder = props.sortOrder;
Expand Down

0 comments on commit a82ba1e

Please sign in to comment.