Skip to content

Commit eed1619

Browse files
author
Jonas Gossens
committed
✨ Add onInput prop to personFinder
1 parent d13e983 commit eed1619

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

examples/react-chayns-personfinder/Example.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export default class PersonFinderExample extends PureComponent {
124124
parent={document.getElementById('portal-example')}
125125
boxClassName="custom-personfinder-overlay"
126126
/>
127+
<PersonFinder onInput={console.log} />
127128
<Button
128129
onClick={this.clear}
129130
>

src/react-chayns-personfinder/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Then it can be used like in the following example:
4242
| uacId | ID of the UAC-Group to search in | number | |
4343
| locationId | LocationId of the UAC-Group to search in | number | |
4444
| reducerFunction | Function to reduce the results (see example) | Function | |
45+
| onInput | Callback on input | Function | |
4546

4647
## Clear the PersonFinder
4748
If you want to clear the PersonFinder, you need to have a reference to the ReactElement:

src/react-chayns-personfinder/component/SimplePersonFinder.jsx

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default class SimplePersonFinder extends Component {
2626
}),
2727
PropTypes.string,
2828
]),
29+
onInput: PropTypes.func,
2930
};
3031

3132
static defaultProps = {
@@ -35,6 +36,7 @@ export default class SimplePersonFinder extends Component {
3536
defaultValue: null,
3637
className: null,
3738
showId: false,
39+
onInput: null,
3840
};
3941

4042
static PERSON = PERSON_RELATION;
@@ -55,10 +57,14 @@ export default class SimplePersonFinder extends Component {
5557
}
5658

5759
handleOnChange(inputValue) {
60+
const { onInput } = this.props;
5861
this.setState({
5962
inputValue,
6063
selectedValue: false,
6164
});
65+
if (onInput && typeof onInput === 'function') {
66+
onInput(inputValue);
67+
}
6268
}
6369

6470
handleSelect(type, value) {

0 commit comments

Comments
 (0)