@sheinx/hooks 3.4.6-beta.1 → 3.4.6-beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAkJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAuJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -76,6 +76,11 @@ var useNumberFormat = function useNumberFormat(props) {
76
76
  setInternalInputValue(getStringValue(val));
77
77
  if (typeof val === 'string') {
78
78
  var num = parseFloat(val);
79
+ if (val === '') {
80
+ // 如果允许空值,则返回 null,否则返回 undefined
81
+ onChange === null || onChange === void 0 || onChange(allowNull ? null : undefined);
82
+ return;
83
+ }
79
84
  if (isNaN(num)) return;
80
85
  onChange === null || onChange === void 0 || onChange(num);
81
86
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAkJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAuJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -67,6 +67,11 @@ var useNumberFormat = function useNumberFormat(props) {
67
67
  setInternalInputValue(getStringValue(val));
68
68
  if (typeof val === 'string') {
69
69
  var num = parseFloat(val);
70
+ if (val === '') {
71
+ // 如果允许空值,则返回 null,否则返回 undefined
72
+ onChange === null || onChange === void 0 || onChange(allowNull ? null : undefined);
73
+ return;
74
+ }
70
75
  if (isNaN(num)) return;
71
76
  onChange === null || onChange === void 0 || onChange(num);
72
77
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.4.6-beta.1",
3
+ "version": "3.4.6-beta.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",