assui 2.0.34 → 2.0.35

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,6 +1,8 @@
1
1
  import * as React from 'react';
2
+ import type { InputProps } from 'antd/es/input';
3
+ import Input from 'antd/es/input';
2
4
  import * as numberTypeEnum from './const/numberType';
3
- export interface NumberInputProps {
5
+ export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'> {
4
6
  /** 输入框的内容 */
5
7
  value?: string | number;
6
8
  /** 输入数据的类型 */
@@ -32,12 +34,6 @@ export interface NumberInputProps {
32
34
  /** 可以点击清除图标删除内容 */
33
35
  allowClear?: boolean;
34
36
  }
35
- declare const NumberInput: {
36
- (props: NumberInputProps): JSX.Element;
37
- defaultProps: {
38
- numberType: string;
39
- enableMinus: boolean;
40
- };
41
- numberType: typeof numberTypeEnum;
42
- };
37
+ declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<Input | null>>;
38
+ export { numberTypeEnum };
43
39
  export default NumberInput;
@@ -59,11 +59,11 @@ import Input from 'antd/es/input';
59
59
  import isUndefined from 'lodash/isUndefined';
60
60
  import * as numberTypeEnum from './const/numberType';
61
61
  import { filterInt, filterFloat } from './utils';
62
-
63
- var NumberInput = function NumberInput(props) {
62
+ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
64
63
  var value = props.value,
65
64
  onChange = props.onChange,
66
- numberType = props.numberType,
65
+ _a = props.numberType,
66
+ numberType = _a === void 0 ? numberTypeEnum.INT : _a,
67
67
  precision = props.precision,
68
68
  formatter = props.formatter,
69
69
  parser = props.parser,
@@ -72,9 +72,9 @@ var NumberInput = function NumberInput(props) {
72
72
  maxLength = props.maxLength,
73
73
  restProps = __rest(props, ["value", "onChange", "numberType", "precision", "formatter", "parser", "enableMinus", "onBlur", "maxLength"]);
74
74
 
75
- var _a = __read(React.useState(''), 2),
76
- inputValue = _a[0],
77
- setInputValue = _a[1];
75
+ var _b = __read(React.useState(''), 2),
76
+ inputValue = _b[0],
77
+ setInputValue = _b[1];
78
78
 
79
79
  var resultValue = isUndefined(value) ? inputValue : value;
80
80
 
@@ -131,16 +131,15 @@ var NumberInput = function NumberInput(props) {
131
131
  var finallyValue = formatter ? formatter("" + resultValue) : resultValue;
132
132
  return /*#__PURE__*/React.createElement(Input, __assign({
133
133
  type: "text",
134
+ ref: ref,
134
135
  value: finallyValue,
135
136
  onBlur: onNumberBlur,
136
137
  onChange: onNumberChange,
137
138
  maxLength: maxLength
138
139
  }, restProps));
139
- };
140
-
140
+ });
141
141
  NumberInput.defaultProps = {
142
- numberType: numberTypeEnum.INT,
143
142
  enableMinus: false
144
143
  };
145
- NumberInput.numberType = numberTypeEnum;
144
+ export { numberTypeEnum };
146
145
  export default NumberInput;
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
+ import type { InputProps } from 'antd/es/input';
3
+ import Input from 'antd/es/input';
2
4
  import * as numberTypeEnum from './const/numberType';
3
- export interface NumberInputProps {
5
+ export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'> {
4
6
  /** 输入框的内容 */
5
7
  value?: string | number;
6
8
  /** 输入数据的类型 */
@@ -32,12 +34,6 @@ export interface NumberInputProps {
32
34
  /** 可以点击清除图标删除内容 */
33
35
  allowClear?: boolean;
34
36
  }
35
- declare const NumberInput: {
36
- (props: NumberInputProps): JSX.Element;
37
- defaultProps: {
38
- numberType: string;
39
- enableMinus: boolean;
40
- };
41
- numberType: typeof numberTypeEnum;
42
- };
37
+ declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<Input | null>>;
38
+ export { numberTypeEnum };
43
39
  export default NumberInput;
@@ -99,6 +99,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
99
99
  Object.defineProperty(exports, "__esModule", {
100
100
  value: true
101
101
  });
102
+ exports.numberTypeEnum = void 0;
102
103
 
103
104
  var React = __importStar(require("react"));
104
105
 
@@ -108,12 +109,15 @@ var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
108
109
 
109
110
  var numberTypeEnum = __importStar(require("./const/numberType"));
110
111
 
112
+ exports.numberTypeEnum = numberTypeEnum;
113
+
111
114
  var utils_1 = require("./utils");
112
115
 
113
- var NumberInput = function NumberInput(props) {
116
+ var NumberInput = React.forwardRef(function (props, ref) {
114
117
  var value = props.value,
115
118
  onChange = props.onChange,
116
- numberType = props.numberType,
119
+ _a = props.numberType,
120
+ numberType = _a === void 0 ? numberTypeEnum.INT : _a,
117
121
  precision = props.precision,
118
122
  formatter = props.formatter,
119
123
  parser = props.parser,
@@ -122,9 +126,9 @@ var NumberInput = function NumberInput(props) {
122
126
  maxLength = props.maxLength,
123
127
  restProps = __rest(props, ["value", "onChange", "numberType", "precision", "formatter", "parser", "enableMinus", "onBlur", "maxLength"]);
124
128
 
125
- var _a = __read(React.useState(''), 2),
126
- inputValue = _a[0],
127
- setInputValue = _a[1];
129
+ var _b = __read(React.useState(''), 2),
130
+ inputValue = _b[0],
131
+ setInputValue = _b[1];
128
132
 
129
133
  var resultValue = isUndefined_1["default"](value) ? inputValue : value;
130
134
 
@@ -181,16 +185,14 @@ var NumberInput = function NumberInput(props) {
181
185
  var finallyValue = formatter ? formatter("" + resultValue) : resultValue;
182
186
  return React.createElement(input_1["default"], __assign({
183
187
  type: "text",
188
+ ref: ref,
184
189
  value: finallyValue,
185
190
  onBlur: onNumberBlur,
186
191
  onChange: onNumberChange,
187
192
  maxLength: maxLength
188
193
  }, restProps));
189
- };
190
-
194
+ });
191
195
  NumberInput.defaultProps = {
192
- numberType: numberTypeEnum.INT,
193
196
  enableMinus: false
194
197
  };
195
- NumberInput.numberType = numberTypeEnum;
196
198
  exports["default"] = NumberInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "2.0.34",
3
+ "version": "2.0.35",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -33,7 +33,7 @@
33
33
  "@ahooksjs/use-url-state": "^2.5.8",
34
34
  "@tinymce/tinymce-react": "^3.13.0",
35
35
  "@types/react-beautiful-dnd": "^13.1.2",
36
- "a-icons": "^1.0.20",
36
+ "a-icons": "^1.0.21",
37
37
  "ahooks": "^2.10.9",
38
38
  "bignumber.js": "^9.0.1",
39
39
  "copy-to-clipboard": "^3.3.1",
@@ -69,5 +69,5 @@
69
69
  "node": ">=10.0.0"
70
70
  },
71
71
  "license": "MIT",
72
- "gitHead": "f5a14525d523426cc473063c0d004a609fc53f43"
72
+ "gitHead": "6eb441eccabca51e9bd9c3c04cae5a3c5e30d8e2"
73
73
  }