import React from 'react' ; import { EuiRange , EuiFormRow } from '@elastic/eui' ; import { i18n } from '@osd/i18n' ; import { IUiSettingsClient } from '../../../../../core/public' ; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public' ; import { AggParamEditorProps } from '../agg_param_props' ; function PrecisionParamEditor ( { agg , value , setValue } ) { const { services } = useOpenSearchDashboards < { uiSettings : IUiSettingsClient ; } > ( ) ; const label = i18n . translate ( 'visDefaultEditor.controls.precisionLabel' , { defaultMessage : 'Precision' , } ) ; if ( agg . params . autoPrecision ) { return null ; } return ( < EuiFormRow label = { label } compressed > < EuiRange min = { 1 } max = { services . uiSettings . get ( 'visualization:tileMap:maxPrecision' ) } value = { value || '' } onChange = { ( ev ) => setValue ( Number ( ev . currentTarget . value ) ) } data - test - subj = { `visEditorMapPrecision${ agg . id }` } showValue compressed / > < /EuiFormRow>); } export { PrecisionParamEditor } ;