@arco-design/mobile-react 2.27.0 → 2.27.1
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/CHANGELOG.md +11 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/index-bar/index.js +7 -9
- package/dist/index.js +127 -709
- package/dist/index.min.js +5 -5
- package/esm/index-bar/index.js +1 -2
- package/package.json +3 -3
- package/umd/index-bar/index.js +10 -10
package/dist/index.js
CHANGED
@@ -110,34 +110,34 @@
|
|
110
110
|
return r;
|
111
111
|
}
|
112
112
|
|
113
|
-
var opt
|
114
|
-
function isArray
|
115
|
-
return opt
|
113
|
+
var opt = Object.prototype.toString;
|
114
|
+
function isArray(obj) {
|
115
|
+
return opt.call(obj) === '[object Array]';
|
116
116
|
}
|
117
|
-
function isObject$
|
118
|
-
return opt
|
117
|
+
function isObject$2(obj) {
|
118
|
+
return opt.call(obj) === '[object Object]';
|
119
119
|
}
|
120
120
|
function isString(obj) {
|
121
|
-
return opt
|
121
|
+
return opt.call(obj) === '[object String]';
|
122
122
|
}
|
123
123
|
function isOneOf(value, validList) {
|
124
124
|
return validList.indexOf(value) !== -1;
|
125
125
|
}
|
126
|
-
function isEmptyValue
|
126
|
+
function isEmptyValue(obj) {
|
127
127
|
return obj === undefined || obj === null || obj === '';
|
128
128
|
}
|
129
|
-
function isFunction
|
129
|
+
function isFunction(obj) {
|
130
130
|
return Object.prototype.toString.call(obj).toLowerCase() === '[object function]';
|
131
131
|
}
|
132
|
-
function isEmptyArray
|
133
|
-
return isArray
|
132
|
+
function isEmptyArray(obj) {
|
133
|
+
return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
134
134
|
}
|
135
|
-
var isDeepEqual
|
135
|
+
var isDeepEqual = function isDeepEqual(obj, sub) {
|
136
136
|
if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
|
137
137
|
return obj === sub;
|
138
138
|
}
|
139
139
|
|
140
|
-
if (isFunction
|
140
|
+
if (isFunction(obj) && isFunction(sub)) {
|
141
141
|
return obj === sub || obj.toString() === sub.toString();
|
142
142
|
}
|
143
143
|
|
@@ -171,9 +171,9 @@
|
|
171
171
|
|
172
172
|
if (isString(v)) {
|
173
173
|
classNames.push(v);
|
174
|
-
} else if (isArray
|
174
|
+
} else if (isArray(v)) {
|
175
175
|
classNames = classNames.concat(v);
|
176
|
-
} else if (isObject$
|
176
|
+
} else if (isObject$2(v)) {
|
177
177
|
Object.keys(v).forEach(function (k) {
|
178
178
|
if (v[k]) {
|
179
179
|
classNames.push(k);
|
@@ -197,113 +197,113 @@
|
|
197
197
|
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
198
198
|
*/
|
199
199
|
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
200
|
-
var NEWTON_ITERATIONS
|
201
|
-
var NEWTON_MIN_SLOPE
|
202
|
-
var SUBDIVISION_PRECISION
|
203
|
-
var SUBDIVISION_MAX_ITERATIONS
|
204
|
-
var kSplineTableSize
|
205
|
-
var kSampleStepSize
|
206
|
-
var float32ArraySupported
|
207
|
-
|
208
|
-
function A
|
200
|
+
var NEWTON_ITERATIONS = 4;
|
201
|
+
var NEWTON_MIN_SLOPE = 0.001;
|
202
|
+
var SUBDIVISION_PRECISION = 0.0000001;
|
203
|
+
var SUBDIVISION_MAX_ITERATIONS = 10;
|
204
|
+
var kSplineTableSize = 11;
|
205
|
+
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
206
|
+
var float32ArraySupported = typeof Float32Array === 'function';
|
207
|
+
|
208
|
+
function A(aA1, aA2) {
|
209
209
|
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
|
210
210
|
}
|
211
211
|
|
212
|
-
function B
|
212
|
+
function B(aA1, aA2) {
|
213
213
|
return 3.0 * aA2 - 6.0 * aA1;
|
214
214
|
}
|
215
215
|
|
216
|
-
function C
|
216
|
+
function C(aA1) {
|
217
217
|
return 3.0 * aA1;
|
218
218
|
} // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
219
219
|
|
220
220
|
|
221
|
-
function calcBezier
|
222
|
-
return ((A
|
221
|
+
function calcBezier(aT, aA1, aA2) {
|
222
|
+
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
223
223
|
} // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
224
224
|
|
225
225
|
|
226
|
-
function getSlope
|
227
|
-
return 3.0 * A
|
226
|
+
function getSlope(aT, aA1, aA2) {
|
227
|
+
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
228
228
|
}
|
229
229
|
|
230
|
-
function binarySubdivide
|
230
|
+
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
231
231
|
var currentX, currentT;
|
232
232
|
var i = 0;
|
233
233
|
|
234
234
|
do {
|
235
235
|
currentT = aA + (aB - aA) / 2.0;
|
236
|
-
currentX = calcBezier
|
236
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
237
237
|
|
238
238
|
if (currentX > 0.0) {
|
239
239
|
aB = currentT;
|
240
240
|
} else {
|
241
241
|
aA = currentT;
|
242
242
|
}
|
243
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION
|
243
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
244
244
|
|
245
245
|
return currentT;
|
246
246
|
}
|
247
247
|
|
248
|
-
function newtonRaphsonIterate
|
249
|
-
for (var i = 0; i < NEWTON_ITERATIONS
|
250
|
-
var currentSlope = getSlope
|
248
|
+
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
249
|
+
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
250
|
+
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
251
251
|
|
252
252
|
if (currentSlope === 0.0) {
|
253
253
|
return aGuessT;
|
254
254
|
}
|
255
255
|
|
256
|
-
var currentX = calcBezier
|
256
|
+
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
257
257
|
aGuessT -= currentX / currentSlope;
|
258
258
|
}
|
259
259
|
|
260
260
|
return aGuessT;
|
261
261
|
}
|
262
262
|
|
263
|
-
function LinearEasing
|
263
|
+
function LinearEasing(x) {
|
264
264
|
return x;
|
265
265
|
}
|
266
266
|
|
267
|
-
function bezier
|
267
|
+
function bezier(mX1, mY1, mX2, mY2) {
|
268
268
|
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
269
269
|
throw new Error('bezier x values must be in [0, 1] range');
|
270
270
|
}
|
271
271
|
|
272
272
|
if (mX1 === mY1 && mX2 === mY2) {
|
273
|
-
return LinearEasing
|
273
|
+
return LinearEasing;
|
274
274
|
} // Precompute samples table
|
275
275
|
|
276
276
|
|
277
|
-
var sampleValues = float32ArraySupported
|
277
|
+
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
278
278
|
|
279
|
-
for (var i = 0; i < kSplineTableSize
|
280
|
-
sampleValues[i] = calcBezier
|
279
|
+
for (var i = 0; i < kSplineTableSize; ++i) {
|
280
|
+
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
281
281
|
}
|
282
282
|
|
283
283
|
function getTForX(aX) {
|
284
284
|
var intervalStart = 0.0;
|
285
285
|
var currentSample = 1;
|
286
|
-
var lastSample = kSplineTableSize
|
286
|
+
var lastSample = kSplineTableSize - 1;
|
287
287
|
|
288
288
|
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
289
|
-
intervalStart += kSampleStepSize
|
289
|
+
intervalStart += kSampleStepSize;
|
290
290
|
}
|
291
291
|
|
292
292
|
--currentSample; // Interpolate to provide an initial guess for t
|
293
293
|
|
294
294
|
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
295
|
-
var guessForT = intervalStart + dist * kSampleStepSize
|
296
|
-
var initialSlope = getSlope
|
295
|
+
var guessForT = intervalStart + dist * kSampleStepSize;
|
296
|
+
var initialSlope = getSlope(guessForT, mX1, mX2);
|
297
297
|
|
298
|
-
if (initialSlope >= NEWTON_MIN_SLOPE
|
299
|
-
return newtonRaphsonIterate
|
298
|
+
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
299
|
+
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
300
300
|
}
|
301
301
|
|
302
302
|
if (initialSlope === 0.0) {
|
303
303
|
return guessForT;
|
304
304
|
}
|
305
305
|
|
306
|
-
return binarySubdivide
|
306
|
+
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
307
307
|
}
|
308
308
|
|
309
309
|
return function BezierEasing(x) {
|
@@ -312,7 +312,7 @@
|
|
312
312
|
return x;
|
313
313
|
}
|
314
314
|
|
315
|
-
return calcBezier
|
315
|
+
return calcBezier(getTForX(x), mY1, mY2);
|
316
316
|
};
|
317
317
|
}
|
318
318
|
|
@@ -386,20 +386,20 @@
|
|
386
386
|
|
387
387
|
return false;
|
388
388
|
};
|
389
|
-
function execRAF
|
389
|
+
function execRAF(fn) {
|
390
390
|
try {
|
391
391
|
return requestAnimationFrame(fn);
|
392
392
|
} catch (e) {
|
393
393
|
return setTimeout(fn, 17);
|
394
394
|
}
|
395
395
|
}
|
396
|
-
function scrollWithAnimation
|
396
|
+
function scrollWithAnimation(initTop, target, scrollTo, duration, bezier$1, type) {
|
397
397
|
if (duration === void 0) {
|
398
398
|
duration = 300;
|
399
399
|
}
|
400
400
|
|
401
|
-
if (bezier === void 0) {
|
402
|
-
bezier = [0.34, 0.69, 0.1, 1];
|
401
|
+
if (bezier$1 === void 0) {
|
402
|
+
bezier$1 = [0.34, 0.69, 0.1, 1];
|
403
403
|
}
|
404
404
|
|
405
405
|
if (type === void 0) {
|
@@ -415,13 +415,13 @@
|
|
415
415
|
if (p > 1) {
|
416
416
|
scrollTo(targetTop);
|
417
417
|
} else {
|
418
|
-
var newTop = initTop + (targetTop - initTop) * bezier
|
418
|
+
var newTop = initTop + (targetTop - initTop) * bezier.apply(void 0, bezier$1)(p);
|
419
419
|
scrollTo(newTop);
|
420
|
-
execRAF
|
420
|
+
execRAF(fn);
|
421
421
|
}
|
422
422
|
};
|
423
423
|
|
424
|
-
execRAF
|
424
|
+
execRAF(fn);
|
425
425
|
}
|
426
426
|
/**
|
427
427
|
* 返回节点的 document 对象属性
|
@@ -943,7 +943,7 @@
|
|
943
943
|
}
|
944
944
|
}
|
945
945
|
|
946
|
-
var defaultMessageTemplate$
|
946
|
+
var defaultMessageTemplate$1 = '%s 不是 %s 类型';
|
947
947
|
var localeConfig = {
|
948
948
|
locale: 'zh-CN',
|
949
949
|
LoadMore: {
|
@@ -1003,13 +1003,13 @@
|
|
1003
1003
|
Form: {
|
1004
1004
|
required: '%s 为必填项',
|
1005
1005
|
type: {
|
1006
|
-
email: defaultMessageTemplate$
|
1007
|
-
url: defaultMessageTemplate$
|
1008
|
-
string: defaultMessageTemplate$
|
1009
|
-
number: defaultMessageTemplate$
|
1010
|
-
array: defaultMessageTemplate$
|
1011
|
-
object: defaultMessageTemplate$
|
1012
|
-
boolean: defaultMessageTemplate$
|
1006
|
+
email: defaultMessageTemplate$1,
|
1007
|
+
url: defaultMessageTemplate$1,
|
1008
|
+
string: defaultMessageTemplate$1,
|
1009
|
+
number: defaultMessageTemplate$1,
|
1010
|
+
array: defaultMessageTemplate$1,
|
1011
|
+
object: defaultMessageTemplate$1,
|
1012
|
+
boolean: defaultMessageTemplate$1
|
1013
1013
|
},
|
1014
1014
|
number: {
|
1015
1015
|
min: '`%s` 小于 `%s`',
|
@@ -1158,7 +1158,7 @@
|
|
1158
1158
|
return DateWithUTC;
|
1159
1159
|
}();
|
1160
1160
|
|
1161
|
-
var ValidatorType
|
1161
|
+
var ValidatorType;
|
1162
1162
|
|
1163
1163
|
(function (ValidatorType) {
|
1164
1164
|
ValidatorType["Number"] = "number";
|
@@ -1167,7 +1167,7 @@
|
|
1167
1167
|
ValidatorType["Boolean"] = "boolean";
|
1168
1168
|
ValidatorType["Object"] = "object";
|
1169
1169
|
ValidatorType["Custom"] = "custom";
|
1170
|
-
})(ValidatorType
|
1170
|
+
})(ValidatorType || (ValidatorType = {}));
|
1171
1171
|
|
1172
1172
|
var __assign$1 = undefined && undefined.__assign || function () {
|
1173
1173
|
__assign$1 = Object.assign || function (t) {
|
@@ -1184,17 +1184,17 @@
|
|
1184
1184
|
|
1185
1185
|
return __assign$1.apply(this, arguments);
|
1186
1186
|
};
|
1187
|
-
var defaultMessageTemplate
|
1188
|
-
var messageTemplate
|
1187
|
+
var defaultMessageTemplate = '%s is not a %s type';
|
1188
|
+
var messageTemplate = {
|
1189
1189
|
required: '%s is required',
|
1190
1190
|
type: {
|
1191
|
-
email: defaultMessageTemplate
|
1192
|
-
url: defaultMessageTemplate
|
1193
|
-
string: defaultMessageTemplate
|
1194
|
-
number: defaultMessageTemplate
|
1195
|
-
array: defaultMessageTemplate
|
1196
|
-
object: defaultMessageTemplate
|
1197
|
-
boolean: defaultMessageTemplate
|
1191
|
+
email: defaultMessageTemplate,
|
1192
|
+
url: defaultMessageTemplate,
|
1193
|
+
string: defaultMessageTemplate,
|
1194
|
+
number: defaultMessageTemplate,
|
1195
|
+
array: defaultMessageTemplate,
|
1196
|
+
object: defaultMessageTemplate,
|
1197
|
+
boolean: defaultMessageTemplate
|
1198
1198
|
},
|
1199
1199
|
number: {
|
1200
1200
|
min: '`%s` is not greater than `%s`',
|
@@ -1228,9 +1228,9 @@
|
|
1228
1228
|
equal: '%s is not equal to `%s`'
|
1229
1229
|
}
|
1230
1230
|
};
|
1231
|
-
var getMsgTemplate
|
1231
|
+
var getMsgTemplate = function getMsgTemplate(templates, temName, values) {
|
1232
1232
|
var temNameArr = temName.split('.');
|
1233
|
-
var theTemplate = defaultMessageTemplate
|
1233
|
+
var theTemplate = defaultMessageTemplate;
|
1234
1234
|
|
1235
1235
|
if (temNameArr[0] in templates) {
|
1236
1236
|
var firstTemplate = templates[temNameArr[0]];
|
@@ -1247,14 +1247,14 @@
|
|
1247
1247
|
return cur < values.length ? values[cur++] : curVal;
|
1248
1248
|
});
|
1249
1249
|
};
|
1250
|
-
var mergeMsgTemplate
|
1250
|
+
var mergeMsgTemplate = function mergeMsgTemplate(originMT, newMT) {
|
1251
1251
|
var targetMT = originMT;
|
1252
1252
|
|
1253
1253
|
if (newMT) {
|
1254
1254
|
Object.keys(originMT).forEach(function (key) {
|
1255
1255
|
var originValue = originMT[key];
|
1256
1256
|
var curValue = newMT === null || newMT === void 0 ? void 0 : newMT[key];
|
1257
|
-
targetMT[key] = isObject$
|
1257
|
+
targetMT[key] = isObject$2(originValue) ? __assign$1(__assign$1({}, originValue), curValue) : curValue || originValue;
|
1258
1258
|
});
|
1259
1259
|
}
|
1260
1260
|
|
@@ -1300,7 +1300,7 @@
|
|
1300
1300
|
return t;
|
1301
1301
|
}; // eslint-disable-next-line max-classes-per-file
|
1302
1302
|
|
1303
|
-
var BaseValidator
|
1303
|
+
var BaseValidator =
|
1304
1304
|
/** @class */
|
1305
1305
|
function () {
|
1306
1306
|
function BaseValidator(value, rule, options) {
|
@@ -1311,7 +1311,7 @@
|
|
1311
1311
|
rest = __rest(rule, ["message"]);
|
1312
1312
|
|
1313
1313
|
this.message = message || '';
|
1314
|
-
this.type = rule.type || ValidatorType
|
1314
|
+
this.type = rule.type || ValidatorType.String;
|
1315
1315
|
this.error = {
|
1316
1316
|
value: value,
|
1317
1317
|
message: [],
|
@@ -1320,13 +1320,13 @@
|
|
1320
1320
|
this.field = options.field || '';
|
1321
1321
|
this.rule = rest;
|
1322
1322
|
this.validateRules = [];
|
1323
|
-
this.curValidMsgTemplate = mergeMsgTemplate
|
1323
|
+
this.curValidMsgTemplate = mergeMsgTemplate(messageTemplate, options.validateMessage);
|
1324
1324
|
}
|
1325
1325
|
|
1326
1326
|
BaseValidator.prototype.isRequired = function () {
|
1327
1327
|
// 优先级最高
|
1328
|
-
if (isEmptyValue
|
1329
|
-
this.error.message = [this.message || getMsgTemplate
|
1328
|
+
if (isEmptyValue(this.value) || isEmptyArray(this.value)) {
|
1329
|
+
this.error.message = [this.message || getMsgTemplate(this.curValidMsgTemplate, 'required', [this.field])];
|
1330
1330
|
this.error.errorTypes = ['required'];
|
1331
1331
|
return false;
|
1332
1332
|
}
|
@@ -1350,7 +1350,7 @@
|
|
1350
1350
|
values = _a.values;
|
1351
1351
|
|
1352
1352
|
if (isError) {
|
1353
|
-
var theMessage = this.message || getMsgTemplate
|
1353
|
+
var theMessage = this.message || getMsgTemplate(this.curValidMsgTemplate, errTemplate, values);
|
1354
1354
|
this.error.errorTypes.push(errTemplate);
|
1355
1355
|
(_b = this.error.message) === null || _b === void 0 ? void 0 : _b.push(theMessage);
|
1356
1356
|
return theMessage;
|
@@ -1379,42 +1379,42 @@
|
|
1379
1379
|
}
|
1380
1380
|
|
1381
1381
|
NumberValidator.prototype.min = function (num) {
|
1382
|
-
this.dealError(!isEmptyValue
|
1382
|
+
this.dealError(!isEmptyValue(this.value) && this.value < num, {
|
1383
1383
|
errTemplate: 'number.min',
|
1384
1384
|
values: [this.field, "" + num]
|
1385
1385
|
});
|
1386
1386
|
};
|
1387
1387
|
|
1388
1388
|
NumberValidator.prototype.max = function (num) {
|
1389
|
-
this.dealError(!isEmptyValue
|
1389
|
+
this.dealError(!isEmptyValue(this.value) && this.value > num, {
|
1390
1390
|
errTemplate: 'number.max',
|
1391
1391
|
values: [this.field, "" + num]
|
1392
1392
|
});
|
1393
1393
|
};
|
1394
1394
|
|
1395
1395
|
NumberValidator.prototype.equal = function (num) {
|
1396
|
-
return this.dealError(!isEmptyValue
|
1396
|
+
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
1397
1397
|
errTemplate: 'number.equal',
|
1398
1398
|
values: [this.field, "" + num]
|
1399
1399
|
});
|
1400
1400
|
};
|
1401
1401
|
|
1402
1402
|
NumberValidator.prototype.positive = function () {
|
1403
|
-
return this.dealError(!isEmptyValue
|
1403
|
+
return this.dealError(!isEmptyValue(this.value) && this.value < 0, {
|
1404
1404
|
errTemplate: 'number.positive',
|
1405
1405
|
values: [this.field]
|
1406
1406
|
});
|
1407
1407
|
};
|
1408
1408
|
|
1409
1409
|
NumberValidator.prototype.negative = function () {
|
1410
|
-
return this.dealError(!isEmptyValue
|
1410
|
+
return this.dealError(!isEmptyValue(this.value) && this.value > 0, {
|
1411
1411
|
errTemplate: 'number.negative',
|
1412
1412
|
values: [this.field]
|
1413
1413
|
});
|
1414
1414
|
};
|
1415
1415
|
|
1416
1416
|
return NumberValidator;
|
1417
|
-
}(BaseValidator
|
1417
|
+
}(BaseValidator);
|
1418
1418
|
|
1419
1419
|
var StringValidator =
|
1420
1420
|
/** @class */
|
@@ -1429,21 +1429,21 @@
|
|
1429
1429
|
}
|
1430
1430
|
|
1431
1431
|
StringValidator.prototype.min = function (num) {
|
1432
|
-
return this.dealError(!isEmptyValue
|
1432
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
1433
1433
|
errTemplate: 'string.min',
|
1434
1434
|
values: [this.field, "" + num]
|
1435
1435
|
});
|
1436
1436
|
};
|
1437
1437
|
|
1438
1438
|
StringValidator.prototype.max = function (num) {
|
1439
|
-
return this.dealError(!isEmptyValue
|
1439
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
1440
1440
|
errTemplate: 'string.max',
|
1441
1441
|
values: [this.field, "" + num]
|
1442
1442
|
});
|
1443
1443
|
};
|
1444
1444
|
|
1445
1445
|
StringValidator.prototype.len = function (num) {
|
1446
|
-
return this.dealError(!isEmptyValue
|
1446
|
+
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
1447
1447
|
errTemplate: 'string.equal',
|
1448
1448
|
values: [this.field, "" + num]
|
1449
1449
|
});
|
@@ -1451,7 +1451,7 @@
|
|
1451
1451
|
|
1452
1452
|
StringValidator.prototype.match = function (regStr) {
|
1453
1453
|
var reg = new RegExp(regStr);
|
1454
|
-
return this.dealError(!isEmptyValue
|
1454
|
+
return this.dealError(!isEmptyValue(this.value) && !reg.test(this.value), {
|
1455
1455
|
errTemplate: 'string.match',
|
1456
1456
|
values: [this.field, regStr]
|
1457
1457
|
});
|
@@ -1459,7 +1459,7 @@
|
|
1459
1459
|
|
1460
1460
|
StringValidator.prototype.uppercase = function (isValue) {
|
1461
1461
|
var isUppercase = (this.value || '').toLocaleUpperCase() === this.value;
|
1462
|
-
return this.dealError(!isEmptyValue
|
1462
|
+
return this.dealError(!isEmptyValue(this.value) && isUppercase !== isValue, {
|
1463
1463
|
errTemplate: 'string.uppercase',
|
1464
1464
|
values: [this.field]
|
1465
1465
|
});
|
@@ -1467,21 +1467,21 @@
|
|
1467
1467
|
|
1468
1468
|
StringValidator.prototype.lowercase = function (isValue) {
|
1469
1469
|
var isLowercase = (this.value || '').toLocaleLowerCase() === this.value;
|
1470
|
-
return this.dealError(!isEmptyValue
|
1470
|
+
return this.dealError(!isEmptyValue(this.value) && isLowercase !== isValue, {
|
1471
1471
|
errTemplate: 'string.lowercase',
|
1472
1472
|
values: [this.field]
|
1473
1473
|
});
|
1474
1474
|
};
|
1475
1475
|
|
1476
1476
|
StringValidator.prototype.whitespace = function () {
|
1477
|
-
return this.dealError(!isEmptyValue
|
1477
|
+
return this.dealError(!isEmptyValue(this.value) && isEmptyValue(this.value.trim()), {
|
1478
1478
|
errTemplate: 'string.whitespace',
|
1479
1479
|
values: [this.field]
|
1480
1480
|
});
|
1481
1481
|
};
|
1482
1482
|
|
1483
1483
|
return StringValidator;
|
1484
|
-
}(BaseValidator
|
1484
|
+
}(BaseValidator);
|
1485
1485
|
|
1486
1486
|
var ArrayValidator =
|
1487
1487
|
/** @class */
|
@@ -1496,21 +1496,21 @@
|
|
1496
1496
|
}
|
1497
1497
|
|
1498
1498
|
ArrayValidator.prototype.min = function (num) {
|
1499
|
-
return this.dealError(!isEmptyValue
|
1499
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
1500
1500
|
errTemplate: 'array.min',
|
1501
1501
|
values: [this.field, "" + num]
|
1502
1502
|
});
|
1503
1503
|
};
|
1504
1504
|
|
1505
1505
|
ArrayValidator.prototype.max = function (num) {
|
1506
|
-
return this.dealError(!isEmptyValue
|
1506
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
1507
1507
|
errTemplate: 'array.max',
|
1508
1508
|
values: [this.field, "" + num]
|
1509
1509
|
});
|
1510
1510
|
};
|
1511
1511
|
|
1512
1512
|
ArrayValidator.prototype.deepEqual = function (sub) {
|
1513
|
-
return this.dealError(!isDeepEqual
|
1513
|
+
return this.dealError(!isDeepEqual(this.value, sub), {
|
1514
1514
|
errTemplate: 'array.equal',
|
1515
1515
|
values: [this.field, "" + JSON.stringify(sub)]
|
1516
1516
|
});
|
@@ -1528,7 +1528,7 @@
|
|
1528
1528
|
};
|
1529
1529
|
|
1530
1530
|
return ArrayValidator;
|
1531
|
-
}(BaseValidator
|
1531
|
+
}(BaseValidator);
|
1532
1532
|
|
1533
1533
|
var ObjectValidator =
|
1534
1534
|
/** @class */
|
@@ -1543,15 +1543,15 @@
|
|
1543
1543
|
}
|
1544
1544
|
|
1545
1545
|
ObjectValidator.prototype.deepEqual = function (sub) {
|
1546
|
-
return this.dealError(!isDeepEqual
|
1546
|
+
return this.dealError(!isDeepEqual(this.value, sub), {
|
1547
1547
|
errTemplate: 'object.deepEqual',
|
1548
1548
|
values: [this.field, "" + JSON.stringify(sub)]
|
1549
1549
|
});
|
1550
1550
|
};
|
1551
1551
|
|
1552
1552
|
ObjectValidator.prototype.hasKeys = function (keys) {
|
1553
|
-
var allKeys = isEmptyValue
|
1554
|
-
return this.dealError(!isEmptyValue
|
1553
|
+
var allKeys = isEmptyValue(this.value) ? [] : Object.keys(this.value);
|
1554
|
+
return this.dealError(!isEmptyValue(this.value) && keys.some(function (theKey) {
|
1555
1555
|
return !allKeys.includes(theKey);
|
1556
1556
|
}), {
|
1557
1557
|
errTemplate: 'object.hasKeys',
|
@@ -1560,7 +1560,7 @@
|
|
1560
1560
|
};
|
1561
1561
|
|
1562
1562
|
return ObjectValidator;
|
1563
|
-
}(BaseValidator
|
1563
|
+
}(BaseValidator);
|
1564
1564
|
|
1565
1565
|
var CustomValidator =
|
1566
1566
|
/** @class */
|
@@ -1598,7 +1598,7 @@
|
|
1598
1598
|
};
|
1599
1599
|
|
1600
1600
|
return CustomValidator;
|
1601
|
-
}(BaseValidator
|
1601
|
+
}(BaseValidator);
|
1602
1602
|
|
1603
1603
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
1604
1604
|
|
@@ -2923,7 +2923,7 @@
|
|
2923
2923
|
Object.keys(this.rules).forEach(function (key) {
|
2924
2924
|
var spPromiseGroup = [];
|
2925
2925
|
|
2926
|
-
if (isArray
|
2926
|
+
if (isArray(_this.rules[key])) {
|
2927
2927
|
for (var i = 0; i < _this.rules[key].length; i++) {
|
2928
2928
|
var rule = _this.rules[key][i];
|
2929
2929
|
|
@@ -3529,7 +3529,7 @@
|
|
3529
3529
|
|
3530
3530
|
var latestPercentage = React.useRef(percentage);
|
3531
3531
|
React.useEffect(function () {
|
3532
|
-
mountedTransition ? scrollWithAnimation
|
3532
|
+
mountedTransition ? scrollWithAnimation(0, percentage, function (progress) {
|
3533
3533
|
var targetProgress = progress / percentage * latestPercentage.current;
|
3534
3534
|
setCurrentPercentage(Math.floor(targetProgress));
|
3535
3535
|
}, duration, mountedBezier) : setCurrentPercentage(percentage);
|
@@ -3594,7 +3594,7 @@
|
|
3594
3594
|
|
3595
3595
|
var _a;
|
3596
3596
|
|
3597
|
-
function isObject$
|
3597
|
+
function isObject$1(obj) {
|
3598
3598
|
return Object.prototype.toString.call(obj) === '[object Object]';
|
3599
3599
|
}
|
3600
3600
|
|
@@ -3606,7 +3606,7 @@
|
|
3606
3606
|
var updateUsingClientEntryPoint = function updateUsingClientEntryPoint(skipWarning) {
|
3607
3607
|
// https://github.com/facebook/react/blob/17806594cc28284fe195f918e8d77de3516848ec/packages/react-dom/npm/client.js#L10
|
3608
3608
|
// Avoid console warning
|
3609
|
-
if (isObject$
|
3609
|
+
if (isObject$1(CopyReactDOM[__SECRET_INTERNALS__])) {
|
3610
3610
|
CopyReactDOM[__SECRET_INTERNALS__].usingClientEntryPoint = skipWarning;
|
3611
3611
|
}
|
3612
3612
|
};
|
@@ -10518,7 +10518,7 @@
|
|
10518
10518
|
* */
|
10519
10519
|
|
10520
10520
|
function isCascadeArray(options) {
|
10521
|
-
return typeof options[0] === 'object' && !isArray
|
10521
|
+
return typeof options[0] === 'object' && !isArray(options[0]);
|
10522
10522
|
}
|
10523
10523
|
/**
|
10524
10524
|
* 格式化传入的数组
|
@@ -12883,7 +12883,7 @@
|
|
12883
12883
|
|
12884
12884
|
var fieldDisabled = disabled || propsDisabled;
|
12885
12885
|
var fieldRules = (rest === null || rest === void 0 ? void 0 : rest.required) ? __spreadArrays$1([{
|
12886
|
-
type: ValidatorType
|
12886
|
+
type: ValidatorType.String,
|
12887
12887
|
required: true
|
12888
12888
|
}], rules || []) : rules;
|
12889
12889
|
var isRequired = isFieldRequired(rules) || (rest === null || rest === void 0 ? void 0 : rest.required);
|
@@ -14897,7 +14897,7 @@
|
|
14897
14897
|
throw new TypeError(FUNC_ERROR_TEXT);
|
14898
14898
|
}
|
14899
14899
|
wait = toNumber(wait) || 0;
|
14900
|
-
if (isObject
|
14900
|
+
if (isObject(options)) {
|
14901
14901
|
leading = !!options.leading;
|
14902
14902
|
maxing = 'maxWait' in options;
|
14903
14903
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
@@ -15054,7 +15054,7 @@
|
|
15054
15054
|
if (typeof func != 'function') {
|
15055
15055
|
throw new TypeError(FUNC_ERROR_TEXT);
|
15056
15056
|
}
|
15057
|
-
if (isObject
|
15057
|
+
if (isObject(options)) {
|
15058
15058
|
leading = 'leading' in options ? !!options.leading : leading;
|
15059
15059
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
15060
15060
|
}
|
@@ -15090,7 +15090,7 @@
|
|
15090
15090
|
* _.isObject(null);
|
15091
15091
|
* // => false
|
15092
15092
|
*/
|
15093
|
-
function isObject
|
15093
|
+
function isObject(value) {
|
15094
15094
|
var type = typeof value;
|
15095
15095
|
return !!value && (type == 'object' || type == 'function');
|
15096
15096
|
}
|
@@ -15175,9 +15175,9 @@
|
|
15175
15175
|
if (isSymbol(value)) {
|
15176
15176
|
return NAN;
|
15177
15177
|
}
|
15178
|
-
if (isObject
|
15178
|
+
if (isObject(value)) {
|
15179
15179
|
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
15180
|
-
value = isObject
|
15180
|
+
value = isObject(other) ? (other + '') : other;
|
15181
15181
|
}
|
15182
15182
|
if (typeof value != 'string') {
|
15183
15183
|
return value === 0 ? value : +value;
|
@@ -17403,7 +17403,7 @@
|
|
17403
17403
|
var index$b = componentWrapper(ImagePicker, 'ImagePicker');
|
17404
17404
|
|
17405
17405
|
/*!
|
17406
|
-
* @arco-design/transformable v1.0.
|
17406
|
+
* @arco-design/transformable v1.0.2
|
17407
17407
|
* (c) 2022 ludan.kibbon
|
17408
17408
|
*/
|
17409
17409
|
function _defineProperty(obj, key, value) {
|
@@ -20598,588 +20598,6 @@
|
|
20598
20598
|
|
20599
20599
|
var index$a = componentWrapper(ImagePreview, methodsGenerator$3(ImagePreviewWithGlobalContext));
|
20600
20600
|
|
20601
|
-
var opt = Object.prototype.toString;
|
20602
|
-
function isArray(obj) {
|
20603
|
-
return opt.call(obj) === '[object Array]';
|
20604
|
-
}
|
20605
|
-
function isObject(obj) {
|
20606
|
-
return opt.call(obj) === '[object Object]';
|
20607
|
-
}
|
20608
|
-
function isEmptyValue(obj) {
|
20609
|
-
return obj === undefined || obj === null || obj === '';
|
20610
|
-
}
|
20611
|
-
function isFunction(obj) {
|
20612
|
-
return Object.prototype.toString.call(obj).toLowerCase() === '[object function]';
|
20613
|
-
}
|
20614
|
-
function isEmptyArray(obj) {
|
20615
|
-
return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
20616
|
-
}
|
20617
|
-
var isDeepEqual = function isDeepEqual(obj, sub) {
|
20618
|
-
if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
|
20619
|
-
return obj === sub;
|
20620
|
-
}
|
20621
|
-
|
20622
|
-
if (isFunction(obj) && isFunction(sub)) {
|
20623
|
-
return obj === sub || obj.toString() === sub.toString();
|
20624
|
-
}
|
20625
|
-
|
20626
|
-
if (Object.keys(obj).length !== Object.keys(sub).length) {
|
20627
|
-
return false;
|
20628
|
-
}
|
20629
|
-
|
20630
|
-
for (var key in obj) {
|
20631
|
-
if (!isDeepEqual(obj[key], sub[key])) return false;
|
20632
|
-
}
|
20633
|
-
|
20634
|
-
return true;
|
20635
|
-
};
|
20636
|
-
|
20637
|
-
/**
|
20638
|
-
* https://github.com/gre/bezier-easing
|
20639
|
-
* BezierEasing - use bezier curve for transition easing function
|
20640
|
-
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
20641
|
-
*/
|
20642
|
-
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
20643
|
-
var NEWTON_ITERATIONS = 4;
|
20644
|
-
var NEWTON_MIN_SLOPE = 0.001;
|
20645
|
-
var SUBDIVISION_PRECISION = 0.0000001;
|
20646
|
-
var SUBDIVISION_MAX_ITERATIONS = 10;
|
20647
|
-
var kSplineTableSize = 11;
|
20648
|
-
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
20649
|
-
var float32ArraySupported = typeof Float32Array === 'function';
|
20650
|
-
|
20651
|
-
function A(aA1, aA2) {
|
20652
|
-
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
|
20653
|
-
}
|
20654
|
-
|
20655
|
-
function B(aA1, aA2) {
|
20656
|
-
return 3.0 * aA2 - 6.0 * aA1;
|
20657
|
-
}
|
20658
|
-
|
20659
|
-
function C(aA1) {
|
20660
|
-
return 3.0 * aA1;
|
20661
|
-
} // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
20662
|
-
|
20663
|
-
|
20664
|
-
function calcBezier(aT, aA1, aA2) {
|
20665
|
-
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
20666
|
-
} // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
20667
|
-
|
20668
|
-
|
20669
|
-
function getSlope(aT, aA1, aA2) {
|
20670
|
-
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
20671
|
-
}
|
20672
|
-
|
20673
|
-
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
20674
|
-
var currentX, currentT;
|
20675
|
-
var i = 0;
|
20676
|
-
|
20677
|
-
do {
|
20678
|
-
currentT = aA + (aB - aA) / 2.0;
|
20679
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
20680
|
-
|
20681
|
-
if (currentX > 0.0) {
|
20682
|
-
aB = currentT;
|
20683
|
-
} else {
|
20684
|
-
aA = currentT;
|
20685
|
-
}
|
20686
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
20687
|
-
|
20688
|
-
return currentT;
|
20689
|
-
}
|
20690
|
-
|
20691
|
-
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
20692
|
-
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
20693
|
-
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
20694
|
-
|
20695
|
-
if (currentSlope === 0.0) {
|
20696
|
-
return aGuessT;
|
20697
|
-
}
|
20698
|
-
|
20699
|
-
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
20700
|
-
aGuessT -= currentX / currentSlope;
|
20701
|
-
}
|
20702
|
-
|
20703
|
-
return aGuessT;
|
20704
|
-
}
|
20705
|
-
|
20706
|
-
function LinearEasing(x) {
|
20707
|
-
return x;
|
20708
|
-
}
|
20709
|
-
|
20710
|
-
function bezier(mX1, mY1, mX2, mY2) {
|
20711
|
-
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
20712
|
-
throw new Error('bezier x values must be in [0, 1] range');
|
20713
|
-
}
|
20714
|
-
|
20715
|
-
if (mX1 === mY1 && mX2 === mY2) {
|
20716
|
-
return LinearEasing;
|
20717
|
-
} // Precompute samples table
|
20718
|
-
|
20719
|
-
|
20720
|
-
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
20721
|
-
|
20722
|
-
for (var i = 0; i < kSplineTableSize; ++i) {
|
20723
|
-
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
20724
|
-
}
|
20725
|
-
|
20726
|
-
function getTForX(aX) {
|
20727
|
-
var intervalStart = 0.0;
|
20728
|
-
var currentSample = 1;
|
20729
|
-
var lastSample = kSplineTableSize - 1;
|
20730
|
-
|
20731
|
-
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
20732
|
-
intervalStart += kSampleStepSize;
|
20733
|
-
}
|
20734
|
-
|
20735
|
-
--currentSample; // Interpolate to provide an initial guess for t
|
20736
|
-
|
20737
|
-
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
20738
|
-
var guessForT = intervalStart + dist * kSampleStepSize;
|
20739
|
-
var initialSlope = getSlope(guessForT, mX1, mX2);
|
20740
|
-
|
20741
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
20742
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
20743
|
-
}
|
20744
|
-
|
20745
|
-
if (initialSlope === 0.0) {
|
20746
|
-
return guessForT;
|
20747
|
-
}
|
20748
|
-
|
20749
|
-
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
20750
|
-
}
|
20751
|
-
|
20752
|
-
return function BezierEasing(x) {
|
20753
|
-
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
20754
|
-
if (x === 0 || x === 1) {
|
20755
|
-
return x;
|
20756
|
-
}
|
20757
|
-
|
20758
|
-
return calcBezier(getTForX(x), mY1, mY2);
|
20759
|
-
};
|
20760
|
-
}
|
20761
|
-
|
20762
|
-
function execRAF(fn) {
|
20763
|
-
try {
|
20764
|
-
return requestAnimationFrame(fn);
|
20765
|
-
} catch (e) {
|
20766
|
-
return setTimeout(fn, 17);
|
20767
|
-
}
|
20768
|
-
}
|
20769
|
-
function scrollWithAnimation(initTop, target, scrollTo, duration, bezier$1, type) {
|
20770
|
-
if (duration === void 0) {
|
20771
|
-
duration = 300;
|
20772
|
-
}
|
20773
|
-
|
20774
|
-
if (bezier$1 === void 0) {
|
20775
|
-
bezier$1 = [0.34, 0.69, 0.1, 1];
|
20776
|
-
}
|
20777
|
-
|
20778
|
-
if (type === void 0) {
|
20779
|
-
type = 'to';
|
20780
|
-
}
|
20781
|
-
|
20782
|
-
var targetTop = Math.max(0, type === 'by' ? initTop + target : target);
|
20783
|
-
var start = Date.now();
|
20784
|
-
|
20785
|
-
var fn = function fn() {
|
20786
|
-
var p = (Date.now() - start) / duration;
|
20787
|
-
|
20788
|
-
if (p > 1) {
|
20789
|
-
scrollTo(targetTop);
|
20790
|
-
} else {
|
20791
|
-
var newTop = initTop + (targetTop - initTop) * bezier.apply(void 0, bezier$1)(p);
|
20792
|
-
scrollTo(newTop);
|
20793
|
-
execRAF(fn);
|
20794
|
-
}
|
20795
|
-
};
|
20796
|
-
|
20797
|
-
execRAF(fn);
|
20798
|
-
}
|
20799
|
-
|
20800
|
-
var ValidatorType;
|
20801
|
-
|
20802
|
-
(function (ValidatorType) {
|
20803
|
-
ValidatorType["Number"] = "number";
|
20804
|
-
ValidatorType["String"] = "string";
|
20805
|
-
ValidatorType["Array"] = "array";
|
20806
|
-
ValidatorType["Boolean"] = "boolean";
|
20807
|
-
ValidatorType["Object"] = "object";
|
20808
|
-
ValidatorType["Custom"] = "custom";
|
20809
|
-
})(ValidatorType || (ValidatorType = {}));
|
20810
|
-
|
20811
|
-
var defaultMessageTemplate = '%s is not a %s type';
|
20812
|
-
var messageTemplate = {
|
20813
|
-
required: '%s is required',
|
20814
|
-
type: {
|
20815
|
-
email: defaultMessageTemplate,
|
20816
|
-
url: defaultMessageTemplate,
|
20817
|
-
string: defaultMessageTemplate,
|
20818
|
-
number: defaultMessageTemplate,
|
20819
|
-
array: defaultMessageTemplate,
|
20820
|
-
object: defaultMessageTemplate,
|
20821
|
-
boolean: defaultMessageTemplate
|
20822
|
-
},
|
20823
|
-
number: {
|
20824
|
-
min: '`%s` is not greater than `%s`',
|
20825
|
-
max: '`%s` is not less than `%s`',
|
20826
|
-
equal: '`%s` is not equal to `%s`',
|
20827
|
-
range: '`%s` is not in range `%s ~ %s`',
|
20828
|
-
positive: '`%s` is not a positive number',
|
20829
|
-
negative: '`%s` is not a negative number'
|
20830
|
-
},
|
20831
|
-
string: {
|
20832
|
-
max: '%s cannot be longer than %s characters',
|
20833
|
-
min: '%s must be at least %s characters',
|
20834
|
-
len: '%s must be exactly %s characters',
|
20835
|
-
match: '`%s` does not match the pattern %s',
|
20836
|
-
uppercase: '%s must be all uppercased',
|
20837
|
-
lowercase: '%s must be all lowercased',
|
20838
|
-
whitespace: '%s cannot be string of whitespace'
|
20839
|
-
},
|
20840
|
-
array: {
|
20841
|
-
max: '%s cannot be greater than %s in length',
|
20842
|
-
min: '%s cannot be less than %s in length',
|
20843
|
-
len: '%s must be exactly %s in length',
|
20844
|
-
includes: '%s is not includes %s',
|
20845
|
-
deepEqual: '%s is not deep equal with%s'
|
20846
|
-
},
|
20847
|
-
object: {
|
20848
|
-
deepEqual: '%s is not deep equal with %s',
|
20849
|
-
hasKeys: '%s does not contain required fields %s'
|
20850
|
-
},
|
20851
|
-
boolean: {
|
20852
|
-
equal: '%s is not equal to `%s`'
|
20853
|
-
}
|
20854
|
-
};
|
20855
|
-
var getMsgTemplate = function getMsgTemplate(templates, temName, values) {
|
20856
|
-
var temNameArr = temName.split('.');
|
20857
|
-
var theTemplate = defaultMessageTemplate;
|
20858
|
-
|
20859
|
-
if (temNameArr[0] in templates) {
|
20860
|
-
var firstTemplate = templates[temNameArr[0]];
|
20861
|
-
|
20862
|
-
if (Object.prototype.toString.call(firstTemplate).toLowerCase() === '[object object]' && temNameArr.length > 1 && temNameArr[1] in templates[temNameArr[0]]) {
|
20863
|
-
theTemplate = firstTemplate[temNameArr[1]];
|
20864
|
-
} else {
|
20865
|
-
theTemplate = firstTemplate;
|
20866
|
-
}
|
20867
|
-
}
|
20868
|
-
|
20869
|
-
var cur = 0;
|
20870
|
-
return theTemplate.replace(/%s/g, function (curVal) {
|
20871
|
-
return cur < values.length ? values[cur++] : curVal;
|
20872
|
-
});
|
20873
|
-
};
|
20874
|
-
var mergeMsgTemplate = function mergeMsgTemplate(originMT, newMT) {
|
20875
|
-
var targetMT = originMT;
|
20876
|
-
|
20877
|
-
if (newMT) {
|
20878
|
-
Object.keys(originMT).forEach(function (key) {
|
20879
|
-
var originValue = originMT[key];
|
20880
|
-
var curValue = newMT === null || newMT === void 0 ? void 0 : newMT[key];
|
20881
|
-
targetMT[key] = isObject(originValue) ? __assign$2(__assign$2({}, originValue), curValue) : curValue || originValue;
|
20882
|
-
});
|
20883
|
-
}
|
20884
|
-
|
20885
|
-
return targetMT;
|
20886
|
-
};
|
20887
|
-
|
20888
|
-
var BaseValidator =
|
20889
|
-
/** @class */
|
20890
|
-
function () {
|
20891
|
-
function BaseValidator(value, rule, options) {
|
20892
|
-
this.value = value;
|
20893
|
-
|
20894
|
-
var _a = rule.message,
|
20895
|
-
message = _a === void 0 ? '' : _a,
|
20896
|
-
rest = __rest$1(rule, ["message"]);
|
20897
|
-
|
20898
|
-
this.message = message || '';
|
20899
|
-
this.type = rule.type || ValidatorType.String;
|
20900
|
-
this.error = {
|
20901
|
-
value: value,
|
20902
|
-
message: [],
|
20903
|
-
errorTypes: []
|
20904
|
-
};
|
20905
|
-
this.field = options.field || '';
|
20906
|
-
this.rule = rest;
|
20907
|
-
this.validateRules = [];
|
20908
|
-
this.curValidMsgTemplate = mergeMsgTemplate(messageTemplate, options.validateMessage);
|
20909
|
-
}
|
20910
|
-
|
20911
|
-
BaseValidator.prototype.isRequired = function () {
|
20912
|
-
// 优先级最高
|
20913
|
-
if (isEmptyValue(this.value) || isEmptyArray(this.value)) {
|
20914
|
-
this.error.message = [this.message || getMsgTemplate(this.curValidMsgTemplate, 'required', [this.field])];
|
20915
|
-
this.error.errorTypes = ['required'];
|
20916
|
-
return false;
|
20917
|
-
}
|
20918
|
-
|
20919
|
-
return true;
|
20920
|
-
};
|
20921
|
-
|
20922
|
-
BaseValidator.prototype.addError = function (errorType, message) {
|
20923
|
-
var _a;
|
20924
|
-
|
20925
|
-
if (message) {
|
20926
|
-
this.error.errorTypes.push(errorType);
|
20927
|
-
(_a = this.error.message) === null || _a === void 0 ? void 0 : _a.push(message);
|
20928
|
-
}
|
20929
|
-
};
|
20930
|
-
|
20931
|
-
BaseValidator.prototype.dealError = function (isError, _a) {
|
20932
|
-
var _b;
|
20933
|
-
|
20934
|
-
var errTemplate = _a.errTemplate,
|
20935
|
-
values = _a.values;
|
20936
|
-
|
20937
|
-
if (isError) {
|
20938
|
-
var theMessage = this.message || getMsgTemplate(this.curValidMsgTemplate, errTemplate, values);
|
20939
|
-
this.error.errorTypes.push(errTemplate);
|
20940
|
-
(_b = this.error.message) === null || _b === void 0 ? void 0 : _b.push(theMessage);
|
20941
|
-
return theMessage;
|
20942
|
-
}
|
20943
|
-
|
20944
|
-
return '';
|
20945
|
-
};
|
20946
|
-
|
20947
|
-
BaseValidator.prototype.getErrors = function () {
|
20948
|
-
return this.error;
|
20949
|
-
};
|
20950
|
-
|
20951
|
-
return BaseValidator;
|
20952
|
-
}();
|
20953
|
-
|
20954
|
-
/** @class */
|
20955
|
-
(function (_super) {
|
20956
|
-
__extends$1(NumberValidator, _super);
|
20957
|
-
|
20958
|
-
function NumberValidator(value, rules, options) {
|
20959
|
-
var _this = _super.call(this, value, rules, options) || this;
|
20960
|
-
|
20961
|
-
_this.validateRules = ['min', 'max', 'equal', 'positive', 'negative'];
|
20962
|
-
return _this;
|
20963
|
-
}
|
20964
|
-
|
20965
|
-
NumberValidator.prototype.min = function (num) {
|
20966
|
-
this.dealError(!isEmptyValue(this.value) && this.value < num, {
|
20967
|
-
errTemplate: 'number.min',
|
20968
|
-
values: [this.field, "" + num]
|
20969
|
-
});
|
20970
|
-
};
|
20971
|
-
|
20972
|
-
NumberValidator.prototype.max = function (num) {
|
20973
|
-
this.dealError(!isEmptyValue(this.value) && this.value > num, {
|
20974
|
-
errTemplate: 'number.max',
|
20975
|
-
values: [this.field, "" + num]
|
20976
|
-
});
|
20977
|
-
};
|
20978
|
-
|
20979
|
-
NumberValidator.prototype.equal = function (num) {
|
20980
|
-
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
20981
|
-
errTemplate: 'number.equal',
|
20982
|
-
values: [this.field, "" + num]
|
20983
|
-
});
|
20984
|
-
};
|
20985
|
-
|
20986
|
-
NumberValidator.prototype.positive = function () {
|
20987
|
-
return this.dealError(!isEmptyValue(this.value) && this.value < 0, {
|
20988
|
-
errTemplate: 'number.positive',
|
20989
|
-
values: [this.field]
|
20990
|
-
});
|
20991
|
-
};
|
20992
|
-
|
20993
|
-
NumberValidator.prototype.negative = function () {
|
20994
|
-
return this.dealError(!isEmptyValue(this.value) && this.value > 0, {
|
20995
|
-
errTemplate: 'number.negative',
|
20996
|
-
values: [this.field]
|
20997
|
-
});
|
20998
|
-
};
|
20999
|
-
|
21000
|
-
return NumberValidator;
|
21001
|
-
})(BaseValidator);
|
21002
|
-
|
21003
|
-
/** @class */
|
21004
|
-
(function (_super) {
|
21005
|
-
__extends$1(StringValidator, _super);
|
21006
|
-
|
21007
|
-
function StringValidator(value, rules, options) {
|
21008
|
-
var _this = _super.call(this, value, rules, options) || this;
|
21009
|
-
|
21010
|
-
_this.validateRules = ['min', 'max', 'len', 'match', 'uppercase', 'lowercase', 'whitespace'];
|
21011
|
-
return _this;
|
21012
|
-
}
|
21013
|
-
|
21014
|
-
StringValidator.prototype.min = function (num) {
|
21015
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
21016
|
-
errTemplate: 'string.min',
|
21017
|
-
values: [this.field, "" + num]
|
21018
|
-
});
|
21019
|
-
};
|
21020
|
-
|
21021
|
-
StringValidator.prototype.max = function (num) {
|
21022
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
21023
|
-
errTemplate: 'string.max',
|
21024
|
-
values: [this.field, "" + num]
|
21025
|
-
});
|
21026
|
-
};
|
21027
|
-
|
21028
|
-
StringValidator.prototype.len = function (num) {
|
21029
|
-
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
21030
|
-
errTemplate: 'string.equal',
|
21031
|
-
values: [this.field, "" + num]
|
21032
|
-
});
|
21033
|
-
};
|
21034
|
-
|
21035
|
-
StringValidator.prototype.match = function (regStr) {
|
21036
|
-
var reg = new RegExp(regStr);
|
21037
|
-
return this.dealError(!isEmptyValue(this.value) && !reg.test(this.value), {
|
21038
|
-
errTemplate: 'string.match',
|
21039
|
-
values: [this.field, regStr]
|
21040
|
-
});
|
21041
|
-
};
|
21042
|
-
|
21043
|
-
StringValidator.prototype.uppercase = function (isValue) {
|
21044
|
-
var isUppercase = (this.value || '').toLocaleUpperCase() === this.value;
|
21045
|
-
return this.dealError(!isEmptyValue(this.value) && isUppercase !== isValue, {
|
21046
|
-
errTemplate: 'string.uppercase',
|
21047
|
-
values: [this.field]
|
21048
|
-
});
|
21049
|
-
};
|
21050
|
-
|
21051
|
-
StringValidator.prototype.lowercase = function (isValue) {
|
21052
|
-
var isLowercase = (this.value || '').toLocaleLowerCase() === this.value;
|
21053
|
-
return this.dealError(!isEmptyValue(this.value) && isLowercase !== isValue, {
|
21054
|
-
errTemplate: 'string.lowercase',
|
21055
|
-
values: [this.field]
|
21056
|
-
});
|
21057
|
-
};
|
21058
|
-
|
21059
|
-
StringValidator.prototype.whitespace = function () {
|
21060
|
-
return this.dealError(!isEmptyValue(this.value) && isEmptyValue(this.value.trim()), {
|
21061
|
-
errTemplate: 'string.whitespace',
|
21062
|
-
values: [this.field]
|
21063
|
-
});
|
21064
|
-
};
|
21065
|
-
|
21066
|
-
return StringValidator;
|
21067
|
-
})(BaseValidator);
|
21068
|
-
|
21069
|
-
/** @class */
|
21070
|
-
(function (_super) {
|
21071
|
-
__extends$1(ArrayValidator, _super);
|
21072
|
-
|
21073
|
-
function ArrayValidator(value, rules, options) {
|
21074
|
-
var _this = _super.call(this, value, rules, options) || this;
|
21075
|
-
|
21076
|
-
_this.validateRules = ['min', 'max', 'deepEqual', 'includes'];
|
21077
|
-
return _this;
|
21078
|
-
}
|
21079
|
-
|
21080
|
-
ArrayValidator.prototype.min = function (num) {
|
21081
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
21082
|
-
errTemplate: 'array.min',
|
21083
|
-
values: [this.field, "" + num]
|
21084
|
-
});
|
21085
|
-
};
|
21086
|
-
|
21087
|
-
ArrayValidator.prototype.max = function (num) {
|
21088
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
21089
|
-
errTemplate: 'array.max',
|
21090
|
-
values: [this.field, "" + num]
|
21091
|
-
});
|
21092
|
-
};
|
21093
|
-
|
21094
|
-
ArrayValidator.prototype.deepEqual = function (sub) {
|
21095
|
-
return this.dealError(!isDeepEqual(this.value, sub), {
|
21096
|
-
errTemplate: 'array.equal',
|
21097
|
-
values: [this.field, "" + JSON.stringify(sub)]
|
21098
|
-
});
|
21099
|
-
};
|
21100
|
-
|
21101
|
-
ArrayValidator.prototype.includes = function (sub) {
|
21102
|
-
var _this = this;
|
21103
|
-
|
21104
|
-
return this.dealError(sub.some(function (el) {
|
21105
|
-
return !_this.value.includes(el);
|
21106
|
-
}), {
|
21107
|
-
errTemplate: 'array.includes',
|
21108
|
-
values: [this.field, "" + JSON.stringify(sub)]
|
21109
|
-
});
|
21110
|
-
};
|
21111
|
-
|
21112
|
-
return ArrayValidator;
|
21113
|
-
})(BaseValidator);
|
21114
|
-
|
21115
|
-
/** @class */
|
21116
|
-
(function (_super) {
|
21117
|
-
__extends$1(ObjectValidator, _super);
|
21118
|
-
|
21119
|
-
function ObjectValidator(value, rules, options) {
|
21120
|
-
var _this = _super.call(this, value, rules, options) || this;
|
21121
|
-
|
21122
|
-
_this.validateRules = ['deepEqual', 'hasKeys'];
|
21123
|
-
return _this;
|
21124
|
-
}
|
21125
|
-
|
21126
|
-
ObjectValidator.prototype.deepEqual = function (sub) {
|
21127
|
-
return this.dealError(!isDeepEqual(this.value, sub), {
|
21128
|
-
errTemplate: 'object.deepEqual',
|
21129
|
-
values: [this.field, "" + JSON.stringify(sub)]
|
21130
|
-
});
|
21131
|
-
};
|
21132
|
-
|
21133
|
-
ObjectValidator.prototype.hasKeys = function (keys) {
|
21134
|
-
var allKeys = isEmptyValue(this.value) ? [] : Object.keys(this.value);
|
21135
|
-
return this.dealError(!isEmptyValue(this.value) && keys.some(function (theKey) {
|
21136
|
-
return !allKeys.includes(theKey);
|
21137
|
-
}), {
|
21138
|
-
errTemplate: 'object.hasKeys',
|
21139
|
-
values: [this.field, "" + JSON.stringify(keys)]
|
21140
|
-
});
|
21141
|
-
};
|
21142
|
-
|
21143
|
-
return ObjectValidator;
|
21144
|
-
})(BaseValidator);
|
21145
|
-
|
21146
|
-
/** @class */
|
21147
|
-
(function (_super) {
|
21148
|
-
__extends$1(CustomValidator, _super);
|
21149
|
-
|
21150
|
-
function CustomValidator(value, rules, options) {
|
21151
|
-
return _super.call(this, value, rules, options) || this;
|
21152
|
-
}
|
21153
|
-
|
21154
|
-
CustomValidator.prototype.validator = function (validatorTool) {
|
21155
|
-
var _this = this;
|
21156
|
-
|
21157
|
-
if (validatorTool) {
|
21158
|
-
return new Promise(function (resolve) {
|
21159
|
-
var ret = validatorTool(_this.value, function (message) {
|
21160
|
-
if (message === void 0) {
|
21161
|
-
message = '';
|
21162
|
-
}
|
21163
|
-
|
21164
|
-
return _this.addError('custom', message || '');
|
21165
|
-
});
|
21166
|
-
|
21167
|
-
if (ret && (ret === null || ret === void 0 ? void 0 : ret.then)) {
|
21168
|
-
ret.then(function () {
|
21169
|
-
return resolve(_this.getErrors());
|
21170
|
-
});
|
21171
|
-
} else {
|
21172
|
-
resolve(_this.getErrors());
|
21173
|
-
}
|
21174
|
-
});
|
21175
|
-
}
|
21176
|
-
|
21177
|
-
return null;
|
21178
|
-
};
|
21179
|
-
|
21180
|
-
return CustomValidator;
|
21181
|
-
})(BaseValidator);
|
21182
|
-
|
21183
20601
|
var IndexBarContext = /*#__PURE__*/React.createContext({
|
21184
20602
|
sticky: true,
|
21185
20603
|
getScrollContainer: function getScrollContainer() {
|
@@ -21306,7 +20724,7 @@
|
|
21306
20724
|
return;
|
21307
20725
|
}
|
21308
20726
|
|
21309
|
-
execRAF
|
20727
|
+
execRAF(function () {
|
21310
20728
|
framePendingRef.current = false;
|
21311
20729
|
|
21312
20730
|
if (containerRef.current) {
|
@@ -23375,10 +22793,10 @@
|
|
23375
22793
|
setDirectionState = _k[2];
|
23376
22794
|
|
23377
22795
|
var getOffset = React.useCallback(function (dir) {
|
23378
|
-
return getDefaultValue(isObject$
|
22796
|
+
return getDefaultValue(isObject$2(edgeOffset) ? edgeOffset[dir] : edgeOffset, defaultEdgeOffset[dir]);
|
23379
22797
|
}, [edgeOffset]);
|
23380
22798
|
var getAutoDirection = React.useCallback(function (dir) {
|
23381
|
-
return getDefaultValue(isObject$
|
22799
|
+
return getDefaultValue(isObject$2(useAutoDirection) ? useAutoDirection[dir] : useAutoDirection, defaultAutoDirection);
|
23382
22800
|
}, [useAutoDirection]);
|
23383
22801
|
React.useEffect(function () {
|
23384
22802
|
setDirectionState(direction);
|
@@ -23820,7 +23238,7 @@
|
|
23820
23238
|
var closeTimer = React.useRef(0);
|
23821
23239
|
/** 垂直方向自适应 */
|
23822
23240
|
|
23823
|
-
var autoVerticalDirection = getDefaultValue(isObject$
|
23241
|
+
var autoVerticalDirection = getDefaultValue(isObject$2(useAutoDirection) ? useAutoDirection.vertical : useAutoDirection, defaultAutoDirection);
|
23824
23242
|
|
23825
23243
|
var popoverDisappear = function popoverDisappear() {
|
23826
23244
|
onVisibleChange(false);
|
@@ -27427,7 +26845,7 @@
|
|
27427
26845
|
}
|
27428
26846
|
|
27429
26847
|
if (needRafScroll) {
|
27430
|
-
scrollWithAnimation
|
26848
|
+
scrollWithAnimation(isVertical ? domRef.current.scrollLeft : domRef.current.scrollTop, position, function (top) {
|
27431
26849
|
if (domRef.current) {
|
27432
26850
|
if (isVertical) {
|
27433
26851
|
domRef.current.scrollLeft = top;
|
@@ -27747,7 +27165,7 @@
|
|
27747
27165
|
clearTimeout(timerRef.current);
|
27748
27166
|
autoScrollingRef.current = true;
|
27749
27167
|
var duration = rightNow ? 0 : transitionDuration || 0;
|
27750
|
-
scrollWithAnimation
|
27168
|
+
scrollWithAnimation(scrollTop, scrollTop + normalizedTopDis, function (top) {
|
27751
27169
|
if (isGlobal) {
|
27752
27170
|
document.documentElement[scrollAttr] = top;
|
27753
27171
|
document.body[scrollAttr] = top;
|