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