react-custom-number
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -77,3 +77,3 @@ import React, { useRef, useState, useEffect } from 'react'; | ||
var _a = useState(''), internalValue = _a[0], setInternalValue = _a[1]; | ||
var _b = props.value, value = _b === void 0 ? '' : _b, _c = props.prefix, prefix = _c === void 0 ? '' : _c, _d = props.suffix, suffix = _d === void 0 ? '' : _d, _e = props.places, places = _e === void 0 ? 2 : _e, _f = props.decimalSeparator, decimalSeparator = _f === void 0 ? '.' : _f, _g = props.thousandsSeparator, thousandsSeparator = _g === void 0 ? ',' : _g, _h = props.thousandsGroup, thousandsGroup = _h === void 0 ? 3 : _h, onChange = props.onChange, onFocus = props.onFocus, rest = __rest(props, ["value", "prefix", "suffix", "places", "decimalSeparator", "thousandsSeparator", "thousandsGroup", "onChange", "onFocus"]); | ||
var _b = props.value, value = _b === void 0 ? '' : _b, _c = props.prefix, prefix = _c === void 0 ? '' : _c, _d = props.suffix, suffix = _d === void 0 ? '' : _d, _e = props.places, places = _e === void 0 ? 2 : _e, _f = props.decimalSeparator, decimalSeparator = _f === void 0 ? '.' : _f, _g = props.thousandsSeparator, thousandsSeparator = _g === void 0 ? ',' : _g, _h = props.thousandsGroup, thousandsGroup = _h === void 0 ? 3 : _h, onChange = props.onChange, onTextChange = props.onTextChange, onFocus = props.onFocus, rest = __rest(props, ["value", "prefix", "suffix", "places", "decimalSeparator", "thousandsSeparator", "thousandsGroup", "onChange", "onTextChange", "onFocus"]); | ||
useEffect(function () { | ||
@@ -90,5 +90,5 @@ applyFormat(); | ||
function onChangeInternal(e) { | ||
var value_with_format = e.target.value; | ||
var value_without_format = remove_format({ value: value_with_format || '0', places: places }).toString(); | ||
onChange && onChange(__assign(__assign({}, e), { target: { value: value_without_format } })); | ||
var value_without_format = remove_format({ value: e.target.value || '0', places: places }).toString(); | ||
onChange && onChange(e); | ||
onTextChange && onTextChange(value_without_format); | ||
} | ||
@@ -95,0 +95,0 @@ function applyFormat() { |
@@ -83,3 +83,3 @@ 'use strict'; | ||
var _a = React.useState(''), internalValue = _a[0], setInternalValue = _a[1]; | ||
var _b = props.value, value = _b === void 0 ? '' : _b, _c = props.prefix, prefix = _c === void 0 ? '' : _c, _d = props.suffix, suffix = _d === void 0 ? '' : _d, _e = props.places, places = _e === void 0 ? 2 : _e, _f = props.decimalSeparator, decimalSeparator = _f === void 0 ? '.' : _f, _g = props.thousandsSeparator, thousandsSeparator = _g === void 0 ? ',' : _g, _h = props.thousandsGroup, thousandsGroup = _h === void 0 ? 3 : _h, onChange = props.onChange, onFocus = props.onFocus, rest = __rest(props, ["value", "prefix", "suffix", "places", "decimalSeparator", "thousandsSeparator", "thousandsGroup", "onChange", "onFocus"]); | ||
var _b = props.value, value = _b === void 0 ? '' : _b, _c = props.prefix, prefix = _c === void 0 ? '' : _c, _d = props.suffix, suffix = _d === void 0 ? '' : _d, _e = props.places, places = _e === void 0 ? 2 : _e, _f = props.decimalSeparator, decimalSeparator = _f === void 0 ? '.' : _f, _g = props.thousandsSeparator, thousandsSeparator = _g === void 0 ? ',' : _g, _h = props.thousandsGroup, thousandsGroup = _h === void 0 ? 3 : _h, onChange = props.onChange, onTextChange = props.onTextChange, onFocus = props.onFocus, rest = __rest(props, ["value", "prefix", "suffix", "places", "decimalSeparator", "thousandsSeparator", "thousandsGroup", "onChange", "onTextChange", "onFocus"]); | ||
React.useEffect(function () { | ||
@@ -96,5 +96,5 @@ applyFormat(); | ||
function onChangeInternal(e) { | ||
var value_with_format = e.target.value; | ||
var value_without_format = remove_format({ value: value_with_format || '0', places: places }).toString(); | ||
onChange && onChange(__assign(__assign({}, e), { target: { value: value_without_format } })); | ||
var value_without_format = remove_format({ value: e.target.value || '0', places: places }).toString(); | ||
onChange && onChange(e); | ||
onTextChange && onTextChange(value_without_format); | ||
} | ||
@@ -101,0 +101,0 @@ function applyFormat() { |
{ | ||
"name": "react-custom-number", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "module": "build/index.esm.js", |
14211