Skip to content

Commit

Permalink
Fix #7599: Tree switch isLeaf to leaf (#7603)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 14, 2025
1 parent bc5b911 commit 10bda0c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/lib/passthrough/tailwind/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ const Tailwind = {
'text-blue-600 hover:bg-white/30': context.selected
},
{
invisible: context.isLeaf
invisible: context.leaf
}
)
}),
Expand Down
4 changes: 2 additions & 2 deletions components/lib/tree/TreeBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const classes = {
input: 'p-tree-filter p-inputtext p-component',
searchIcon: 'p-tree-filter-icon',
container: 'p-tree-container',
node: ({ isLeaf }) =>
node: ({ leaf }) =>
classNames('p-treenode', {
'p-treenode-leaf': isLeaf
'p-treenode-leaf': leaf
}),
content: ({ nodeProps: props, checked, selected, isCheckboxSelectionMode }) =>
classNames('p-treenode-content', {
Expand Down
6 changes: 3 additions & 3 deletions components/lib/tree/UITreeNode.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { Checkbox } from '../checkbox/Checkbox';
import { useMergeProps } from '../hooks/Hooks';
import { CheckIcon } from '../icons/check';
import { ChevronDownIcon } from '../icons/chevrondown';
import { ChevronRightIcon } from '../icons/chevronright';
import { MinusIcon } from '../icons/minus';
import { Ripple } from '../ripple/Ripple';
import { classNames, DomHandler, IconUtils, ObjectUtils } from '../utils/Utils';
import { Checkbox } from '../checkbox/Checkbox';

export const UITreeNode = React.memo((props) => {
const contentRef = React.useRef(null);
Expand All @@ -25,7 +25,7 @@ export const UITreeNode = React.memo((props) => {
selected: !isCheckboxSelectionMode() ? isSelected() : false,
expanded: expanded || false,
checked: isCheckboxSelectionMode() ? isChecked() : false,
isLeaf
leaf: isLeaf
}
});
};
Expand Down Expand Up @@ -958,7 +958,7 @@ export const UITreeNode = React.memo((props) => {
const nodeProps = mergeProps(
{
ref: elementRef,
className: classNames(props.node.className, cx('node', { isLeaf })),
className: classNames(props.node.className, cx('node', { leaf: isLeaf })),
style: props.node.style,
tabIndex,
role: 'treeitem',
Expand Down
5 changes: 5 additions & 0 deletions components/lib/tree/tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ export interface TreeContext {
* @defaultValue false
*/
checked: boolean;
/**
* Whether the node is a leaf node.
* @defaultValue false
*/
leaf: boolean;
}

/**
Expand Down

0 comments on commit 10bda0c

Please sign in to comment.