assui 2.0.41 → 2.0.45
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/es/highlight-textarea/index.d.ts +1 -1
- package/es/number-input/const/dataTypeEnum.d.ts +3 -5
- package/es/number-input/const/dataTypeEnum.js +3 -8
- package/es/number-input/const/numberType.d.ts +2 -2
- package/es/number-input/index.d.ts +2 -2
- package/es/number-input/index.js +8 -20
- package/lib/highlight-textarea/index.d.ts +1 -1
- package/lib/number-input/const/dataTypeEnum.d.ts +3 -5
- package/lib/number-input/const/dataTypeEnum.js +5 -8
- package/lib/number-input/const/numberType.d.ts +2 -2
- package/lib/number-input/index.d.ts +2 -2
- package/lib/number-input/index.js +9 -22
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { HighlighedContentsProps } from './HighlighedContents';
|
|
3
3
|
import type { HighlightType } from './types';
|
|
4
|
-
export interface HighlightTextareaProps extends HighlighedContentsProps {
|
|
4
|
+
export interface HighlightTextareaProps extends HighlighedContentsProps, Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onChange' | 'onScroll' | 'style'> {
|
|
5
5
|
prefixCls?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
textAreaClassName?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const INT
|
|
2
|
-
export declare const FLOAT
|
|
1
|
+
export declare const INT: "int";
|
|
2
|
+
export declare const FLOAT: "float";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { InputProps } from 'antd/es/input';
|
|
3
|
-
import dataTypeEnum from './const/dataTypeEnum';
|
|
3
|
+
import * as dataTypeEnum from './const/dataTypeEnum';
|
|
4
4
|
import * as numberTypeEnum from './const/numberType';
|
|
5
5
|
export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'> {
|
|
6
6
|
/** 输入框的内容 */
|
|
@@ -8,7 +8,7 @@ export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'
|
|
|
8
8
|
/** 输入数据的类型 */
|
|
9
9
|
numberType?: 'int' | 'float';
|
|
10
10
|
/** value的数据类型 */
|
|
11
|
-
dataType?:
|
|
11
|
+
dataType?: 'number' | 'string';
|
|
12
12
|
/** 精度,只对float有效 */
|
|
13
13
|
precision?: number;
|
|
14
14
|
/** 同html input属性功能 */
|
package/es/number-input/index.js
CHANGED
|
@@ -57,8 +57,7 @@ var __read = this && this.__read || function (o, n) {
|
|
|
57
57
|
import * as React from 'react';
|
|
58
58
|
import Input from 'antd/es/input';
|
|
59
59
|
import isUndefined from 'lodash/isUndefined';
|
|
60
|
-
import
|
|
61
|
-
import dataTypeEnum from './const/dataTypeEnum';
|
|
60
|
+
import * as dataTypeEnum from './const/dataTypeEnum';
|
|
62
61
|
import * as numberTypeEnum from './const/numberType';
|
|
63
62
|
import { filterInt, filterFloat } from './utils';
|
|
64
63
|
var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -67,7 +66,7 @@ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
67
66
|
_a = props.numberType,
|
|
68
67
|
numberType = _a === void 0 ? numberTypeEnum.INT : _a,
|
|
69
68
|
_b = props.dataType,
|
|
70
|
-
dataType = _b === void 0 ? dataTypeEnum.
|
|
69
|
+
dataType = _b === void 0 ? dataTypeEnum.NUMBER : _b,
|
|
71
70
|
precision = props.precision,
|
|
72
71
|
formatter = props.formatter,
|
|
73
72
|
parser = props.parser,
|
|
@@ -111,20 +110,7 @@ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
if (onChange) {
|
|
114
|
-
|
|
115
|
-
if (newNumber === '') {
|
|
116
|
-
onChange(newNumber);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (numberType === numberTypeEnum.INT) {
|
|
121
|
-
onChange(+newNumber);
|
|
122
|
-
} else {
|
|
123
|
-
endsWith(newNumber, '.') || endsWith(newNumber, '.0') ? onChange(newNumber) : onChange(+newNumber);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
onChange(newNumber);
|
|
127
|
-
}
|
|
113
|
+
onChange(newNumber);
|
|
128
114
|
}
|
|
129
115
|
}
|
|
130
116
|
};
|
|
@@ -140,9 +126,11 @@ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
140
126
|
}
|
|
141
127
|
}
|
|
142
128
|
|
|
143
|
-
if (dataType === dataTypeEnum.
|
|
144
|
-
if (numberType === numberTypeEnum.FLOAT
|
|
145
|
-
onChange(+resultValue);
|
|
129
|
+
if (dataType === dataTypeEnum.NUMBER && resultValue) {
|
|
130
|
+
if (numberType === numberTypeEnum.FLOAT) {
|
|
131
|
+
onChange && onChange(+resultValue);
|
|
132
|
+
} else {
|
|
133
|
+
onChange && onChange(parseInt("" + resultValue, 10));
|
|
146
134
|
}
|
|
147
135
|
}
|
|
148
136
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { HighlighedContentsProps } from './HighlighedContents';
|
|
3
3
|
import type { HighlightType } from './types';
|
|
4
|
-
export interface HighlightTextareaProps extends HighlighedContentsProps {
|
|
4
|
+
export interface HighlightTextareaProps extends HighlighedContentsProps, Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onChange' | 'onScroll' | 'style'> {
|
|
5
5
|
prefixCls?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
textAreaClassName?: string;
|
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})(dataType || (dataType = {}));
|
|
12
|
-
|
|
13
|
-
exports["default"] = dataType;
|
|
6
|
+
exports.STRING = exports.NUMBER = void 0;
|
|
7
|
+
var NUMBER = 'number';
|
|
8
|
+
exports.NUMBER = NUMBER;
|
|
9
|
+
var STRING = 'string';
|
|
10
|
+
exports.STRING = STRING;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const INT
|
|
2
|
-
export declare const FLOAT
|
|
1
|
+
export declare const INT: "int";
|
|
2
|
+
export declare const FLOAT: "float";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { InputProps } from 'antd/es/input';
|
|
3
|
-
import dataTypeEnum from './const/dataTypeEnum';
|
|
3
|
+
import * as dataTypeEnum from './const/dataTypeEnum';
|
|
4
4
|
import * as numberTypeEnum from './const/numberType';
|
|
5
5
|
export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'> {
|
|
6
6
|
/** 输入框的内容 */
|
|
@@ -8,7 +8,7 @@ export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'
|
|
|
8
8
|
/** 输入数据的类型 */
|
|
9
9
|
numberType?: 'int' | 'float';
|
|
10
10
|
/** value的数据类型 */
|
|
11
|
-
dataType?:
|
|
11
|
+
dataType?: 'number' | 'string';
|
|
12
12
|
/** 精度,只对float有效 */
|
|
13
13
|
precision?: number;
|
|
14
14
|
/** 同html input属性功能 */
|
|
@@ -107,11 +107,9 @@ var input_1 = __importDefault(require("antd/es/input"));
|
|
|
107
107
|
|
|
108
108
|
var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
|
|
109
109
|
|
|
110
|
-
var
|
|
110
|
+
var dataTypeEnum = __importStar(require("./const/dataTypeEnum"));
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
exports.dataTypeEnum = dataTypeEnum_1["default"];
|
|
112
|
+
exports.dataTypeEnum = dataTypeEnum;
|
|
115
113
|
|
|
116
114
|
var numberTypeEnum = __importStar(require("./const/numberType"));
|
|
117
115
|
|
|
@@ -125,7 +123,7 @@ var NumberInput = React.forwardRef(function (props, ref) {
|
|
|
125
123
|
_a = props.numberType,
|
|
126
124
|
numberType = _a === void 0 ? numberTypeEnum.INT : _a,
|
|
127
125
|
_b = props.dataType,
|
|
128
|
-
dataType = _b === void 0 ?
|
|
126
|
+
dataType = _b === void 0 ? dataTypeEnum.NUMBER : _b,
|
|
129
127
|
precision = props.precision,
|
|
130
128
|
formatter = props.formatter,
|
|
131
129
|
parser = props.parser,
|
|
@@ -169,20 +167,7 @@ var NumberInput = React.forwardRef(function (props, ref) {
|
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
if (onChange) {
|
|
172
|
-
|
|
173
|
-
if (newNumber === '') {
|
|
174
|
-
onChange(newNumber);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (numberType === numberTypeEnum.INT) {
|
|
179
|
-
onChange(+newNumber);
|
|
180
|
-
} else {
|
|
181
|
-
endsWith_1["default"](newNumber, '.') || endsWith_1["default"](newNumber, '.0') ? onChange(newNumber) : onChange(+newNumber);
|
|
182
|
-
}
|
|
183
|
-
} else {
|
|
184
|
-
onChange(newNumber);
|
|
185
|
-
}
|
|
170
|
+
onChange(newNumber);
|
|
186
171
|
}
|
|
187
172
|
}
|
|
188
173
|
};
|
|
@@ -198,9 +183,11 @@ var NumberInput = React.forwardRef(function (props, ref) {
|
|
|
198
183
|
}
|
|
199
184
|
}
|
|
200
185
|
|
|
201
|
-
if (dataType ===
|
|
202
|
-
if (numberType === numberTypeEnum.FLOAT
|
|
203
|
-
onChange(+resultValue);
|
|
186
|
+
if (dataType === dataTypeEnum.NUMBER && resultValue) {
|
|
187
|
+
if (numberType === numberTypeEnum.FLOAT) {
|
|
188
|
+
onChange && onChange(+resultValue);
|
|
189
|
+
} else {
|
|
190
|
+
onChange && onChange(parseInt("" + resultValue, 10));
|
|
204
191
|
}
|
|
205
192
|
}
|
|
206
193
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.45",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"node": ">=10.0.0"
|
|
70
70
|
},
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "dcf4e99cc0a9759aa5567b2114c0ae8d780d9d4f"
|
|
73
73
|
}
|