@autobest-ui/components 1.1.2 → 1.1.9

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.
Files changed (126) hide show
  1. package/README.md +10 -10
  2. package/esm/accordion/__stories__/style.scss +58 -58
  3. package/esm/affix/__stories__/style.scss +13 -13
  4. package/esm/affix/style/index.scss +34 -34
  5. package/esm/base.scss +42 -42
  6. package/esm/carousel/__stories__/style.scss +41 -41
  7. package/esm/carousel/style/index.scss +37 -37
  8. package/esm/checkbox/style/index.scss +117 -117
  9. package/esm/collapse/__stories__/style.scss +18 -18
  10. package/esm/collapse/style/index.scss +42 -42
  11. package/esm/confirm/style/index.scss +44 -44
  12. package/esm/date-picker/calendar/grid/index.scss +85 -85
  13. package/esm/date-picker/calendar/index.scss +57 -57
  14. package/esm/date-picker/index.d.ts +1 -0
  15. package/esm/date-picker/index.js +17 -7
  16. package/esm/date-picker/style/index.css +1 -1
  17. package/esm/date-picker/style/index.scss +23 -19
  18. package/esm/drawer/style/index.scss +44 -44
  19. package/esm/ellipsis/style/index.scss +35 -35
  20. package/esm/guide/__stories__/style.scss +13 -13
  21. package/esm/guide/style/index.scss +17 -17
  22. package/esm/icon/__stories__/style.scss +39 -39
  23. package/esm/icon/style/index.scss +6 -6
  24. package/esm/index.d.ts +2 -1
  25. package/esm/input-number/index.d.ts +30 -17
  26. package/esm/input-number/index.js +116 -36
  27. package/esm/input-number/style/index.scss +86 -86
  28. package/esm/lazy-image/__stories__/style.scss +9 -9
  29. package/esm/lazy-image/style/index.scss +24 -24
  30. package/esm/link-list/style/index.scss +125 -125
  31. package/esm/loading/style/index.scss +30 -30
  32. package/esm/loading-bar/style/index.scss +62 -62
  33. package/esm/loading-container/__stories__/style.scss +5 -5
  34. package/esm/loading-container/style/index.scss +27 -27
  35. package/esm/loading-icon/style/index.scss +23 -23
  36. package/esm/mask/style/index.scss +34 -34
  37. package/esm/message/style/index.scss +70 -70
  38. package/esm/modal/style/index.scss +112 -112
  39. package/esm/move/__stories__/style.scss +6 -6
  40. package/esm/move/style/index.scss +7 -7
  41. package/esm/popover/__stories__/style.scss +15 -15
  42. package/esm/popover/style/index.scss +59 -59
  43. package/esm/select/__stories__/style.scss +8 -8
  44. package/esm/select/style/index.scss +126 -126
  45. package/esm/show-more/style/index.scss +22 -22
  46. package/esm/skeleton/__stories__/style.scss +2 -2
  47. package/esm/skeleton/style/index.scss +26 -26
  48. package/esm/style.css +16 -16
  49. package/esm/table/__stories__/style.scss +33 -33
  50. package/esm/table/body/BodyRow.d.ts +9 -3
  51. package/esm/table/body/BodyRow.js +6 -2
  52. package/esm/table/body/index.d.ts +2 -2
  53. package/esm/table/body/index.js +8 -7
  54. package/esm/table/header/HeaderCell.d.ts +2 -2
  55. package/esm/table/header/HeaderRow.d.ts +2 -2
  56. package/esm/table/index.d.ts +4 -4
  57. package/esm/table/index.js +3 -3
  58. package/esm/table/interface.d.ts +9 -3
  59. package/esm/table/style/index.scss +51 -51
  60. package/esm/tabs/__stories__/style.scss +8 -8
  61. package/esm/tabs/style/index.scss +62 -62
  62. package/esm/tooltip/style/index.scss +61 -61
  63. package/esm/trigger/style/index.scss +79 -79
  64. package/lib/accordion/__stories__/style.scss +58 -58
  65. package/lib/affix/__stories__/style.scss +13 -13
  66. package/lib/affix/style/index.scss +34 -34
  67. package/lib/base.scss +42 -42
  68. package/lib/carousel/__stories__/style.scss +41 -41
  69. package/lib/carousel/style/index.scss +37 -37
  70. package/lib/checkbox/style/index.scss +117 -117
  71. package/lib/collapse/__stories__/style.scss +18 -18
  72. package/lib/collapse/style/index.scss +42 -42
  73. package/lib/confirm/style/index.scss +44 -44
  74. package/lib/date-picker/calendar/grid/index.scss +85 -85
  75. package/lib/date-picker/calendar/index.scss +57 -57
  76. package/lib/date-picker/index.d.ts +1 -0
  77. package/lib/date-picker/index.js +17 -7
  78. package/lib/date-picker/style/index.css +1 -1
  79. package/lib/date-picker/style/index.scss +23 -19
  80. package/lib/drawer/style/index.scss +44 -44
  81. package/lib/ellipsis/style/index.scss +35 -35
  82. package/lib/guide/__stories__/style.scss +13 -13
  83. package/lib/guide/style/index.scss +17 -17
  84. package/lib/icon/__stories__/style.scss +39 -39
  85. package/lib/icon/style/index.scss +6 -6
  86. package/lib/index.d.ts +2 -1
  87. package/lib/input-number/index.d.ts +30 -17
  88. package/lib/input-number/index.js +116 -36
  89. package/lib/input-number/style/index.scss +86 -86
  90. package/lib/lazy-image/__stories__/style.scss +9 -9
  91. package/lib/lazy-image/style/index.scss +24 -24
  92. package/lib/link-list/style/index.scss +125 -125
  93. package/lib/loading/style/index.scss +30 -30
  94. package/lib/loading-bar/style/index.scss +62 -62
  95. package/lib/loading-container/__stories__/style.scss +5 -5
  96. package/lib/loading-container/style/index.scss +27 -27
  97. package/lib/loading-icon/style/index.scss +23 -23
  98. package/lib/mask/style/index.scss +34 -34
  99. package/lib/message/style/index.scss +70 -70
  100. package/lib/modal/style/index.scss +112 -112
  101. package/lib/move/__stories__/style.scss +6 -6
  102. package/lib/move/style/index.scss +7 -7
  103. package/lib/popover/__stories__/style.scss +15 -15
  104. package/lib/popover/style/index.scss +59 -59
  105. package/lib/select/__stories__/style.scss +8 -8
  106. package/lib/select/style/index.scss +126 -126
  107. package/lib/show-more/style/index.scss +22 -22
  108. package/lib/skeleton/__stories__/style.scss +2 -2
  109. package/lib/skeleton/style/index.scss +26 -26
  110. package/lib/style.css +16 -16
  111. package/lib/table/__stories__/style.scss +33 -33
  112. package/lib/table/body/BodyRow.d.ts +9 -3
  113. package/lib/table/body/BodyRow.js +6 -2
  114. package/lib/table/body/index.d.ts +2 -2
  115. package/lib/table/body/index.js +8 -7
  116. package/lib/table/header/HeaderCell.d.ts +2 -2
  117. package/lib/table/header/HeaderRow.d.ts +2 -2
  118. package/lib/table/index.d.ts +4 -4
  119. package/lib/table/index.js +3 -3
  120. package/lib/table/interface.d.ts +9 -3
  121. package/lib/table/style/index.scss +51 -51
  122. package/lib/tabs/__stories__/style.scss +8 -8
  123. package/lib/tabs/style/index.scss +62 -62
  124. package/lib/tooltip/style/index.scss +61 -61
  125. package/lib/trigger/style/index.scss +79 -79
  126. package/package.json +2 -2
@@ -1,35 +1,35 @@
1
- $namespace: ab-ellipsis;
2
-
3
- $lines: (1) (2) (3) (4) (5);
4
- @mixin generateLines($type) {
5
- @each $val in $lines {
6
- &.#{$namespace}#{$type}#{$val} {
7
- -webkit-line-clamp: $val;
8
- }
9
- }
10
- }
11
-
12
- @mixin clearLines($type) {
13
- @each $val in $lines {
14
- &.#{$namespace}#{$type}#{$val} {
15
- -webkit-line-clamp: unset;
16
- }
17
- }
18
- }
19
-
20
- .#{$namespace} {
21
- overflow: hidden;
22
- display: block;
23
- display: -webkit-box;
24
- -webkit-box-orient: vertical;
25
-
26
- @include generateLines('-line');
27
- }
28
-
29
-
30
- @media only screen and (max-width: 767px) {
31
- .#{$namespace} {
32
- @include clearLines('-line');
33
- @include generateLines('-m-line');
34
- }
35
- }
1
+ $namespace: ab-ellipsis;
2
+
3
+ $lines: (1) (2) (3) (4) (5);
4
+ @mixin generateLines($type) {
5
+ @each $val in $lines {
6
+ &.#{$namespace}#{$type}#{$val} {
7
+ -webkit-line-clamp: $val;
8
+ }
9
+ }
10
+ }
11
+
12
+ @mixin clearLines($type) {
13
+ @each $val in $lines {
14
+ &.#{$namespace}#{$type}#{$val} {
15
+ -webkit-line-clamp: unset;
16
+ }
17
+ }
18
+ }
19
+
20
+ .#{$namespace} {
21
+ overflow: hidden;
22
+ display: block;
23
+ display: -webkit-box;
24
+ -webkit-box-orient: vertical;
25
+
26
+ @include generateLines('-line');
27
+ }
28
+
29
+
30
+ @media only screen and (max-width: 767px) {
31
+ .#{$namespace} {
32
+ @include clearLines('-line');
33
+ @include generateLines('-m-line');
34
+ }
35
+ }
@@ -1,14 +1,14 @@
1
- .guide-demo {
2
- .input {
3
- width: 3rem;
4
- }
5
-
6
- .btn {
7
- display: block;
8
- margin-top: .2rem;
9
- width: .8rem;
10
- height: .3rem;
11
- font-size: .16rem;
12
- text-align: center;
13
- }
1
+ .guide-demo {
2
+ .input {
3
+ width: 3rem;
4
+ }
5
+
6
+ .btn {
7
+ display: block;
8
+ margin-top: .2rem;
9
+ width: .8rem;
10
+ height: .3rem;
11
+ font-size: .16rem;
12
+ text-align: center;
13
+ }
14
14
  }
@@ -1,18 +1,18 @@
1
- $namespace: ab-guide;
2
-
3
- .#{$namespace} {
4
- &-mask.ab-mask {
5
- background-color: rgba(0, 0, 0, .7);
6
- z-index: 4;
7
- }
8
-
9
- &-icon {
10
- position: absolute;
11
- z-index: 5;
12
- }
13
-
14
- &-content {
15
- position: relative;
16
- z-index: 6;
17
- }
1
+ $namespace: ab-guide;
2
+
3
+ .#{$namespace} {
4
+ &-mask.ab-mask {
5
+ background-color: rgba(0, 0, 0, .7);
6
+ z-index: 4;
7
+ }
8
+
9
+ &-icon {
10
+ position: absolute;
11
+ z-index: 5;
12
+ }
13
+
14
+ &-content {
15
+ position: relative;
16
+ z-index: 6;
17
+ }
18
18
  }
@@ -1,40 +1,40 @@
1
- .demo-icon-list{
2
- padding: .2rem .1rem;
3
- font-size: .12rem;
4
- display: flex;
5
- width: 100%;
6
- flex-wrap: wrap;
7
-
8
- & > li {
9
- padding: .1rem;
10
- border: 1px solid #E0E0E0;
11
- margin: .05rem;
12
- display: flex;
13
- flex-direction: column;
14
- justify-content: center;
15
- align-items: center;
16
- background-color: #F3F4F6;
17
- min-width: 1.2rem;
18
- min-height: 1.5rem;
19
-
20
- svg {
21
- max-width: .5rem;
22
- height: .5rem;
23
- }
24
-
25
- p {
26
- padding: 0 5px;
27
- text-align: center;
28
- width: 1rem;
29
- word-break: break-all;
30
- }
31
-
32
- &:hover{
33
- background-color: #E5E7EB;
34
- }
35
- }
36
-
37
- .demo-icon-name{
38
- padding-top: .15rem;
39
- }
1
+ .demo-icon-list{
2
+ padding: .2rem .1rem;
3
+ font-size: .12rem;
4
+ display: flex;
5
+ width: 100%;
6
+ flex-wrap: wrap;
7
+
8
+ & > li {
9
+ padding: .1rem;
10
+ border: 1px solid #E0E0E0;
11
+ margin: .05rem;
12
+ display: flex;
13
+ flex-direction: column;
14
+ justify-content: center;
15
+ align-items: center;
16
+ background-color: #F3F4F6;
17
+ min-width: 1.2rem;
18
+ min-height: 1.5rem;
19
+
20
+ svg {
21
+ max-width: .5rem;
22
+ height: .5rem;
23
+ }
24
+
25
+ p {
26
+ padding: 0 5px;
27
+ text-align: center;
28
+ width: 1rem;
29
+ word-break: break-all;
30
+ }
31
+
32
+ &:hover{
33
+ background-color: #E5E7EB;
34
+ }
35
+ }
36
+
37
+ .demo-icon-name{
38
+ padding-top: .15rem;
39
+ }
40
40
  }
@@ -1,7 +1,7 @@
1
- $namespace: ab-icon;
2
-
3
- .#{$namespace}{
4
- &, span, div, svg{
5
- display: block;
6
- }
1
+ $namespace: ab-icon;
2
+
3
+ .#{$namespace}{
4
+ &, span, div, svg{
5
+ display: block;
6
+ }
7
7
  }
package/lib/index.d.ts CHANGED
@@ -43,7 +43,8 @@ export type { ScriptAttributes, ScriptProps } from './script';
43
43
  export { default as Script } from './script';
44
44
  export type { MessageProps } from './message';
45
45
  export { default as Message } from './message';
46
- export type { TableProps } from './table';
46
+ export type { TableProps, TableRowSelectionInfo } from './table';
47
+ export type { TableColumnInfo, TableColumnOnRenderReturnObjectInfo } from './table/interface';
47
48
  export { default as Table } from './table';
48
49
  export type { DatePickerProps } from './date-picker';
49
50
  export { default as DatePicker } from './date-picker';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { AddListenerEventHandler } from '@autobest-ui/utils';
3
- interface OnchangeHandler {
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: OnchangeHandler;
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
- isPositive?: boolean;
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?: OnchangeHandler;
64
+ onChangePackMultipleBefore?: OnChangeHandler;
60
65
  /**
61
66
  * packMultiple 有值时,判断后的回调函数
62
67
  */
63
- onChangePackMultipleAfter?: OnchangeHandler;
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
- isPositive: boolean;
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
- debounce: DebounceRef;
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
- getDebounce: () => DebounceRef;
125
- callback: (value: string) => void;
126
- onValueChange: (ev: ChangeEvent) => void;
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.getDebounce = function () {
335
- if (_this.debounce) {
336
- return _this.debounce;
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
- _this.debounce = (0, _utils.debounce)(_this.onChangePackMultipleValue, _this.props.delay);
340
- return _this.debounce;
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
- var packMultiple = _this.props.packMultiple || 1;
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
- var valueNumber = parseFloat(value);
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
- _this.getDebounce()(value);
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.debounce) {
367
- _this.debounce.cancel();
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
- isPositive = _a.isPositive,
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 (isPositive && currentValue.indexOf('.') > -1) {
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: (parseFloat(value.toString()) || 0) + step
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: (parseFloat(value.toString()) || 0) - step
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.debounce) {
502
- this.debounce.cancel();
503
- this.debounce = null;
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.isPositive;
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
- isPositive: true,
633
+ digital: 0,
634
+ padDigital: false,
555
635
  delay: 1000,
556
636
  visibleButton: false
557
637
  };