@pdg/react-form 1.0.68 → 1.0.70

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
@@ -2664,6 +2664,7 @@ styleInject(css_248z$j);var FormTag = React.forwardRef(function (_a, ref) {
2664
2664
  }, [inputValue, appendTag, onKeyDown]);
2665
2665
  var handleInputChange = React.useCallback(function (value) {
2666
2666
  setInputValue(value.replace(/ /g, '').replace(/,/g, ''));
2667
+ setInputValue(value);
2667
2668
  }, []);
2668
2669
  var handleBlur = React.useCallback(function (e) {
2669
2670
  if (notEmpty(inputValue)) {
@@ -2703,6 +2704,8 @@ styleInject(css_248z$j);var FormTag = React.forwardRef(function (_a, ref) {
2703
2704
  if (readOnly) {
2704
2705
  renderProps.inputProps.className = classNames$1(renderProps.inputProps.className, 'Mui-disabled');
2705
2706
  }
2707
+ delete renderProps.inputProps.onChange;
2708
+ delete renderProps.inputProps.value;
2706
2709
  return (React.createElement(FormText, __assign$7({}, renderProps, { ref: handleRef, name: name, className: classNames$1(className, 'FormValueItem', 'FormTag'), error: error, disabled: disabled, fullWidth: fullWidth, required: required, value: inputValue, exceptValue: exceptValue, helperText: error ? errorHelperText : helperText, onKeyDown: handleInputKeyDown, onChange: handleInputChange, onBlur: handleBlur })));
2707
2710
  } })));
2708
2711
  });
@@ -7509,7 +7512,7 @@ styleInject(css_248z$c);var FormTextEditor = React.forwardRef(function (_a, ref)
7509
7512
  // State - FormState -----------------------------------------------------------------------------------------------
7510
7513
  var _c = useAutoUpdateState$1(initFocused == null ? formFocused : initFocused), focused = _c[0], setFocused = _c[1];
7511
7514
  // Ref -------------------------------------------------------------------------------------------------------------
7512
- var editorRef = React.useRef(null);
7515
+ var editorRef = React.useRef();
7513
7516
  var keyDownTime = React.useRef(0);
7514
7517
  // State - value ---------------------------------------------------------------------------------------------------
7515
7518
  var _d = useAutoUpdateState$1(initValue || ''), value = _d[0], setValue = _d[1];
@@ -7528,13 +7531,8 @@ styleInject(css_248z$c);var FormTextEditor = React.forwardRef(function (_a, ref)
7528
7531
  var _j = useAutoUpdateState$1(initData), data = _j[0], setData = _j[1];
7529
7532
  // Function - focus ------------------------------------------------------------------------------------------------
7530
7533
  var focus = React.useCallback(function () {
7531
- var _a, _b;
7532
- var textarea = (_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.elementRef) === null || _b === void 0 ? void 0 : _b.current;
7533
- if (textarea) {
7534
- textarea.style.display = 'block';
7535
- textarea.focus();
7536
- textarea.style.display = 'none';
7537
- }
7534
+ var _a;
7535
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
7538
7536
  }, [editorRef]);
7539
7537
  // Function - setErrorErrorHelperText -----------------------------------------------------------------------------------
7540
7538
  var setErrorErrorHelperText = React.useCallback(function (error, errorHelperText) {
@@ -7543,14 +7541,8 @@ styleInject(css_248z$c);var FormTextEditor = React.forwardRef(function (_a, ref)
7543
7541
  }, [setError]);
7544
7542
  // Function - validate ---------------------------------------------------------------------------------------------
7545
7543
  var validate = React.useCallback(function (value) {
7546
- var isEmptyValue = false;
7547
- if (value) {
7548
- var d = document.createElement('div');
7549
- d.innerHTML = value;
7550
- var text = d.textContent || d.innerText;
7551
- isEmptyValue = empty(text.trim());
7552
- }
7553
- if (required && (isEmptyValue || empty(value))) {
7544
+ var _a;
7545
+ if (required && empty((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.getContent())) {
7554
7546
  setErrorErrorHelperText(true, '필수 입력 항목입니다.');
7555
7547
  return false;
7556
7548
  }
@@ -7666,7 +7658,7 @@ styleInject(css_248z$c);var FormTextEditor = React.forwardRef(function (_a, ref)
7666
7658
  // Render ----------------------------------------------------------------------------------------------------------
7667
7659
  return (React.createElement(FormItemBase, { variant: variant, size: size, color: color, focused: focused, className: classNames$1(className, 'FormValueItem', 'FormTextEditor', !initialized && 'initializing'), labelIcon: labelIcon, label: label, error: error, required: required, fullWidth: true, helperText: error ? errorHelperText : helperText, helperTextProps: { style: { marginLeft: 5 } }, style: { width: '100%' }, hidden: hidden, controlHeight: height, control: React.createElement(React.Fragment, null,
7668
7660
  !initialized ? React.createElement(material.Skeleton, { variant: 'rectangular', width: '100%', height: height }) : null,
7669
- React.createElement(Editor, { ref: editorRef, apiKey: apiKey, value: value, disabled: readOnly || disabled, init: {
7661
+ React.createElement(Editor, { apiKey: apiKey, value: value, disabled: readOnly || disabled, init: {
7670
7662
  height: height,
7671
7663
  menubar: menubar,
7672
7664
  readonly: true,
@@ -7696,7 +7688,8 @@ styleInject(css_248z$c);var FormTextEditor = React.forwardRef(function (_a, ref)
7696
7688
  bold italic | align | forecolor backcolor | \
7697
7689
  link image media | advtable | code',
7698
7690
  images_upload_handler: handleImageUpload,
7699
- }, onInit: function () {
7691
+ }, onInit: function (evt, editor) {
7692
+ editorRef.current = editor;
7700
7693
  setTimeout(function () { return setInitialized(true); }, 10);
7701
7694
  }, onEditorChange: handleEditorChange, onKeyDown: handleKeyDown, onFocus: function () { return setFocused(initFocused || true); }, onBlur: function () { return setFocused(initFocused || false); } })) }));
7702
7695
  });