shineout 3.5.1-beta.1 → 3.5.1-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
@@ -500,5 +500,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
500
500
  // 此文件由脚本自动生成,请勿直接修改。
501
501
  // This file was generated automatically by a script. Please do not modify it directly.
502
502
  var _default = exports.default = {
503
- version: '3.5.1-beta.1'
503
+ version: '3.5.1-beta.2'
504
504
  };
package/dist/shineout.js CHANGED
@@ -12002,7 +12002,7 @@ var handleStyle = function handleStyle(style) {
12002
12002
  };
12003
12003
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12004
12004
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12005
- /* harmony default export */ var version = ('3.5.1-beta.1');
12005
+ /* harmony default export */ var version = ('3.5.1-beta.2');
12006
12006
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12007
12007
 
12008
12008
 
@@ -39604,7 +39604,8 @@ var FormItemContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_
39604
39604
 
39605
39605
 
39606
39606
  var FieldsetContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)({
39607
- path: ''
39607
+ path: '',
39608
+ validateFieldSet: function validateFieldSet() {}
39608
39609
  });
39609
39610
  function extendName() {
39610
39611
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -39620,7 +39621,8 @@ function extendName() {
39620
39621
  }
39621
39622
  var useFieldSetConsumer = function useFieldSetConsumer(props) {
39622
39623
  var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(FieldsetContext),
39623
- path = _React$useContext.path;
39624
+ path = _React$useContext.path,
39625
+ validateFieldSet = _React$useContext.validateFieldSet;
39624
39626
  var bind = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(function () {
39625
39627
  return path ? (props.bind || []).concat(path) : props.bind;
39626
39628
  }, [path, props.bind]);
@@ -39629,7 +39631,8 @@ var useFieldSetConsumer = function useFieldSetConsumer(props) {
39629
39631
  }, [path, props.name]);
39630
39632
  return objectSpread2_default()(objectSpread2_default()({}, props), {}, {
39631
39633
  name: name,
39632
- bind: bind
39634
+ bind: bind,
39635
+ validateFieldSet: validateFieldSet
39633
39636
  });
39634
39637
  };
39635
39638
  /* harmony default export */ var fieldset_context = (FieldsetContext);
@@ -40019,7 +40022,8 @@ function useFormControl(props) {
40019
40022
  bind: props.bind
40020
40023
  }),
40021
40024
  name = _useFieldSetConsumer.name,
40022
- bind = _useFieldSetConsumer.bind;
40025
+ bind = _useFieldSetConsumer.bind,
40026
+ validateFieldSet = _useFieldSetConsumer.validateFieldSet;
40023
40027
  var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(undefined),
40024
40028
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
40025
40029
  errorState = _React$useState2[0],
@@ -40116,7 +40120,19 @@ function useFormControl(props) {
40116
40120
  bindValidate();
40117
40121
  return res;
40118
40122
  }).catch(function (e) {
40119
- formFunc === null || formFunc === void 0 || formFunc.setError(name, e);
40123
+ if (isArray(e)) {
40124
+ e.forEach(function (error, index) {
40125
+ if (error) {
40126
+ var _Object$keys, _Object$values;
40127
+ var fieldSetName = (_Object$keys = Object.keys(error)) === null || _Object$keys === void 0 ? void 0 : _Object$keys[0];
40128
+ var fieldSetError = (_Object$values = Object.values(error)) === null || _Object$values === void 0 ? void 0 : _Object$values[0];
40129
+ var na = "".concat(name, "[").concat(index, "].").concat(fieldSetName);
40130
+ if (fieldSetName && fieldSetError) {
40131
+ formFunc === null || formFunc === void 0 || formFunc.setError(na, fieldSetError);
40132
+ }
40133
+ }
40134
+ });
40135
+ }
40120
40136
  onError === null || onError === void 0 || onError(e);
40121
40137
  bindValidate();
40122
40138
  return e;
@@ -40157,6 +40173,7 @@ function useFormControl(props) {
40157
40173
  other[_key - 1] = arguments[_key];
40158
40174
  }
40159
40175
  if (onChangePo) onChangePo.apply(void 0, [v].concat(other));
40176
+ if (validateFieldSet) validateFieldSet();
40160
40177
  });
40161
40178
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
40162
40179
  if (inForm && controlFunc) {
@@ -46990,7 +47007,8 @@ EmptyComp.displayName = 'ShineoutEmpty';
46990
47007
 
46991
47008
 
46992
47009
  var topPath = {
46993
- path: ''
47010
+ path: '',
47011
+ validateFieldSet: function validateFieldSet() {}
46994
47012
  };
46995
47013
  var Provider = function Provider(props) {
46996
47014
  var children = props.children,
@@ -48033,7 +48051,8 @@ var useFormFieldSet = function useFormFieldSet(props) {
48033
48051
  console.error('[FieldSet] should render in Form');
48034
48052
  }
48035
48053
  var ProviderValue = {
48036
- path: name
48054
+ path: name,
48055
+ validateFieldSet: function validateFieldSet() {}
48037
48056
  };
48038
48057
  return {
48039
48058
  Provider: fieldset_context.Provider,
@@ -48050,6 +48069,7 @@ var useFormFieldSet = function useFormFieldSet(props) {
48050
48069
 
48051
48070
 
48052
48071
 
48072
+
48053
48073
  var form_fieldset_produce = utils_immer_produce;
48054
48074
  var FormFieldSet = function FormFieldSet(props) {
48055
48075
  var children = props.children,
@@ -48059,6 +48079,11 @@ var FormFieldSet = function FormFieldSet(props) {
48059
48079
  }),
48060
48080
  context = _React$useRef.current;
48061
48081
  var formFunc = useFormFunc();
48082
+ var validateFieldSet = function validateFieldSet() {
48083
+ formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name).catch(function (e) {
48084
+ return e;
48085
+ });
48086
+ };
48062
48087
  var getValidateProps = usePersistFn(function () {
48063
48088
  return props;
48064
48089
  });
@@ -48077,7 +48102,9 @@ var FormFieldSet = function FormFieldSet(props) {
48077
48102
  name = _useFormFieldSet.name;
48078
48103
  if (typeof children !== 'function') {
48079
48104
  return /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
48080
- value: ProviderValue,
48105
+ value: objectSpread2_default()(objectSpread2_default()({}, ProviderValue), {}, {
48106
+ validateFieldSet: validateFieldSet
48107
+ }),
48081
48108
  children: children
48082
48109
  });
48083
48110
  }
@@ -48106,7 +48133,8 @@ var FormFieldSet = function FormFieldSet(props) {
48106
48133
  valueArr.forEach(function (v, i) {
48107
48134
  result.push( /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
48108
48135
  value: {
48109
- path: "".concat(ProviderValue.path, "[").concat(i, "]")
48136
+ path: "".concat(ProviderValue.path, "[").concat(i, "]"),
48137
+ validateFieldSet: validateFieldSet
48110
48138
  },
48111
48139
  children: children({
48112
48140
  list: valueArr,
@@ -66318,7 +66346,7 @@ var upload_interface = __webpack_require__(8821);
66318
66346
 
66319
66347
 
66320
66348
  /* harmony default export */ var src_0 = ({
66321
- version: '3.5.1-beta.1'
66349
+ version: '3.5.1-beta.2'
66322
66350
  });
66323
66351
  }();
66324
66352
  /******/ return __webpack_exports__;