shineout 3.9.5-beta.6 → 3.9.5-beta.8

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.9.5-beta.6'
525
+ version: '3.9.5-beta.8'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12401,7 +12401,7 @@ var handleStyle = function handleStyle(style) {
12401
12401
  };
12402
12402
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12403
12403
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12404
- /* harmony default export */ var version = ('3.9.5-beta.6');
12404
+ /* harmony default export */ var version = ('3.9.5-beta.8');
12405
12405
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12406
12406
 
12407
12407
 
@@ -37436,34 +37436,13 @@ var Input = function Input(props) {
37436
37436
  addEnd = props.addEnd,
37437
37437
  hasSuffix = props.hasSuffix,
37438
37438
  rest = objectWithoutProperties_default()(props, simple_input_excluded);
37439
- var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
37440
- needTriggerEnter: false
37441
- }),
37442
- context = _useRef.current;
37443
37439
  var inputStyle = jssStyle === null || jssStyle === void 0 || (_jssStyle$input = jssStyle.input) === null || _jssStyle$input === void 0 ? void 0 : _jssStyle$input.call(jssStyle);
37444
37440
  var config = useConfig();
37445
37441
  var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormFieldContext),
37446
37442
  fieldId = _useContext.fieldId;
37447
37443
  var showClearFromProp = props.showClear && !props.disabled;
37448
37444
  var _useInput = use_input(objectSpread2_default()(objectSpread2_default()({}, rest), {}, {
37449
- onFocusedChange: onFocusedChange,
37450
- // 由于form的原生submit事件是在keydown中触发的,submit校验后触发scrollToError会导致当前焦点的input立即失焦,导致input的回车事件无法触发
37451
- // 所以这里在onKeyDown时机记录下needTriggerEnter标志,在onBlur时机判断是否需要触发onEnterPress
37452
- onKeyDown: function onKeyDown(e) {
37453
- var _props$onKeyDown;
37454
- if (e.key === 'Enter') {
37455
- context.needTriggerEnter = true;
37456
- }
37457
- (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 || _props$onKeyDown.call(props, e);
37458
- },
37459
- onBlur: function onBlur(e) {
37460
- var _props$onBlur;
37461
- if (context.needTriggerEnter) {
37462
- context.needTriggerEnter = false;
37463
- _onEnterPress === null || _onEnterPress === void 0 || _onEnterPress(e.target.value || '', e);
37464
- }
37465
- (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
37466
- }
37445
+ onFocusedChange: onFocusedChange
37467
37446
  })),
37468
37447
  getRootProps = _useInput.getRootProps,
37469
37448
  getClearProps = _useInput.getClearProps,
@@ -37478,10 +37457,6 @@ var Input = function Input(props) {
37478
37457
  });
37479
37458
  var onKeyUp = usePersistFn(function (e) {
37480
37459
  var _props$onKeyUp;
37481
- if (e.key === 'Enter') {
37482
- context.needTriggerEnter = false;
37483
- }
37484
- ;
37485
37460
  (_props$onKeyUp = props.onKeyUp) === null || _props$onKeyUp === void 0 || _props$onKeyUp.call(props, e);
37486
37461
  keyHandler(e);
37487
37462
  });
@@ -38284,10 +38259,21 @@ var input_Input = function Input(props) {
38284
38259
  showClear: props.showClear,
38285
38260
  onKeyDown: function onKeyDown(e) {
38286
38261
  var _props$onKeyDown;
38262
+ // 在 Enter 键按下时,如果开启了 trim,先执行 trim 逻辑
38263
+ if (e.key === 'Enter' && inputFormatParams.trim) {
38264
+ var target = e.target;
38265
+ var value = target.value;
38266
+ var trimmedValue = value.trim();
38267
+ if (value !== trimmedValue) {
38268
+ var _commonProps$onChange;
38269
+ target.value = trimmedValue;
38270
+ (_commonProps$onChange = commonProps.onChange) === null || _commonProps$onChange === void 0 || _commonProps$onChange.call(commonProps, trimmedValue);
38271
+ }
38272
+ }
38287
38273
  if (e.key === 'Enter' && !e.defaultPrevented) {
38288
38274
  var _props$onChange;
38289
- var value = e.target.value;
38290
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, value);
38275
+ var _value = e.target.value;
38276
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, _value);
38291
38277
  }
38292
38278
  (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 || _props$onKeyDown.call(props, e);
38293
38279
  }
@@ -42513,7 +42499,7 @@ var ResultInput = function ResultInput(props) {
42513
42499
  onBindInput === null || onBindInput === void 0 || onBindInput(inputRef.current);
42514
42500
  }, []);
42515
42501
  var renderResultPlaceholder = function renderResultPlaceholder() {
42516
- if (!inputText && !focus && props.placeholder && typeof props.placeholder !== 'string') {
42502
+ if (props.isEmpty && !inputText && !focus && props.placeholder && typeof props.placeholder !== 'string') {
42517
42503
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
42518
42504
  className: styles.inputPlaceholder,
42519
42505
  children: props.placeholder
@@ -53035,8 +53021,6 @@ var useForm = function useForm(props) {
53035
53021
  return;
53036
53022
  }
53037
53023
  context.submitLock = true;
53038
- var activeEl = document.activeElement;
53039
- if (activeEl) activeEl.blur();
53040
53024
  setTimeout(function () {
53041
53025
  // 防止连续点击
53042
53026
  context.submitLock = false;
@@ -53064,7 +53048,6 @@ var useForm = function useForm(props) {
53064
53048
  result = _context.sent;
53065
53049
  if (result === true) {
53066
53050
  (_props$onSubmit2 = props.onSubmit) === null || _props$onSubmit2 === void 0 || _props$onSubmit2.call(props, (_context$value2 = context.value) !== null && _context$value2 !== void 0 ? _context$value2 : {});
53067
- if (activeEl) activeEl.focus();
53068
53051
  } else {
53069
53052
  handleSubmitError(result);
53070
53053
  }
@@ -74786,7 +74769,7 @@ var upload_interface = __webpack_require__(8821);
74786
74769
 
74787
74770
 
74788
74771
  /* harmony default export */ var src_0 = ({
74789
- version: '3.9.5-beta.6'
74772
+ version: '3.9.5-beta.8'
74790
74773
  });
74791
74774
  }();
74792
74775
  /******/ return __webpack_exports__;