@nutui/nutui-react 2.0.19 → 2.0.20-beta.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/CHANGELOG.md +11 -0
- package/dist/esm/Image.js +1 -1
- package/dist/esm/formitem2.js +184 -78
- 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/tr-TR.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.es.js +25 -47
- package/dist/nutui.react.umd.js +25 -47
- package/dist/style.mjs +1 -1
- package/dist/types/packages/calendar/calendar.d.ts +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# v2.0.20
|
|
2
|
+
`2023-10-13`
|
|
3
|
+
|
|
4
|
+
* :sparkles: feat: add demo about infiniteloading (#1533) @xiaoyatong
|
|
5
|
+
* :bug: fix(form): 自定义校验 promise 返回错误不能被正确收集 (#1523) @samber
|
|
6
|
+
* :bug: fix(popup): popup zIndex 无效 (#1521) @Clay Zhang
|
|
7
|
+
* :bug: fix: demo format (#1530) @xiaoyatong
|
|
8
|
+
* :bug: fix: taro image and imagepreivew on h5 (#1532) @xiaoyatong
|
|
9
|
+
* :bug: fix: taro image default width and height (#1531) @xiaoyatong
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
# v2.0.19
|
|
2
13
|
`2023-09-27`
|
|
3
14
|
|
package/dist/esm/Image.js
CHANGED
package/dist/esm/formitem2.js
CHANGED
|
@@ -3,6 +3,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
3
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
4
|
import _getPrototypeOf2 from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
6
7
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
8
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
@@ -35,6 +36,66 @@ function _isNativeReflectConstruct2() {
|
|
|
35
36
|
return false;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
40
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
41
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
42
|
+
if (!it) {
|
|
43
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
44
|
+
if (it)
|
|
45
|
+
o = it;
|
|
46
|
+
var i = 0;
|
|
47
|
+
var F = function F2() {
|
|
48
|
+
};
|
|
49
|
+
return { s: F, n: function n() {
|
|
50
|
+
if (i >= o.length)
|
|
51
|
+
return { done: true };
|
|
52
|
+
return { done: false, value: o[i++] };
|
|
53
|
+
}, e: function e(_e) {
|
|
54
|
+
throw _e;
|
|
55
|
+
}, f: F };
|
|
56
|
+
}
|
|
57
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
|
+
}
|
|
59
|
+
var normalCompletion = true, didErr = false, err;
|
|
60
|
+
return { s: function s() {
|
|
61
|
+
it = it.call(o);
|
|
62
|
+
}, n: function n() {
|
|
63
|
+
var step = it.next();
|
|
64
|
+
normalCompletion = step.done;
|
|
65
|
+
return step;
|
|
66
|
+
}, e: function e(_e2) {
|
|
67
|
+
didErr = true;
|
|
68
|
+
err = _e2;
|
|
69
|
+
}, f: function f() {
|
|
70
|
+
try {
|
|
71
|
+
if (!normalCompletion && it["return"] != null)
|
|
72
|
+
it["return"]();
|
|
73
|
+
} finally {
|
|
74
|
+
if (didErr)
|
|
75
|
+
throw err;
|
|
76
|
+
}
|
|
77
|
+
} };
|
|
78
|
+
}
|
|
79
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
80
|
+
if (!o)
|
|
81
|
+
return;
|
|
82
|
+
if (typeof o === "string")
|
|
83
|
+
return _arrayLikeToArray(o, minLen);
|
|
84
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
85
|
+
if (n === "Object" && o.constructor)
|
|
86
|
+
n = o.constructor.name;
|
|
87
|
+
if (n === "Map" || n === "Set")
|
|
88
|
+
return Array.from(o);
|
|
89
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
90
|
+
return _arrayLikeToArray(o, minLen);
|
|
91
|
+
}
|
|
92
|
+
function _arrayLikeToArray(arr, len) {
|
|
93
|
+
if (len == null || len > arr.length)
|
|
94
|
+
len = arr.length;
|
|
95
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
96
|
+
arr2[i] = arr[i];
|
|
97
|
+
return arr2;
|
|
98
|
+
}
|
|
38
99
|
function ownKeys(object4, enumerableOnly) {
|
|
39
100
|
var keys = Object.keys(object4);
|
|
40
101
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1155,11 +1216,11 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1155
1216
|
});
|
|
1156
1217
|
_defineProperty(this, "setFieldsValue", function(newStore) {
|
|
1157
1218
|
_this3.store = _objectSpread(_objectSpread({}, _this3.store), newStore);
|
|
1158
|
-
_this3.fieldEntities.forEach(function(
|
|
1159
|
-
var name =
|
|
1219
|
+
_this3.fieldEntities.forEach(function(entity) {
|
|
1220
|
+
var name = entity.props.name;
|
|
1160
1221
|
Object.keys(newStore).forEach(function(key) {
|
|
1161
1222
|
if (key === name) {
|
|
1162
|
-
|
|
1223
|
+
entity.onStoreChange("update");
|
|
1163
1224
|
}
|
|
1164
1225
|
});
|
|
1165
1226
|
});
|
|
@@ -1167,78 +1228,123 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1167
1228
|
_defineProperty(this, "setCallback", function(callback) {
|
|
1168
1229
|
_this3.callbacks = _objectSpread(_objectSpread({}, _this3.callbacks), callback);
|
|
1169
1230
|
});
|
|
1170
|
-
_defineProperty(this, "
|
|
1171
|
-
var
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1231
|
+
_defineProperty(this, "validateFields", /* @__PURE__ */ function() {
|
|
1232
|
+
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee(nameList) {
|
|
1233
|
+
var filterEntitys, errs, _iterator, _step, _loop;
|
|
1234
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
1235
|
+
while (1)
|
|
1236
|
+
switch (_context2.prev = _context2.next) {
|
|
1237
|
+
case 0:
|
|
1238
|
+
filterEntitys = [];
|
|
1239
|
+
errs = [];
|
|
1240
|
+
_this3.errors.length = 0;
|
|
1241
|
+
if (!nameList || nameList.length === 0) {
|
|
1242
|
+
filterEntitys = _this3.fieldEntities;
|
|
1243
|
+
} else {
|
|
1244
|
+
filterEntitys = _this3.fieldEntities.filter(function(_ref2) {
|
|
1245
|
+
var name = _ref2.props.name;
|
|
1246
|
+
return nameList.includes(name);
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
_iterator = _createForOfIteratorHelper(filterEntitys);
|
|
1250
|
+
_context2.prev = 5;
|
|
1251
|
+
_loop = /* @__PURE__ */ _regeneratorRuntime.mark(function _loop2() {
|
|
1252
|
+
var entity, _entity$props, name, _entity$props$rules, rules2, descriptor, validator, _this3$store2, errors;
|
|
1253
|
+
return _regeneratorRuntime.wrap(function _loop$(_context) {
|
|
1254
|
+
while (1)
|
|
1255
|
+
switch (_context.prev = _context.next) {
|
|
1256
|
+
case 0:
|
|
1257
|
+
entity = _step.value;
|
|
1258
|
+
_entity$props = entity.props, name = _entity$props.name, _entity$props$rules = _entity$props.rules, rules2 = _entity$props$rules === void 0 ? [] : _entity$props$rules;
|
|
1259
|
+
descriptor = {};
|
|
1260
|
+
if (rules2.length) {
|
|
1261
|
+
if (rules2.length > 1) {
|
|
1262
|
+
descriptor[name] = [];
|
|
1263
|
+
rules2.forEach(function(v) {
|
|
1264
|
+
descriptor[name].push(v);
|
|
1265
|
+
});
|
|
1266
|
+
} else {
|
|
1267
|
+
descriptor[name] = rules2[0];
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
validator = new Schema(descriptor);
|
|
1271
|
+
_context.prev = 5;
|
|
1272
|
+
_this3.errors[name] = [];
|
|
1273
|
+
_context.next = 9;
|
|
1274
|
+
return validator.validate(_defineProperty({}, name, (_this3$store2 = _this3.store) === null || _this3$store2 === void 0 ? void 0 : _this3$store2[name]));
|
|
1275
|
+
case 9:
|
|
1276
|
+
_context.next = 15;
|
|
1277
|
+
break;
|
|
1278
|
+
case 11:
|
|
1279
|
+
_context.prev = 11;
|
|
1280
|
+
_context.t0 = _context["catch"](5);
|
|
1281
|
+
errors = _context.t0.errors;
|
|
1282
|
+
if (errors) {
|
|
1283
|
+
errs.push.apply(errs, _toConsumableArray(errors));
|
|
1284
|
+
_this3.errors[name] = errors;
|
|
1285
|
+
}
|
|
1286
|
+
case 15:
|
|
1287
|
+
entity.onStoreChange("validate");
|
|
1288
|
+
case 16:
|
|
1289
|
+
case "end":
|
|
1290
|
+
return _context.stop();
|
|
1291
|
+
}
|
|
1292
|
+
}, _loop2, null, [[5, 11]]);
|
|
1293
|
+
});
|
|
1294
|
+
_iterator.s();
|
|
1295
|
+
case 8:
|
|
1296
|
+
if ((_step = _iterator.n()).done) {
|
|
1297
|
+
_context2.next = 12;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
return _context2.delegateYield(_loop(), "t0", 10);
|
|
1301
|
+
case 10:
|
|
1302
|
+
_context2.next = 8;
|
|
1303
|
+
break;
|
|
1304
|
+
case 12:
|
|
1305
|
+
_context2.next = 17;
|
|
1306
|
+
break;
|
|
1307
|
+
case 14:
|
|
1308
|
+
_context2.prev = 14;
|
|
1309
|
+
_context2.t1 = _context2["catch"](5);
|
|
1310
|
+
_iterator.e(_context2.t1);
|
|
1311
|
+
case 17:
|
|
1312
|
+
_context2.prev = 17;
|
|
1313
|
+
_iterator.f();
|
|
1314
|
+
return _context2.finish(17);
|
|
1315
|
+
case 20:
|
|
1316
|
+
return _context2.abrupt("return", errs);
|
|
1317
|
+
case 21:
|
|
1318
|
+
case "end":
|
|
1319
|
+
return _context2.stop();
|
|
1320
|
+
}
|
|
1321
|
+
}, _callee, null, [[5, 14, 17, 20]]);
|
|
1322
|
+
}));
|
|
1323
|
+
return function(_x) {
|
|
1324
|
+
return _ref.apply(this, arguments);
|
|
1325
|
+
};
|
|
1326
|
+
}());
|
|
1327
|
+
_defineProperty(this, "submit", /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee2() {
|
|
1328
|
+
var errors, _this3$callbacks$onFi, _this3$callbacks, _this3$callbacks$onFi2, _this3$callbacks2;
|
|
1329
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
1330
|
+
while (1)
|
|
1331
|
+
switch (_context3.prev = _context3.next) {
|
|
1332
|
+
case 0:
|
|
1333
|
+
_context3.next = 2;
|
|
1334
|
+
return _this3.validateFields();
|
|
1335
|
+
case 2:
|
|
1336
|
+
errors = _context3.sent;
|
|
1337
|
+
if (errors.length === 0) {
|
|
1338
|
+
(_this3$callbacks$onFi = (_this3$callbacks = _this3.callbacks).onFinish) === null || _this3$callbacks$onFi === void 0 ? void 0 : _this3$callbacks$onFi.call(_this3$callbacks, _this3.store);
|
|
1339
|
+
} else if (errors.length > 0) {
|
|
1340
|
+
(_this3$callbacks$onFi2 = (_this3$callbacks2 = _this3.callbacks).onFinishFailed) === null || _this3$callbacks$onFi2 === void 0 ? void 0 : _this3$callbacks$onFi2.call(_this3$callbacks2, _this3.store, errors);
|
|
1341
|
+
}
|
|
1342
|
+
case 4:
|
|
1343
|
+
case "end":
|
|
1344
|
+
return _context3.stop();
|
|
1227
1345
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
});
|
|
1231
|
-
});
|
|
1232
|
-
_defineProperty(this, "submit", function() {
|
|
1233
|
-
var errors = _this3.validate();
|
|
1234
|
-
if (errors.length === 0) {
|
|
1235
|
-
var _this3$callbacks$onFi, _this3$callbacks;
|
|
1236
|
-
(_this3$callbacks$onFi = (_this3$callbacks = _this3.callbacks).onFinish) === null || _this3$callbacks$onFi === void 0 ? void 0 : _this3$callbacks$onFi.call(_this3$callbacks, _this3.store);
|
|
1237
|
-
} else if (errors.length > 0) {
|
|
1238
|
-
var _this3$callbacks$onFi2, _this3$callbacks2;
|
|
1239
|
-
(_this3$callbacks$onFi2 = (_this3$callbacks2 = _this3.callbacks).onFinishFailed) === null || _this3$callbacks$onFi2 === void 0 ? void 0 : _this3$callbacks$onFi2.call(_this3$callbacks2, _this3.store, errors);
|
|
1240
|
-
}
|
|
1241
|
-
});
|
|
1346
|
+
}, _callee2);
|
|
1347
|
+
})));
|
|
1242
1348
|
_defineProperty(this, "resetFields", function() {
|
|
1243
1349
|
_this3.errors.length = 0;
|
|
1244
1350
|
_this3.store = _this3.initialValues;
|
|
@@ -1246,8 +1352,8 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1246
1352
|
entity.onStoreChange("reset");
|
|
1247
1353
|
});
|
|
1248
1354
|
});
|
|
1249
|
-
_defineProperty(this, "dispatch", function(
|
|
1250
|
-
var name =
|
|
1355
|
+
_defineProperty(this, "dispatch", function(_ref5) {
|
|
1356
|
+
var name = _ref5.name;
|
|
1251
1357
|
_this3.validateFields([name]);
|
|
1252
1358
|
});
|
|
1253
1359
|
_defineProperty(this, "getInternal", function(key) {
|
|
@@ -1380,8 +1486,8 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
|
1380
1486
|
return controlled;
|
|
1381
1487
|
});
|
|
1382
1488
|
_defineProperty(_assertThisInitialized(_this4), "refresh", function() {
|
|
1383
|
-
_this4.setState(function(
|
|
1384
|
-
var resetCount =
|
|
1489
|
+
_this4.setState(function(_ref6) {
|
|
1490
|
+
var resetCount = _ref6.resetCount;
|
|
1385
1491
|
return {
|
|
1386
1492
|
resetCount: resetCount + 1
|
|
1387
1493
|
};
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.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.es.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
var _a;
|
|
8
8
|
/*!
|
|
9
|
-
* @nutui/nutui-react v2.0.
|
|
9
|
+
* @nutui/nutui-react v2.0.20 Fri Oct 13 2023 14:00:36 GMT+0800 (China Standard Time)
|
|
10
10
|
* (c) 2023 @jdf2e.
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*/
|
|
@@ -3750,7 +3750,7 @@ const defaultProps$1p = {
|
|
|
3750
3750
|
fit: "fill",
|
|
3751
3751
|
position: "center",
|
|
3752
3752
|
alt: "",
|
|
3753
|
-
width: "
|
|
3753
|
+
width: "",
|
|
3754
3754
|
height: "",
|
|
3755
3755
|
error: true,
|
|
3756
3756
|
loading: true,
|
|
@@ -16461,11 +16461,11 @@ class FormStore {
|
|
|
16461
16461
|
...this.store,
|
|
16462
16462
|
...newStore
|
|
16463
16463
|
};
|
|
16464
|
-
this.fieldEntities.forEach((
|
|
16465
|
-
const { name } =
|
|
16464
|
+
this.fieldEntities.forEach((entity) => {
|
|
16465
|
+
const { name } = entity.props;
|
|
16466
16466
|
Object.keys(newStore).forEach((key) => {
|
|
16467
16467
|
if (key === name) {
|
|
16468
|
-
|
|
16468
|
+
entity.onStoreChange("update");
|
|
16469
16469
|
}
|
|
16470
16470
|
});
|
|
16471
16471
|
});
|
|
@@ -16476,44 +16476,19 @@ class FormStore {
|
|
|
16476
16476
|
...callback
|
|
16477
16477
|
};
|
|
16478
16478
|
});
|
|
16479
|
-
__publicField(this, "
|
|
16480
|
-
|
|
16479
|
+
__publicField(this, "validateFields", async (nameList) => {
|
|
16480
|
+
var _a2;
|
|
16481
|
+
let filterEntitys = [];
|
|
16482
|
+
const errs = [];
|
|
16481
16483
|
this.errors.length = 0;
|
|
16482
|
-
this.fieldEntities.forEach((entity) => {
|
|
16483
|
-
var _a2;
|
|
16484
|
-
const { name, rules: rules2 = [] } = entity.props;
|
|
16485
|
-
const descriptor = {};
|
|
16486
|
-
if (rules2.length) {
|
|
16487
|
-
if (rules2.length > 1) {
|
|
16488
|
-
descriptor[name] = [];
|
|
16489
|
-
rules2.forEach((v) => {
|
|
16490
|
-
descriptor[name].push(v);
|
|
16491
|
-
});
|
|
16492
|
-
} else {
|
|
16493
|
-
descriptor[name] = rules2[0];
|
|
16494
|
-
}
|
|
16495
|
-
}
|
|
16496
|
-
const validator = new Schema(descriptor);
|
|
16497
|
-
validator.messages();
|
|
16498
|
-
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16499
|
-
if (errors) {
|
|
16500
|
-
err.push(...errors);
|
|
16501
|
-
this.errors[name] = errors;
|
|
16502
|
-
}
|
|
16503
|
-
entity.onStoreChange("validate");
|
|
16504
|
-
});
|
|
16505
|
-
});
|
|
16506
|
-
return err;
|
|
16507
|
-
});
|
|
16508
|
-
__publicField(this, "validateFields", (nameList) => {
|
|
16509
16484
|
if (!nameList || nameList.length === 0) {
|
|
16510
|
-
this.
|
|
16511
|
-
|
|
16485
|
+
filterEntitys = this.fieldEntities;
|
|
16486
|
+
} else {
|
|
16487
|
+
filterEntitys = this.fieldEntities.filter(
|
|
16488
|
+
({ props: { name } }) => nameList.includes(name)
|
|
16489
|
+
);
|
|
16512
16490
|
}
|
|
16513
|
-
|
|
16514
|
-
return nameList.includes(name);
|
|
16515
|
-
}).forEach((entity) => {
|
|
16516
|
-
var _a2;
|
|
16491
|
+
for (const entity of filterEntitys) {
|
|
16517
16492
|
const { name, rules: rules2 = [] } = entity.props;
|
|
16518
16493
|
const descriptor = {};
|
|
16519
16494
|
if (rules2.length) {
|
|
@@ -16527,19 +16502,22 @@ class FormStore {
|
|
|
16527
16502
|
}
|
|
16528
16503
|
}
|
|
16529
16504
|
const validator = new Schema(descriptor);
|
|
16530
|
-
|
|
16531
|
-
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16505
|
+
try {
|
|
16532
16506
|
this.errors[name] = [];
|
|
16507
|
+
await validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] });
|
|
16508
|
+
} catch ({ errors }) {
|
|
16533
16509
|
if (errors) {
|
|
16510
|
+
errs.push(...errors);
|
|
16534
16511
|
this.errors[name] = errors;
|
|
16535
16512
|
}
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
}
|
|
16513
|
+
}
|
|
16514
|
+
entity.onStoreChange("validate");
|
|
16515
|
+
}
|
|
16516
|
+
return errs;
|
|
16539
16517
|
});
|
|
16540
|
-
__publicField(this, "submit", () => {
|
|
16518
|
+
__publicField(this, "submit", async () => {
|
|
16541
16519
|
var _a2, _b, _c, _d;
|
|
16542
|
-
const errors = this.
|
|
16520
|
+
const errors = await this.validateFields();
|
|
16543
16521
|
if (errors.length === 0) {
|
|
16544
16522
|
(_b = (_a2 = this.callbacks).onFinish) == null ? void 0 : _b.call(_a2, this.store);
|
|
16545
16523
|
} else if (errors.length > 0) {
|
package/dist/nutui.react.umd.js
CHANGED
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
/*!
|
|
12
|
-
* @nutui/nutui-react v2.0.
|
|
12
|
+
* @nutui/nutui-react v2.0.20 Fri Oct 13 2023 14:00:36 GMT+0800 (China Standard Time)
|
|
13
13
|
* (c) 2023 @jdf2e.
|
|
14
14
|
* Released under the MIT License.
|
|
15
15
|
*/
|
|
@@ -3768,7 +3768,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3768
3768
|
fit: "fill",
|
|
3769
3769
|
position: "center",
|
|
3770
3770
|
alt: "",
|
|
3771
|
-
width: "
|
|
3771
|
+
width: "",
|
|
3772
3772
|
height: "",
|
|
3773
3773
|
error: true,
|
|
3774
3774
|
loading: true,
|
|
@@ -16479,11 +16479,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16479
16479
|
...this.store,
|
|
16480
16480
|
...newStore
|
|
16481
16481
|
};
|
|
16482
|
-
this.fieldEntities.forEach((
|
|
16483
|
-
const { name } =
|
|
16482
|
+
this.fieldEntities.forEach((entity) => {
|
|
16483
|
+
const { name } = entity.props;
|
|
16484
16484
|
Object.keys(newStore).forEach((key) => {
|
|
16485
16485
|
if (key === name) {
|
|
16486
|
-
|
|
16486
|
+
entity.onStoreChange("update");
|
|
16487
16487
|
}
|
|
16488
16488
|
});
|
|
16489
16489
|
});
|
|
@@ -16494,44 +16494,19 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16494
16494
|
...callback
|
|
16495
16495
|
};
|
|
16496
16496
|
});
|
|
16497
|
-
__publicField(this, "
|
|
16498
|
-
|
|
16497
|
+
__publicField(this, "validateFields", async (nameList) => {
|
|
16498
|
+
var _a2;
|
|
16499
|
+
let filterEntitys = [];
|
|
16500
|
+
const errs = [];
|
|
16499
16501
|
this.errors.length = 0;
|
|
16500
|
-
this.fieldEntities.forEach((entity) => {
|
|
16501
|
-
var _a2;
|
|
16502
|
-
const { name, rules: rules2 = [] } = entity.props;
|
|
16503
|
-
const descriptor = {};
|
|
16504
|
-
if (rules2.length) {
|
|
16505
|
-
if (rules2.length > 1) {
|
|
16506
|
-
descriptor[name] = [];
|
|
16507
|
-
rules2.forEach((v) => {
|
|
16508
|
-
descriptor[name].push(v);
|
|
16509
|
-
});
|
|
16510
|
-
} else {
|
|
16511
|
-
descriptor[name] = rules2[0];
|
|
16512
|
-
}
|
|
16513
|
-
}
|
|
16514
|
-
const validator = new Schema(descriptor);
|
|
16515
|
-
validator.messages();
|
|
16516
|
-
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16517
|
-
if (errors) {
|
|
16518
|
-
err.push(...errors);
|
|
16519
|
-
this.errors[name] = errors;
|
|
16520
|
-
}
|
|
16521
|
-
entity.onStoreChange("validate");
|
|
16522
|
-
});
|
|
16523
|
-
});
|
|
16524
|
-
return err;
|
|
16525
|
-
});
|
|
16526
|
-
__publicField(this, "validateFields", (nameList) => {
|
|
16527
16502
|
if (!nameList || nameList.length === 0) {
|
|
16528
|
-
this.
|
|
16529
|
-
|
|
16503
|
+
filterEntitys = this.fieldEntities;
|
|
16504
|
+
} else {
|
|
16505
|
+
filterEntitys = this.fieldEntities.filter(
|
|
16506
|
+
({ props: { name } }) => nameList.includes(name)
|
|
16507
|
+
);
|
|
16530
16508
|
}
|
|
16531
|
-
|
|
16532
|
-
return nameList.includes(name);
|
|
16533
|
-
}).forEach((entity) => {
|
|
16534
|
-
var _a2;
|
|
16509
|
+
for (const entity of filterEntitys) {
|
|
16535
16510
|
const { name, rules: rules2 = [] } = entity.props;
|
|
16536
16511
|
const descriptor = {};
|
|
16537
16512
|
if (rules2.length) {
|
|
@@ -16545,19 +16520,22 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16545
16520
|
}
|
|
16546
16521
|
}
|
|
16547
16522
|
const validator = new Schema(descriptor);
|
|
16548
|
-
|
|
16549
|
-
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16523
|
+
try {
|
|
16550
16524
|
this.errors[name] = [];
|
|
16525
|
+
await validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] });
|
|
16526
|
+
} catch ({ errors }) {
|
|
16551
16527
|
if (errors) {
|
|
16528
|
+
errs.push(...errors);
|
|
16552
16529
|
this.errors[name] = errors;
|
|
16553
16530
|
}
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
}
|
|
16531
|
+
}
|
|
16532
|
+
entity.onStoreChange("validate");
|
|
16533
|
+
}
|
|
16534
|
+
return errs;
|
|
16557
16535
|
});
|
|
16558
|
-
__publicField(this, "submit", () => {
|
|
16536
|
+
__publicField(this, "submit", async () => {
|
|
16559
16537
|
var _a2, _b, _c, _d;
|
|
16560
|
-
const errors = this.
|
|
16538
|
+
const errors = await this.validateFields();
|
|
16561
16539
|
if (errors.length === 0) {
|
|
16562
16540
|
(_b = (_a2 = this.callbacks).onFinish) == null ? void 0 : _b.call(_a2, this.store);
|
|
16563
16541
|
} else if (errors.length > 0) {
|
package/dist/style.mjs
CHANGED
|
@@ -111,22 +111,22 @@ export interface CalendarProps {
|
|
|
111
111
|
renderDayBottom?: (date: Day) => string | JSX.Element
|
|
112
112
|
/**
|
|
113
113
|
* 关闭时触发
|
|
114
|
-
* @default
|
|
114
|
+
* @default -
|
|
115
115
|
*/
|
|
116
116
|
onClose?: () => void
|
|
117
117
|
/**
|
|
118
118
|
* 选择之后或是点击确认按钮触发
|
|
119
|
-
* @default
|
|
119
|
+
* @default -
|
|
120
120
|
*/
|
|
121
121
|
onConfirm?: (param: string) => void
|
|
122
122
|
/**
|
|
123
123
|
* 点击/选择后触发
|
|
124
|
-
* @default
|
|
124
|
+
* @default -
|
|
125
125
|
*/
|
|
126
126
|
onDayClick?: (data: string) => void
|
|
127
127
|
/**
|
|
128
128
|
* 年月子标题到达顶部时触发
|
|
129
|
-
* @default
|
|
129
|
+
* @default -
|
|
130
130
|
*/
|
|
131
131
|
onPageChange?: (param: string) => void
|
|
132
132
|
}
|