From 3817ed8bf4ac4059988c49cd4af28157b178786b Mon Sep 17 00:00:00 2001 From: toofff Date: Sat, 24 Mar 2018 01:58:52 +0100 Subject: [PATCH] feat: Add no matches text in parameter (#62) --- README.md | 7 +++++++ src/index.js | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e03a5c9..272fbddd 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ A lightweight and fast control to render a select component that can display hie * [onNodeToggle](#onnodetoggle) * [data](#data) * [placeholderText](#placeholdertext) + * [noMatchesText](#noMatchesText) * [keepTreeOnSearch](#keeptreeonsearch) * [simpleSelect](#simpleselect) * [Styling and Customization](#styling-and-customization) @@ -225,6 +226,12 @@ Type: `string` The text to display as placeholder on the search box. Defaults to `Choose...` +### noMatchesText + +Type: `string` + +The text to display when the search does not find results in the content list. Defaults to `No matches found` + ### keepTreeOnSearch Type: `bool` diff --git a/src/index.js b/src/index.js index c576a300..50d01c5b 100644 --- a/src/index.js +++ b/src/index.js @@ -26,7 +26,8 @@ class DropdownTreeSelect extends Component { onChange: PropTypes.func, onAction: PropTypes.func, onNodeToggle: PropTypes.func, - simpleSelect: PropTypes.bool + simpleSelect: PropTypes.bool, + noMatchesText: PropTypes.string } constructor (props) { @@ -166,7 +167,7 @@ class DropdownTreeSelect extends Component { {this.state.showDropdown && (
{this.state.allNodesHidden ? ( - No matches found + {this.props.noMatchesText || 'No matches found'} ) : (