import React from 'react' ; import { EuiFormRow , EuiSelect } from '@elastic/eui' ; import { FieldFormatEditor , FieldFormatEditorFactory , IndexPatternFieldEditorSetup , } from '../../../../src/plugins/data_view_field_editor/public' ; import { ExampleCurrencyFormat } from '../../common' ; const ExampleCurrencyFormatEditor = ( props ) => { return ( < EuiFormRow label = { 'Currency' } > < EuiSelect defaultValue = { props . formatParams . currency } options = { [ { text : 'EUR' , value : 'EUR' } , { text : 'USD' , value : 'USD' } , ] } onChange = { ( e ) => { props . onChange ( { currency : e . target . value , } ) ; } } /> < /EuiFormRow>); } ; ExampleCurrencyFormatEditor . formatId = ExampleCurrencyFormat . id ; const ExampleCurrencyFormatEditorFactory = async ( ) => ExampleCurrencyFormatEditor ; ExampleCurrencyFormatEditorFactory . formatId = ExampleCurrencyFormatEditor . formatId ; export function registerExampleFormatEditor ( indexPatternFieldEditor ) { indexPatternFieldEditor . fieldFormatEditors . register ( ExampleCurrencyFormatEditorFactory ) ; }