import React, { useState } from 'react';
import { Box} from '@material-ui/core';
import {InputSelect, FormInput} from './FormComponents';
import PropTypes from 'prop-types';
import CustomPropTypes from '../custom_prop_types';
import RefreshIcon from '@material-ui/icons/Refresh';
import { PgIconButton } from './Buttons';
function ChildContent({cid, helpid, onRefreshClick, label, ...props}) {
return
} title={label||''}/>
;
}
ChildContent.propTypes = {
cid: PropTypes.string,
helpid: PropTypes.string,
onRefreshClick: PropTypes.func,
label: PropTypes.string,
};
export function SelectRefresh({ required, className, label, helpMessage, testcid, controlProps, ...props }){
const [options, setOptions] = useState([]);
const [optionsReloadBasis, setOptionsReloadBasis] = useState(false);
const {getOptionsOnRefresh, ...selectControlProps} = controlProps;
const onRefreshClick = ()=>{
getOptionsOnRefresh && getOptionsOnRefresh()
.then((res)=>{
setOptions(res);
setOptionsReloadBasis((prevVal)=>!prevVal);
});
};
return (
);
}
SelectRefresh.propTypes = {
required: PropTypes.bool,
label: PropTypes.string,
className: CustomPropTypes.className,
helpMessage: PropTypes.string,
testcid: PropTypes.string,
controlProps: PropTypes.object,
};