@hi-ui/input 4.1.1 → 4.2.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @hi-ui/input
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3024](https://github.com/XiaoMi/hiui/pull/3024) [`4baa3bda2`](https://github.com/XiaoMi/hiui/commit/4baa3bda267233c45d15717bc8765587901447b3) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(input): 修复 type="X" 时最后一位无法输入 X 的问题 (#3023)
8
+ chore(input): type 类型中增加 number 类型
9
+
10
+ ## 4.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [#2954](https://github.com/XiaoMi/hiui/pull/2954) [`8e4eedb`](https://github.com/XiaoMi/hiui/commit/8e4eedb1bb08ef07258adec3ebdb303fbb100311) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: MockInput 没有匹配到值时默认展示 value 值
15
+
3
16
  ## 4.1.1
4
17
 
5
18
  ### Patch Changes
@@ -75,7 +75,10 @@ var MockInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
75
75
  if (value === '') return null;
76
76
  var displayItem = data.find(function (item) {
77
77
  return item.id === value;
78
- });
78
+ }) || {
79
+ id: value,
80
+ title: value
81
+ };
79
82
  return displayItem || null;
80
83
  }, [value, data]);
81
84
  var displayValue = React.useMemo(function () {
@@ -31,6 +31,9 @@ var formatId = function formatId(val) {
31
31
  }
32
32
  };
33
33
  var pureId = function pureId(val) {
34
+ if (/\d{6}\s\d{4}\s\d{4}\s\d{3}X/g.test(val)) {
35
+ return val;
36
+ }
34
37
  var tmp = val.replace(/[^\d|.]/g, '');
35
38
  return tmp.slice(0, 18);
36
39
  };
@@ -63,7 +63,10 @@ var MockInput = /*#__PURE__*/forwardRef(function (_a, ref) {
63
63
  if (value === '') return null;
64
64
  var displayItem = data.find(function (item) {
65
65
  return item.id === value;
66
- });
66
+ }) || {
67
+ id: value,
68
+ title: value
69
+ };
67
70
  return displayItem || null;
68
71
  }, [value, data]);
69
72
  var displayValue = useMemo(function () {
@@ -25,6 +25,9 @@ var formatId = function formatId(val) {
25
25
  }
26
26
  };
27
27
  var pureId = function pureId(val) {
28
+ if (/\d{6}\s\d{4}\s\d{4}\s\d{3}X/g.test(val)) {
29
+ return val;
30
+ }
28
31
  var tmp = val.replace(/[^\d|.]/g, '');
29
32
  return tmp.slice(0, 18);
30
33
  };
@@ -1,3 +1,3 @@
1
1
  import { HiBaseAppearanceEnum } from '@hi-ui/core';
2
2
  export declare type InputAppearanceEnum = HiBaseAppearanceEnum | 'underline';
3
- export declare type InputTypeEnum = 'text' | 'id' | 'tel' | 'card' | 'amount' | 'email' | 'password';
3
+ export declare type InputTypeEnum = 'text' | 'id' | 'tel' | 'card' | 'amount' | 'email' | 'password' | 'number';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/input",
3
- "version": "4.1.1",
3
+ "version": "4.2.1",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",