Skip to content

Commit

Permalink
Fix #5950: Tree emptyFilterMessage (#5953)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Feb 13, 2024
1 parent a17d55b commit 1c93879
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
4 changes: 3 additions & 1 deletion components/lib/tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,11 @@ export const Tree = React.memo(
ptm('emptyMessage')
);

const message = ObjectUtils.getJSXElement(props.emptyMessage, props) || localeOption('emptyMessage');

return (
<li {...emptyMessageProps}>
<span className="p-treenode-content">{localeOption('emptyMessage')}</span>
<span className="p-treenode-content">{message}</span>
</li>
);
};
Expand Down
60 changes: 30 additions & 30 deletions components/lib/tree/TreeBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,53 +116,53 @@ export const TreeBase = ComponentBase.extend({
__parentMetadata: null,
id: null,
value: null,
checkboxIcon: null,
disabled: false,
emptyMessage: null,
selectionMode: null,
selectionKeys: null,
onSelectionChange: null,
contextMenuSelectionKey: null,
onContextMenuSelectionChange: null,
expandedKeys: null,
ariaLabel: null,
ariaLabelledBy: null,
style: null,
checkboxIcon: null,
className: null,
contentStyle: null,
contentClassName: null,
metaKeySelection: true,
propagateSelectionUp: true,
propagateSelectionDown: true,
loading: false,
loadingIcon: null,
expandIcon: null,
collapseIcon: null,
contentClassName: null,
contentStyle: null,
contextMenuSelectionKey: null,
disabled: false,
dragdropScope: null,
header: null,
footer: null,
showHeader: true,
emptyMessage: null,
expandIcon: null,
expandedKeys: null,
filter: false,
filterIcon: null,
filterValue: null,
filterBy: 'label',
filterIcon: null,
filterLocale: undefined,
filterMode: 'lenient',
filterPlaceholder: null,
filterLocale: undefined,
filterTemplate: null,
filterValue: null,
footer: null,
header: null,
level: 0,
loading: false,
loadingIcon: null,
metaKeySelection: true,
nodeTemplate: null,
togglerTemplate: null,
onSelect: null,
onUnselect: null,
onExpand: null,
onCollapse: null,
onToggle: null,
onDragDrop: null,
onContextMenu: null,
onContextMenuSelectionChange: null,
onDragDrop: null,
onExpand: null,
onFilterValueChange: null,
onNodeClick: null,
onNodeDoubleClick: null,
onSelect: null,
onSelectionChange: null,
onToggle: null,
onUnselect: null,
propagateSelectionDown: true,
propagateSelectionUp: true,
selectionKeys: null,
selectionMode: null,
showHeader: true,
style: null,
togglerTemplate: null,
children: undefined
},
css: {
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 @@ -573,6 +573,11 @@ export interface TreeProps {
* @defaultValue undefined
*/
filterLocale?: string | undefined;
/**
* Template to display when filtering does not return any results.
* @defaultValue No results found
*/
emptyMessage?: React.ReactNode | ((props: TreeProps) => React.ReactNode) | undefined;
/**
* Defines a string value that labels an interactive element.
*/
Expand Down

0 comments on commit 1c93879

Please sign in to comment.