shineout 3.7.3-beta.3 → 3.7.3-beta.4

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
@@ -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.7.3-beta.3'
525
+ version: '3.7.3-beta.4'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12234,7 +12234,7 @@ var handleStyle = function handleStyle(style) {
12234
12234
  };
12235
12235
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12236
12236
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12237
- /* harmony default export */ var version = ('3.7.3-beta.3');
12237
+ /* harmony default export */ var version = ('3.7.3-beta.4');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -35810,12 +35810,33 @@ var Input = function Input(props) {
35810
35810
  addEnd = props.addEnd,
35811
35811
  hasSuffix = props.hasSuffix,
35812
35812
  rest = objectWithoutProperties_default()(props, simple_input_excluded);
35813
+ var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
35814
+ needTriggerEnter: false
35815
+ }),
35816
+ context = _useRef.current;
35813
35817
  var inputStyle = jssStyle === null || jssStyle === void 0 || (_jssStyle$input = jssStyle.input) === null || _jssStyle$input === void 0 ? void 0 : _jssStyle$input.call(jssStyle);
35814
35818
  var config = useConfig();
35815
35819
  var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormFieldContext),
35816
35820
  fieldId = _useContext.fieldId;
35817
35821
  var _useInput = use_input(objectSpread2_default()(objectSpread2_default()({}, rest), {}, {
35818
- onFocusedChange: onFocusedChange
35822
+ onFocusedChange: onFocusedChange,
35823
+ // 由于form的原生submit事件是在keydown中触发的,submit校验后触发scrollToError会导致当前焦点的input立即失焦,导致input的回车事件无法触发
35824
+ // 所以这里在onKeyDown时机记录下needTriggerEnter标志,在onBlur时机判断是否需要触发onEnterPress
35825
+ onKeyDown: function onKeyDown(e) {
35826
+ var _props$onKeyDown;
35827
+ if (e.key === 'Enter') {
35828
+ context.needTriggerEnter = true;
35829
+ }
35830
+ (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 || _props$onKeyDown.call(props, e);
35831
+ },
35832
+ onBlur: function onBlur(e) {
35833
+ var _props$onBlur;
35834
+ if (context.needTriggerEnter) {
35835
+ context.needTriggerEnter = false;
35836
+ _onEnterPress === null || _onEnterPress === void 0 || _onEnterPress(e.target.value || '', e);
35837
+ }
35838
+ (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
35839
+ }
35819
35840
  })),
35820
35841
  getRootProps = _useInput.getRootProps,
35821
35842
  getClearProps = _useInput.getClearProps,
@@ -35831,6 +35852,10 @@ var Input = function Input(props) {
35831
35852
  });
35832
35853
  var onKeyUp = usePersistFn(function (e) {
35833
35854
  var _props$onKeyUp;
35855
+ if (e.key === 'Enter') {
35856
+ context.needTriggerEnter = false;
35857
+ }
35858
+ ;
35834
35859
  (_props$onKeyUp = props.onKeyUp) === null || _props$onKeyUp === void 0 || _props$onKeyUp.call(props, e);
35835
35860
  keyHandler(e);
35836
35861
  });
@@ -50651,14 +50676,14 @@ var useForm = function useForm(props) {
50651
50676
  });
50652
50677
  case 6:
50653
50678
  result = _context.sent;
50654
- if (activeEl) activeEl.focus();
50655
50679
  if (result === true) {
50656
50680
  (_props$onSubmit2 = props.onSubmit) === null || _props$onSubmit2 === void 0 || _props$onSubmit2.call(props, (_context$value2 = context.value) !== null && _context$value2 !== void 0 ? _context$value2 : {});
50681
+ if (activeEl) activeEl.focus();
50657
50682
  } else {
50658
50683
  handleSubmitError(result);
50659
50684
  }
50660
50685
  callback === null || callback === void 0 || callback();
50661
- case 10:
50686
+ case 9:
50662
50687
  case "end":
50663
50688
  return _context.stop();
50664
50689
  }
@@ -71565,7 +71590,7 @@ var upload_interface = __webpack_require__(8821);
71565
71590
 
71566
71591
 
71567
71592
  /* harmony default export */ var src_0 = ({
71568
- version: '3.7.3-beta.3'
71593
+ version: '3.7.3-beta.4'
71569
71594
  });
71570
71595
  }();
71571
71596
  /******/ return __webpack_exports__;