shineout 3.5.7-beta.1 → 3.5.7-beta.2

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 CHANGED
@@ -507,5 +507,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
507
507
  // 此文件由脚本自动生成,请勿直接修改。
508
508
  // This file was generated automatically by a script. Please do not modify it directly.
509
509
  var _default = exports.default = {
510
- version: '3.5.7-beta.1'
510
+ version: '3.5.7-beta.2'
511
511
  };
package/dist/shineout.js CHANGED
@@ -12040,7 +12040,7 @@ var handleStyle = function handleStyle(style) {
12040
12040
  };
12041
12041
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12042
12042
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12043
- /* harmony default export */ var version = ('3.5.7-beta.1');
12043
+ /* harmony default export */ var version = ('3.5.7-beta.2');
12044
12044
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12045
12045
 
12046
12046
 
@@ -47817,6 +47817,7 @@ var useForm = function useForm(props) {
47817
47817
  var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
47818
47818
  defaultValues: {},
47819
47819
  validateMap: {},
47820
+ ignoreValidateFields: [],
47820
47821
  updateMap: {},
47821
47822
  flowMap: {},
47822
47823
  removeArr: new Set(),
@@ -47922,9 +47923,22 @@ var useForm = function useForm(props) {
47922
47923
  return new Promise(function (resolve, reject) {
47923
47924
  var finalFields = Object.keys(context.validateMap);
47924
47925
  if (fields) {
47925
- // 假设进去的是['user'],那么最终的finalFields是['user', 'user.name', 'user.age']
47926
- // 假设进去的是['users'],那么最终的finalFields是['users', 'users[0].name', 'users[0].age', 'users[1].name', 'users[1].age']
47927
- finalFields = getCompleteFieldKeys(fields, finalFields);
47926
+ if (config.ignoreChildren) {
47927
+ // 旧行为:仅校验当前字段
47928
+ finalFields = (isArray(fields) ? fields : [fields]).filter(function (key) {
47929
+ return context.validateMap[key];
47930
+ });
47931
+ } else {
47932
+ // 新行为:校验当前字段及其所有子字段
47933
+ // 假设进去的是['user'],那么最终的finalFields是['user', 'user.name', 'user.age']
47934
+ // 假设进去的是['users'],那么最终的finalFields是['users', 'users[0].name', 'users[0].age', 'users[1].name', 'users[1].age']
47935
+ finalFields = getCompleteFieldKeys(fields, finalFields);
47936
+ }
47937
+ }
47938
+ if (context.ignoreValidateFields.length > 0) {
47939
+ finalFields = finalFields.filter(function (key) {
47940
+ return !context.ignoreValidateFields.includes(key);
47941
+ });
47928
47942
  }
47929
47943
  var validates = finalFields.map(function (key) {
47930
47944
  var validateField = context.validateMap[key];
@@ -48160,7 +48174,7 @@ var useForm = function useForm(props) {
48160
48174
  }, 10);
48161
48175
  };
48162
48176
  };
48163
- var validateFieldset = function validateFieldset(name) {
48177
+ var validateFieldset = function validateFieldset(name, config) {
48164
48178
  var na = "".concat(name, "[");
48165
48179
  var no = "".concat(name, ".");
48166
48180
  var fields = [];
@@ -48169,6 +48183,15 @@ var useForm = function useForm(props) {
48169
48183
  fields.push(key);
48170
48184
  }
48171
48185
  });
48186
+
48187
+ // 用户声明了跳过校验子字段
48188
+ if (config !== null && config !== void 0 && config.ignoreChildren) {
48189
+ var parentName = name.split('[')[0];
48190
+ context.ignoreValidateFields = getCompleteFieldKeys(parentName, Array.from(context.names));
48191
+ setTimeout(function () {
48192
+ context.ignoreValidateFields = [];
48193
+ });
48194
+ }
48172
48195
  validateFields(fields).catch(function () {});
48173
48196
  };
48174
48197
  var getDefaultValue = function getDefaultValue() {
@@ -48881,7 +48904,9 @@ var FormFieldSet = function FormFieldSet(props) {
48881
48904
 
48882
48905
  var formFunc = useFormFunc();
48883
48906
  var validateFieldSet = function validateFieldSet() {
48884
- formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name).catch(function (e) {
48907
+ formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name, {
48908
+ ignoreChildren: true
48909
+ }).catch(function (e) {
48885
48910
  return e;
48886
48911
  });
48887
48912
  };
@@ -48945,9 +48970,9 @@ var FormFieldSet = function FormFieldSet(props) {
48945
48970
  draft[i] = val;
48946
48971
  });
48947
48972
  _onChange(newValue);
48948
- if (options === undefined || options !== null && options !== void 0 && options.validate) {
48949
- formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"));
48950
- }
48973
+ formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"), {
48974
+ ignoreChildren: (options === null || options === void 0 ? void 0 : options.validate) === false
48975
+ });
48951
48976
  },
48952
48977
  onInsert: function onInsert(val) {
48953
48978
  var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
@@ -67365,7 +67390,7 @@ var upload_interface = __webpack_require__(8821);
67365
67390
 
67366
67391
 
67367
67392
  /* harmony default export */ var src_0 = ({
67368
- version: '3.5.7-beta.1'
67393
+ version: '3.5.7-beta.2'
67369
67394
  });
67370
67395
  }();
67371
67396
  /******/ return __webpack_exports__;