Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue 7329 #7360

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components/lib/datatable/TableFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { ColumnGroupBase } from '../columngroup/ColumnGroupBase';
import { useMergeProps } from '../hooks/Hooks';
import { RowBase } from '../row/RowBase';
import { FooterCell } from './FooterCell';
import { PrimeReactContext } from '../api/Api';

export const TableFooter = React.memo((props) => {
const { ptm, ptmo, cx } = props.ptCallbacks;
const mergeProps = useMergeProps();
const getRowProps = (row) => ColumnGroupBase.getCProps(row);
const context = React.useContext(PrimeReactContext);

const getColumnGroupProps = () => {
return props.footerColumnGroup ? ColumnGroupBase.getCProps(props.footerColumnGroup) : undefined;
Expand Down Expand Up @@ -68,6 +70,7 @@ export const TableFooter = React.memo((props) => {
{
role: 'row'
},
RowBase.getProps(row.props, context),
getRowPTOptions(row, 'root')
);

Expand Down
3 changes: 3 additions & 0 deletions components/lib/datatable/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { classNames } from '../utils/Utils';
import { ColumnFilter } from './ColumnFilter';
import { HeaderCell } from './HeaderCell';
import { HeaderCheckbox } from './HeaderCheckbox';
import { PrimeReactContext } from '../api/Api';

export const TableHeader = React.memo((props) => {
const [sortableDisabledFieldsState, setSortableDisabledFieldsState] = React.useState([]);
Expand All @@ -16,6 +17,7 @@ export const TableHeader = React.memo((props) => {
const isMultipleSort = props.sortMode === 'multiple';
const isAllSortableDisabled = isSingleSort && allSortableDisabledState;
const { ptm, ptmo, cx } = props.ptCallbacks;
const context = React.useContext(PrimeReactContext);

const getColumnProp = (column, name) => {
return ColumnBase.getCProp(column, name);
Expand Down Expand Up @@ -241,6 +243,7 @@ export const TableHeader = React.memo((props) => {
{
role: 'row'
},
RowBase.getProps(row.props, context),
getRowPTOptions(row, 'root')
);

Expand Down
4 changes: 3 additions & 1 deletion components/lib/treetable/TreeTableFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { ColumnGroupBase } from '../columngroup/ColumnGroupBase';
import { useMergeProps } from '../hooks/Hooks';
import { RowBase } from '../row/RowBase';
import { ObjectUtils } from '../utils/Utils';
import { PrimeReactContext } from '../api/Api';

export const TreeTableFooter = React.memo((props) => {
const mergeProps = useMergeProps();
const { ptm, ptmo, cx } = props.ptCallbacks;
const context = React.useContext(PrimeReactContext);

const getColumnProp = (column, name) => {
return ColumnBase.getCProp(column, name);
Expand Down Expand Up @@ -48,7 +50,7 @@ export const TreeTableFooter = React.memo((props) => {
const createFooterRow = (row, index) => {
const rowColumns = React.Children.toArray(RowBase.getCProp(row, 'children'));
const rowFooterCells = rowColumns.map(createFooterCell);
const footerRowProps = mergeProps(ptm('footerRow', { hostName: props.hostName, role: 'row' }));
const footerRowProps = mergeProps(ptm('footerRow', { hostName: props.hostName, role: 'row' }), RowBase.getProps(row.props, context));

return (
<tr {...footerRowProps} key={index}>
Expand Down
6 changes: 4 additions & 2 deletions components/lib/treetable/TreeTableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { InputText } from '../inputtext/InputText';
import { RowBase } from '../row/RowBase';
import { Tooltip } from '../tooltip/Tooltip';
import { classNames, DomHandler, IconUtils, ObjectUtils } from '../utils/Utils';
import { PrimeReactContext } from '../api/Api';

export const TreeTableHeader = React.memo((props) => {
const mergeProps = useMergeProps();
const { ptm, ptmo, cx } = props.ptCallbacks;
const filterTimeout = React.useRef(null);
const context = React.useContext(PrimeReactContext);

const getColumnProp = (column, ...args) => {
return column ? (typeof args[0] === 'string' ? ColumnBase.getCProp(column, args[0]) : ColumnBase.getCProp(args[0] || column, args[1])) : null;
Expand Down Expand Up @@ -320,7 +322,7 @@ export const TreeTableHeader = React.memo((props) => {
className: classNames(getColumnProp(column, 'headerClassName') || getColumnProp(column, 'className'), cx('headerCell', { headerProps: props, frozen, column, options, getColumnProp, sorted, align })),
style: getColumnProp(column, 'headerStyle') || getColumnProp(column, 'style'),
tabIndex: sortable ? props.tabIndex : null,
'aria-sort': ariaSort,
'aria-sort': ariaSort, //TODO: aria-sort is defined here two times (ariaSort, ariaSortData) ?
onClick: (e) => onHeaderClick(e, column),
onMouseDown: (e) => onHeaderMouseDown(e, column),
onKeyDown: (e) => onHeaderKeyDown(e, column),
Expand Down Expand Up @@ -376,7 +378,7 @@ export const TreeTableHeader = React.memo((props) => {
const createHeaderRow = (row, index) => {
const rowColumns = React.Children.toArray(RowBase.getCProp(row, 'children'));
const rowHeaderCells = rowColumns.map((col, i) => createHeaderCell(col, { index: i, filterOnly: false, renderFilter: true }));
const headerRowProps = mergeProps(ptm('headerRow', { hostName: props.hostName }));
const headerRowProps = mergeProps(ptm('headerRow', { hostName: props.hostName }), RowBase.getProps(row.props, context));

return (
<tr role="row" {...headerRowProps} key={index}>
Expand Down
Loading