@@ -299,6 +299,7 @@ export const RFFCFormSelect = ({
299
299
className = 'mb-3' ,
300
300
validate,
301
301
disabled = false ,
302
+ props,
302
303
} ) => {
303
304
// handler for ignoring the first element ('the placeholder')
304
305
const selectValidate = ( value , allValues , meta ) => {
@@ -320,10 +321,11 @@ export const RFFCFormSelect = ({
320
321
valid = { ! meta . error && meta . touched }
321
322
invalid = { meta . error && meta . touched }
322
323
disabled = { disabled }
324
+ { ...props }
323
325
>
324
326
< option value = { placeholder } > { placeholder } </ option >
325
- { values . map ( ( { label, value } , idx ) => (
326
- < option key = { `${ idx } -${ value } ` } value = { value } >
327
+ { values . map ( ( { label, value, ... props } , idx ) => (
328
+ < option key = { `${ idx } -${ value } ` } value = { value } { ... props } >
327
329
{ label }
328
330
</ option >
329
331
) ) }
@@ -383,11 +385,14 @@ export const RFFSelectSearch = ({
383
385
disabled = false ,
384
386
retainInput = true ,
385
387
isLoading = false ,
388
+ refreshFunction,
389
+ props,
386
390
} ) => {
387
391
const [ inputText , setInputText ] = useState ( '' )
388
392
const selectSearchvalues = values . map ( ( val ) => ( {
389
393
value : val . value ,
390
394
label : val . name ,
395
+ ...val . props ,
391
396
} ) )
392
397
393
398
const debounceOnInputChange = useMemo ( ( ) => {
@@ -410,7 +415,16 @@ export const RFFSelectSearch = ({
410
415
{ ( { meta, input } ) => {
411
416
return (
412
417
< div >
413
- < CFormLabel htmlFor = { name } > { label } </ CFormLabel >
418
+ < CFormLabel htmlFor = { name } >
419
+ { label }
420
+ { refreshFunction && (
421
+ < CTooltip content = "Refresh" placement = "right" >
422
+ < CButton onClick = { refreshFunction } variant = "ghost" className = "ms-1" size = "sm" >
423
+ < FontAwesomeIcon icon = "sync" />
424
+ </ CButton >
425
+ </ CTooltip >
426
+ ) }
427
+ </ CFormLabel >
414
428
{ onChange && (
415
429
< Select
416
430
className = "react-select-container"
@@ -427,6 +441,7 @@ export const RFFSelectSearch = ({
427
441
onInputChange = { debounceOnInputChange }
428
442
inputValue = { inputText }
429
443
isLoading = { isLoading }
444
+ { ...props }
430
445
/>
431
446
) }
432
447
{ ! onChange && (
@@ -444,6 +459,7 @@ export const RFFSelectSearch = ({
444
459
isMulti = { multi }
445
460
inputValue = { inputText }
446
461
isLoading = { isLoading }
462
+ { ...props }
447
463
/>
448
464
) }
449
465
{ meta . error && meta . touched && < span className = "text-danger" > { meta . error } </ span > }
@@ -460,6 +476,7 @@ RFFSelectSearch.propTypes = {
460
476
placeholder : PropTypes . string ,
461
477
onInputChange : PropTypes . func ,
462
478
isLoading : PropTypes . bool ,
479
+ refreshFunction : PropTypes . func ,
463
480
values : PropTypes . arrayOf ( PropTypes . shape ( { value : PropTypes . string , name : PropTypes . string } ) )
464
481
. isRequired ,
465
482
}
0 commit comments