@sheinx/hooks 3.5.7-beta.5 → 3.5.7-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-input-format.d.ts","sourceRoot":"","sources":["use-input-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,QAAA,MAAM,cAAc,UAAW,gBAAgB;kBAsBP,MAAM,GAAG,SAAS;
|
1
|
+
{"version":3,"file":"use-input-format.d.ts","sourceRoot":"","sources":["use-input-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,QAAA,MAAM,cAAc,UAAW,gBAAgB;kBAsBP,MAAM,GAAG,SAAS;gBAoCpB,gBAAgB;iBAgDd,gBAAgB;;;CAyBvD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -28,7 +28,7 @@ var useInputFormat = function useInputFormat(props) {
|
|
28
28
|
autoFix = props.autoFix,
|
29
29
|
coin = props.coin,
|
30
30
|
cancelBlurChange = props.cancelBlurChange;
|
31
|
-
var _React$useState = _react.default.useState(
|
31
|
+
var _React$useState = _react.default.useState(coin),
|
32
32
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
33
33
|
showCoin = _React$useState2[0],
|
34
34
|
setShowCoin = _React$useState2[1];
|
@@ -55,6 +55,13 @@ var useInputFormat = function useInputFormat(props) {
|
|
55
55
|
var noNeg = numType === 'non-negative' || numType === 'positive';
|
56
56
|
var regExp = new RegExp("^(".concat(noNeg ? '' : '-', ")?(\\d").concat(regLength(integerLimit), ")(").concat(digits !== 0 ? "\\.\\d".concat(regLength(digits)) : '', ")?.*$"), 'g');
|
57
57
|
value = value.replace(regExp, '$1$2$3');
|
58
|
+
|
59
|
+
// 修正小数位数
|
60
|
+
var _value = v.split('.');
|
61
|
+
var __value = value.split('.');
|
62
|
+
if (_value[1] !== undefined && __value[1] === undefined) {
|
63
|
+
value = "".concat(value, ".").concat(_value[1]);
|
64
|
+
}
|
58
65
|
}
|
59
66
|
onChange(value);
|
60
67
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-input-format.d.ts","sourceRoot":"","sources":["use-input-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,QAAA,MAAM,cAAc,UAAW,gBAAgB;kBAsBP,MAAM,GAAG,SAAS;
|
1
|
+
{"version":3,"file":"use-input-format.d.ts","sourceRoot":"","sources":["use-input-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,QAAA,MAAM,cAAc,UAAW,gBAAgB;kBAsBP,MAAM,GAAG,SAAS;gBAoCpB,gBAAgB;iBAgDd,gBAAgB;;;CAyBvD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -21,7 +21,7 @@ var useInputFormat = function useInputFormat(props) {
|
|
21
21
|
autoFix = props.autoFix,
|
22
22
|
coin = props.coin,
|
23
23
|
cancelBlurChange = props.cancelBlurChange;
|
24
|
-
var _React$useState = React.useState(
|
24
|
+
var _React$useState = React.useState(coin),
|
25
25
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
26
26
|
showCoin = _React$useState2[0],
|
27
27
|
setShowCoin = _React$useState2[1];
|
@@ -48,6 +48,13 @@ var useInputFormat = function useInputFormat(props) {
|
|
48
48
|
var noNeg = numType === 'non-negative' || numType === 'positive';
|
49
49
|
var regExp = new RegExp("^(".concat(noNeg ? '' : '-', ")?(\\d").concat(regLength(integerLimit), ")(").concat(digits !== 0 ? "\\.\\d".concat(regLength(digits)) : '', ")?.*$"), 'g');
|
50
50
|
value = value.replace(regExp, '$1$2$3');
|
51
|
+
|
52
|
+
// 修正小数位数
|
53
|
+
var _value = v.split('.');
|
54
|
+
var __value = value.split('.');
|
55
|
+
if (_value[1] !== undefined && __value[1] === undefined) {
|
56
|
+
value = "".concat(value, ".").concat(_value[1]);
|
57
|
+
}
|
51
58
|
}
|
52
59
|
onChange(value);
|
53
60
|
});
|