shineout 3.9.1-beta.7 → 3.9.2-beta.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/cjs/index.js +1 -1
- package/dist/shineout.js +64 -26
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
522
522
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
523
523
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
524
524
|
var _default = exports.default = {
|
|
525
|
-
version: '3.9.
|
|
525
|
+
version: '3.9.2-beta.1'
|
|
526
526
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -12400,7 +12400,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
12400
12400
|
};
|
|
12401
12401
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
12402
12402
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
12403
|
-
/* harmony default export */ var version = ('3.9.
|
|
12403
|
+
/* harmony default export */ var version = ('3.9.2-beta.1');
|
|
12404
12404
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12405
12405
|
|
|
12406
12406
|
|
|
@@ -36740,6 +36740,26 @@ var getCompleteFieldKeys = function getCompleteFieldKeys(fields, allFields) {
|
|
|
36740
36740
|
return Array.from(new Set(completeFields));
|
|
36741
36741
|
};
|
|
36742
36742
|
|
|
36743
|
+
/**
|
|
36744
|
+
* 获取字段的所有父级key数组
|
|
36745
|
+
* @param field 字段key
|
|
36746
|
+
* @description 获取字段的所有父级key数组,并去掉数组下标部分, 结果按从近及远排序
|
|
36747
|
+
* @example a.b[0].c => ['a.b', 'a']
|
|
36748
|
+
*/
|
|
36749
|
+
var getParentKeys = function getParentKeys(field) {
|
|
36750
|
+
if (!field) return [];
|
|
36751
|
+
var parts = field.split('.');
|
|
36752
|
+
var parentKeys = [];
|
|
36753
|
+
for (var i = parts.length - 1; i > 0; i--) {
|
|
36754
|
+
var parentKey = parts.slice(0, i).join('.');
|
|
36755
|
+
var cleanedKey = parentKey.replace(/\[\d+\]/g, '');
|
|
36756
|
+
if (cleanedKey && !parentKeys.includes(cleanedKey)) {
|
|
36757
|
+
parentKeys.push(cleanedKey);
|
|
36758
|
+
}
|
|
36759
|
+
}
|
|
36760
|
+
return parentKeys;
|
|
36761
|
+
};
|
|
36762
|
+
|
|
36743
36763
|
/**
|
|
36744
36764
|
* 将对象中的所有值设置为空, 如果值是数组,重置为空数组,如果是对象,重置为空对象,如果是基础类型,重置为undefined
|
|
36745
36765
|
* @param obj 对象
|
|
@@ -44578,13 +44598,14 @@ function useFormControl(props) {
|
|
|
44578
44598
|
if (isArray(e)) {
|
|
44579
44599
|
e.forEach(function (error, index) {
|
|
44580
44600
|
if (error) {
|
|
44581
|
-
var
|
|
44582
|
-
|
|
44583
|
-
|
|
44584
|
-
|
|
44585
|
-
|
|
44586
|
-
|
|
44587
|
-
|
|
44601
|
+
var keys = Object.keys(error);
|
|
44602
|
+
keys.forEach(function (fieldName) {
|
|
44603
|
+
var fieldError = error === null || error === void 0 ? void 0 : error[fieldName];
|
|
44604
|
+
var na = "".concat(name, "[").concat(index, "].").concat(fieldName);
|
|
44605
|
+
if (fieldName && fieldError) {
|
|
44606
|
+
formFunc === null || formFunc === void 0 || formFunc.setError(na, fieldError);
|
|
44607
|
+
}
|
|
44608
|
+
});
|
|
44588
44609
|
}
|
|
44589
44610
|
});
|
|
44590
44611
|
} else {
|
|
@@ -52507,6 +52528,7 @@ var useForm = function useForm(props) {
|
|
|
52507
52528
|
ignoreValidateFields: [],
|
|
52508
52529
|
updateMap: {},
|
|
52509
52530
|
flowMap: {},
|
|
52531
|
+
rulesMap: {},
|
|
52510
52532
|
removeArr: new Set(),
|
|
52511
52533
|
names: new Set(),
|
|
52512
52534
|
submitLock: false,
|
|
@@ -52606,18 +52628,30 @@ var useForm = function useForm(props) {
|
|
|
52606
52628
|
var update = function update(name) {
|
|
52607
52629
|
var _context$flowMap$glob;
|
|
52608
52630
|
if (!name) {
|
|
52631
|
+
var needValidateParentKeys = new Set();
|
|
52609
52632
|
Object.keys(context.updateMap).forEach(function (key) {
|
|
52610
52633
|
var _context$updateMap$ke;
|
|
52611
|
-
(_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (
|
|
52612
|
-
|
|
52634
|
+
(_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (updateFn) {
|
|
52635
|
+
updateFn(context.value, context.errors, context.serverErrors);
|
|
52613
52636
|
if (context.errors[key]) {
|
|
52614
52637
|
validateFields(key).catch(function () {});
|
|
52638
|
+
getParentKeys(key).forEach(function (parentKey) {
|
|
52639
|
+
if (context.validateMap[parentKey] && context.rulesMap[parentKey]) {
|
|
52640
|
+
needValidateParentKeys.add(parentKey);
|
|
52641
|
+
}
|
|
52642
|
+
});
|
|
52615
52643
|
}
|
|
52616
52644
|
});
|
|
52617
52645
|
});
|
|
52646
|
+
// fix issue's playground id: 0898fabb-a1b4-4453-a2aa-f5a92e7777c0
|
|
52647
|
+
if (needValidateParentKeys.size > 0) {
|
|
52648
|
+
needValidateParentKeys.forEach(function (parentKey) {
|
|
52649
|
+
validateFields(parentKey).catch(function () {});
|
|
52650
|
+
});
|
|
52651
|
+
}
|
|
52618
52652
|
Object.keys(context.flowMap).forEach(function (key) {
|
|
52619
|
-
context.flowMap[key].forEach(function (
|
|
52620
|
-
|
|
52653
|
+
context.flowMap[key].forEach(function (updateFn) {
|
|
52654
|
+
updateFn();
|
|
52621
52655
|
});
|
|
52622
52656
|
});
|
|
52623
52657
|
} else {
|
|
@@ -52629,22 +52663,22 @@ var useForm = function useForm(props) {
|
|
|
52629
52663
|
if (!context.updateMap[key]) {
|
|
52630
52664
|
var _context$updateMap$pa;
|
|
52631
52665
|
var parentKey = key.split('.')[0];
|
|
52632
|
-
(_context$updateMap$pa = context.updateMap[parentKey]) === null || _context$updateMap$pa === void 0 || _context$updateMap$pa.forEach(function (
|
|
52633
|
-
|
|
52666
|
+
(_context$updateMap$pa = context.updateMap[parentKey]) === null || _context$updateMap$pa === void 0 || _context$updateMap$pa.forEach(function (updateFn) {
|
|
52667
|
+
updateFn(context.value, context.errors, context.serverErrors);
|
|
52634
52668
|
});
|
|
52635
52669
|
} else {
|
|
52636
52670
|
var _context$updateMap$ke2;
|
|
52637
|
-
(_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (
|
|
52638
|
-
|
|
52671
|
+
(_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (updateFn) {
|
|
52672
|
+
updateFn(context.value, context.errors, context.serverErrors);
|
|
52639
52673
|
});
|
|
52640
52674
|
}
|
|
52641
|
-
(_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (
|
|
52642
|
-
|
|
52675
|
+
(_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (updateFn) {
|
|
52676
|
+
updateFn();
|
|
52643
52677
|
});
|
|
52644
52678
|
});
|
|
52645
52679
|
}
|
|
52646
|
-
(_context$flowMap$glob = context.flowMap[globalKey]) === null || _context$flowMap$glob === void 0 || _context$flowMap$glob.forEach(function (
|
|
52647
|
-
|
|
52680
|
+
(_context$flowMap$glob = context.flowMap[globalKey]) === null || _context$flowMap$glob === void 0 || _context$flowMap$glob.forEach(function (updateFn) {
|
|
52681
|
+
updateFn();
|
|
52648
52682
|
});
|
|
52649
52683
|
};
|
|
52650
52684
|
var updateFieldsets = use_persist_fn(function (name) {
|
|
@@ -52975,6 +53009,7 @@ var useForm = function useForm(props) {
|
|
|
52975
53009
|
if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
|
|
52976
53010
|
context.names.delete(n);
|
|
52977
53011
|
delete context.defaultValues[n];
|
|
53012
|
+
delete context.rulesMap[n];
|
|
52978
53013
|
}
|
|
52979
53014
|
var finalReserveAble = (_props$reserveAble = props.reserveAble) !== null && _props$reserveAble !== void 0 ? _props$reserveAble : reserveAble;
|
|
52980
53015
|
if (!finalReserveAble && !context.removeLock) {
|
|
@@ -52989,22 +53024,25 @@ var useForm = function useForm(props) {
|
|
|
52989
53024
|
if (isArray(propRules)) {
|
|
52990
53025
|
newRules = newRules.concat(propRules);
|
|
52991
53026
|
}
|
|
53027
|
+
if (newRules.length > 0) {
|
|
53028
|
+
context.rulesMap[name] = newRules;
|
|
53029
|
+
}
|
|
52992
53030
|
return newRules;
|
|
52993
53031
|
},
|
|
52994
53032
|
watch: function watch() {
|
|
52995
53033
|
var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [globalKey];
|
|
52996
|
-
var
|
|
53034
|
+
var updateFn = arguments.length > 1 ? arguments[1] : undefined;
|
|
52997
53035
|
names.forEach(function (name) {
|
|
52998
53036
|
context.flowMap[name] = context.flowMap[name] || new Set();
|
|
52999
|
-
context.flowMap[name].add(
|
|
53037
|
+
context.flowMap[name].add(updateFn);
|
|
53000
53038
|
});
|
|
53001
53039
|
},
|
|
53002
53040
|
unWatch: function unWatch() {
|
|
53003
53041
|
var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [globalKey];
|
|
53004
|
-
var
|
|
53042
|
+
var updateFn = arguments.length > 1 ? arguments[1] : undefined;
|
|
53005
53043
|
names.forEach(function (name) {
|
|
53006
|
-
if (
|
|
53007
|
-
context.flowMap[name].delete(
|
|
53044
|
+
if (updateFn) {
|
|
53045
|
+
context.flowMap[name].delete(updateFn);
|
|
53008
53046
|
} else {
|
|
53009
53047
|
delete context.flowMap[name];
|
|
53010
53048
|
}
|
|
@@ -74423,7 +74461,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
74423
74461
|
|
|
74424
74462
|
|
|
74425
74463
|
/* harmony default export */ var src_0 = ({
|
|
74426
|
-
version: '3.9.
|
|
74464
|
+
version: '3.9.2-beta.1'
|
|
74427
74465
|
});
|
|
74428
74466
|
}();
|
|
74429
74467
|
/******/ return __webpack_exports__;
|