@autobest-ui/components 2.3.0 → 2.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.
Files changed (141) hide show
  1. package/esm/accordion/Item.js +6 -23
  2. package/esm/accordion/index.js +8 -36
  3. package/esm/affix/PortalAffix.js +7 -11
  4. package/esm/affix/index.js +30 -70
  5. package/esm/carousel/index.js +45 -141
  6. package/esm/checkbox/index.js +12 -37
  7. package/esm/collapse/index.js +11 -49
  8. package/esm/confirm/index.d.ts +8 -0
  9. package/esm/confirm/index.js +23 -31
  10. package/esm/date-picker/DateEnum.js +0 -3
  11. package/esm/date-picker/calendar/Day.js +62 -78
  12. package/esm/date-picker/calendar/MonthYear.js +20 -53
  13. package/esm/date-picker/calendar/grid/index.js +7 -12
  14. package/esm/date-picker/calendar/index.js +4 -31
  15. package/esm/date-picker/index.js +11 -51
  16. package/esm/date-picker/utils.js +6 -11
  17. package/esm/drawer/Child.js +10 -20
  18. package/esm/drawer/index.js +22 -71
  19. package/esm/ellipsis/index.js +9 -17
  20. package/esm/guide/index.js +25 -63
  21. package/esm/index.d.ts +2 -2
  22. package/esm/index.js +1 -1
  23. package/esm/input-number/ControlArrow.js +0 -2
  24. package/esm/input-number/constants.js +2 -2
  25. package/esm/input-number/index.js +26 -106
  26. package/esm/lazy-image/index.js +10 -55
  27. package/esm/link-list/index.js +11 -35
  28. package/esm/loading/index.js +15 -42
  29. package/esm/loading-container/index.js +3 -6
  30. package/esm/loading-icon/index.js +0 -2
  31. package/esm/mask/index.js +6 -9
  32. package/esm/message/index.d.ts +44 -7
  33. package/esm/message/index.js +96 -111
  34. package/esm/message/renderMessage.d.ts +17 -0
  35. package/esm/message/renderMessage.js +137 -0
  36. package/esm/message/style/index.css +1 -1
  37. package/esm/modal/Title.js +5 -12
  38. package/esm/modal/getPopupLocation.js +5 -7
  39. package/esm/modal/index.js +44 -125
  40. package/esm/move/index.js +32 -132
  41. package/esm/move/range.js +6 -12
  42. package/esm/move/utils.js +3 -10
  43. package/esm/popover/index.js +9 -28
  44. package/esm/portal/index.js +1 -22
  45. package/esm/script/index.js +19 -59
  46. package/esm/select/index.js +28 -106
  47. package/esm/show-more/index.js +40 -103
  48. package/esm/skeleton/Item.js +1 -3
  49. package/esm/skeleton/index.js +5 -11
  50. package/esm/style.css +1 -1
  51. package/esm/table/body/BodyRow.js +11 -28
  52. package/esm/table/body/CheckIcon.js +10 -18
  53. package/esm/table/body/index.js +8 -12
  54. package/esm/table/header/CheckIcon.js +3 -11
  55. package/esm/table/header/HeaderCell.js +12 -33
  56. package/esm/table/header/HeaderRow.js +6 -17
  57. package/esm/table/index.js +30 -100
  58. package/esm/tabs/index.js +35 -118
  59. package/esm/tooltip/index.js +0 -4
  60. package/esm/trigger/align.js +6 -6
  61. package/esm/trigger/bottomAlign.js +33 -45
  62. package/esm/trigger/constants.js +0 -1
  63. package/esm/trigger/getPopupLocation.js +48 -68
  64. package/esm/trigger/index.js +52 -187
  65. package/esm/trigger/leftAlign.js +33 -47
  66. package/esm/trigger/ref.js +2 -7
  67. package/esm/trigger/rightAlign.js +33 -45
  68. package/esm/trigger/topAlign.js +33 -45
  69. package/esm/trigger/utils.js +28 -45
  70. package/lib/accordion/Item.js +6 -27
  71. package/lib/accordion/index.js +8 -41
  72. package/lib/affix/PortalAffix.js +7 -17
  73. package/lib/affix/index.js +30 -75
  74. package/lib/carousel/index.js +45 -146
  75. package/lib/checkbox/index.js +12 -41
  76. package/lib/collapse/index.js +11 -53
  77. package/lib/confirm/index.d.ts +8 -0
  78. package/lib/confirm/index.js +23 -38
  79. package/lib/date-picker/DateEnum.js +0 -3
  80. package/lib/date-picker/calendar/Day.js +62 -87
  81. package/lib/date-picker/calendar/MonthYear.js +20 -62
  82. package/lib/date-picker/calendar/grid/index.js +7 -16
  83. package/lib/date-picker/calendar/index.js +4 -37
  84. package/lib/date-picker/index.js +9 -58
  85. package/lib/date-picker/utils.js +6 -26
  86. package/lib/drawer/Child.js +10 -25
  87. package/lib/drawer/index.js +22 -78
  88. package/lib/ellipsis/index.js +9 -23
  89. package/lib/guide/index.js +25 -71
  90. package/lib/index.d.ts +2 -2
  91. package/lib/index.js +12 -32
  92. package/lib/input-number/ControlArrow.js +0 -4
  93. package/lib/input-number/constants.js +2 -2
  94. package/lib/input-number/index.js +26 -114
  95. package/lib/lazy-image/index.js +10 -58
  96. package/lib/link-list/index.js +11 -40
  97. package/lib/loading/index.js +13 -48
  98. package/lib/loading-bar/index.js +0 -5
  99. package/lib/loading-container/index.js +3 -11
  100. package/lib/loading-icon/index.js +0 -7
  101. package/lib/mask/index.js +6 -17
  102. package/lib/message/index.d.ts +44 -7
  103. package/lib/message/index.js +97 -120
  104. package/lib/message/renderMessage.d.ts +17 -0
  105. package/lib/message/renderMessage.js +144 -0
  106. package/lib/message/style/index.css +1 -1
  107. package/lib/modal/Affix.js +0 -4
  108. package/lib/modal/Title.js +5 -15
  109. package/lib/modal/getPopupLocation.js +5 -9
  110. package/lib/modal/index.js +44 -135
  111. package/lib/move/index.js +32 -144
  112. package/lib/move/range.js +6 -14
  113. package/lib/move/utils.js +3 -12
  114. package/lib/popover/index.js +9 -33
  115. package/lib/portal/index.js +1 -25
  116. package/lib/script/index.js +19 -61
  117. package/lib/select/index.js +28 -113
  118. package/lib/show-more/index.js +40 -110
  119. package/lib/skeleton/Item.js +1 -8
  120. package/lib/skeleton/index.js +5 -16
  121. package/lib/style.css +1 -1
  122. package/lib/table/body/BodyRow.js +11 -33
  123. package/lib/table/body/CheckIcon.js +10 -22
  124. package/lib/table/body/index.js +8 -17
  125. package/lib/table/header/CheckIcon.js +3 -15
  126. package/lib/table/header/HeaderCell.js +12 -37
  127. package/lib/table/header/HeaderRow.js +6 -22
  128. package/lib/table/index.js +30 -107
  129. package/lib/tabs/index.js +35 -122
  130. package/lib/tooltip/index.js +0 -9
  131. package/lib/trigger/align.js +0 -4
  132. package/lib/trigger/bottomAlign.js +33 -48
  133. package/lib/trigger/constants.js +0 -2
  134. package/lib/trigger/getPopupLocation.js +48 -74
  135. package/lib/trigger/index.js +52 -198
  136. package/lib/trigger/leftAlign.js +33 -50
  137. package/lib/trigger/ref.js +2 -12
  138. package/lib/trigger/rightAlign.js +33 -48
  139. package/lib/trigger/topAlign.js +33 -48
  140. package/lib/trigger/utils.js +28 -53
  141. package/package.json +7 -3
@@ -9,110 +9,83 @@ var __extends = this && this.__extends || function () {
9
9
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
10
10
  }
11
11
  };
12
-
13
12
  return _extendStatics(d, b);
14
13
  };
15
-
16
14
  return function (d, b) {
17
15
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
-
19
16
  _extendStatics(d, b);
20
-
21
17
  function __() {
22
18
  this.constructor = d;
23
19
  }
24
-
25
20
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26
21
  };
27
22
  }();
28
-
29
23
  var __assign = this && this.__assign || function () {
30
24
  __assign = Object.assign || function (t) {
31
25
  for (var s, i = 1, n = arguments.length; i < n; i++) {
32
26
  s = arguments[i];
33
-
34
27
  for (var p in s) {
35
28
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
36
29
  }
37
30
  }
38
-
39
31
  return t;
40
32
  };
41
-
42
33
  return __assign.apply(this, arguments);
43
34
  };
44
-
45
35
  import React from 'react';
46
36
  import classNames from 'classnames';
47
37
  import { isBlank, composeRef, toFixed, isEmptyObject, addEventListener, getNumberFromString } from '@autobest-ui/utils';
48
38
  import { FirstZeroReg, NumberReg } from './constants';
49
39
  import ControlArrow from './ControlArrow';
50
-
51
- var InputNumberNotRef =
52
- /** @class */
53
- function (_super) {
40
+ var InputNumberNotRef = /** @class */function (_super) {
54
41
  __extends(InputNumberNotRef, _super);
55
-
56
42
  function InputNumberNotRef(props) {
57
43
  var _this = _super.call(this, props) || this;
58
-
59
44
  _this.prefixCls = 'ab-input-number';
60
45
  _this.inputRef = /*#__PURE__*/React.createRef();
61
46
  /**
62
47
  * 解析用户输入的内容,并返回解析后的结果
63
48
  * @param originalValue
64
49
  */
65
-
66
50
  _this.getParserOriginalValue = function (originalValue) {
67
51
  // 输入为空
68
52
  if (isBlank(originalValue)) {
69
53
  return undefined;
70
54
  }
71
-
72
55
  if (!NumberReg.test(originalValue) || FirstZeroReg.test(originalValue)) {
73
56
  return isBlank(_this.state.parserValue) ? undefined : _this.state.parserValue.toString();
74
57
  }
75
-
76
58
  var _a = _this.props,
77
- min = _a.min,
78
- max = _a.max,
79
- precision = _a.precision;
59
+ min = _a.min,
60
+ max = _a.max,
61
+ precision = _a.precision;
80
62
  var currentValue = parseFloat(originalValue);
81
-
82
63
  if (!isBlank(min) && currentValue < min) {
83
64
  currentValue = min;
84
65
  }
85
-
86
66
  if (!isBlank(max) && currentValue > max) {
87
67
  currentValue = max;
88
68
  }
89
-
90
69
  return toFixed(currentValue, precision);
91
70
  };
92
71
  /**
93
72
  * 键盘和点击上下按钮更新value值
94
73
  * @param isUp
95
74
  */
96
-
97
-
98
75
  _this.changeValueWithStep = function (isUp) {
99
76
  var step = _this.props.step;
100
77
  var prevValue = _this.state.parserValue ? _this.state.parserValue : 0;
101
78
  var keyboardValue = isUp ? prevValue + step : prevValue - step;
102
-
103
79
  var parserValueStr = _this.getParserOriginalValue(keyboardValue.toString());
104
-
105
80
  var parserValue = getNumberFromString(parserValueStr);
106
81
  var _a = _this.props,
107
- name = _a.name,
108
- onChange = _a.onChange;
109
-
82
+ name = _a.name,
83
+ onChange = _a.onChange;
110
84
  if (prevValue !== parserValue) {
111
85
  if (onChange) {
112
86
  onChange(parserValue, name);
113
87
  return;
114
88
  }
115
-
116
89
  _this.setState({
117
90
  parserValue: parserValue,
118
91
  originalValueStr: parserValueStr
@@ -122,84 +95,64 @@ function (_super) {
122
95
  /**
123
96
  * 设置input焦点
124
97
  */
125
-
126
-
127
98
  _this.setInputFocus = function () {
128
99
  var element = _this.inputRef.current;
129
-
130
100
  if (!element) {
131
101
  return;
132
102
  }
133
-
134
103
  element.focus();
135
104
  };
136
-
137
105
  _this.onKeyboard = function (ev) {
138
106
  if (_this.props.disabled) {
139
107
  return;
140
108
  }
141
-
142
109
  if (ev.code === 'ArrowUp' || ev.code === 'ArrowDown') {
143
110
  ev.preventDefault();
144
-
145
111
  _this.changeValueWithStep(ev.code === 'ArrowUp');
146
112
  }
147
113
  };
148
-
149
114
  _this.onFocus = function (ev) {
150
115
  if (_this.props.disabled) {
151
116
  return;
152
117
  }
153
-
154
118
  if (!_this.state.isFocusInput) {
155
119
  _this.setState({
156
120
  isFocusInput: true
157
121
  });
158
122
  }
159
-
160
123
  if (_this.props.keyboard && !_this.keyboardHandler) {
161
124
  _this.keyboardHandler = addEventListener(ev.target, 'keydown', _this.onKeyboard);
162
125
  }
163
126
  };
164
-
165
127
  _this.onBlur = function (ev) {
166
128
  if (_this.keyboardHandler) {
167
129
  _this.keyboardHandler.remove();
168
-
169
130
  _this.keyboardHandler = null;
170
131
  }
171
-
172
132
  if (_this.state.isFocusInput) {
173
133
  _this.setState({
174
134
  isFocusInput: false
175
135
  });
176
136
  }
177
-
178
137
  if (_this.props.disabled) {
179
138
  return;
180
139
  }
181
-
182
140
  var originalValueStr = ev.target.value;
183
141
  var _a = _this.props,
184
- name = _a.name,
185
- onBlur = _a.onBlur,
186
- onChange = _a.onChange,
187
- onContinualChange = _a.onContinualChange;
188
-
142
+ name = _a.name,
143
+ onBlur = _a.onBlur,
144
+ onChange = _a.onChange,
145
+ onContinualChange = _a.onContinualChange;
189
146
  var parserValueStr = _this.getParserOriginalValue(originalValueStr);
190
-
191
147
  var parserValue = getNumberFromString(parserValueStr);
192
-
193
148
  _this.setState({
194
149
  originalValueStr: parserValueStr
195
150
  });
196
-
197
151
  if ('value' in _this.props && parserValue !== _this.props.value || parserValue !== _this.state.parserValue) {
198
152
  // 触发onChange, 因为在onChange阶段,不合法将不会触发,当用户结束输入后触发最后一次合法的onChange
199
153
  if (onContinualChange) {
200
154
  onContinualChange(parserValueStr, parserValue, name);
201
155
  }
202
-
203
156
  if (onChange) {
204
157
  onChange(parserValue, name);
205
158
  } else {
@@ -208,7 +161,6 @@ function (_super) {
208
161
  });
209
162
  }
210
163
  }
211
-
212
164
  if (onBlur) {
213
165
  onBlur(parserValue, name);
214
166
  }
@@ -219,91 +171,68 @@ function (_super) {
219
171
  * 在输入结束后(onBlur时),触发最后一次
220
172
  * @param ev
221
173
  */
222
-
223
-
224
174
  _this.onChangeValue = function (ev) {
225
175
  if (_this.props.disabled) {
226
176
  return;
227
177
  }
228
-
229
178
  var originalValueStr = ev.target.value;
230
-
231
179
  var parserValueStr = _this.getParserOriginalValue(originalValueStr);
232
-
233
180
  var parserValue = getNumberFromString(parserValueStr);
234
181
  var _a = _this.props,
235
- name = _a.name,
236
- onChange = _a.onChange,
237
- onContinualChange = _a.onContinualChange;
238
-
182
+ name = _a.name,
183
+ onChange = _a.onChange,
184
+ onContinualChange = _a.onContinualChange;
239
185
  if (onContinualChange) {
240
186
  onContinualChange(originalValueStr, parserValue, name);
241
187
  }
242
-
243
188
  _this.setState({
244
189
  originalValueStr: originalValueStr
245
- }); // 若输入的内容不合法,将不再触发onChange/setStates
190
+ });
191
+ // 若输入的内容不合法,将不再触发onChange/setStates
246
192
  // 在输入结束后(onBlur时),触发一次
247
-
248
-
249
193
  if (parserValueStr !== originalValueStr) {
250
194
  return;
251
195
  }
252
-
253
196
  if (onChange) {
254
197
  onChange(parserValue, name);
255
198
  return;
256
199
  }
257
-
258
200
  _this.setState({
259
201
  parserValue: parserValue
260
202
  });
261
203
  };
262
-
263
204
  _this.onKeyup = function (ev) {
264
205
  ev.preventDefault();
265
-
266
206
  if (!_this.props.controls || _this.props.disabled) {
267
207
  return;
268
208
  }
269
-
270
209
  _this.setInputFocus();
271
-
272
210
  _this.changeValueWithStep(true);
273
211
  };
274
-
275
212
  _this.onKeydown = function (ev) {
276
213
  ev.preventDefault();
277
-
278
214
  if (!_this.props.controls || _this.props.disabled) {
279
215
  return;
280
216
  }
281
-
282
217
  _this.setInputFocus();
283
-
284
218
  _this.changeValueWithStep(false);
285
219
  };
286
-
287
220
  _this.onMouseEnter = function () {
288
221
  if (!_this.props.controls || _this.state.isEnterInput || _this.props.disabled) {
289
222
  return;
290
223
  }
291
-
292
224
  _this.setState({
293
225
  isEnterInput: true
294
226
  });
295
227
  };
296
-
297
228
  _this.onMouseLeave = function () {
298
229
  if (!_this.props.controls || !_this.state.isEnterInput || _this.props.disabled) {
299
230
  return;
300
231
  }
301
-
302
232
  _this.setState({
303
233
  isEnterInput: false
304
234
  });
305
235
  };
306
-
307
236
  var defaultValueStr = toFixed(props.defaultValue, props.precision);
308
237
  _this.state = {
309
238
  originalValueStr: defaultValueStr,
@@ -313,48 +242,41 @@ function (_super) {
313
242
  };
314
243
  return _this;
315
244
  }
316
-
317
245
  InputNumberNotRef.getDerivedStateFromProps = function (nextProps, prevStates) {
318
- var nextState = {}; // 判断是否为受控方式
319
-
246
+ var nextState = {};
247
+ // 判断是否为受控方式
320
248
  if ('value' in nextProps) {
321
249
  var fixedValueStr = toFixed(nextProps.value, nextProps.precision);
322
-
323
250
  if (nextProps.value !== prevStates.parserValue) {
324
251
  nextState.parserValue = getNumberFromString(fixedValueStr);
325
252
  nextState.originalValueStr = fixedValueStr;
326
253
  }
327
254
  }
328
-
329
255
  if (isEmptyObject(nextState)) {
330
256
  return null;
331
257
  }
332
-
333
258
  return nextState;
334
259
  };
335
-
336
260
  InputNumberNotRef.prototype.componentWillUnmount = function () {
337
261
  if (this.keyboardHandler) {
338
262
  this.keyboardHandler.remove();
339
263
  this.keyboardHandler = null;
340
264
  }
341
265
  };
342
-
343
266
  InputNumberNotRef.prototype.render = function () {
344
267
  var _a, _b, _c;
345
-
346
268
  var cls = this.prefixCls;
347
269
  var _d = this.props,
348
- upperRef = _d.upperRef,
349
- className = _d.className,
350
- placeholder = _d.placeholder,
351
- disabled = _d.disabled,
352
- style = _d.style,
353
- controls = _d.controls;
270
+ upperRef = _d.upperRef,
271
+ className = _d.className,
272
+ placeholder = _d.placeholder,
273
+ disabled = _d.disabled,
274
+ style = _d.style,
275
+ controls = _d.controls;
354
276
  var _e = this.state,
355
- isEnterInput = _e.isEnterInput,
356
- isFocusInput = _e.isFocusInput,
357
- originalValueStr = _e.originalValueStr;
277
+ isEnterInput = _e.isEnterInput,
278
+ isFocusInput = _e.isFocusInput,
279
+ originalValueStr = _e.originalValueStr;
358
280
  return /*#__PURE__*/React.createElement("div", {
359
281
  className: classNames(cls, className, (_a = {}, _a["".concat(cls, "-enter")] = isEnterInput || isFocusInput, _a), (_b = {}, _b["".concat(cls, "-focus")] = isFocusInput, _b), (_c = {}, _c["".concat(cls, "-disabled")] = disabled, _c)),
360
282
  onMouseEnter: this.onMouseEnter,
@@ -376,7 +298,6 @@ function (_super) {
376
298
  onKeydown: this.onKeydown
377
299
  }) : null);
378
300
  };
379
-
380
301
  InputNumberNotRef.defaultProps = {
381
302
  defaultValue: '',
382
303
  controls: true,
@@ -385,7 +306,6 @@ function (_super) {
385
306
  };
386
307
  return InputNumberNotRef;
387
308
  }(React.Component);
388
-
389
309
  export { InputNumberNotRef };
390
310
  var InputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {
391
311
  return /*#__PURE__*/React.createElement(InputNumberNotRef, __assign({}, props, {
@@ -9,184 +9,141 @@ var __extends = this && this.__extends || function () {
9
9
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
10
10
  }
11
11
  };
12
-
13
12
  return _extendStatics(d, b);
14
13
  };
15
-
16
14
  return function (d, b) {
17
15
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
-
19
16
  _extendStatics(d, b);
20
-
21
17
  function __() {
22
18
  this.constructor = d;
23
19
  }
24
-
25
20
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26
21
  };
27
22
  }();
28
-
29
23
  var __assign = this && this.__assign || function () {
30
24
  __assign = Object.assign || function (t) {
31
25
  for (var s, i = 1, n = arguments.length; i < n; i++) {
32
26
  s = arguments[i];
33
-
34
27
  for (var p in s) {
35
28
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
36
29
  }
37
30
  }
38
-
39
31
  return t;
40
32
  };
41
-
42
33
  return __assign.apply(this, arguments);
43
34
  };
44
-
45
35
  import React from 'react';
46
36
  import classNames from 'classnames';
47
-
48
37
  function noop() {}
49
-
50
- var LazyImage =
51
- /** @class */
52
- function (_super) {
38
+ var LazyImage = /** @class */function (_super) {
53
39
  __extends(LazyImage, _super);
54
-
55
40
  function LazyImage(props) {
56
41
  var _this = _super.call(this, props) || this;
57
-
58
42
  _this.prefixCls = 'ab-lazy-image';
59
43
  _this.rootRef = /*#__PURE__*/React.createRef();
60
44
  _this.isUnmount = false;
61
45
  /**
62
46
  * 监听原生lazy loading, 并回调不同的事件
63
47
  */
64
-
65
48
  _this.originalLazyLoad = function () {
66
49
  if (_this.rootRef.current) {
67
50
  var _a = _this.props,
68
- onLoading = _a.onLoading,
69
- onLoaded_1 = _a.onLoaded,
70
- onError_1 = _a.onError;
51
+ onLoading = _a.onLoading,
52
+ onLoaded_1 = _a.onLoaded,
53
+ onError_1 = _a.onError;
71
54
  var imgElement_1 = _this.rootRef.current;
72
-
73
55
  if (onLoading) {
74
56
  onLoading(imgElement_1.src);
75
57
  }
76
-
77
58
  if (imgElement_1.complete) {
78
59
  if (!_this.isUnmount) {
79
60
  _this.setState({
80
61
  loading: false
81
62
  });
82
63
  }
83
-
84
64
  if (onLoaded_1) {
85
65
  onLoaded_1(imgElement_1.src);
86
66
  }
87
-
88
67
  return;
89
68
  }
90
-
91
69
  imgElement_1.onload = function () {
92
70
  if (!_this.isUnmount) {
93
71
  _this.setState({
94
72
  loading: false
95
73
  });
96
74
  }
97
-
98
75
  if (onLoaded_1) {
99
76
  onLoaded_1(imgElement_1.src);
100
77
  }
101
-
102
78
  imgElement_1.onload = null;
103
79
  };
104
-
105
80
  imgElement_1.onerror = function () {
106
81
  if (!_this.isUnmount) {
107
82
  _this.setState({
108
83
  loading: false
109
84
  });
110
85
  }
111
-
112
86
  if (onError_1) {
113
87
  onError_1();
114
88
  }
115
-
116
89
  imgElement_1.onerror = null;
117
90
  };
118
91
  }
119
92
  };
120
-
121
93
  _this.onMouseOut = function (ev) {
122
94
  if (_this.props.isMobile) {
123
95
  return;
124
96
  }
125
-
126
97
  var _a = _this.props,
127
- hoverOpacity = _a.hoverOpacity,
128
- onMouseOut = _a.onMouseOut;
98
+ hoverOpacity = _a.hoverOpacity,
99
+ onMouseOut = _a.onMouseOut;
129
100
  var el = ev.target;
130
-
131
101
  if (hoverOpacity) {
132
102
  el.style.opacity = '1';
133
103
  }
134
-
135
104
  if (onMouseOut) {
136
105
  onMouseOut(ev);
137
106
  }
138
107
  };
139
-
140
108
  _this.onMouseOver = function (ev) {
141
109
  if (_this.props.isMobile) {
142
110
  return;
143
111
  }
144
-
145
112
  var _a = _this.props,
146
- hoverOpacity = _a.hoverOpacity,
147
- onMouseOver = _a.onMouseOver;
113
+ hoverOpacity = _a.hoverOpacity,
114
+ onMouseOver = _a.onMouseOver;
148
115
  var el = ev.target;
149
-
150
116
  if (hoverOpacity) {
151
117
  el.style.opacity = hoverOpacity.toString();
152
118
  }
153
-
154
119
  if (onMouseOver) {
155
120
  onMouseOver(ev);
156
121
  }
157
122
  };
158
-
159
123
  _this.state = {
160
124
  loading: true
161
125
  };
162
126
  return _this;
163
127
  }
164
-
165
128
  LazyImage.prototype.componentWillUnmount = function () {
166
129
  this.isUnmount = true;
167
130
  };
168
-
169
131
  LazyImage.prototype.componentDidMount = function () {
170
132
  this.originalLazyLoad();
171
133
  };
172
-
173
134
  LazyImage.prototype.componentDidUpdate = function (prevProps) {
174
135
  if (prevProps.src !== this.props.src) {
175
136
  this.originalLazyLoad();
176
137
  }
177
138
  };
178
-
179
139
  LazyImage.prototype.render = function () {
180
140
  var _a;
181
-
182
141
  var cls = this.prefixCls;
183
142
  var _b = this.props,
184
- className = _b.className,
185
- active = _b.active;
143
+ className = _b.className,
144
+ active = _b.active;
186
145
  var loading = this.state.loading;
187
-
188
146
  var props = __assign({}, this.props);
189
-
190
147
  delete props.className;
191
148
  delete props.onMouseOver;
192
149
  delete props.onMouseOut;
@@ -207,7 +164,6 @@ function (_super) {
207
164
  loading: "lazy"
208
165
  }));
209
166
  };
210
-
211
167
  LazyImage.defaultProps = {
212
168
  className: '',
213
169
  hoverOpacity: null,
@@ -216,5 +172,4 @@ function (_super) {
216
172
  };
217
173
  return LazyImage;
218
174
  }(React.Component);
219
-
220
175
  export default LazyImage;