shineout 3.5.1-beta.1 → 3.5.1-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
@@ -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.3'
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.3');
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,21 @@ 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
+ } else {
40136
+ formFunc === null || formFunc === void 0 || formFunc.setError(name, e);
40137
+ }
40120
40138
  onError === null || onError === void 0 || onError(e);
40121
40139
  bindValidate();
40122
40140
  return e;
@@ -40157,6 +40175,7 @@ function useFormControl(props) {
40157
40175
  other[_key - 1] = arguments[_key];
40158
40176
  }
40159
40177
  if (onChangePo) onChangePo.apply(void 0, [v].concat(other));
40178
+ if (validateFieldSet) validateFieldSet();
40160
40179
  });
40161
40180
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
40162
40181
  if (inForm && controlFunc) {
@@ -46990,7 +47009,8 @@ EmptyComp.displayName = 'ShineoutEmpty';
46990
47009
 
46991
47010
 
46992
47011
  var topPath = {
46993
- path: ''
47012
+ path: '',
47013
+ validateFieldSet: function validateFieldSet() {}
46994
47014
  };
46995
47015
  var Provider = function Provider(props) {
46996
47016
  var children = props.children,
@@ -48033,7 +48053,8 @@ var useFormFieldSet = function useFormFieldSet(props) {
48033
48053
  console.error('[FieldSet] should render in Form');
48034
48054
  }
48035
48055
  var ProviderValue = {
48036
- path: name
48056
+ path: name,
48057
+ validateFieldSet: function validateFieldSet() {}
48037
48058
  };
48038
48059
  return {
48039
48060
  Provider: fieldset_context.Provider,
@@ -48050,6 +48071,7 @@ var useFormFieldSet = function useFormFieldSet(props) {
48050
48071
 
48051
48072
 
48052
48073
 
48074
+
48053
48075
  var form_fieldset_produce = utils_immer_produce;
48054
48076
  var FormFieldSet = function FormFieldSet(props) {
48055
48077
  var children = props.children,
@@ -48059,6 +48081,11 @@ var FormFieldSet = function FormFieldSet(props) {
48059
48081
  }),
48060
48082
  context = _React$useRef.current;
48061
48083
  var formFunc = useFormFunc();
48084
+ var validateFieldSet = function validateFieldSet() {
48085
+ formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name).catch(function (e) {
48086
+ return e;
48087
+ });
48088
+ };
48062
48089
  var getValidateProps = usePersistFn(function () {
48063
48090
  return props;
48064
48091
  });
@@ -48077,7 +48104,9 @@ var FormFieldSet = function FormFieldSet(props) {
48077
48104
  name = _useFormFieldSet.name;
48078
48105
  if (typeof children !== 'function') {
48079
48106
  return /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
48080
- value: ProviderValue,
48107
+ value: objectSpread2_default()(objectSpread2_default()({}, ProviderValue), {}, {
48108
+ validateFieldSet: validateFieldSet
48109
+ }),
48081
48110
  children: children
48082
48111
  });
48083
48112
  }
@@ -48106,7 +48135,8 @@ var FormFieldSet = function FormFieldSet(props) {
48106
48135
  valueArr.forEach(function (v, i) {
48107
48136
  result.push( /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
48108
48137
  value: {
48109
- path: "".concat(ProviderValue.path, "[").concat(i, "]")
48138
+ path: "".concat(ProviderValue.path, "[").concat(i, "]"),
48139
+ validateFieldSet: validateFieldSet
48110
48140
  },
48111
48141
  children: children({
48112
48142
  list: valueArr,
@@ -66318,7 +66348,7 @@ var upload_interface = __webpack_require__(8821);
66318
66348
 
66319
66349
 
66320
66350
  /* harmony default export */ var src_0 = ({
66321
- version: '3.5.1-beta.1'
66351
+ version: '3.5.1-beta.3'
66322
66352
  });
66323
66353
  }();
66324
66354
  /******/ return __webpack_exports__;