import React, { ChangeEvent, FocusEvent, PureComponent } from 'react'; import { CustomVariableModel, VariableWithMultiSupport } from '../types'; import { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor'; import { OnPropChangeArguments, VariableEditorProps } from '../editor/types'; import { connectWithStore } from 'app/core/utils/connectWithReduxStore'; import { MapDispatchToProps, MapStateToProps } from 'react-redux'; import { StoreState } from 'app/types'; import { changeVariableMultiValue } from '../state/actions'; interface OwnProps extends VariableEditorProps {} interface ConnectedProps {} interface DispatchProps { changeVariableMultiValue: typeof changeVariableMultiValue; } export type Props = OwnProps & ConnectedProps & DispatchProps; class CustomVariableEditorUnconnected extends PureComponent { onChange = (event: ChangeEvent) => { this.props.onPropChange({ propName: 'query', propValue: event.target.value, }); }; onSelectionOptionsChange = async ({ propName, propValue }: OnPropChangeArguments) => { this.props.onPropChange({ propName, propValue, updateOptions: true }); }; onBlur = (event: FocusEvent) => { this.props.onPropChange({ propName: 'query', propValue: event.target.value, updateOptions: true, }); }; render() { return ( <>
Custom Options
Values separated by comma
); } } const mapStateToProps: MapStateToProps = (state, ownProps) => ({}); const mapDispatchToProps: MapDispatchToProps = { changeVariableMultiValue, }; export const CustomVariableEditor = connectWithStore( CustomVariableEditorUnconnected, mapStateToProps, mapDispatchToProps );