@autobest-ui/components 1.2.0 → 1.4.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/carousel/index.d.ts +13 -21
- package/esm/carousel/index.js +44 -77
- package/esm/carousel/style/index.css +1 -1
- package/esm/carousel/style/index.scss +1 -7
- package/esm/date-picker/calendar/grid/index.css +1 -1
- package/esm/date-picker/calendar/grid/index.js +17 -27
- package/esm/date-picker/calendar/grid/index.scss +4 -0
- package/esm/date-picker/calendar/index.d.ts +4 -0
- package/esm/date-picker/calendar/index.js +1 -1
- package/esm/date-picker/index.d.ts +17 -6
- package/esm/date-picker/index.js +62 -17
- package/esm/date-picker/style/index.css +1 -1
- package/esm/date-picker/style/index.js +0 -2
- package/esm/date-picker/style/index.scss +6 -1
- package/esm/index.d.ts +3 -4
- package/esm/index.js +0 -1
- package/esm/input-number/index.d.ts +30 -17
- package/esm/input-number/index.js +116 -36
- package/esm/style.css +9 -24
- package/esm/table/body/BodyRow.d.ts +9 -3
- package/esm/table/body/BodyRow.js +6 -2
- package/esm/table/body/index.d.ts +2 -2
- package/esm/table/body/index.js +8 -7
- package/esm/table/header/HeaderCell.d.ts +2 -2
- package/esm/table/header/HeaderCell.js +15 -7
- package/esm/table/header/HeaderRow.d.ts +2 -2
- package/esm/table/index.d.ts +4 -4
- package/esm/table/index.js +3 -3
- package/esm/table/interface.d.ts +9 -3
- package/esm/table/style/index.css +1 -1
- package/esm/table/style/index.js +0 -2
- package/esm/table/style/index.scss +2 -0
- package/lib/carousel/index.d.ts +13 -21
- package/lib/carousel/index.js +45 -80
- package/lib/carousel/style/index.css +1 -1
- package/lib/carousel/style/index.scss +1 -7
- package/lib/date-picker/calendar/grid/index.css +1 -1
- package/lib/date-picker/calendar/grid/index.js +17 -28
- package/lib/date-picker/calendar/grid/index.scss +4 -0
- package/lib/date-picker/calendar/index.d.ts +4 -0
- package/lib/date-picker/calendar/index.js +1 -1
- package/lib/date-picker/index.d.ts +17 -6
- package/lib/date-picker/index.js +61 -17
- package/lib/date-picker/style/index.css +1 -1
- package/lib/date-picker/style/index.js +0 -2
- package/lib/date-picker/style/index.scss +6 -1
- package/lib/index.d.ts +3 -4
- package/lib/index.js +0 -8
- package/lib/input-number/index.d.ts +30 -17
- package/lib/input-number/index.js +116 -36
- package/lib/style.css +9 -24
- package/lib/table/body/BodyRow.d.ts +9 -3
- package/lib/table/body/BodyRow.js +6 -2
- package/lib/table/body/index.d.ts +2 -2
- package/lib/table/body/index.js +8 -7
- package/lib/table/header/HeaderCell.d.ts +2 -2
- package/lib/table/header/HeaderCell.js +15 -8
- package/lib/table/header/HeaderRow.d.ts +2 -2
- package/lib/table/index.d.ts +4 -4
- package/lib/table/index.js +3 -3
- package/lib/table/interface.d.ts +9 -3
- package/lib/table/style/index.css +1 -1
- package/lib/table/style/index.js +0 -2
- package/lib/table/style/index.scss +2 -0
- package/package.json +2 -2
- package/esm/accordion/__stories__/style.css +0 -1
- package/esm/accordion/__stories__/style.scss +0 -59
- package/esm/affix/__stories__/style.css +0 -1
- package/esm/affix/__stories__/style.scss +0 -13
- package/esm/carousel/__stories__/style.css +0 -1
- package/esm/carousel/__stories__/style.scss +0 -41
- package/esm/collapse/__stories__/style.css +0 -1
- package/esm/collapse/__stories__/style.scss +0 -19
- package/esm/guide/__stories__/style.css +0 -1
- package/esm/guide/__stories__/style.scss +0 -14
- package/esm/icon/__stories__/iconNames.d.ts +0 -2
- package/esm/icon/__stories__/iconNames.js +0 -1
- package/esm/icon/__stories__/style.css +0 -1
- package/esm/icon/__stories__/style.scss +0 -40
- package/esm/icon/index.d.ts +0 -43
- package/esm/icon/index.js +0 -94
- package/esm/icon/style/index.css +0 -1
- package/esm/icon/style/index.d.ts +0 -1
- package/esm/icon/style/index.js +0 -5
- package/esm/icon/style/index.scss +0 -7
- package/esm/lazy-image/__stories__/style.css +0 -1
- package/esm/lazy-image/__stories__/style.scss +0 -9
- package/esm/loading-container/__stories__/style.css +0 -1
- package/esm/loading-container/__stories__/style.scss +0 -6
- package/esm/move/__stories__/style.css +0 -1
- package/esm/move/__stories__/style.scss +0 -6
- package/esm/popover/__stories__/style.css +0 -1
- package/esm/popover/__stories__/style.scss +0 -16
- package/esm/select/__stories__/style.css +0 -1
- package/esm/select/__stories__/style.scss +0 -8
- package/esm/skeleton/__stories__/style.css +0 -1
- package/esm/skeleton/__stories__/style.scss +0 -3
- package/esm/table/__stories__/style.css +0 -1
- package/esm/table/__stories__/style.scss +0 -34
- package/esm/tabs/__stories__/style.css +0 -1
- package/esm/tabs/__stories__/style.scss +0 -8
- package/lib/accordion/__stories__/style.css +0 -1
- package/lib/accordion/__stories__/style.scss +0 -59
- package/lib/affix/__stories__/style.css +0 -1
- package/lib/affix/__stories__/style.scss +0 -13
- package/lib/carousel/__stories__/style.css +0 -1
- package/lib/carousel/__stories__/style.scss +0 -41
- package/lib/collapse/__stories__/style.css +0 -1
- package/lib/collapse/__stories__/style.scss +0 -19
- package/lib/guide/__stories__/style.css +0 -1
- package/lib/guide/__stories__/style.scss +0 -14
- package/lib/icon/__stories__/iconNames.d.ts +0 -2
- package/lib/icon/__stories__/iconNames.js +0 -8
- package/lib/icon/__stories__/style.css +0 -1
- package/lib/icon/__stories__/style.scss +0 -40
- package/lib/icon/index.d.ts +0 -43
- package/lib/icon/index.js +0 -111
- package/lib/icon/style/index.css +0 -1
- package/lib/icon/style/index.d.ts +0 -1
- package/lib/icon/style/index.js +0 -7
- package/lib/icon/style/index.scss +0 -7
- package/lib/lazy-image/__stories__/style.css +0 -1
- package/lib/lazy-image/__stories__/style.scss +0 -9
- package/lib/loading-container/__stories__/style.css +0 -1
- package/lib/loading-container/__stories__/style.scss +0 -6
- package/lib/move/__stories__/style.css +0 -1
- package/lib/move/__stories__/style.scss +0 -6
- package/lib/popover/__stories__/style.css +0 -1
- package/lib/popover/__stories__/style.scss +0 -16
- package/lib/select/__stories__/style.css +0 -1
- package/lib/select/__stories__/style.scss +0 -8
- package/lib/skeleton/__stories__/style.css +0 -1
- package/lib/skeleton/__stories__/style.scss +0 -3
- package/lib/table/__stories__/style.css +0 -1
- package/lib/table/__stories__/style.scss +0 -34
- package/lib/tabs/__stories__/style.css +0 -1
- package/lib/tabs/__stories__/style.scss +0 -8
|
@@ -12,6 +12,10 @@ export interface CalendarProps extends Omit<DayCalendarProps, omitType>, Omit<Mo
|
|
|
12
12
|
* 选择日期的回调函数
|
|
13
13
|
*/
|
|
14
14
|
onSelect: (date?: Date, name?: ReactText) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 默认日期
|
|
17
|
+
*/
|
|
18
|
+
defaultDate?: Date;
|
|
15
19
|
}
|
|
16
20
|
interface CalendarState {
|
|
17
21
|
selectedDate: Date;
|
|
@@ -87,7 +87,7 @@ function (_super) {
|
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
var nowDate = props.
|
|
90
|
+
var nowDate = props.defaultDate || props.today || new Date();
|
|
91
91
|
_this.state = {
|
|
92
92
|
selectedDate: nowDate,
|
|
93
93
|
navigatedDate: (0, _utils.getMonthStart)(nowDate.getFullYear(), nowDate.getMonth())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactText } from 'react';
|
|
2
2
|
import Calendar, { CalendarProps } from './calendar';
|
|
3
|
-
export interface DatePickerProps extends Partial<CalendarProps
|
|
3
|
+
export interface DatePickerProps extends Partial<Omit<CalendarProps, 'defaultDate'>> {
|
|
4
4
|
/**
|
|
5
5
|
* 组件整体样式
|
|
6
6
|
*/
|
|
@@ -13,6 +13,14 @@ export interface DatePickerProps extends Partial<CalendarProps> {
|
|
|
13
13
|
* 需要显示在input框中的日期格式
|
|
14
14
|
*/
|
|
15
15
|
onFormatDate?: (v: Date, name?: ReactText) => string;
|
|
16
|
+
/**
|
|
17
|
+
* 默认选中的值,用于初始化展示
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: Date;
|
|
20
|
+
/**
|
|
21
|
+
* 外部控制value
|
|
22
|
+
*/
|
|
23
|
+
value?: Date;
|
|
16
24
|
/**
|
|
17
25
|
* 是否显示input框中的日历图标
|
|
18
26
|
*/
|
|
@@ -29,10 +37,6 @@ export interface DatePickerProps extends Partial<CalendarProps> {
|
|
|
29
37
|
* 是否禁用
|
|
30
38
|
*/
|
|
31
39
|
disabled?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 默认选中的值,用于初始化展示
|
|
34
|
-
*/
|
|
35
|
-
defaultValue?: Date;
|
|
36
40
|
/**
|
|
37
41
|
* 与onFormatDate正相反,将input框中的字符串转为Date,当onFormatDate有值时,该属性``也需要有值
|
|
38
42
|
*/
|
|
@@ -45,7 +49,9 @@ interface DatePickerState {
|
|
|
45
49
|
declare class DatePicker extends React.Component<DatePickerProps, DatePickerState> {
|
|
46
50
|
prefixCls: string;
|
|
47
51
|
calendarRef: React.RefObject<Calendar>;
|
|
48
|
-
|
|
52
|
+
defaultDate?: Date;
|
|
53
|
+
popoverTriggered: boolean;
|
|
54
|
+
constructor(props: DatePickerProps);
|
|
49
55
|
static defaultProps: {
|
|
50
56
|
onFormatDate: (date: any) => any;
|
|
51
57
|
iconVisible: boolean;
|
|
@@ -53,7 +59,12 @@ declare class DatePicker extends React.Component<DatePickerProps, DatePickerStat
|
|
|
53
59
|
disabled: boolean;
|
|
54
60
|
parseDateFromString: (value: any) => Date;
|
|
55
61
|
};
|
|
62
|
+
static getDerivedStateFromProps(nextProps: DatePickerProps, prevState: DatePickerState): {
|
|
63
|
+
inputValue: string;
|
|
64
|
+
calendarVisible: boolean;
|
|
65
|
+
};
|
|
56
66
|
onCalendarSelect: (date: Date) => void;
|
|
67
|
+
updateDate: () => void;
|
|
57
68
|
onInputFocus: () => void;
|
|
58
69
|
onInputChange: (ev: any) => void;
|
|
59
70
|
onChangeDate: () => void;
|
package/lib/date-picker/index.js
CHANGED
|
@@ -17,8 +17,6 @@ var _calendar = _interopRequireDefault(require("./calendar"));
|
|
|
17
17
|
|
|
18
18
|
var _popover = _interopRequireDefault(require("../popover"));
|
|
19
19
|
|
|
20
|
-
var _icon = _interopRequireDefault(require("../icon"));
|
|
21
|
-
|
|
22
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
21
|
|
|
24
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -76,6 +74,7 @@ function (_super) {
|
|
|
76
74
|
|
|
77
75
|
_this.prefixCls = 'ab-date-picker';
|
|
78
76
|
_this.calendarRef = (0, _react.createRef)();
|
|
77
|
+
_this.popoverTriggered = false;
|
|
79
78
|
|
|
80
79
|
_this.onCalendarSelect = function (date) {
|
|
81
80
|
_this.setState({
|
|
@@ -88,14 +87,35 @@ function (_super) {
|
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
89
|
|
|
91
|
-
_this.
|
|
92
|
-
if (_this.calendarRef.current
|
|
93
|
-
|
|
90
|
+
_this.updateDate = function () {
|
|
91
|
+
if (!_this.calendarRef.current || !_this.state.inputValue) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var date = _this.props.parseDateFromString(_this.state.inputValue, _this.props.name);
|
|
96
|
+
|
|
97
|
+
if (isNaN(date.getTime())) {
|
|
98
|
+
return;
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
_this.calendarRef.current.updateDate(date);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
_this.onInputFocus = function () {
|
|
105
|
+
_this.updateDate();
|
|
106
|
+
|
|
96
107
|
_this.setState({
|
|
97
108
|
calendarVisible: true
|
|
98
109
|
});
|
|
110
|
+
|
|
111
|
+
if (!_this.popoverTriggered) {
|
|
112
|
+
// 标记触发过popover visible
|
|
113
|
+
_this.popoverTriggered = true;
|
|
114
|
+
|
|
115
|
+
if ('value' in _this.props && _this.props.value) {
|
|
116
|
+
_this.defaultDate = _this.props.value;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
99
119
|
};
|
|
100
120
|
|
|
101
121
|
_this.onInputChange = function (ev) {
|
|
@@ -109,13 +129,11 @@ function (_super) {
|
|
|
109
129
|
};
|
|
110
130
|
|
|
111
131
|
_this.onChangeDate = function () {
|
|
112
|
-
if (!_this.props.allowTextInput
|
|
132
|
+
if (!_this.props.allowTextInput) {
|
|
113
133
|
return;
|
|
114
134
|
}
|
|
115
135
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
_this.calendarRef.current.updateDate(date);
|
|
136
|
+
_this.updateDate();
|
|
119
137
|
};
|
|
120
138
|
|
|
121
139
|
_this.onPopoverVisibleChange = function (visible) {
|
|
@@ -143,12 +161,14 @@ function (_super) {
|
|
|
143
161
|
return _react.default.createElement(_calendar.default, __assign({}, copyProps, {
|
|
144
162
|
ref: _this.calendarRef,
|
|
145
163
|
onSelect: _this.onCalendarSelect,
|
|
146
|
-
className: copyProps.calendarClassName
|
|
164
|
+
className: copyProps.calendarClassName,
|
|
165
|
+
defaultDate: _this.defaultDate
|
|
147
166
|
}));
|
|
148
167
|
};
|
|
149
168
|
|
|
150
169
|
var defaultValue = props.defaultValue,
|
|
151
170
|
onFormatDate = props.onFormatDate;
|
|
171
|
+
_this.defaultDate = defaultValue;
|
|
152
172
|
_this.state = {
|
|
153
173
|
calendarVisible: false,
|
|
154
174
|
inputValue: defaultValue ? onFormatDate(defaultValue) : ''
|
|
@@ -156,6 +176,25 @@ function (_super) {
|
|
|
156
176
|
return _this;
|
|
157
177
|
}
|
|
158
178
|
|
|
179
|
+
DatePicker.getDerivedStateFromProps = function (nextProps, prevState) {
|
|
180
|
+
if ('value' in nextProps) {
|
|
181
|
+
var onFormatDate = nextProps.onFormatDate,
|
|
182
|
+
value = nextProps.value;
|
|
183
|
+
var currentValue = value ? onFormatDate(value) : '';
|
|
184
|
+
|
|
185
|
+
if (prevState.inputValue === currentValue) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
inputValue: currentValue,
|
|
191
|
+
calendarVisible: false
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return null;
|
|
196
|
+
};
|
|
197
|
+
|
|
159
198
|
DatePicker.prototype.render = function () {
|
|
160
199
|
var cls = this.prefixCls;
|
|
161
200
|
var _a = this.props,
|
|
@@ -182,13 +221,18 @@ function (_super) {
|
|
|
182
221
|
value: inputValue,
|
|
183
222
|
onFocus: this.onInputFocus,
|
|
184
223
|
onChange: this.onInputChange
|
|
185
|
-
}), iconVisible && _react.default.createElement(
|
|
186
|
-
className: cls + "-icon"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
}), iconVisible && _react.default.createElement("span", {
|
|
225
|
+
className: cls + "-icon"
|
|
226
|
+
}, _react.default.createElement("svg", {
|
|
227
|
+
viewBox: "0 0 1024 1024",
|
|
228
|
+
version: "1.1",
|
|
229
|
+
width: "0.16rem",
|
|
230
|
+
height: "0.18rem",
|
|
231
|
+
fill: "currentColor",
|
|
232
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
233
|
+
}, _react.default.createElement("path", {
|
|
234
|
+
d: "M928 128H832V64h-64v64H256V64H192v64H96l-32 32v768l32 32h832l32-32v-768l-32-32zM896 896H128V320h768v576z m0-640H128V192h768v64zM256 512H192v64h64V512z m-64 128h64v64H192v-64z m64 128H192v64h64v-64z m128-256h64v64H384V512z m64 128H384v64h64v-64z m-64 128h64v64H384v-64z m64-384H384v64h64V384z m128 128h64v64H576V512z m64 128H576v64h64v-64z m-64 128h64v64H576v-64z m64-384H576v64h64V384z m128 128h64v64h-64V512z m64 128h-64v64h64v-64z m-64-256h64v64h-64V384z"
|
|
235
|
+
})))));
|
|
192
236
|
};
|
|
193
237
|
|
|
194
238
|
DatePicker.defaultProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-date-picker{position:relative}.ab-date-picker-input{outline:0;font-size:.14rem;padding:.04rem;width:1.44rem}.ab-date-picker-icon{position:absolute;right:.05rem;top:50%;transform:translateY(-50%)}
|
|
1
|
+
.ab-date-picker{position:relative}.ab-date-picker-input{outline:0;font-size:.14rem;padding:.04rem;width:1.44rem}.ab-date-picker-input.ab-date-picker-error{background:#fffacd}.ab-date-picker-icon{color:#606060;position:absolute;right:.05rem;top:50%;transform:translateY(-50%)}
|
|
@@ -8,12 +8,17 @@ $namespace: ab-date-picker;
|
|
|
8
8
|
font-size: .14rem;
|
|
9
9
|
padding: .04rem;
|
|
10
10
|
width: 1.44rem;
|
|
11
|
+
|
|
12
|
+
&.#{$namespace}-error {
|
|
13
|
+
background: #fffacd;
|
|
14
|
+
}
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
&-icon {
|
|
18
|
+
color: #606060;
|
|
14
19
|
position: absolute;
|
|
15
20
|
right: 0.05rem;
|
|
16
21
|
top: 50%;
|
|
17
22
|
transform: translateY(-50%);
|
|
18
23
|
}
|
|
19
|
-
}
|
|
24
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export type { PopoverPlacement, PopoverTriggerType, PopoverProps } from './popov
|
|
|
11
11
|
export { default as Popover } from './popover';
|
|
12
12
|
export type { TooltipProps, TooltipPlacement, TooltipTriggerType } from './tooltip';
|
|
13
13
|
export { default as Tooltip } from './tooltip';
|
|
14
|
-
export type { IconProps } from './icon';
|
|
15
|
-
export { default as Icon } from './icon';
|
|
16
14
|
export type { SkeletonProps } from './skeleton';
|
|
17
15
|
export { default as Skeleton } from './skeleton';
|
|
18
16
|
export type { MoveProps } from './move';
|
|
@@ -25,7 +23,7 @@ export type { ConfirmProps } from './confirm';
|
|
|
25
23
|
export { default as Confirm } from './confirm';
|
|
26
24
|
export type { CollapseProps } from './collapse';
|
|
27
25
|
export { default as Collapse } from './collapse';
|
|
28
|
-
export type { CarouselProps
|
|
26
|
+
export type { CarouselProps } from './carousel';
|
|
29
27
|
export { default as Carousel } from './carousel';
|
|
30
28
|
export type { GuideProps } from './guide';
|
|
31
29
|
export { default as Guide } from './guide';
|
|
@@ -43,7 +41,8 @@ export type { ScriptAttributes, ScriptProps } from './script';
|
|
|
43
41
|
export { default as Script } from './script';
|
|
44
42
|
export type { MessageProps } from './message';
|
|
45
43
|
export { default as Message } from './message';
|
|
46
|
-
export type { TableProps } from './table';
|
|
44
|
+
export type { TableProps, TableRowSelectionInfo } from './table';
|
|
45
|
+
export type { TableColumnInfo, TableColumnOnRenderReturnObjectInfo } from './table/interface';
|
|
47
46
|
export { default as Table } from './table';
|
|
48
47
|
export type { DatePickerProps } from './date-picker';
|
|
49
48
|
export { default as DatePicker } from './date-picker';
|
package/lib/index.js
CHANGED
|
@@ -47,12 +47,6 @@ Object.defineProperty(exports, "Tooltip", {
|
|
|
47
47
|
return _tooltip.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "Icon", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function get() {
|
|
53
|
-
return _icon.default;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
50
|
Object.defineProperty(exports, "Skeleton", {
|
|
57
51
|
enumerable: true,
|
|
58
52
|
get: function get() {
|
|
@@ -200,8 +194,6 @@ var _popover = _interopRequireDefault(require("./popover"));
|
|
|
200
194
|
|
|
201
195
|
var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
202
196
|
|
|
203
|
-
var _icon = _interopRequireDefault(require("./icon"));
|
|
204
|
-
|
|
205
197
|
var _skeleton = _interopRequireDefault(require("./skeleton"));
|
|
206
198
|
|
|
207
199
|
var _move = _interopRequireDefault(require("./move"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AddListenerEventHandler } from '@autobest-ui/utils';
|
|
3
|
-
interface
|
|
2
|
+
import { debounce, AddListenerEventHandler } from '@autobest-ui/utils';
|
|
3
|
+
interface OnChangeHandler {
|
|
4
4
|
(value: string, name?: string): void;
|
|
5
5
|
}
|
|
6
6
|
interface ChangeEvent {
|
|
@@ -12,7 +12,7 @@ export interface InputNumberProps extends Omit<React.InputHTMLAttributes<any>, '
|
|
|
12
12
|
/**
|
|
13
13
|
* 值修改后的回调函数,用于修改value属性
|
|
14
14
|
*/
|
|
15
|
-
onChange:
|
|
15
|
+
onChange: OnChangeHandler;
|
|
16
16
|
/**
|
|
17
17
|
* input样式
|
|
18
18
|
*/
|
|
@@ -30,7 +30,8 @@ export interface InputNumberProps extends Omit<React.InputHTMLAttributes<any>, '
|
|
|
30
30
|
*/
|
|
31
31
|
max?: number;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* 打包值,向上取整,不赋值或者赋值为0表示不做取整操作
|
|
34
|
+
* 注:packMultiple不允许传小数
|
|
34
35
|
*/
|
|
35
36
|
packMultiple?: number;
|
|
36
37
|
/**
|
|
@@ -38,9 +39,13 @@ export interface InputNumberProps extends Omit<React.InputHTMLAttributes<any>, '
|
|
|
38
39
|
*/
|
|
39
40
|
disabled?: boolean;
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
+
* 可输入的小数位数,0或没有值表示只能输入整数
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
+
digital?: number;
|
|
45
|
+
/**
|
|
46
|
+
* 为true则自动补全小数位数
|
|
47
|
+
*/
|
|
48
|
+
padDigital?: boolean;
|
|
44
49
|
/**
|
|
45
50
|
* 输入框默认字符大小
|
|
46
51
|
*/
|
|
@@ -56,11 +61,11 @@ export interface InputNumberProps extends Omit<React.InputHTMLAttributes<any>, '
|
|
|
56
61
|
/**
|
|
57
62
|
* packMultiple 有值时,判断前的回调函数
|
|
58
63
|
*/
|
|
59
|
-
onChangePackMultipleBefore?:
|
|
64
|
+
onChangePackMultipleBefore?: OnChangeHandler;
|
|
60
65
|
/**
|
|
61
66
|
* packMultiple 有值时,判断后的回调函数
|
|
62
67
|
*/
|
|
63
|
-
onChangePackMultipleAfter?:
|
|
68
|
+
onChangePackMultipleAfter?: OnChangeHandler;
|
|
64
69
|
/**
|
|
65
70
|
* 是否需要显示增加按钮
|
|
66
71
|
*/
|
|
@@ -70,10 +75,6 @@ interface InputNumberStates {
|
|
|
70
75
|
enter: boolean;
|
|
71
76
|
focus: boolean;
|
|
72
77
|
}
|
|
73
|
-
interface DebounceRef {
|
|
74
|
-
(value: string): void;
|
|
75
|
-
cancel: () => void;
|
|
76
|
-
}
|
|
77
78
|
interface LocationInfo {
|
|
78
79
|
left: number;
|
|
79
80
|
top: number;
|
|
@@ -86,13 +87,15 @@ declare class InputNumber extends React.Component<InputNumberProps, InputNumberS
|
|
|
86
87
|
name: string;
|
|
87
88
|
size: number;
|
|
88
89
|
disabled: boolean;
|
|
89
|
-
|
|
90
|
+
digital: number;
|
|
91
|
+
padDigital: boolean;
|
|
90
92
|
delay: number;
|
|
91
93
|
visibleButton: boolean;
|
|
92
94
|
};
|
|
93
95
|
constructor(props: InputNumberProps);
|
|
94
96
|
currentRef: React.RefObject<HTMLLabelElement>;
|
|
95
|
-
|
|
97
|
+
changePackMultipleValueDebounce: ReturnType<typeof debounce>;
|
|
98
|
+
padDigitalDebounce: ReturnType<typeof debounce>;
|
|
96
99
|
addLocationInfo: LocationInfo;
|
|
97
100
|
subLocationInfo: LocationInfo;
|
|
98
101
|
mouseUpHandler: AddListenerEventHandler;
|
|
@@ -120,10 +123,20 @@ declare class InputNumber extends React.Component<InputNumberProps, InputNumberS
|
|
|
120
123
|
isInside: (ev: React.MouseEvent<Element, MouseEvent>, locationInfo: LocationInfo) => boolean;
|
|
121
124
|
getLocationInfo: () => void;
|
|
122
125
|
getCurrentValue: (value: string) => number;
|
|
126
|
+
getPadDigitalValue: (value: string) => string;
|
|
123
127
|
onChangePackMultipleValue: (value: string) => void;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
onPadDigital: (value: any) => void;
|
|
129
|
+
getPadDigitalDebounce: () => {
|
|
130
|
+
(...arg: any[]): void;
|
|
131
|
+
cancel(): void;
|
|
132
|
+
};
|
|
133
|
+
getChangePackMultipleValueDebounce: () => {
|
|
134
|
+
(...arg: any[]): void;
|
|
135
|
+
cancel(): void;
|
|
136
|
+
};
|
|
137
|
+
callback: (value: string, ignoreDelay?: any) => void;
|
|
138
|
+
onValueChange: (ev: ChangeEvent, ignoreDelay?: any) => void;
|
|
139
|
+
getValueCalculate: (value: number, offset: number) => number;
|
|
127
140
|
onAdd: () => void;
|
|
128
141
|
onSub: () => void;
|
|
129
142
|
renderButton: () => JSX.Element;
|