@autobest-ui/components 1.2.1 → 1.5.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/guide/index.d.ts +4 -5
- package/esm/guide/index.js +4 -6
- package/esm/index.d.ts +3 -5
- package/esm/index.js +1 -3
- package/esm/input-number/index.d.ts +30 -17
- package/esm/input-number/index.js +116 -36
- package/esm/loading/index.d.ts +7 -2
- package/esm/loading/index.js +18 -24
- package/esm/loading/style/index.css +1 -1
- package/esm/loading/style/index.scss +0 -10
- package/esm/style.css +7 -23
- 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/guide/index.d.ts +4 -5
- package/lib/guide/index.js +4 -7
- package/lib/index.d.ts +3 -5
- package/lib/index.js +2 -30
- package/lib/input-number/index.d.ts +30 -17
- package/lib/input-number/index.js +116 -36
- package/lib/loading/index.d.ts +7 -2
- package/lib/loading/index.js +18 -25
- package/lib/loading/style/index.css +1 -1
- package/lib/loading/style/index.scss +0 -10
- package/lib/style.css +7 -23
- 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/esm/use-config/index.d.ts +0 -5
- package/esm/use-config/index.js +0 -13
- package/esm/use-config/style/index.css +0 -0
- package/esm/use-config/style/index.d.ts +0 -1
- package/esm/use-config/style/index.js +0 -1
- package/esm/use-config/style/index.scss +0 -0
- 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
- package/lib/use-config/index.d.ts +0 -5
- package/lib/use-config/index.js +0 -21
- package/lib/use-config/style/index.css +0 -0
- package/lib/use-config/style/index.d.ts +0 -1
- package/lib/use-config/style/index.js +0 -1
- package/lib/use-config/style/index.scss +0 -0
package/lib/guide/index.js
CHANGED
|
@@ -17,8 +17,6 @@ var _utils = require("@autobest-ui/utils");
|
|
|
17
17
|
|
|
18
18
|
var _portal = _interopRequireDefault(require("../portal"));
|
|
19
19
|
|
|
20
|
-
var _useConfig = _interopRequireDefault(require("../use-config"));
|
|
21
|
-
|
|
22
20
|
var _mask = _interopRequireDefault(require("../mask"));
|
|
23
21
|
|
|
24
22
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
@@ -116,7 +114,7 @@ function (_super) {
|
|
|
116
114
|
|
|
117
115
|
var _a = this.props,
|
|
118
116
|
loadablePointer = _a.loadablePointer,
|
|
119
|
-
|
|
117
|
+
imgSrc = _a.imgSrc,
|
|
120
118
|
position = _a.position,
|
|
121
119
|
visible = _a.visible,
|
|
122
120
|
translateX = _a.translateX,
|
|
@@ -124,7 +122,7 @@ function (_super) {
|
|
|
124
122
|
|
|
125
123
|
if (loadablePointer && visible) {
|
|
126
124
|
var image_1 = new Image();
|
|
127
|
-
image_1.src =
|
|
125
|
+
image_1.src = imgSrc;
|
|
128
126
|
|
|
129
127
|
image_1.onload = function () {
|
|
130
128
|
var element = _this.getElement();
|
|
@@ -171,7 +169,7 @@ function (_super) {
|
|
|
171
169
|
var _a = this.props,
|
|
172
170
|
visible = _a.visible,
|
|
173
171
|
loadablePointer = _a.loadablePointer,
|
|
174
|
-
|
|
172
|
+
imgSrc = _a.imgSrc;
|
|
175
173
|
var _b = this.state,
|
|
176
174
|
top = _b.top,
|
|
177
175
|
left = _b.left;
|
|
@@ -191,7 +189,7 @@ function (_super) {
|
|
|
191
189
|
}), loadablePointer ? _react.default.createElement("img", {
|
|
192
190
|
style: style,
|
|
193
191
|
className: cls + "-icon",
|
|
194
|
-
src:
|
|
192
|
+
src: imgSrc,
|
|
195
193
|
alt: "selection pointer",
|
|
196
194
|
ref: this.imgRef
|
|
197
195
|
}) : null));
|
|
@@ -223,7 +221,6 @@ function (_super) {
|
|
|
223
221
|
|
|
224
222
|
Guide.defaultProps = {
|
|
225
223
|
loadablePointer: false,
|
|
226
|
-
img: _useConfig.default.assetCommonUiUrl + "/images/vehicle_pointer.png",
|
|
227
224
|
position: 'center',
|
|
228
225
|
translateX: 0,
|
|
229
226
|
translateY: 0,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { default as UseConfig } from './use-config';
|
|
2
1
|
export type { AccordionProps } from './accordion';
|
|
3
2
|
export { default as Accordion } from './accordion';
|
|
4
3
|
export type { EllipsisProps, EllipsisLinesType } from './ellipsis';
|
|
@@ -11,8 +10,6 @@ export type { PopoverPlacement, PopoverTriggerType, PopoverProps } from './popov
|
|
|
11
10
|
export { default as Popover } from './popover';
|
|
12
11
|
export type { TooltipProps, TooltipPlacement, TooltipTriggerType } from './tooltip';
|
|
13
12
|
export { default as Tooltip } from './tooltip';
|
|
14
|
-
export type { IconProps } from './icon';
|
|
15
|
-
export { default as Icon } from './icon';
|
|
16
13
|
export type { SkeletonProps } from './skeleton';
|
|
17
14
|
export { default as Skeleton } from './skeleton';
|
|
18
15
|
export type { MoveProps } from './move';
|
|
@@ -26,7 +23,7 @@ export { default as Confirm } from './confirm';
|
|
|
26
23
|
export type { CollapseProps } from './collapse';
|
|
27
24
|
export { default as Collapse } from './collapse';
|
|
28
25
|
export type { CarouselProps } from './carousel';
|
|
29
|
-
export { default as Carousel
|
|
26
|
+
export { default as Carousel } from './carousel';
|
|
30
27
|
export type { GuideProps } from './guide';
|
|
31
28
|
export { default as Guide } from './guide';
|
|
32
29
|
export type { DrawerProps } from './drawer';
|
|
@@ -43,7 +40,8 @@ export type { ScriptAttributes, ScriptProps } from './script';
|
|
|
43
40
|
export { default as Script } from './script';
|
|
44
41
|
export type { MessageProps } from './message';
|
|
45
42
|
export { default as Message } from './message';
|
|
46
|
-
export type { TableProps } from './table';
|
|
43
|
+
export type { TableProps, TableRowSelectionInfo } from './table';
|
|
44
|
+
export type { TableColumnInfo, TableColumnOnRenderReturnObjectInfo } from './table/interface';
|
|
47
45
|
export { default as Table } from './table';
|
|
48
46
|
export type { DatePickerProps } from './date-picker';
|
|
49
47
|
export { default as DatePicker } from './date-picker';
|
package/lib/index.js
CHANGED
|
@@ -2,17 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
Object.defineProperty(exports, "UseConfig", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _useConfig.default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
8
|
Object.defineProperty(exports, "Accordion", {
|
|
17
9
|
enumerable: true,
|
|
18
10
|
get: function get() {
|
|
@@ -49,12 +41,6 @@ Object.defineProperty(exports, "Tooltip", {
|
|
|
49
41
|
return _tooltip.default;
|
|
50
42
|
}
|
|
51
43
|
});
|
|
52
|
-
Object.defineProperty(exports, "Icon", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function get() {
|
|
55
|
-
return _icon.default;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
44
|
Object.defineProperty(exports, "Skeleton", {
|
|
59
45
|
enumerable: true,
|
|
60
46
|
get: function get() {
|
|
@@ -97,12 +83,6 @@ Object.defineProperty(exports, "Carousel", {
|
|
|
97
83
|
return _carousel.default;
|
|
98
84
|
}
|
|
99
85
|
});
|
|
100
|
-
Object.defineProperty(exports, "CarouselDirection", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function get() {
|
|
103
|
-
return _carousel.CarouselDirection;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
86
|
Object.defineProperty(exports, "Guide", {
|
|
107
87
|
enumerable: true,
|
|
108
88
|
get: function get() {
|
|
@@ -194,8 +174,6 @@ Object.defineProperty(exports, "LoadingIcon", {
|
|
|
194
174
|
}
|
|
195
175
|
});
|
|
196
176
|
|
|
197
|
-
var _useConfig = _interopRequireDefault(require("./use-config"));
|
|
198
|
-
|
|
199
177
|
var _accordion = _interopRequireDefault(require("./accordion"));
|
|
200
178
|
|
|
201
179
|
var _ellipsis = _interopRequireDefault(require("./ellipsis"));
|
|
@@ -208,8 +186,6 @@ var _popover = _interopRequireDefault(require("./popover"));
|
|
|
208
186
|
|
|
209
187
|
var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
210
188
|
|
|
211
|
-
var _icon = _interopRequireDefault(require("./icon"));
|
|
212
|
-
|
|
213
189
|
var _skeleton = _interopRequireDefault(require("./skeleton"));
|
|
214
190
|
|
|
215
191
|
var _move = _interopRequireDefault(require("./move"));
|
|
@@ -222,7 +198,7 @@ var _confirm = _interopRequireDefault(require("./confirm"));
|
|
|
222
198
|
|
|
223
199
|
var _collapse = _interopRequireDefault(require("./collapse"));
|
|
224
200
|
|
|
225
|
-
var _carousel =
|
|
201
|
+
var _carousel = _interopRequireDefault(require("./carousel"));
|
|
226
202
|
|
|
227
203
|
var _guide = _interopRequireDefault(require("./guide"));
|
|
228
204
|
|
|
@@ -252,8 +228,4 @@ var _loadingContainer = _interopRequireDefault(require("./loading-container"));
|
|
|
252
228
|
|
|
253
229
|
var _loadingBar = _interopRequireDefault(require("./loading-bar"));
|
|
254
230
|
|
|
255
|
-
var _loadingIcon = _interopRequireDefault(require("./loading-icon"));
|
|
256
|
-
|
|
257
|
-
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); }
|
|
258
|
-
|
|
259
|
-
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; }
|
|
231
|
+
var _loadingIcon = _interopRequireDefault(require("./loading-icon"));
|
|
@@ -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;
|
|
@@ -55,7 +55,7 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
55
55
|
return __assign.apply(this, arguments);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
var cls = 'ab-input-number';
|
|
58
|
+
var cls = 'ab-input-number'; // TODO: 重构组件
|
|
59
59
|
|
|
60
60
|
var InputNumber =
|
|
61
61
|
/** @class */
|
|
@@ -317,6 +317,19 @@ function (_super) {
|
|
|
317
317
|
return ceilNumber;
|
|
318
318
|
};
|
|
319
319
|
|
|
320
|
+
_this.getPadDigitalValue = function (value) {
|
|
321
|
+
var _a = _this.props,
|
|
322
|
+
digital = _a.digital,
|
|
323
|
+
padDigital = _a.padDigital;
|
|
324
|
+
|
|
325
|
+
if (!padDigital || (0, _utils.isBlank)(value) || !digital) {
|
|
326
|
+
return value;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
var resultArr = value.split('.');
|
|
330
|
+
return resultArr[0] + "." + (resultArr[1] || '').padEnd(digital, '0');
|
|
331
|
+
};
|
|
332
|
+
|
|
320
333
|
_this.onChangePackMultipleValue = function (value) {
|
|
321
334
|
var currentValue = _this.getCurrentValue(value).toString();
|
|
322
335
|
|
|
@@ -331,60 +344,97 @@ function (_super) {
|
|
|
331
344
|
}
|
|
332
345
|
};
|
|
333
346
|
|
|
334
|
-
_this.
|
|
335
|
-
|
|
336
|
-
|
|
347
|
+
_this.onPadDigital = function (value) {
|
|
348
|
+
var currentValue = _this.getPadDigitalValue(value);
|
|
349
|
+
|
|
350
|
+
var _a = _this.props,
|
|
351
|
+
onChange = _a.onChange,
|
|
352
|
+
name = _a.name;
|
|
353
|
+
|
|
354
|
+
if (value !== currentValue) {
|
|
355
|
+
onChange(currentValue, name);
|
|
337
356
|
}
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
_this.getPadDigitalDebounce = function () {
|
|
360
|
+
if (_this.padDigitalDebounce) {
|
|
361
|
+
return _this.padDigitalDebounce;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
_this.padDigitalDebounce = (0, _utils.debounce)(_this.onPadDigital, _this.props.delay);
|
|
365
|
+
return _this.padDigitalDebounce;
|
|
366
|
+
};
|
|
338
367
|
|
|
339
|
-
|
|
340
|
-
|
|
368
|
+
_this.getChangePackMultipleValueDebounce = function () {
|
|
369
|
+
if (_this.changePackMultipleValueDebounce) {
|
|
370
|
+
return _this.changePackMultipleValueDebounce;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
_this.changePackMultipleValueDebounce = (0, _utils.debounce)(_this.onChangePackMultipleValue, _this.props.delay);
|
|
374
|
+
return _this.changePackMultipleValueDebounce;
|
|
341
375
|
};
|
|
342
376
|
|
|
343
|
-
_this.callback = function (value) {
|
|
377
|
+
_this.callback = function (value, ignoreDelay) {
|
|
344
378
|
var _a = _this.props,
|
|
345
379
|
name = _a.name,
|
|
346
380
|
onChange = _a.onChange,
|
|
347
|
-
onChangePackMultipleBefore = _a.onChangePackMultipleBefore
|
|
348
|
-
|
|
381
|
+
onChangePackMultipleBefore = _a.onChangePackMultipleBefore,
|
|
382
|
+
packMultiple = _a.packMultiple,
|
|
383
|
+
padDigital = _a.padDigital;
|
|
349
384
|
|
|
350
|
-
if (onChange) {
|
|
385
|
+
if (onChange && value !== _this.props.value) {
|
|
351
386
|
onChange(value, name);
|
|
352
387
|
}
|
|
353
388
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if (!(0, _utils.isBlank)(packMultiple) && !(0, _utils.isBlank)(value) && valueNumber % packMultiple !== 0) {
|
|
389
|
+
if (packMultiple && !(0, _utils.isBlank)(value) && parseFloat(value) % packMultiple !== 0) {
|
|
357
390
|
if (onChangePackMultipleBefore) {
|
|
358
391
|
onChangePackMultipleBefore(value, name);
|
|
359
392
|
}
|
|
360
393
|
|
|
361
|
-
|
|
394
|
+
if (ignoreDelay) {
|
|
395
|
+
_this.onChangePackMultipleValue(value);
|
|
396
|
+
} else {
|
|
397
|
+
_this.getChangePackMultipleValueDebounce()(value);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (padDigital) {
|
|
404
|
+
if (ignoreDelay) {
|
|
405
|
+
_this.onPadDigital(value);
|
|
406
|
+
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
_this.getPadDigitalDebounce()(value);
|
|
362
411
|
}
|
|
363
412
|
};
|
|
364
413
|
|
|
365
|
-
_this.onValueChange = function (ev) {
|
|
366
|
-
if (_this.
|
|
367
|
-
_this.
|
|
414
|
+
_this.onValueChange = function (ev, ignoreDelay) {
|
|
415
|
+
if (_this.changePackMultipleValueDebounce) {
|
|
416
|
+
_this.changePackMultipleValueDebounce.cancel();
|
|
368
417
|
}
|
|
369
418
|
|
|
370
419
|
var _a = _this.props,
|
|
371
420
|
min = _a.min,
|
|
372
421
|
max = _a.max,
|
|
373
|
-
|
|
422
|
+
digital = _a.digital,
|
|
374
423
|
value = _a.value;
|
|
375
|
-
var currentValue = ev.target.value.toString();
|
|
424
|
+
var currentValue = ev.target.value.toString(); // 输入为空
|
|
376
425
|
|
|
377
426
|
if ((0, _utils.isBlank)(currentValue)) {
|
|
378
|
-
_this.callback('');
|
|
427
|
+
_this.callback('', ignoreDelay);
|
|
379
428
|
|
|
380
429
|
return;
|
|
381
430
|
}
|
|
382
431
|
|
|
383
|
-
var preValue = value.toString();
|
|
432
|
+
var preValue = value.toString(); // 输入的不是数字格式
|
|
433
|
+
|
|
384
434
|
var reg = /^-$|(^(-?\d+)(\.\d*)?)$/;
|
|
385
435
|
|
|
386
436
|
if (!reg.test(currentValue)) {
|
|
387
|
-
_this.callback(preValue);
|
|
437
|
+
_this.callback(preValue, ignoreDelay);
|
|
388
438
|
|
|
389
439
|
return;
|
|
390
440
|
} // 0开头后面直接是数字,没有点如:011, 这是不合法的
|
|
@@ -393,41 +443,59 @@ function (_super) {
|
|
|
393
443
|
var zeroReg = /^0\d+$/;
|
|
394
444
|
|
|
395
445
|
if (zeroReg.test(currentValue)) {
|
|
396
|
-
_this.callback(preValue);
|
|
446
|
+
_this.callback(preValue, ignoreDelay);
|
|
397
447
|
|
|
398
448
|
return;
|
|
449
|
+
} // 小数位数限制
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
if (digital) {
|
|
453
|
+
currentValue = new RegExp("[^.]+([.](\\d{0," + digital + "}))?").exec(currentValue)[0].toString();
|
|
399
454
|
}
|
|
400
455
|
|
|
401
456
|
var valueNumber = parseFloat(currentValue);
|
|
402
457
|
|
|
403
458
|
if (!(0, _utils.isBlank)(min)) {
|
|
404
459
|
if (min > valueNumber) {
|
|
405
|
-
_this.callback(preValue);
|
|
460
|
+
_this.callback(preValue, ignoreDelay);
|
|
406
461
|
|
|
407
462
|
return;
|
|
408
463
|
} // 如果min>= 0, 将阻止输入-
|
|
409
464
|
|
|
410
465
|
|
|
411
466
|
if (min >= 0 && currentValue.indexOf('-') > -1) {
|
|
412
|
-
_this.callback('');
|
|
467
|
+
_this.callback('', ignoreDelay);
|
|
413
468
|
|
|
414
469
|
return;
|
|
415
470
|
}
|
|
416
471
|
}
|
|
417
472
|
|
|
418
473
|
if (!(0, _utils.isBlank)(max) && max < valueNumber) {
|
|
419
|
-
_this.callback(preValue);
|
|
474
|
+
_this.callback(preValue, ignoreDelay);
|
|
420
475
|
|
|
421
476
|
return;
|
|
422
477
|
}
|
|
423
478
|
|
|
424
|
-
if (
|
|
425
|
-
_this.callback(preValue);
|
|
479
|
+
if (!digital && currentValue.indexOf('.') > -1) {
|
|
480
|
+
_this.callback(preValue, ignoreDelay);
|
|
426
481
|
|
|
427
482
|
return;
|
|
428
483
|
}
|
|
429
484
|
|
|
430
|
-
_this.callback(currentValue);
|
|
485
|
+
_this.callback(currentValue, ignoreDelay);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
_this.getValueCalculate = function (value, offset) {
|
|
489
|
+
var valueStr = value.toString();
|
|
490
|
+
var offsetStr = offset.toString();
|
|
491
|
+
|
|
492
|
+
if (valueStr.indexOf('.') < 0 && offsetStr.indexOf('.') < 0) {
|
|
493
|
+
return value + offset;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
var digital = _this.props.digital;
|
|
497
|
+
var powValue = Math.pow(10, digital);
|
|
498
|
+
return Math.round((value + offset) * powValue) / powValue;
|
|
431
499
|
};
|
|
432
500
|
|
|
433
501
|
_this.onAdd = function () {
|
|
@@ -438,7 +506,7 @@ function (_super) {
|
|
|
438
506
|
|
|
439
507
|
var ev = {
|
|
440
508
|
target: {
|
|
441
|
-
value: (
|
|
509
|
+
value: _this.getPadDigitalValue(_this.getValueCalculate(Number(value), step).toString())
|
|
442
510
|
}
|
|
443
511
|
};
|
|
444
512
|
|
|
@@ -452,7 +520,7 @@ function (_super) {
|
|
|
452
520
|
var step = packMultiple || 1;
|
|
453
521
|
var ev = {
|
|
454
522
|
target: {
|
|
455
|
-
value: (
|
|
523
|
+
value: _this.getPadDigitalValue(_this.getValueCalculate(Number(value), step * -1).toString())
|
|
456
524
|
}
|
|
457
525
|
};
|
|
458
526
|
|
|
@@ -485,6 +553,11 @@ function (_super) {
|
|
|
485
553
|
|
|
486
554
|
InputNumber.prototype.componentDidMount = function () {
|
|
487
555
|
this.addMouseMoveListener();
|
|
556
|
+
this.onValueChange({
|
|
557
|
+
target: {
|
|
558
|
+
value: this.props.value
|
|
559
|
+
}
|
|
560
|
+
}, true);
|
|
488
561
|
};
|
|
489
562
|
|
|
490
563
|
InputNumber.prototype.componentWillUnmount = function () {
|
|
@@ -498,9 +571,14 @@ function (_super) {
|
|
|
498
571
|
this.mouseMoveHandler = null;
|
|
499
572
|
}
|
|
500
573
|
|
|
501
|
-
if (this.
|
|
502
|
-
this.
|
|
503
|
-
this.
|
|
574
|
+
if (this.padDigitalDebounce) {
|
|
575
|
+
this.padDigitalDebounce.cancel();
|
|
576
|
+
this.padDigitalDebounce = null;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (this.changePackMultipleValueDebounce) {
|
|
580
|
+
this.changePackMultipleValueDebounce.cancel();
|
|
581
|
+
this.changePackMultipleValueDebounce = null;
|
|
504
582
|
}
|
|
505
583
|
};
|
|
506
584
|
|
|
@@ -509,7 +587,8 @@ function (_super) {
|
|
|
509
587
|
|
|
510
588
|
delete copyProps.onChangePackMultipleBefore;
|
|
511
589
|
delete copyProps.onChangePackMultipleAfter;
|
|
512
|
-
delete copyProps.
|
|
590
|
+
delete copyProps.digital;
|
|
591
|
+
delete copyProps.padDigital;
|
|
513
592
|
delete copyProps.packMultiple;
|
|
514
593
|
delete copyProps.visibleButton;
|
|
515
594
|
delete copyProps.onChange;
|
|
@@ -551,7 +630,8 @@ function (_super) {
|
|
|
551
630
|
name: '',
|
|
552
631
|
size: 3,
|
|
553
632
|
disabled: false,
|
|
554
|
-
|
|
633
|
+
digital: 0,
|
|
634
|
+
padDigital: false,
|
|
555
635
|
delay: 1000,
|
|
556
636
|
visibleButton: false
|
|
557
637
|
};
|
package/lib/loading/index.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export interface LoadingProps {
|
|
2
3
|
/**
|
|
3
|
-
* loading
|
|
4
|
+
* loading 样式
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* 自定义loading, 需要补全自定义元素样式
|
|
9
|
+
*/
|
|
10
|
+
customIcon?: React.ReactElement;
|
|
6
11
|
/**
|
|
7
12
|
* loading开始后自动隐藏的时间,单位:毫秒
|
|
8
13
|
*/
|
package/lib/loading/index.js
CHANGED
|
@@ -15,8 +15,6 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
15
15
|
|
|
16
16
|
var _utils = require("@autobest-ui/utils");
|
|
17
17
|
|
|
18
|
-
var _useConfig = _interopRequireDefault(require("../use-config"));
|
|
19
|
-
|
|
20
18
|
var _loadingIcon = _interopRequireDefault(require("../loading-icon"));
|
|
21
19
|
|
|
22
20
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
@@ -39,18 +37,13 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
39
37
|
var loadingElement = null;
|
|
40
38
|
var loadingTimer = null;
|
|
41
39
|
var closeTimer = null;
|
|
40
|
+
var prevCustomIcon = null;
|
|
42
41
|
var cls = 'ab-loading';
|
|
43
42
|
|
|
44
|
-
function getLoadingContainer(
|
|
45
|
-
var _a;
|
|
46
|
-
|
|
43
|
+
function getLoadingContainer(customIcon, className) {
|
|
47
44
|
return _react.default.createElement("div", {
|
|
48
|
-
className: (0, _classnames.default)(cls + "-wrap",
|
|
49
|
-
},
|
|
50
|
-
className: cls + "-content",
|
|
51
|
-
src: _useConfig.default.assetCommonUiUrl + "/images/p_loading_rect.gif",
|
|
52
|
-
alt: "loading..."
|
|
53
|
-
}) : _react.default.createElement(_loadingIcon.default, {
|
|
45
|
+
className: (0, _classnames.default)(cls + "-wrap", className)
|
|
46
|
+
}, customIcon || _react.default.createElement(_loadingIcon.default, {
|
|
54
47
|
className: cls + "-content"
|
|
55
48
|
}));
|
|
56
49
|
} // openIds 容器
|
|
@@ -59,13 +52,12 @@ function getLoadingContainer(isRectLoading) {
|
|
|
59
52
|
var openIds = []; // closeIds 容器
|
|
60
53
|
|
|
61
54
|
var closeIds = [];
|
|
62
|
-
var prevIsRectLoading = false;
|
|
63
55
|
|
|
64
|
-
function createLoading(
|
|
56
|
+
function createLoading(customIcon, className) {
|
|
65
57
|
loadingElement = document.createElement('div');
|
|
66
58
|
document.body.appendChild(loadingElement);
|
|
67
59
|
|
|
68
|
-
_reactDom.default.render(getLoadingContainer(
|
|
60
|
+
_reactDom.default.render(getLoadingContainer(customIcon, className), loadingElement);
|
|
69
61
|
}
|
|
70
62
|
|
|
71
63
|
var Loading =
|
|
@@ -79,24 +71,25 @@ function () {
|
|
|
79
71
|
}
|
|
80
72
|
|
|
81
73
|
config = __assign({
|
|
82
|
-
isRectLoading: false,
|
|
83
74
|
expire: 0
|
|
84
|
-
}, config); //
|
|
75
|
+
}, config); // 防止重复创建或自定义loading icon,重新创建
|
|
85
76
|
|
|
86
77
|
if (!loadingElement) {
|
|
87
|
-
createLoading(config.
|
|
88
|
-
} else if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
createLoading(config.customIcon, config.className);
|
|
79
|
+
} else if (config.customIcon || config.customIcon !== prevCustomIcon) {
|
|
80
|
+
if (loadingElement) {
|
|
81
|
+
try {
|
|
82
|
+
document.body.removeChild(loadingElement);
|
|
83
|
+
loadingElement = null;
|
|
84
|
+
} catch (e) {}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
createLoading(config.customIcon, config.className);
|
|
95
88
|
} else {
|
|
96
89
|
loadingElement.style.display = 'block';
|
|
97
90
|
}
|
|
98
91
|
|
|
99
|
-
|
|
92
|
+
prevCustomIcon = config.customIcon; // 如果配置中有expire且大于0
|
|
100
93
|
// 将会在到达时间后自动关闭,不用手动再关闭(不需要再close())
|
|
101
94
|
|
|
102
95
|
if (config.expire > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-loading-wrap{position:fixed;top:0;left:0;z-index:9999;background-color:rgba(255,255,255,.7);height:100%;width:100%}.ab-loading-wrap .ab-loading-content{position:absolute;left:50%;top:50%;display:block;width:.31rem;height:.31rem;transform:translate3d(-50%,-50%,0)}
|
|
1
|
+
.ab-loading-wrap{position:fixed;top:0;left:0;z-index:9999;background-color:rgba(255,255,255,.7);height:100%;width:100%}.ab-loading-wrap .ab-loading-content{position:absolute;left:50%;top:50%;display:block;width:.31rem;height:.31rem;transform:translate3d(-50%,-50%,0)}
|
|
@@ -18,14 +18,4 @@ $namespace: ab-loading;
|
|
|
18
18
|
height: .31rem;
|
|
19
19
|
transform: translate3d(-50%, -50%, 0);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
&.#{$namespace}-rect-loading {
|
|
23
|
-
background-color: rgba(#000, .7);
|
|
24
|
-
|
|
25
|
-
.#{$namespace}-content {
|
|
26
|
-
top: 10%;
|
|
27
|
-
width: 1.6rem;
|
|
28
|
-
height: .24rem;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
21
|
}
|