UNPKG

@react-awesome-query-builder/ui

Version:
26 lines (25 loc) 1.03 kB
import _extends from "@babel/runtime/helpers/extends"; import React from "react"; import { NumericFormat, getNumberFormatProps } from "../../../../utils/numberFormat"; export default (function (props) { var value = props.value, setValue = props.setValue, readonly = props.readonly, placeholder = props.placeholder, min = props.min, max = props.max, customProps = props.customProps; var numericFormatProps = getNumberFormatProps(props); var formattedValue = value == undefined ? "" : value; //const isValid = value != undefined && (max == undefined || value <= max) && (min == undefined || value >= min); var onValueChange = function onValueChange(values) { var floatValue = values.floatValue; setValue(floatValue !== undefined ? floatValue : undefined); }; return /*#__PURE__*/React.createElement(NumericFormat, _extends({ value: formattedValue, placeholder: placeholder, disabled: readonly, onValueChange: onValueChange }, customProps, numericFormatProps)); });