1 | import getOptionLabel from './getOptionLabel';
|
2 | import { head } from './nodash';
|
3 |
|
4 | function 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 |
|
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 |
|
25 | export default getInputText; |
\ | No newline at end of file |