@nutui/nutui-react 1.4.13 → 1.4.14
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/dist/esm/Input.js +1 -1
- package/dist/esm/InputNumber.js +91 -13
- package/dist/esm/Picker.js +0 -1
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +104 -27
- package/dist/nutui.react.umd.js +104 -27
- package/dist/packages/picker/picker.scss +103 -97
- package/dist/packages/swiper/swiper1.scss +65 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +23 -16
package/dist/esm/Input.js
CHANGED
|
@@ -205,7 +205,7 @@ var Input = forwardRef(function (props, ref) {
|
|
|
205
205
|
if (maxlength && val.length > Number(maxlength)) {
|
|
206
206
|
val = val.slice(0, Number(maxlength));
|
|
207
207
|
}
|
|
208
|
-
updateValue(
|
|
208
|
+
updateValue(val, 'onBlur');
|
|
209
209
|
onBlur && onBlur(val, event);
|
|
210
210
|
};
|
|
211
211
|
var handleClickInput = function handleClickInput(event) {
|
package/dist/esm/InputNumber.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["children", "disabled", "buttonSize", "min", "max", "inputWidth", "readonly", "modelValue", "decimalPlaces", "step", "isAsync", "className", "style", "add", "reduce", "change", "overlimit", "blur", "focus", "onAdd", "onReduce", "onOverlimit", "onBlurFuc", "onFocus", "onChangeFuc", "iconClassPrefix", "iconFontClassName"];
|
|
4
|
+
var _excluded = ["children", "disabled", "buttonSize", "min", "max", "inputWidth", "readonly", "modelValue", "decimalPlaces", "step", "isAsync", "className", "style", "formatter", "add", "reduce", "change", "overlimit", "blur", "focus", "onAdd", "onReduce", "onOverlimit", "onBlurFuc", "onFocus", "onChangeFuc", "iconClassPrefix", "iconFontClassName"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
import React__default, { useState, useEffect } from 'react';
|
|
7
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import Icon from './Icon.js';
|
|
10
10
|
import { c as cn } from './bem-3b438e61.js';
|
|
@@ -40,6 +40,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
40
40
|
isAsync = _defaultProps$props.isAsync,
|
|
41
41
|
className = _defaultProps$props.className,
|
|
42
42
|
style = _defaultProps$props.style,
|
|
43
|
+
formatter = _defaultProps$props.formatter,
|
|
43
44
|
add = _defaultProps$props.add,
|
|
44
45
|
reduce = _defaultProps$props.reduce,
|
|
45
46
|
change = _defaultProps$props.change,
|
|
@@ -59,9 +60,15 @@ var InputNumber = function InputNumber(props) {
|
|
|
59
60
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
61
|
inputValue = _useState2[0],
|
|
61
62
|
setInputValue = _useState2[1];
|
|
63
|
+
var inputRef = useRef('');
|
|
62
64
|
useEffect(function () {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
if (formatter) {
|
|
66
|
+
inputRef.current = formatter(modelValue);
|
|
67
|
+
setInputValue(formatter(modelValue));
|
|
68
|
+
} else {
|
|
69
|
+
setInputValue(modelValue);
|
|
70
|
+
}
|
|
71
|
+
}, [modelValue, formatter]);
|
|
65
72
|
var b = cn('inputnumber');
|
|
66
73
|
var classes = classNames(_defineProperty({}, "".concat(b(''), "--disabled"), disabled), className, b(''));
|
|
67
74
|
var styles = _objectSpread({
|
|
@@ -69,6 +76,10 @@ var InputNumber = function InputNumber(props) {
|
|
|
69
76
|
}, style);
|
|
70
77
|
var addAllow = function addAllow() {
|
|
71
78
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : inputValue;
|
|
79
|
+
if (formatter) {
|
|
80
|
+
var numValue = String(value).replace(/[^0-9|\.]/gi, '');
|
|
81
|
+
return Number(numValue) < Number(max) && !disabled;
|
|
82
|
+
}
|
|
72
83
|
if (value || typeof value === 'number') {
|
|
73
84
|
return value < Number(max) && !disabled;
|
|
74
85
|
}
|
|
@@ -76,6 +87,10 @@ var InputNumber = function InputNumber(props) {
|
|
|
76
87
|
};
|
|
77
88
|
var reduceAllow = function reduceAllow() {
|
|
78
89
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : inputValue;
|
|
90
|
+
if (formatter) {
|
|
91
|
+
var numValue = String(value).replace(/[^0-9|\.]/gi, '');
|
|
92
|
+
return Number(numValue) > Number(min) && !disabled;
|
|
93
|
+
}
|
|
79
94
|
if (value || typeof value === 'number') {
|
|
80
95
|
return value > Number(min) && !disabled;
|
|
81
96
|
}
|
|
@@ -96,11 +111,11 @@ var InputNumber = function InputNumber(props) {
|
|
|
96
111
|
change && change(outputValue, e);
|
|
97
112
|
if (!isAsync) {
|
|
98
113
|
if (Number(outputValue) < Number(min)) {
|
|
99
|
-
setInputValue(Number(min));
|
|
114
|
+
formatter ? setInputValue(formatter(Number(min))) : setInputValue(Number(min));
|
|
100
115
|
} else if (Number(outputValue) > Number(max)) {
|
|
101
|
-
setInputValue(Number(max));
|
|
116
|
+
formatter ? setInputValue(formatter(Number(max))) : setInputValue(Number(max));
|
|
102
117
|
} else {
|
|
103
|
-
setInputValue(outputValue);
|
|
118
|
+
formatter ? setInputValue(formatter(outputValue)) : setInputValue(outputValue);
|
|
104
119
|
}
|
|
105
120
|
}
|
|
106
121
|
};
|
|
@@ -108,8 +123,15 @@ var InputNumber = function InputNumber(props) {
|
|
|
108
123
|
onReduce && onReduce(e);
|
|
109
124
|
reduce && reduce(e);
|
|
110
125
|
if (reduceAllow()) {
|
|
111
|
-
|
|
112
|
-
|
|
126
|
+
if (formatter) {
|
|
127
|
+
var numValue = String(inputValue).replace(/[^0-9|\.]/gi, '');
|
|
128
|
+
var outputValue = Number(numValue) - Number(step);
|
|
129
|
+
inputRef.current = formatter(outputValue);
|
|
130
|
+
emitChange(outputValue, e);
|
|
131
|
+
} else {
|
|
132
|
+
var _outputValue = Number(inputValue) - Number(step);
|
|
133
|
+
emitChange(_outputValue, e);
|
|
134
|
+
}
|
|
113
135
|
} else {
|
|
114
136
|
onOverlimit && onOverlimit(e);
|
|
115
137
|
overlimit && overlimit(e);
|
|
@@ -119,8 +141,15 @@ var InputNumber = function InputNumber(props) {
|
|
|
119
141
|
onAdd && onAdd(e);
|
|
120
142
|
add && add(e);
|
|
121
143
|
if (addAllow()) {
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
if (formatter) {
|
|
145
|
+
var numValue = String(inputValue).replace(/[^0-9|\.]/gi, '');
|
|
146
|
+
var outputValue = Number(numValue) + Number(step);
|
|
147
|
+
inputRef.current = formatter(outputValue);
|
|
148
|
+
emitChange(outputValue, e);
|
|
149
|
+
} else {
|
|
150
|
+
var _outputValue2 = Number(inputValue) + Number(step);
|
|
151
|
+
emitChange(_outputValue2, e);
|
|
152
|
+
}
|
|
124
153
|
} else {
|
|
125
154
|
onOverlimit && onOverlimit(e);
|
|
126
155
|
overlimit && overlimit(e);
|
|
@@ -138,6 +167,42 @@ var InputNumber = function InputNumber(props) {
|
|
|
138
167
|
}
|
|
139
168
|
}
|
|
140
169
|
};
|
|
170
|
+
var changeFormatValue = function changeFormatValue(e) {
|
|
171
|
+
var input = e.target.value;
|
|
172
|
+
var numReg = new RegExp('^[0-9]*$');
|
|
173
|
+
var numValue = input.replace(/[^0-9|\.]/gi, '');
|
|
174
|
+
if (formatter) {
|
|
175
|
+
if (!numReg.test(input[0]) && numValue) {
|
|
176
|
+
setInputValue(formatter(numValue));
|
|
177
|
+
} else if (!numReg.test(input[0]) && !numValue) {
|
|
178
|
+
setInputValue(input);
|
|
179
|
+
} else if (numReg.test(input[0])) {
|
|
180
|
+
console.log('inputRef.current', inputRef.current);
|
|
181
|
+
console.log('formatter(numValue)', formatter(numValue));
|
|
182
|
+
// 针对于100%这种尾字符例子,直接删除会进行匹配
|
|
183
|
+
if (formatter(numValue) === inputRef.current) {
|
|
184
|
+
setInputValue(numValue);
|
|
185
|
+
} else {
|
|
186
|
+
setInputValue(formatter(numValue));
|
|
187
|
+
inputRef.current = formatter(numValue);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var burFormatValue = function burFormatValue(e) {
|
|
193
|
+
var input = e.target.value;
|
|
194
|
+
var numReg = new RegExp('^[0-9]*$');
|
|
195
|
+
var numValue = input.replace(/[^0-9|\.]/gi, '');
|
|
196
|
+
if (formatter) {
|
|
197
|
+
if (formatter(numValue) === input) {
|
|
198
|
+
emitChange(numValue, e);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (!numReg.test(input) || !input) {
|
|
202
|
+
setInputValue(formatter(''));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
141
206
|
var focusValue = function focusValue(e) {
|
|
142
207
|
if (disabled) return;
|
|
143
208
|
if (readonly) return;
|
|
@@ -170,7 +235,20 @@ var InputNumber = function InputNumber(props) {
|
|
|
170
235
|
size: buttonSize,
|
|
171
236
|
name: "minus",
|
|
172
237
|
onClick: reduceNumber
|
|
173
|
-
})), React__default.createElement("input", {
|
|
238
|
+
})), React__default.createElement(React__default.Fragment, null, formatter ? React__default.createElement("input", {
|
|
239
|
+
type: "text",
|
|
240
|
+
min: min,
|
|
241
|
+
max: max,
|
|
242
|
+
style: {
|
|
243
|
+
width: pxCheck(inputWidth)
|
|
244
|
+
},
|
|
245
|
+
disabled: disabled,
|
|
246
|
+
readOnly: readonly,
|
|
247
|
+
value: inputValue,
|
|
248
|
+
onInput: changeFormatValue,
|
|
249
|
+
onBlur: burFormatValue,
|
|
250
|
+
onFocus: focusValue
|
|
251
|
+
}) : React__default.createElement("input", {
|
|
174
252
|
type: "number",
|
|
175
253
|
min: min,
|
|
176
254
|
max: max,
|
|
@@ -183,7 +261,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
183
261
|
onInput: changeValue,
|
|
184
262
|
onBlur: burValue,
|
|
185
263
|
onFocus: focusValue
|
|
186
|
-
}), React__default.createElement("div", {
|
|
264
|
+
})), React__default.createElement("div", {
|
|
187
265
|
className: "nut-input-add"
|
|
188
266
|
}, React__default.createElement(Icon, {
|
|
189
267
|
classPrefix: iconClassPrefix,
|
package/dist/esm/Picker.js
CHANGED
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED
package/dist/nutui.react.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
var _a;
|
|
8
8
|
/*!
|
|
9
|
-
* @nutui/nutui-react v1.4.
|
|
9
|
+
* @nutui/nutui-react v1.4.14 Thu Apr 06 2023 15:54:39 GMT+0800 (China Standard Time)
|
|
10
10
|
* (c) 2023 @jdf2e.
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*/
|
|
@@ -10186,7 +10186,7 @@ const Utils = {
|
|
|
10186
10186
|
* @return {String}
|
|
10187
10187
|
*/
|
|
10188
10188
|
getWhatDay(year, month, day) {
|
|
10189
|
-
const date4 =
|
|
10189
|
+
const date4 = new Date(`${year}/${month}/${day}`);
|
|
10190
10190
|
const index = date4.getDay();
|
|
10191
10191
|
const dayNames = [
|
|
10192
10192
|
"星期日",
|
|
@@ -10204,7 +10204,7 @@ const Utils = {
|
|
|
10204
10204
|
* @return {Number}
|
|
10205
10205
|
*/
|
|
10206
10206
|
getMonthPreDay(year, month) {
|
|
10207
|
-
const date4 =
|
|
10207
|
+
const date4 = new Date(`${year}/${month}/01`);
|
|
10208
10208
|
let day = date4.getDay();
|
|
10209
10209
|
if (day == 0) {
|
|
10210
10210
|
day = 7;
|
|
@@ -10261,7 +10261,7 @@ const Utils = {
|
|
|
10261
10261
|
*/
|
|
10262
10262
|
getDay(i) {
|
|
10263
10263
|
i = i || 0;
|
|
10264
|
-
let date4 =
|
|
10264
|
+
let date4 = new Date();
|
|
10265
10265
|
const diff = i * (1e3 * 60 * 60 * 24);
|
|
10266
10266
|
date4 = new Date(date4.getTime() + diff);
|
|
10267
10267
|
return this.date2Str(date4);
|
|
@@ -10451,7 +10451,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10451
10451
|
};
|
|
10452
10452
|
const isCurrDay = (month, day) => {
|
|
10453
10453
|
const date4 = `${month.curData[0]}-${month.curData[1]}-${day}`;
|
|
10454
|
-
return Utils.isEqual(date4, Utils.date2Str(
|
|
10454
|
+
return Utils.isEqual(date4, Utils.date2Str(new Date()));
|
|
10455
10455
|
};
|
|
10456
10456
|
const confirm2 = () => {
|
|
10457
10457
|
const { type: type22 } = props;
|
|
@@ -10787,8 +10787,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10787
10787
|
}
|
|
10788
10788
|
});
|
|
10789
10789
|
} else {
|
|
10790
|
-
const currentYear2 =
|
|
10791
|
-
const currentMonth =
|
|
10790
|
+
const currentYear2 = new Date().getFullYear();
|
|
10791
|
+
const currentMonth = new Date().getMonth() + 1;
|
|
10792
10792
|
const currentYearMonthIndex = state.monthsData.findIndex((item) => {
|
|
10793
10793
|
return +item.curData[0] === currentYear2 && +item.curData[1] === currentMonth;
|
|
10794
10794
|
});
|
|
@@ -11888,7 +11888,6 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
11888
11888
|
const rotation = 20;
|
|
11889
11889
|
const moving = useRef(false);
|
|
11890
11890
|
let timer;
|
|
11891
|
-
useRef(null);
|
|
11892
11891
|
const rollerRef = useRef(null);
|
|
11893
11892
|
const pickerSlotRef = useRef(null);
|
|
11894
11893
|
const [startTime, setStartTime] = useState(0);
|
|
@@ -12295,7 +12294,7 @@ const InternalPicker = (props, ref) => {
|
|
|
12295
12294
|
};
|
|
12296
12295
|
const Picker = React__default.forwardRef(InternalPicker);
|
|
12297
12296
|
const Picker$1 = Picker;
|
|
12298
|
-
const currentYear =
|
|
12297
|
+
const currentYear = new Date().getFullYear();
|
|
12299
12298
|
const defaultProps$X = {
|
|
12300
12299
|
modelValue: null,
|
|
12301
12300
|
visible: false,
|
|
@@ -14171,7 +14170,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
14171
14170
|
if (maxlength && val.length > Number(maxlength)) {
|
|
14172
14171
|
val = val.slice(0, Number(maxlength));
|
|
14173
14172
|
}
|
|
14174
|
-
updateValue(
|
|
14173
|
+
updateValue(val, "onBlur");
|
|
14175
14174
|
onBlur && onBlur(val, event);
|
|
14176
14175
|
};
|
|
14177
14176
|
const handleClickInput = (event) => {
|
|
@@ -14382,6 +14381,7 @@ const InputNumber = (props) => {
|
|
|
14382
14381
|
isAsync,
|
|
14383
14382
|
className,
|
|
14384
14383
|
style,
|
|
14384
|
+
formatter,
|
|
14385
14385
|
add,
|
|
14386
14386
|
reduce,
|
|
14387
14387
|
change,
|
|
@@ -14402,9 +14402,15 @@ const InputNumber = (props) => {
|
|
|
14402
14402
|
...props
|
|
14403
14403
|
};
|
|
14404
14404
|
const [inputValue, setInputValue] = useState(modelValue);
|
|
14405
|
+
const inputRef = useRef("");
|
|
14405
14406
|
useEffect(() => {
|
|
14406
|
-
|
|
14407
|
-
|
|
14407
|
+
if (formatter) {
|
|
14408
|
+
inputRef.current = formatter(modelValue);
|
|
14409
|
+
setInputValue(formatter(modelValue));
|
|
14410
|
+
} else {
|
|
14411
|
+
setInputValue(modelValue);
|
|
14412
|
+
}
|
|
14413
|
+
}, [modelValue, formatter]);
|
|
14408
14414
|
const b2 = cn("inputnumber");
|
|
14409
14415
|
const classes = classNames(
|
|
14410
14416
|
{
|
|
@@ -14418,12 +14424,20 @@ const InputNumber = (props) => {
|
|
|
14418
14424
|
...style
|
|
14419
14425
|
};
|
|
14420
14426
|
const addAllow = (value = inputValue) => {
|
|
14427
|
+
if (formatter) {
|
|
14428
|
+
const numValue = String(value).replace(/[^0-9|\.]/gi, "");
|
|
14429
|
+
return Number(numValue) < Number(max) && !disabled;
|
|
14430
|
+
}
|
|
14421
14431
|
if (value || typeof value === "number") {
|
|
14422
14432
|
return value < Number(max) && !disabled;
|
|
14423
14433
|
}
|
|
14424
14434
|
return false;
|
|
14425
14435
|
};
|
|
14426
14436
|
const reduceAllow = (value = inputValue) => {
|
|
14437
|
+
if (formatter) {
|
|
14438
|
+
const numValue = String(value).replace(/[^0-9|\.]/gi, "");
|
|
14439
|
+
return Number(numValue) > Number(min) && !disabled;
|
|
14440
|
+
}
|
|
14427
14441
|
if (value || typeof value === "number") {
|
|
14428
14442
|
return value > Number(min) && !disabled;
|
|
14429
14443
|
}
|
|
@@ -14444,11 +14458,11 @@ const InputNumber = (props) => {
|
|
|
14444
14458
|
change && change(outputValue, e);
|
|
14445
14459
|
if (!isAsync) {
|
|
14446
14460
|
if (Number(outputValue) < Number(min)) {
|
|
14447
|
-
setInputValue(Number(min));
|
|
14461
|
+
formatter ? setInputValue(formatter(Number(min))) : setInputValue(Number(min));
|
|
14448
14462
|
} else if (Number(outputValue) > Number(max)) {
|
|
14449
|
-
setInputValue(Number(max));
|
|
14463
|
+
formatter ? setInputValue(formatter(Number(max))) : setInputValue(Number(max));
|
|
14450
14464
|
} else {
|
|
14451
|
-
setInputValue(outputValue);
|
|
14465
|
+
formatter ? setInputValue(formatter(outputValue)) : setInputValue(outputValue);
|
|
14452
14466
|
}
|
|
14453
14467
|
}
|
|
14454
14468
|
};
|
|
@@ -14456,8 +14470,15 @@ const InputNumber = (props) => {
|
|
|
14456
14470
|
onReduce && onReduce(e);
|
|
14457
14471
|
reduce && reduce(e);
|
|
14458
14472
|
if (reduceAllow()) {
|
|
14459
|
-
|
|
14460
|
-
|
|
14473
|
+
if (formatter) {
|
|
14474
|
+
const numValue = String(inputValue).replace(/[^0-9|\.]/gi, "");
|
|
14475
|
+
const outputValue = Number(numValue) - Number(step);
|
|
14476
|
+
inputRef.current = formatter(outputValue);
|
|
14477
|
+
emitChange(outputValue, e);
|
|
14478
|
+
} else {
|
|
14479
|
+
const outputValue = Number(inputValue) - Number(step);
|
|
14480
|
+
emitChange(outputValue, e);
|
|
14481
|
+
}
|
|
14461
14482
|
} else {
|
|
14462
14483
|
onOverlimit && onOverlimit(e);
|
|
14463
14484
|
overlimit && overlimit(e);
|
|
@@ -14467,8 +14488,15 @@ const InputNumber = (props) => {
|
|
|
14467
14488
|
onAdd && onAdd(e);
|
|
14468
14489
|
add && add(e);
|
|
14469
14490
|
if (addAllow()) {
|
|
14470
|
-
|
|
14471
|
-
|
|
14491
|
+
if (formatter) {
|
|
14492
|
+
const numValue = String(inputValue).replace(/[^0-9|\.]/gi, "");
|
|
14493
|
+
const outputValue = Number(numValue) + Number(step);
|
|
14494
|
+
inputRef.current = formatter(outputValue);
|
|
14495
|
+
emitChange(outputValue, e);
|
|
14496
|
+
} else {
|
|
14497
|
+
const outputValue = Number(inputValue) + Number(step);
|
|
14498
|
+
emitChange(outputValue, e);
|
|
14499
|
+
}
|
|
14472
14500
|
} else {
|
|
14473
14501
|
onOverlimit && onOverlimit(e);
|
|
14474
14502
|
overlimit && overlimit(e);
|
|
@@ -14486,6 +14514,41 @@ const InputNumber = (props) => {
|
|
|
14486
14514
|
}
|
|
14487
14515
|
}
|
|
14488
14516
|
};
|
|
14517
|
+
const changeFormatValue = (e) => {
|
|
14518
|
+
const input = e.target.value;
|
|
14519
|
+
const numReg = new RegExp("^[0-9]*$");
|
|
14520
|
+
const numValue = input.replace(/[^0-9|\.]/gi, "");
|
|
14521
|
+
if (formatter) {
|
|
14522
|
+
if (!numReg.test(input[0]) && numValue) {
|
|
14523
|
+
setInputValue(formatter(numValue));
|
|
14524
|
+
} else if (!numReg.test(input[0]) && !numValue) {
|
|
14525
|
+
setInputValue(input);
|
|
14526
|
+
} else if (numReg.test(input[0])) {
|
|
14527
|
+
console.log("inputRef.current", inputRef.current);
|
|
14528
|
+
console.log("formatter(numValue)", formatter(numValue));
|
|
14529
|
+
if (formatter(numValue) === inputRef.current) {
|
|
14530
|
+
setInputValue(numValue);
|
|
14531
|
+
} else {
|
|
14532
|
+
setInputValue(formatter(numValue));
|
|
14533
|
+
inputRef.current = formatter(numValue);
|
|
14534
|
+
}
|
|
14535
|
+
}
|
|
14536
|
+
}
|
|
14537
|
+
};
|
|
14538
|
+
const burFormatValue = (e) => {
|
|
14539
|
+
const input = e.target.value;
|
|
14540
|
+
const numReg = new RegExp("^[0-9]*$");
|
|
14541
|
+
const numValue = input.replace(/[^0-9|\.]/gi, "");
|
|
14542
|
+
if (formatter) {
|
|
14543
|
+
if (formatter(numValue) === input) {
|
|
14544
|
+
emitChange(numValue, e);
|
|
14545
|
+
return;
|
|
14546
|
+
}
|
|
14547
|
+
if (!numReg.test(input) || !input) {
|
|
14548
|
+
setInputValue(formatter(""));
|
|
14549
|
+
}
|
|
14550
|
+
}
|
|
14551
|
+
};
|
|
14489
14552
|
const focusValue = (e) => {
|
|
14490
14553
|
if (disabled)
|
|
14491
14554
|
return;
|
|
@@ -14520,7 +14583,21 @@ const InputNumber = (props) => {
|
|
|
14520
14583
|
name: "minus",
|
|
14521
14584
|
onClick: reduceNumber
|
|
14522
14585
|
}
|
|
14523
|
-
)), /* @__PURE__ */ React__default.createElement(
|
|
14586
|
+
)), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, formatter ? /* @__PURE__ */ React__default.createElement(
|
|
14587
|
+
"input",
|
|
14588
|
+
{
|
|
14589
|
+
type: "text",
|
|
14590
|
+
min,
|
|
14591
|
+
max,
|
|
14592
|
+
style: { width: pxCheck(inputWidth) },
|
|
14593
|
+
disabled,
|
|
14594
|
+
readOnly: readonly,
|
|
14595
|
+
value: inputValue,
|
|
14596
|
+
onInput: changeFormatValue,
|
|
14597
|
+
onBlur: burFormatValue,
|
|
14598
|
+
onFocus: focusValue
|
|
14599
|
+
}
|
|
14600
|
+
) : /* @__PURE__ */ React__default.createElement(
|
|
14524
14601
|
"input",
|
|
14525
14602
|
{
|
|
14526
14603
|
type: "number",
|
|
@@ -14534,7 +14611,7 @@ const InputNumber = (props) => {
|
|
|
14534
14611
|
onBlur: burValue,
|
|
14535
14612
|
onFocus: focusValue
|
|
14536
14613
|
}
|
|
14537
|
-
), /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-add" }, /* @__PURE__ */ React__default.createElement(
|
|
14614
|
+
)), /* @__PURE__ */ React__default.createElement("div", { className: "nut-input-add" }, /* @__PURE__ */ React__default.createElement(
|
|
14538
14615
|
Icon,
|
|
14539
14616
|
{
|
|
14540
14617
|
classPrefix: iconClassPrefix,
|
|
@@ -16499,7 +16576,7 @@ class FileItem {
|
|
|
16499
16576
|
constructor() {
|
|
16500
16577
|
__publicField(this, "status", "ready");
|
|
16501
16578
|
__publicField(this, "message", "准备中..");
|
|
16502
|
-
__publicField(this, "uid",
|
|
16579
|
+
__publicField(this, "uid", new Date().getTime().toString());
|
|
16503
16580
|
__publicField(this, "name");
|
|
16504
16581
|
__publicField(this, "url");
|
|
16505
16582
|
__publicField(this, "type");
|
|
@@ -17062,7 +17139,7 @@ const BackTop = (props) => {
|
|
|
17062
17139
|
};
|
|
17063
17140
|
const scrollAnimation = () => {
|
|
17064
17141
|
let cid = requestAniFrame2()(function fn() {
|
|
17065
|
-
const t = duration - Math.max(0, startTime -
|
|
17142
|
+
const t = duration - Math.max(0, startTime - +new Date() + duration / 2);
|
|
17066
17143
|
const y = t * -scrollTop / duration + scrollTop;
|
|
17067
17144
|
scroll(y);
|
|
17068
17145
|
cid = requestAniFrame2()(fn);
|
|
@@ -17091,7 +17168,7 @@ const BackTop = (props) => {
|
|
|
17091
17168
|
}
|
|
17092
17169
|
const goTop = (e) => {
|
|
17093
17170
|
onClick && onClick(e);
|
|
17094
|
-
const otime =
|
|
17171
|
+
const otime = +new Date();
|
|
17095
17172
|
startTime = otime;
|
|
17096
17173
|
isAnimation && duration > 0 ? scrollAnimation() : scroll();
|
|
17097
17174
|
};
|
|
@@ -17806,7 +17883,7 @@ class Notification extends React.PureComponent {
|
|
|
17806
17883
|
__publicField(Notification, "newInstance");
|
|
17807
17884
|
Notification.newInstance = (properties, callback) => {
|
|
17808
17885
|
const element = document.createElement("div");
|
|
17809
|
-
const id = properties.id ? properties.id : `${
|
|
17886
|
+
const id = properties.id ? properties.id : `${new Date().getTime()}`;
|
|
17810
17887
|
element.id = id;
|
|
17811
17888
|
properties.id = id;
|
|
17812
17889
|
document.body.appendChild(element);
|
|
@@ -20282,7 +20359,7 @@ const ImagePreview = (props) => {
|
|
|
20282
20359
|
const touches = event.touches;
|
|
20283
20360
|
const events = touches[0];
|
|
20284
20361
|
const events2 = touches[1];
|
|
20285
|
-
const curTouchTime =
|
|
20362
|
+
const curTouchTime = new Date().getTime();
|
|
20286
20363
|
if (curTouchTime - lastTouchEndTime < 300) {
|
|
20287
20364
|
const store12 = store;
|
|
20288
20365
|
if (store12.scale > 1) {
|
|
@@ -20336,7 +20413,7 @@ const ImagePreview = (props) => {
|
|
|
20336
20413
|
}
|
|
20337
20414
|
};
|
|
20338
20415
|
const onTouchEnd = () => {
|
|
20339
|
-
setLastTouchEndTime(
|
|
20416
|
+
setLastTouchEndTime(new Date().getTime());
|
|
20340
20417
|
const store1 = store;
|
|
20341
20418
|
store1.moveable = false;
|
|
20342
20419
|
if (store1.scale < 1.1 && store1.scale > 1 || store1.scale < 1) {
|