UNPKG

609 BJavaScriptView Raw
1import getOptionLabel from './getOptionLabel';
2import { head } from './nodash';
3
4function getInputText(props) {
5 var activeItem = props.activeItem,
6 labelKey = props.labelKey,
7 multiple = props.multiple,
8 selected = props.selected,
9 text = props.text;
10
11 if (activeItem) {
12 // Display the input value if the pagination item is active.
13 return getOptionLabel(activeItem, labelKey);
14 }
15
16 var selectedItem = !multiple && !!selected.length && head(selected);
17
18 if (selectedItem) {
19 return getOptionLabel(selectedItem, labelKey);
20 }
21
22 return text;
23}
24
25export default getInputText;
\No newline at end of file