import React from 'react';
import Popup from './popup';
/**
* A component that displays a control in a bootstrap form with a drop down button to display
* a popup content. Both control content and popup can be (shall be) customized.
*
* Used as base to many popup controls
*/
export default class PopupControl extends React.Component {
constructor(props) {
super(props);
this.btnKeyPress = this.btnKeyPress.bind(this);
this.controlClick = this.controlClick.bind(this);
// initialize an empty list of values
this.state = { };
}
preventHide() {
if (this.refs.popup) {
this.refs.popup.preventHide();
}
}
/**
* Return the rendered component for the label
* @return {React.Component} The label component, or null if there is no label
*/
labelRender() {
const label = this.props.label;
return label ? : null;
}
/**
* Create the popup component to be displayed based on the options
* @return {React.Component} Popup component, or null if no option is found
*/
createPopup() {
const content = this.props.popupContent;
return content ?