@pdg/react-form 1.0.49 → 1.0.50

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/dist/index.js CHANGED
@@ -2125,13 +2125,13 @@ styleInject(css_248z$j);var FormTextField = React__default["default"].forwardRef
2125
2125
  var _b;
2126
2126
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
2127
2127
  //----------------------------------------------------------------------------------------------------------------
2128
- name = _a.name, required = _a.required, initValue = _a.value, initData = _a.data, icon = _a.icon, labelIcon = _a.labelIcon, initLabel = _a.label, initError = _a.error, initHelperText = _a.helperText, exceptValue = _a.exceptValue, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initDisabled = _a.disabled, placeholder = _a.placeholder, maxLength = _a.maxLength, clear = _a.clear, width = _a.width, initMuiInputProps = _a.InputProps, initMuiInputLabelProps = _a.InputLabelProps, initInputProps = _a.inputProps, initInputRef = _a.inputRef, select = _a.select, SelectProps = _a.SelectProps, multiline = _a.multiline, validPattern = _a.validPattern, invalidPattern = _a.invalidPattern, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, noFormValueItem = _a.noFormValueItem, hidden = _a.hidden,
2128
+ name = _a.name, required = _a.required, initValue = _a.value, initData = _a.data, icon = _a.icon, labelIcon = _a.labelIcon, initLabel = _a.label, initError = _a.error, initHelperText = _a.helperText, exceptValue = _a.exceptValue, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initDisabled = _a.disabled, placeholder = _a.placeholder, maxLength = _a.maxLength, clear = _a.clear, width = _a.width, initMuiInputProps = _a.InputProps, initMuiInputLabelProps = _a.InputLabelProps, initInputProps = _a.inputProps, initInputRef = _a.inputRef, select = _a.select, SelectProps = _a.SelectProps, multiline = _a.multiline, validPattern = _a.validPattern, invalidPattern = _a.invalidPattern, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, noFormValueItem = _a.noFormValueItem, hidden = _a.hidden, disableReturnKey = _a.disableReturnKey,
2129
2129
  //----------------------------------------------------------------------------------------------------------------
2130
2130
  onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate, onBlur = _a.onBlur, onKeyDown = _a.onKeyDown,
2131
2131
  //----------------------------------------------------------------------------------------------------------------
2132
2132
  className = _a.className, initStyle = _a.style,
2133
2133
  //----------------------------------------------------------------------------------------------------------------
2134
- props = __rest$3(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "name", "required", "value", "data", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
2134
+ props = __rest$3(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "name", "required", "value", "data", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "disableReturnKey", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
2135
2135
  var id = React.useId();
2136
2136
  // Ref -------------------------------------------------------------------------------------------------------------
2137
2137
  var inputRef = React.useRef(null);
@@ -2411,14 +2411,17 @@ styleInject(css_248z$j);var FormTextField = React__default["default"].forwardRef
2411
2411
  onBlur(e);
2412
2412
  }, [error, value, validate, onBlur]);
2413
2413
  var handleKeyDown = React.useCallback(function (e) {
2414
- if (!select && !multiline && !noFormValueItem && ['Enter'].includes(e.key)) {
2414
+ if (['Enter'].includes(e.key) &&
2415
+ !select &&
2416
+ (!multiline || (multiline && disableReturnKey)) &&
2417
+ !noFormValueItem) {
2415
2418
  e.preventDefault();
2416
2419
  e.stopPropagation();
2417
2420
  onRequestSearchSubmit(name, value);
2418
2421
  }
2419
2422
  if (onKeyDown)
2420
2423
  onKeyDown(e);
2421
- }, [select, multiline, noFormValueItem, onKeyDown, onRequestSearchSubmit, name, value]);
2424
+ }, [select, multiline, disableReturnKey, noFormValueItem, onKeyDown, onRequestSearchSubmit, name, value]);
2422
2425
  // Render ----------------------------------------------------------------------------------------------------------
2423
2426
  return (React__default["default"].createElement(material.TextField, __assign$6({}, props, { variant: variant, size: size, color: color, focused: focused || undefined, name: name, label: label, placeholder: placeholder, className: classNames$1(className, 'FormValueItem', 'FormTextField', "variant-".concat(variant)), inputRef: initInputRef ? initInputRef : inputRef, value: value, required: required, fullWidth: !width && fullWidth, error: error, helperText: formColWithHelperText ? undefined : helperText, FormHelperTextProps: { component: 'div' }, disabled: disabled, InputProps: muiInputProps, InputLabelProps: muiInputLabelProps, inputProps: ((_b = initInputProps === null || initInputProps === void 0 ? void 0 : initInputProps.className) === null || _b === void 0 ? void 0 : _b.includes('FormTag-Input')) ? initInputProps : inputProps, style: style, select: select, SelectProps: SelectProps, multiline: multiline, onChange: handleChange, onBlur: handleBlur, onKeyDown: handleKeyDown })));
2424
2427
  });
@@ -2434,7 +2437,7 @@ FormTextField.defaultProps = FormTextFieldDefaultProps;var FormTextDefaultProps
2434
2437
  return finalValue;
2435
2438
  }, [onValue]);
2436
2439
  // Render ----------------------------------------------------------------------------------------------------------
2437
- return React__default["default"].createElement(FormTextField, __assign$6({ ref: ref, className: classNames$1(className, 'FormText'), onValue: handleValue }, props));
2440
+ return (React__default["default"].createElement(FormTextField, __assign$6({ ref: ref, className: classNames$1(className, 'FormText'), disableReturnKey: true, onValue: handleValue }, props)));
2438
2441
  });
2439
2442
  FormText.displayName = 'FormText';
2440
2443
  FormText.defaultProps = FormTextDefaultProps;var FormHiddenDefaultProps = {};var css_248z$i = ".FormHidden {\n display: none !important;\n}";