shineout 3.5.7-beta.1 → 3.5.7-beta.3

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.3'
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.3');
12044
12044
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12045
12045
 
12046
12046
 
@@ -32583,7 +32583,9 @@ var FormFooterProvider = function FormFooterProvider(props) {
32583
32583
  if (!context.hasSubmit) {
32584
32584
  context.submit = info.submit;
32585
32585
  context.hasSubmit = true;
32586
+ return true;
32586
32587
  }
32588
+ return false;
32587
32589
  });
32588
32590
  var deleteFormInfo = usePersistFn(function () {
32589
32591
  context.hasSubmit = false;
@@ -47817,6 +47819,7 @@ var useForm = function useForm(props) {
47817
47819
  var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
47818
47820
  defaultValues: {},
47819
47821
  validateMap: {},
47822
+ ignoreValidateFields: [],
47820
47823
  updateMap: {},
47821
47824
  flowMap: {},
47822
47825
  removeArr: new Set(),
@@ -47922,9 +47925,22 @@ var useForm = function useForm(props) {
47922
47925
  return new Promise(function (resolve, reject) {
47923
47926
  var finalFields = Object.keys(context.validateMap);
47924
47927
  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);
47928
+ if (config.ignoreChildren) {
47929
+ // 旧行为:仅校验当前字段
47930
+ finalFields = (isArray(fields) ? fields : [fields]).filter(function (key) {
47931
+ return context.validateMap[key];
47932
+ });
47933
+ } else {
47934
+ // 新行为:校验当前字段及其所有子字段
47935
+ // 假设进去的是['user'],那么最终的finalFields是['user', 'user.name', 'user.age']
47936
+ // 假设进去的是['users'],那么最终的finalFields是['users', 'users[0].name', 'users[0].age', 'users[1].name', 'users[1].age']
47937
+ finalFields = getCompleteFieldKeys(fields, finalFields);
47938
+ }
47939
+ }
47940
+ if (context.ignoreValidateFields.length > 0) {
47941
+ finalFields = finalFields.filter(function (key) {
47942
+ return !context.ignoreValidateFields.includes(key);
47943
+ });
47928
47944
  }
47929
47945
  var validates = finalFields.map(function (key) {
47930
47946
  var validateField = context.validateMap[key];
@@ -48160,7 +48176,7 @@ var useForm = function useForm(props) {
48160
48176
  }, 10);
48161
48177
  };
48162
48178
  };
48163
- var validateFieldset = function validateFieldset(name) {
48179
+ var validateFieldset = function validateFieldset(name, config) {
48164
48180
  var na = "".concat(name, "[");
48165
48181
  var no = "".concat(name, ".");
48166
48182
  var fields = [];
@@ -48169,6 +48185,15 @@ var useForm = function useForm(props) {
48169
48185
  fields.push(key);
48170
48186
  }
48171
48187
  });
48188
+
48189
+ // 用户声明了跳过校验子字段
48190
+ if (config !== null && config !== void 0 && config.ignoreChildren) {
48191
+ var parentName = name.split('[')[0];
48192
+ context.ignoreValidateFields = getCompleteFieldKeys(parentName, Array.from(context.names));
48193
+ setTimeout(function () {
48194
+ context.ignoreValidateFields = [];
48195
+ });
48196
+ }
48172
48197
  validateFields(fields).catch(function () {});
48173
48198
  };
48174
48199
  var getDefaultValue = function getDefaultValue() {
@@ -48456,6 +48481,10 @@ var Form = function Form(props) {
48456
48481
  props.setForm(formRefObj);
48457
48482
  }
48458
48483
  }, [formRefObj]);
48484
+ var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({
48485
+ bindindModalFormContextSuccess: false
48486
+ }),
48487
+ context = _React$useRef.current;
48459
48488
  var handleFormModalInfo = function handleFormModalInfo() {
48460
48489
  var status = undefined;
48461
48490
  if (props.disabled) {
@@ -48468,13 +48497,16 @@ var Form = function Form(props) {
48468
48497
  modalFormContext === null || modalFormContext === void 0 || modalFormContext.setFormStats(status);
48469
48498
  }
48470
48499
  if (props.onSubmit) {
48471
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.setFormInfo(formRefObj);
48500
+ var ok = modalFormContext === null || modalFormContext === void 0 ? void 0 : modalFormContext.setFormInfo(formRefObj);
48501
+ context.bindindModalFormContextSuccess = !!ok;
48472
48502
  }
48473
48503
  };
48474
48504
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
48475
48505
  handleFormModalInfo();
48476
48506
  return function () {
48477
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.deleteFormInfo();
48507
+ if (context.bindindModalFormContextSuccess) {
48508
+ modalFormContext === null || modalFormContext === void 0 || modalFormContext.deleteFormInfo();
48509
+ }
48478
48510
  };
48479
48511
  }, [props.disabled, props.pending]);
48480
48512
  var rootClass = classnames_default()([formClasses === null || formClasses === void 0 ? void 0 : formClasses.rootClass, formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapper, className, props.inline && (formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapperInline)]);
@@ -48881,7 +48913,9 @@ var FormFieldSet = function FormFieldSet(props) {
48881
48913
 
48882
48914
  var formFunc = useFormFunc();
48883
48915
  var validateFieldSet = function validateFieldSet() {
48884
- formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name).catch(function (e) {
48916
+ formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name, {
48917
+ ignoreChildren: true
48918
+ }).catch(function (e) {
48885
48919
  return e;
48886
48920
  });
48887
48921
  };
@@ -48945,9 +48979,9 @@ var FormFieldSet = function FormFieldSet(props) {
48945
48979
  draft[i] = val;
48946
48980
  });
48947
48981
  _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
- }
48982
+ formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"), {
48983
+ ignoreChildren: (options === null || options === void 0 ? void 0 : options.validate) === false
48984
+ });
48951
48985
  },
48952
48986
  onInsert: function onInsert(val) {
48953
48987
  var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
@@ -67365,7 +67399,7 @@ var upload_interface = __webpack_require__(8821);
67365
67399
 
67366
67400
 
67367
67401
  /* harmony default export */ var src_0 = ({
67368
- version: '3.5.7-beta.1'
67402
+ version: '3.5.7-beta.3'
67369
67403
  });
67370
67404
  }();
67371
67405
  /******/ return __webpack_exports__;