@autobest-ui/components 2.9.2-alpha.0 → 2.10.0-alpha.0
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/esm/affix/index.d.ts +3 -3
- package/esm/affix/index.js +2 -2
- package/esm/carousel/index.d.ts +2 -2
- package/esm/carousel/index.js +1 -1
- package/esm/checkbox/CheckboxGroup.d.ts +1 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -1
- package/esm/input-number/getParserOriginalValue.d.ts +26 -0
- package/esm/input-number/getParserOriginalValue.js +73 -0
- package/esm/input-number/index.d.ts +20 -7
- package/esm/input-number/index.js +57 -48
- package/esm/loading-icon/index.d.ts +1 -2
- package/esm/loading-icon/index.js +2 -4
- package/esm/modal/index.d.ts +3 -3
- package/esm/modal/index.js +2 -2
- package/esm/move/index.d.ts +6 -6
- package/esm/move/index.js +5 -5
- package/esm/popover/index.d.ts +1 -1
- package/esm/popover/index.js +7 -2
- package/esm/radio/Radio.d.ts +4 -0
- package/esm/radio/Radio.js +80 -0
- package/esm/radio/RadioGroup.d.ts +16 -0
- package/esm/radio/RadioGroup.js +106 -0
- package/esm/radio/context.d.ts +5 -0
- package/esm/radio/context.js +4 -0
- package/esm/radio/index.d.ts +3 -0
- package/esm/radio/index.js +2 -0
- package/esm/radio/interface.d.ts +17 -0
- package/esm/radio/interface.js +1 -0
- package/esm/radio/style/index.css +1 -0
- package/esm/select/index.d.ts +2 -2
- package/esm/select/index.js +1 -1
- package/esm/select/style/index.css +1 -1
- package/esm/style.css +1 -1
- package/esm/table/index.d.ts +2 -2
- package/esm/table/index.js +1 -1
- package/esm/tabs/index.d.ts +2 -2
- package/esm/tabs/index.js +1 -1
- package/esm/trigger/index.d.ts +5 -5
- package/esm/trigger/index.js +5 -5
- package/lib/affix/index.d.ts +3 -3
- package/lib/affix/index.js +2 -2
- package/lib/carousel/index.d.ts +2 -2
- package/lib/carousel/index.js +1 -1
- package/lib/checkbox/CheckboxGroup.d.ts +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +13 -0
- package/lib/input-number/getParserOriginalValue.d.ts +26 -0
- package/lib/input-number/getParserOriginalValue.js +79 -0
- package/lib/input-number/index.d.ts +20 -7
- package/lib/input-number/index.js +55 -46
- package/lib/loading-icon/index.d.ts +1 -2
- package/lib/loading-icon/index.js +2 -4
- package/lib/modal/index.d.ts +3 -3
- package/lib/modal/index.js +2 -2
- package/lib/move/index.d.ts +6 -6
- package/lib/move/index.js +5 -5
- package/lib/popover/index.d.ts +1 -1
- package/lib/popover/index.js +7 -2
- package/lib/radio/Radio.d.ts +4 -0
- package/lib/radio/Radio.js +91 -0
- package/lib/radio/RadioGroup.d.ts +16 -0
- package/lib/radio/RadioGroup.js +117 -0
- package/lib/radio/context.d.ts +5 -0
- package/lib/radio/context.js +15 -0
- package/lib/radio/index.d.ts +3 -0
- package/lib/radio/index.js +20 -0
- package/lib/radio/interface.d.ts +17 -0
- package/lib/radio/interface.js +5 -0
- package/lib/radio/style/index.css +1 -0
- package/lib/select/index.d.ts +2 -2
- package/lib/select/index.js +1 -1
- package/lib/select/style/index.css +1 -1
- package/lib/style.css +1 -1
- package/lib/table/index.d.ts +2 -2
- package/lib/table/index.js +1 -1
- package/lib/tabs/index.d.ts +2 -2
- package/lib/tabs/index.js +1 -1
- package/lib/trigger/index.d.ts +5 -5
- package/lib/trigger/index.js +5 -5
- package/package.json +5 -4
package/esm/affix/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AddListenerEventRemoveHandler, getOffsetAndSize } from '@autobest-ui/utils';
|
|
3
3
|
export interface GetFixedStateParams {
|
|
4
4
|
positionInfo: OffsetInfo;
|
|
5
5
|
scrollTop: number;
|
|
@@ -59,8 +59,8 @@ interface AffixStates {
|
|
|
59
59
|
declare type OffsetInfo = ReturnType<typeof getOffsetAndSize>;
|
|
60
60
|
declare class Affix extends React.Component<AffixProps, AffixStates> {
|
|
61
61
|
prefixCls: string;
|
|
62
|
-
scrollHandler:
|
|
63
|
-
resizeHandler:
|
|
62
|
+
scrollHandler: AddListenerEventRemoveHandler;
|
|
63
|
+
resizeHandler: AddListenerEventRemoveHandler;
|
|
64
64
|
isFixed: boolean;
|
|
65
65
|
wrapRef: React.RefObject<HTMLDivElement>;
|
|
66
66
|
customRef: React.RefObject<HTMLDivElement>;
|
package/esm/affix/index.js
CHANGED
|
@@ -153,11 +153,11 @@ var Affix = /** @class */function (_super) {
|
|
|
153
153
|
};
|
|
154
154
|
Affix.prototype.componentWillUnmount = function () {
|
|
155
155
|
if (this.scrollHandler) {
|
|
156
|
-
this.scrollHandler
|
|
156
|
+
this.scrollHandler();
|
|
157
157
|
this.scrollHandler = null;
|
|
158
158
|
}
|
|
159
159
|
if (this.resizeHandler) {
|
|
160
|
-
this.resizeHandler
|
|
160
|
+
this.resizeHandler();
|
|
161
161
|
this.resizeHandler = null;
|
|
162
162
|
}
|
|
163
163
|
};
|
package/esm/carousel/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AddListenerEventRemoveHandler } from '@autobest-ui/utils';
|
|
3
3
|
export interface CarouselProps {
|
|
4
4
|
children: React.ReactElement[] | React.ReactElement;
|
|
5
5
|
/**
|
|
@@ -74,7 +74,7 @@ declare class Carousel extends React.Component<CarouselProps, CarouselStates> {
|
|
|
74
74
|
fadeEffect: boolean;
|
|
75
75
|
monitorWindowResize: boolean;
|
|
76
76
|
};
|
|
77
|
-
resizeHandler:
|
|
77
|
+
resizeHandler: AddListenerEventRemoveHandler | null;
|
|
78
78
|
constructor(props: any);
|
|
79
79
|
componentDidMount(): void;
|
|
80
80
|
componentDidUpdate(prevProps: CarouselProps): void;
|
package/esm/carousel/index.js
CHANGED
|
@@ -310,7 +310,7 @@ var Carousel = /** @class */function (_super) {
|
|
|
310
310
|
clearTimeout(this.autoplayTimer);
|
|
311
311
|
clearTimeout(this.fadeEffectTimer);
|
|
312
312
|
if (this.resizeHandler) {
|
|
313
|
-
this.resizeHandler
|
|
313
|
+
this.resizeHandler();
|
|
314
314
|
this.resizeHandler = null;
|
|
315
315
|
}
|
|
316
316
|
if (this.intersectionObserver) {
|
|
@@ -3,6 +3,7 @@ import { CheckboxProps } from './Checkbox';
|
|
|
3
3
|
declare type CommonCheckboxProps = Partial<Pick<CheckboxProps, 'theme' | 'reverse' | 'disabled'>>;
|
|
4
4
|
export interface CheckboxGroupOptionItem extends CommonCheckboxProps {
|
|
5
5
|
name: string;
|
|
6
|
+
value?: string | number;
|
|
6
7
|
checked: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface CheckboxGroupProps extends CommonCheckboxProps {
|
package/esm/index.d.ts
CHANGED
|
@@ -57,3 +57,5 @@ export { default as LoadingIcon } from './loading-icon';
|
|
|
57
57
|
export type { TriggerProps, TriggerType, TriggerPlacement, ArrowStyleProps } from './trigger';
|
|
58
58
|
export { default as Trigger } from './trigger';
|
|
59
59
|
export { composeRef, supportRef, fillRef } from './trigger/ref';
|
|
60
|
+
export type { RadioProps, RadioGroupProps, RadioValue, RadioOptionItem } from './radio';
|
|
61
|
+
export { Radio, RadioGroup } from './radio';
|
package/esm/index.js
CHANGED
|
@@ -27,4 +27,5 @@ export { default as LoadingContainer } from './loading-container';
|
|
|
27
27
|
export { default as LoadingBar } from './loading-bar';
|
|
28
28
|
export { default as LoadingIcon } from './loading-icon';
|
|
29
29
|
export { default as Trigger } from './trigger';
|
|
30
|
-
export { composeRef, supportRef, fillRef } from './trigger/ref';
|
|
30
|
+
export { composeRef, supportRef, fillRef } from './trigger/ref';
|
|
31
|
+
export { Radio, RadioGroup } from './radio';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface GetParserOriginalValueParams {
|
|
2
|
+
originalValue: string | number;
|
|
3
|
+
prevParserValue: string | number;
|
|
4
|
+
trimStartZero?: boolean;
|
|
5
|
+
precision?: number;
|
|
6
|
+
isRounding?: boolean;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
skipError?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param originalValueParam
|
|
14
|
+
* @param trimStartZero
|
|
15
|
+
* @param prevParserValue
|
|
16
|
+
* @param precision
|
|
17
|
+
* @param isRounding
|
|
18
|
+
* @param min
|
|
19
|
+
* @param max
|
|
20
|
+
* @param skipError 遇到首位0、小于最小值、大于最大值问题,不对value进行处理,输出控制台警告
|
|
21
|
+
*/
|
|
22
|
+
export default function ({ originalValue: originalValueParam, trimStartZero, prevParserValue, precision, isRounding, min, max, skipError }: GetParserOriginalValueParams): {
|
|
23
|
+
parserValueStr: string | undefined;
|
|
24
|
+
parserValue: string | number | undefined;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { getNumberFromString, isBlank, toFixed } from '@autobest-ui/utils';
|
|
2
|
+
import { FirstZeroReg, NumberReg } from './constants';
|
|
3
|
+
function consoleError(msg) {
|
|
4
|
+
if (process.env.NODE_ENV === 'development') {
|
|
5
|
+
// eslint-disable-next-line no-console
|
|
6
|
+
console.error(msg);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function getValueBetweenMinAndMax(value, min, max, skipError) {
|
|
10
|
+
var currentValue = parseFloat(value);
|
|
11
|
+
if (!isBlank(min) && currentValue < min) {
|
|
12
|
+
if (!skipError) {
|
|
13
|
+
return min;
|
|
14
|
+
}
|
|
15
|
+
consoleError('Value is smaller than min');
|
|
16
|
+
}
|
|
17
|
+
if (!isBlank(max) && currentValue > max) {
|
|
18
|
+
if (!skipError) {
|
|
19
|
+
return max;
|
|
20
|
+
}
|
|
21
|
+
consoleError('Value is greater than max');
|
|
22
|
+
}
|
|
23
|
+
return currentValue;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param originalValueParam
|
|
28
|
+
* @param trimStartZero
|
|
29
|
+
* @param prevParserValue
|
|
30
|
+
* @param precision
|
|
31
|
+
* @param isRounding
|
|
32
|
+
* @param min
|
|
33
|
+
* @param max
|
|
34
|
+
* @param skipError 遇到首位0、小于最小值、大于最大值问题,不对value进行处理,输出控制台警告
|
|
35
|
+
*/
|
|
36
|
+
export default function (_a) {
|
|
37
|
+
var originalValueParam = _a.originalValue,
|
|
38
|
+
trimStartZero = _a.trimStartZero,
|
|
39
|
+
prevParserValue = _a.prevParserValue,
|
|
40
|
+
precision = _a.precision,
|
|
41
|
+
isRounding = _a.isRounding,
|
|
42
|
+
min = _a.min,
|
|
43
|
+
max = _a.max,
|
|
44
|
+
skipError = _a.skipError;
|
|
45
|
+
// 输入为空
|
|
46
|
+
if (isBlank(originalValueParam)) {
|
|
47
|
+
return {
|
|
48
|
+
parserValueStr: undefined,
|
|
49
|
+
parserValue: undefined
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var originalValue = typeof originalValueParam === 'number' ? originalValueParam.toString() : originalValueParam;
|
|
53
|
+
var hasFirstZero = FirstZeroReg.test(originalValue);
|
|
54
|
+
if (!NumberReg.test(originalValue) || trimStartZero && hasFirstZero) {
|
|
55
|
+
if (!skipError) {
|
|
56
|
+
return {
|
|
57
|
+
parserValueStr: isBlank(prevParserValue) ? undefined : prevParserValue.toString(),
|
|
58
|
+
parserValue: prevParserValue
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
consoleError('Value has first 0');
|
|
62
|
+
}
|
|
63
|
+
var currentValue = getValueBetweenMinAndMax(originalValue, min, max, skipError);
|
|
64
|
+
var parserString = toFixed(currentValue, precision, isRounding);
|
|
65
|
+
if (hasFirstZero) {
|
|
66
|
+
// 补齐首位0
|
|
67
|
+
parserString = parserString.padStart(originalValue.split('.')[0].length, '0');
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
parserValueStr: parserString,
|
|
71
|
+
parserValue: hasFirstZero ? parserString : getNumberFromString(parserString)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AddListenerEventRemoveHandler } from '@autobest-ui/utils';
|
|
3
3
|
import { InputProps, InputValue } from '../input/Input';
|
|
4
|
-
export interface InputNumberProps extends Omit<InputProps<number>, 'value' | 'defaultValue' | 'suffix' | 'onKeyDown'> {
|
|
4
|
+
export interface InputNumberProps extends Omit<InputProps<number | string>, 'value' | 'defaultValue' | 'suffix' | 'onKeyDown'> {
|
|
5
5
|
/**
|
|
6
6
|
* 输入框默认值,用于非受控组件,配合ref使用
|
|
7
7
|
*/
|
|
@@ -42,15 +42,23 @@ export interface InputNumberProps extends Omit<InputProps<number>, 'value' | 'de
|
|
|
42
42
|
* 值发生改变将会触发,onChange是不合法将不在触发,只在最后onBlur时再触发一次
|
|
43
43
|
* 该方法主要用在用户输入内容判断上,不要在此方法中执行修改value的操作
|
|
44
44
|
*/
|
|
45
|
-
onContinualChange?: (originalValue: string | number | undefined, parserValue: number | undefined, name?: string) => void;
|
|
45
|
+
onContinualChange?: (originalValue: string | number | undefined, parserValue: string | number | undefined, name?: string) => void;
|
|
46
46
|
/**
|
|
47
47
|
* 用户触发keydown时的回调,主要用于键盘监听
|
|
48
48
|
*/
|
|
49
|
-
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>, parserValue: number | undefined, name?: string) => void;
|
|
49
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>, parserValue: string | number | undefined, name?: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* 是否过滤开头的0,默认true过滤
|
|
52
|
+
*/
|
|
53
|
+
trimStartZero?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* 处理用户输入值时是否要四舍五入,默认true
|
|
56
|
+
*/
|
|
57
|
+
isRounding?: boolean;
|
|
50
58
|
}
|
|
51
59
|
interface InputNumberStates {
|
|
52
60
|
originalValueStr: string | undefined;
|
|
53
|
-
parserValue: number | undefined;
|
|
61
|
+
parserValue: string | number | undefined;
|
|
54
62
|
}
|
|
55
63
|
interface InputNumberPropsWithRef extends InputNumberProps {
|
|
56
64
|
/**
|
|
@@ -61,12 +69,14 @@ interface InputNumberPropsWithRef extends InputNumberProps {
|
|
|
61
69
|
export declare class InputNumberNotRef extends React.Component<InputNumberPropsWithRef, InputNumberStates> {
|
|
62
70
|
prefixCls: string;
|
|
63
71
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
64
|
-
keyboardHandler:
|
|
72
|
+
keyboardHandler: AddListenerEventRemoveHandler;
|
|
65
73
|
static defaultProps: {
|
|
66
74
|
defaultValue: string;
|
|
67
75
|
controls: boolean;
|
|
68
76
|
step: number;
|
|
69
77
|
keyboard: boolean;
|
|
78
|
+
trimStartZero: boolean;
|
|
79
|
+
isRounding: boolean;
|
|
70
80
|
};
|
|
71
81
|
constructor(props: InputNumberPropsWithRef);
|
|
72
82
|
static getDerivedStateFromProps(nextProps: InputNumberPropsWithRef, prevStates: InputNumberStates): InputNumberStates;
|
|
@@ -75,7 +85,10 @@ export declare class InputNumberNotRef extends React.Component<InputNumberPropsW
|
|
|
75
85
|
* 解析用户输入的内容,并返回解析后的结果
|
|
76
86
|
* @param originalValue
|
|
77
87
|
*/
|
|
78
|
-
getParserOriginalValue: (originalValue: string) =>
|
|
88
|
+
getParserOriginalValue: (originalValue: string) => {
|
|
89
|
+
parserValueStr: string;
|
|
90
|
+
parserValue: string | number;
|
|
91
|
+
};
|
|
79
92
|
/**
|
|
80
93
|
* 键盘和点击上下按钮更新value值
|
|
81
94
|
* @param isUp
|
|
@@ -35,10 +35,11 @@ var __assign = this && this.__assign || function () {
|
|
|
35
35
|
import React from 'react';
|
|
36
36
|
import classNames from 'classnames';
|
|
37
37
|
import { composeRef } from '@autobest-ui/components';
|
|
38
|
-
import { isBlank,
|
|
38
|
+
import { isBlank, isEmptyObject, addEventListener } from '@autobest-ui/utils';
|
|
39
39
|
import Input from '../input/Input';
|
|
40
|
-
import { FirstZeroReg
|
|
40
|
+
import { FirstZeroReg } from './constants';
|
|
41
41
|
import ControlArrow from './ControlArrow';
|
|
42
|
+
import getParserOriginalValue from './getParserOriginalValue';
|
|
42
43
|
var InputNumberNotRef = /** @class */function (_super) {
|
|
43
44
|
__extends(InputNumberNotRef, _super);
|
|
44
45
|
function InputNumberNotRef(props) {
|
|
@@ -50,25 +51,10 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
50
51
|
* @param originalValue
|
|
51
52
|
*/
|
|
52
53
|
_this.getParserOriginalValue = function (originalValue) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
if (!NumberReg.test(originalValue) || FirstZeroReg.test(originalValue)) {
|
|
58
|
-
return isBlank(_this.state.parserValue) ? undefined : _this.state.parserValue.toString();
|
|
59
|
-
}
|
|
60
|
-
var _a = _this.props,
|
|
61
|
-
min = _a.min,
|
|
62
|
-
max = _a.max,
|
|
63
|
-
precision = _a.precision;
|
|
64
|
-
var currentValue = parseFloat(originalValue);
|
|
65
|
-
if (!isBlank(min) && currentValue < min) {
|
|
66
|
-
currentValue = min;
|
|
67
|
-
}
|
|
68
|
-
if (!isBlank(max) && currentValue > max) {
|
|
69
|
-
currentValue = max;
|
|
70
|
-
}
|
|
71
|
-
return toFixed(currentValue, precision);
|
|
54
|
+
return getParserOriginalValue(__assign(__assign({}, _this.props), {
|
|
55
|
+
originalValue: originalValue,
|
|
56
|
+
prevParserValue: _this.state.parserValue
|
|
57
|
+
}));
|
|
72
58
|
};
|
|
73
59
|
/**
|
|
74
60
|
* 键盘和点击上下按钮更新value值
|
|
@@ -76,14 +62,20 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
76
62
|
*/
|
|
77
63
|
_this.changeValueWithStep = function (isUp) {
|
|
78
64
|
var step = _this.props.step;
|
|
79
|
-
var
|
|
65
|
+
var prevParserValue = _this.state.parserValue;
|
|
66
|
+
var prevValue = prevParserValue ? typeof prevParserValue === 'number' ? prevParserValue : parseFloat(prevParserValue) : 0;
|
|
80
67
|
var keyboardValue = isUp ? prevValue + step : prevValue - step;
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
var keyboardValueStr = keyboardValue.toString();
|
|
69
|
+
if (typeof prevParserValue === 'string' && FirstZeroReg.test(prevParserValue)) {
|
|
70
|
+
keyboardValueStr = keyboardValueStr.padStart(prevParserValue.length, '0');
|
|
71
|
+
}
|
|
72
|
+
var _a = _this.getParserOriginalValue(keyboardValueStr),
|
|
73
|
+
parserValueStr = _a.parserValueStr,
|
|
74
|
+
parserValue = _a.parserValue;
|
|
75
|
+
var _b = _this.props,
|
|
76
|
+
name = _b.name,
|
|
77
|
+
onChange = _b.onChange,
|
|
78
|
+
onContinualChange = _b.onContinualChange;
|
|
87
79
|
if (prevValue !== parserValue) {
|
|
88
80
|
if (onContinualChange) {
|
|
89
81
|
onContinualChange(parserValueStr, parserValue, name);
|
|
@@ -124,14 +116,13 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
124
116
|
}
|
|
125
117
|
var onFocus = _this.props.onFocus;
|
|
126
118
|
if (onFocus) {
|
|
127
|
-
var
|
|
128
|
-
var parserValue = getNumberFromString(parserValueStr);
|
|
119
|
+
var parserValue = _this.getParserOriginalValue(originalValueStr).parserValue;
|
|
129
120
|
onFocus(parserValue, name);
|
|
130
121
|
}
|
|
131
122
|
};
|
|
132
123
|
_this.onBlur = function (originalValueStr, name) {
|
|
133
124
|
if (_this.keyboardHandler) {
|
|
134
|
-
_this.keyboardHandler
|
|
125
|
+
_this.keyboardHandler();
|
|
135
126
|
_this.keyboardHandler = null;
|
|
136
127
|
}
|
|
137
128
|
if (_this.props.disabled) {
|
|
@@ -141,8 +132,9 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
141
132
|
onBlur = _a.onBlur,
|
|
142
133
|
onChange = _a.onChange,
|
|
143
134
|
onContinualChange = _a.onContinualChange;
|
|
144
|
-
var
|
|
145
|
-
|
|
135
|
+
var _b = _this.getParserOriginalValue(originalValueStr),
|
|
136
|
+
parserValueStr = _b.parserValueStr,
|
|
137
|
+
parserValue = _b.parserValue;
|
|
146
138
|
_this.setState({
|
|
147
139
|
originalValueStr: parserValueStr
|
|
148
140
|
});
|
|
@@ -172,11 +164,12 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
172
164
|
if (_this.props.disabled) {
|
|
173
165
|
return;
|
|
174
166
|
}
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
var _a = _this.getParserOriginalValue(originalValueStr),
|
|
168
|
+
parserValueStr = _a.parserValueStr,
|
|
169
|
+
parserValue = _a.parserValue;
|
|
170
|
+
var _b = _this.props,
|
|
171
|
+
onChange = _b.onChange,
|
|
172
|
+
onContinualChange = _b.onContinualChange;
|
|
180
173
|
if (onContinualChange) {
|
|
181
174
|
onContinualChange(originalValueStr, parserValue, name);
|
|
182
175
|
}
|
|
@@ -220,10 +213,16 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
220
213
|
onKeyDown(ev, _this.state.parserValue, name);
|
|
221
214
|
}
|
|
222
215
|
};
|
|
223
|
-
var
|
|
216
|
+
var _a = getParserOriginalValue(__assign(__assign({}, props), {
|
|
217
|
+
originalValue: props.defaultValue,
|
|
218
|
+
prevParserValue: undefined,
|
|
219
|
+
skipError: true
|
|
220
|
+
})),
|
|
221
|
+
parserValueStr = _a.parserValueStr,
|
|
222
|
+
parserValue = _a.parserValue;
|
|
224
223
|
_this.state = {
|
|
225
|
-
originalValueStr:
|
|
226
|
-
parserValue:
|
|
224
|
+
originalValueStr: parserValueStr,
|
|
225
|
+
parserValue: parserValue
|
|
227
226
|
};
|
|
228
227
|
return _this;
|
|
229
228
|
}
|
|
@@ -234,9 +233,15 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
234
233
|
if (nextProps.value !== prevStates.parserValue && (
|
|
235
234
|
// 兼容外部传入空string/null的情况, 只有当一个值非空时,才会重新重置State信息
|
|
236
235
|
!isBlank(nextProps.value) || !isBlank(prevStates.parserValue))) {
|
|
237
|
-
var
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
var _a = getParserOriginalValue(__assign(__assign({}, nextProps), {
|
|
237
|
+
originalValue: nextProps.value,
|
|
238
|
+
prevParserValue: prevStates.parserValue,
|
|
239
|
+
skipError: true
|
|
240
|
+
})),
|
|
241
|
+
parserValueStr = _a.parserValueStr,
|
|
242
|
+
parserValue = _a.parserValue;
|
|
243
|
+
nextState.parserValue = parserValue;
|
|
244
|
+
nextState.originalValueStr = parserValueStr;
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
247
|
if (isEmptyObject(nextState)) {
|
|
@@ -246,7 +251,7 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
246
251
|
};
|
|
247
252
|
InputNumberNotRef.prototype.componentWillUnmount = function () {
|
|
248
253
|
if (this.keyboardHandler) {
|
|
249
|
-
this.keyboardHandler
|
|
254
|
+
this.keyboardHandler();
|
|
250
255
|
this.keyboardHandler = null;
|
|
251
256
|
}
|
|
252
257
|
};
|
|
@@ -262,7 +267,8 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
262
267
|
style = _b.style,
|
|
263
268
|
prefix = _b.prefix,
|
|
264
269
|
controls = _b.controls,
|
|
265
|
-
checkValueOnMounted = _b.checkValueOnMounted
|
|
270
|
+
checkValueOnMounted = _b.checkValueOnMounted,
|
|
271
|
+
maxLength = _b.maxLength;
|
|
266
272
|
var originalValueStr = this.state.originalValueStr;
|
|
267
273
|
return /*#__PURE__*/React.createElement(Input, {
|
|
268
274
|
ref: composeRef(this.inputRef, upperRef),
|
|
@@ -282,14 +288,17 @@ var InputNumberNotRef = /** @class */function (_super) {
|
|
|
282
288
|
onUp: this.onUp,
|
|
283
289
|
onDown: this.onDown
|
|
284
290
|
}) : null,
|
|
285
|
-
checkValueOnMounted: checkValueOnMounted
|
|
291
|
+
checkValueOnMounted: checkValueOnMounted,
|
|
292
|
+
maxLength: maxLength
|
|
286
293
|
});
|
|
287
294
|
};
|
|
288
295
|
InputNumberNotRef.defaultProps = {
|
|
289
296
|
defaultValue: '',
|
|
290
297
|
controls: true,
|
|
291
298
|
step: 1,
|
|
292
|
-
keyboard: true
|
|
299
|
+
keyboard: true,
|
|
300
|
+
trimStartZero: true,
|
|
301
|
+
isRounding: true
|
|
293
302
|
};
|
|
294
303
|
return InputNumberNotRef;
|
|
295
304
|
}(React.Component);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface LoadingIconProps {
|
|
3
3
|
className?: string;
|
|
4
|
-
style?: CSSProperties;
|
|
5
4
|
}
|
|
6
5
|
declare const _default: React.MemoExoticComponent<(props: LoadingIconProps) => JSX.Element>;
|
|
7
6
|
export default _default;
|
|
@@ -2,11 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
var cls = 'ab-svg-loading';
|
|
4
4
|
var LoadingIcon = function LoadingIcon(props) {
|
|
5
|
-
var className = props.className
|
|
6
|
-
style = props.style;
|
|
5
|
+
var className = props.className;
|
|
7
6
|
return /*#__PURE__*/React.createElement("span", {
|
|
8
|
-
className: classNames(className, cls)
|
|
9
|
-
style: style
|
|
7
|
+
className: classNames(className, cls)
|
|
10
8
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
11
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12
10
|
width: "24",
|
package/esm/modal/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AddListenerEventRemoveHandler } from '@autobest-ui/utils';
|
|
3
3
|
declare type PrevPopupSize = {
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
@@ -92,8 +92,8 @@ declare class Modal extends React.Component<ModalProps, ModalStates> {
|
|
|
92
92
|
maskClosable: boolean;
|
|
93
93
|
hiddenScroll: boolean;
|
|
94
94
|
};
|
|
95
|
-
clickOutsideHandler:
|
|
96
|
-
touchOutsideHandler:
|
|
95
|
+
clickOutsideHandler: AddListenerEventRemoveHandler;
|
|
96
|
+
touchOutsideHandler: AddListenerEventRemoveHandler;
|
|
97
97
|
popupTimer: any;
|
|
98
98
|
affixTimer: any;
|
|
99
99
|
popupRef: React.RefObject<HTMLDivElement>;
|
package/esm/modal/index.js
CHANGED
|
@@ -258,11 +258,11 @@ var Modal = /** @class */function (_super) {
|
|
|
258
258
|
Modal.prototype.clearOutsideHandler = function () {
|
|
259
259
|
this.clearPopupTimer();
|
|
260
260
|
if (this.clickOutsideHandler) {
|
|
261
|
-
this.clickOutsideHandler
|
|
261
|
+
this.clickOutsideHandler();
|
|
262
262
|
this.clickOutsideHandler = null;
|
|
263
263
|
}
|
|
264
264
|
if (this.touchOutsideHandler) {
|
|
265
|
-
this.touchOutsideHandler
|
|
265
|
+
this.touchOutsideHandler();
|
|
266
266
|
this.touchOutsideHandler = null;
|
|
267
267
|
}
|
|
268
268
|
};
|
package/esm/move/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AddListenerEventRemoveHandler } from '@autobest-ui/utils';
|
|
3
3
|
import { Position } from './utils';
|
|
4
4
|
export interface MoveProps {
|
|
5
5
|
/**
|
|
@@ -82,11 +82,11 @@ declare class Move extends React.Component<MoveProps> {
|
|
|
82
82
|
isTouchScale: boolean;
|
|
83
83
|
isForceUpdatePlacement: boolean;
|
|
84
84
|
moveRef: React.RefObject<HTMLElement>;
|
|
85
|
-
resizeHandler:
|
|
86
|
-
startHandler:
|
|
87
|
-
mousewheelHandler:
|
|
88
|
-
moveHandler:
|
|
89
|
-
endHandler:
|
|
85
|
+
resizeHandler: AddListenerEventRemoveHandler;
|
|
86
|
+
startHandler: AddListenerEventRemoveHandler;
|
|
87
|
+
mousewheelHandler: AddListenerEventRemoveHandler;
|
|
88
|
+
moveHandler: AddListenerEventRemoveHandler;
|
|
89
|
+
endHandler: AddListenerEventRemoveHandler;
|
|
90
90
|
updateTimer: any;
|
|
91
91
|
componentDidMount(): void;
|
|
92
92
|
componentDidUpdate(prevProps?: MoveProps): void;
|
package/esm/move/index.js
CHANGED
|
@@ -310,26 +310,26 @@ var Move = /** @class */function (_super) {
|
|
|
310
310
|
Move.prototype.componentWillUnmount = function () {
|
|
311
311
|
clearTimeout(this.updateTimer);
|
|
312
312
|
if (this.startHandler) {
|
|
313
|
-
this.startHandler
|
|
313
|
+
this.startHandler();
|
|
314
314
|
this.startHandler = null;
|
|
315
315
|
}
|
|
316
316
|
if (this.mousewheelHandler) {
|
|
317
|
-
this.mousewheelHandler
|
|
317
|
+
this.mousewheelHandler();
|
|
318
318
|
this.mousewheelHandler = null;
|
|
319
319
|
}
|
|
320
320
|
if (this.resizeHandler) {
|
|
321
|
-
this.resizeHandler
|
|
321
|
+
this.resizeHandler();
|
|
322
322
|
this.resizeHandler = null;
|
|
323
323
|
}
|
|
324
324
|
this.clearHandler();
|
|
325
325
|
};
|
|
326
326
|
Move.prototype.clearHandler = function () {
|
|
327
327
|
if (this.moveHandler) {
|
|
328
|
-
this.moveHandler
|
|
328
|
+
this.moveHandler();
|
|
329
329
|
this.moveHandler = null;
|
|
330
330
|
}
|
|
331
331
|
if (this.endHandler) {
|
|
332
|
-
this.endHandler
|
|
332
|
+
this.endHandler();
|
|
333
333
|
this.endHandler = null;
|
|
334
334
|
}
|
|
335
335
|
};
|
package/esm/popover/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface PopoverProps extends Pick<TriggerProps, Exclude<keyof TriggerPr
|
|
|
32
32
|
}
|
|
33
33
|
export declare type PopoverPlacement = TriggerPlacement;
|
|
34
34
|
export declare type PopoverTriggerType = TriggerType;
|
|
35
|
-
declare function Popover({ theme, innerClassName, closeClassName, arrowClassName, hiddenClose, tip, closeIcon, ...extraProps }: PopoverProps): JSX.Element;
|
|
35
|
+
declare function Popover({ theme, innerClassName, closeClassName, arrowClassName, hiddenClose, tip, closeIcon, maxHeight, ...extraProps }: PopoverProps): JSX.Element;
|
|
36
36
|
declare namespace Popover {
|
|
37
37
|
var defaultProps: {
|
|
38
38
|
hiddenClose: boolean;
|
package/esm/popover/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
24
|
import classNames from 'classnames';
|
|
25
|
+
import { isBlank } from '@autobest-ui/utils';
|
|
25
26
|
import Trigger from '../trigger';
|
|
26
27
|
var prefixCls = 'ab-popover';
|
|
27
28
|
function Popover(_a) {
|
|
@@ -33,7 +34,8 @@ function Popover(_a) {
|
|
|
33
34
|
hiddenClose = _a.hiddenClose,
|
|
34
35
|
tip = _a.tip,
|
|
35
36
|
closeIcon = _a.closeIcon,
|
|
36
|
-
|
|
37
|
+
maxHeight = _a.maxHeight,
|
|
38
|
+
extraProps = __rest(_a, ["theme", "innerClassName", "closeClassName", "arrowClassName", "hiddenClose", "tip", "closeIcon", "maxHeight"]);
|
|
37
39
|
var triggerEl = React.useRef(null);
|
|
38
40
|
var _c = React.useState({}),
|
|
39
41
|
arrowStyle = _c[0],
|
|
@@ -71,7 +73,10 @@ function Popover(_a) {
|
|
|
71
73
|
className: classNames("".concat(cls, "-arrow"), arrowClassName),
|
|
72
74
|
style: arrowStyle
|
|
73
75
|
}), /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
className: innerClass
|
|
76
|
+
className: innerClass,
|
|
77
|
+
style: !isBlank(maxHeight) ? {
|
|
78
|
+
maxHeight: "".concat(maxHeight, "px")
|
|
79
|
+
} : undefined
|
|
75
80
|
}, tip));
|
|
76
81
|
}
|
|
77
82
|
return /*#__PURE__*/React.createElement(Trigger, __assign({}, extraProps, {
|