1+ var _this = this ;
2+
3+ function _objectWithoutProperties ( obj , keys ) { var target = { } ; for ( var i in obj ) { if ( keys . indexOf ( i ) >= 0 ) continue ; if ( ! Object . prototype . hasOwnProperty . call ( obj , i ) ) continue ; target [ i ] = obj [ i ] ; } return target ; }
4+
5+ import * as React from 'react' ;
6+ import { FormGroup , Input , Label } from "reactstrap" ;
7+
8+ var handleBlur = function handleBlur ( event ) {
9+ if ( _this . ignoreNextBlur === true ) {
10+ // The parent components are relying on the bubbling of the event.
11+ event . stopPropagation ( ) ;
12+ _this . ignoreNextBlur = false ;
13+ event . target . name = _this . props . name ;
14+ return ;
15+ }
16+ } ;
17+
18+ var ReactstrapSelectInput = function ReactstrapSelectInput ( _ref ) {
19+ var field = _ref . field ,
20+ _ref$form = _ref . form ,
21+ isSubmitting = _ref$form . isSubmitting ,
22+ touched = _ref$form . touched ,
23+ errors = _ref$form . errors ,
24+ _ref$disabled = _ref . disabled ,
25+ disabled = _ref$disabled === undefined ? false : _ref$disabled ,
26+ props = _objectWithoutProperties ( _ref , [ "field" , "form" , "disabled" ] ) ;
27+
28+ var error = errors [ field . name ] ;
29+ var touch = touched [ field . name ] ;
30+ return React . createElement (
31+ FormGroup ,
32+ null ,
33+ React . createElement (
34+ Label ,
35+ { "for" : field . name , className : "label-color" } ,
36+ props . inputprops . label
37+ ) ,
38+ React . createElement (
39+ Input ,
40+ Object . assign ( { } , field , props , { type : "select" , invalid : Boolean ( touched [ field . name ] && errors [ field . name ] ) ,
41+ onBlur : handleBlur ( ) , placeholder : "Test" } ) ,
42+ React . createElement (
43+ "option" ,
44+ { value : "" } ,
45+ props . inputprops . label
46+ ) ,
47+ props . inputprops . options . map ( function ( option , index ) {
48+ if ( option . name ) return React . createElement (
49+ "option" ,
50+ { value : option . id , key : index } ,
51+ option . name
52+ ) ;
53+ return React . createElement (
54+ "option" ,
55+ { value : option , key : index } ,
56+ option
57+ ) ;
58+ } )
59+ ) ,
60+ touch && error && React . createElement (
61+ "p" ,
62+ null ,
63+ error
64+ )
65+ ) ;
66+ } ;
67+
68+ export default ReactstrapSelectInput ;
0 commit comments