@pdg/react-form 1.0.137 → 1.0.139

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React,{createContext,useContext,useRef,useCallback,useMemo,useLayoutEffect,useEffect,useState,useId}from'react';import classNames from'classnames';import {Box,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,InputAdornment,IconButton,TextField,Chip,Autocomplete,Icon,CircularProgress,MenuItem,Checkbox,FormControl,Input,OutlinedInput,FilledInput,FormControlLabel,Typography,RadioGroup,Radio,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Button,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,ifUndefined,nextTick,notEmpty,equal,telNoAutoDash,companyNoAutoDash,personalNoAutoDash}from'@pdg/util';import dayjs from'dayjs';import {useAutoUpdateLayoutRef,useAutoUpdateState,useAutoUpdateRefState,useFirstSkipEffect,useForceUpdate}from'@pdg/react-hook';import {PdgButton,PdgIcon,PdgIconText}from'@pdg/react-component';import {useResizeDetector}from'react-resize-detector';import {NumericFormat}from'react-number-format';import {CheckBoxOutlineBlank,CheckBox,RadioButtonChecked,RadioButtonUnchecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';import'dayjs/locale/ko';function styleInject(css, ref) {
1
+ import React,{createContext,useContext,useRef,useCallback,useMemo,useLayoutEffect,useEffect,useState,useId}from'react';import classNames from'classnames';import {Box,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,InputAdornment,IconButton,TextField,Chip,Autocomplete,Icon,CircularProgress,MenuItem,Checkbox,FormControl,Input,OutlinedInput,FilledInput,FormControlLabel,Typography,RadioGroup,Radio,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Button,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,ifUndefined,nextTick,notEmpty,equal,telNoAutoDash,companyNoAutoDash,personalNoAutoDash}from'@pdg/util';import dayjs from'dayjs';import {useAutoUpdateLayoutRef,useAutoUpdateState,useAutoUpdateRefState,useFirstSkipEffect,useForceUpdate,useAutoUpdateRef}from'@pdg/react-hook';import {PdgButton,PdgIcon,PdgIconText}from'@pdg/react-component';import {useResizeDetector}from'react-resize-detector';import {NumericFormat}from'react-number-format';import {CheckBoxOutlineBlank,CheckBox,RadioButtonChecked,RadioButtonUnchecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';import'dayjs/locale/ko';function styleInject(css, ref) {
2
2
  if ( ref === void 0 ) ref = {};
3
3
  var insertAt = ref.insertAt;
4
4
 
@@ -966,13 +966,13 @@ var templateObject_1$f, templateObject_2$8, templateObject_3$4;var FormCol = Rea
966
966
  * ******************************************************************************************************************/
967
967
  return (React.createElement(FormContextProvider, { value: __assign(__assign({}, otherFormState), { variant: variant, size: size, color: color, spacing: spacing, focused: focused, labelShrink: labelShrink, fullWidth: fullWidth, formColGap: formColGap, formColXs: xs || formColAutoXs || 12, formColWidth: formColWidth, formColWithLabel: !!label, formColWithHelperText: !!helperText }) },
968
968
  React.createElement(Grid, { ref: gridRef, size: { xs: xs || formColAutoXs || 12 }, className: classNames(className, 'FormCol', !!label && 'with-label', !!helperText && 'with-helper-text'), style: hidden ? __assign(__assign({}, initStyle), { display: 'none' }) : initStyle, sx: sx },
969
- React.createElement(Grid, { container: true, direction: 'column' },
970
- label && (React.createElement(Grid, { className: 'FormCol-header' },
969
+ React.createElement("div", null,
970
+ label && (React.createElement("div", { className: 'FormCol-header' },
971
971
  React.createElement(StyledFormLabelContainerDiv, null,
972
972
  React.createElement(StyledFormLabel, { className: 'FormCol-FormLabel', size: size, icon: icon, focused: focused, color: color, error: error, warning: warning }, label)))),
973
- React.createElement(Grid, { size: { xs: 2, sm: 12 }, className: 'FormCol-content' },
973
+ React.createElement("div", { className: 'FormCol-content' },
974
974
  React.createElement(StyledContentContainerBox, { gap: formColGap }, children)),
975
- helperText && (React.createElement(Grid, { className: 'FormCol-helper-text' },
975
+ helperText && (React.createElement("div", { className: 'FormCol-helper-text' },
976
976
  React.createElement(FormHelperText, { component: 'div', error: error, style: { marginLeft: helperTextShift ? 14 : 5 } }, helperText)))))));
977
977
  });var StyledContainerDiv = styled('div')(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n flex: 1;\n position: relative;\n"], ["\n flex: 1;\n position: relative;\n"])));
978
978
  var StyledContentDiv = styled('div')(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n ::-webkit-scrollbar {\n width: 8px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: #e4e4e4;\n border-radius: 100px;\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background-color: #cfcfcf;\n border-radius: 100px;\n }\n"], ["\n ::-webkit-scrollbar {\n width: 8px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: #e4e4e4;\n border-radius: 100px;\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background-color: #cfcfcf;\n border-radius: 100px;\n }\n"])));
@@ -1658,15 +1658,7 @@ FormMobile.displayName = 'FormMobile';var NumberFormatCustom = React.forwardRef(
1658
1658
  /********************************************************************************************************************
1659
1659
  * Ref
1660
1660
  * ******************************************************************************************************************/
1661
- var strValueRef = React.useRef(undefined);
1662
- /********************************************************************************************************************
1663
- * Effect
1664
- * ******************************************************************************************************************/
1665
- useEffect(function () {
1666
- strValueRef.current = empty(initValue) ? '' : "".concat(initValue);
1667
- forceUpdate();
1668
- // eslint-disable-next-line react-hooks/exhaustive-deps
1669
- }, [initValue]);
1661
+ var strValueRef = useAutoUpdateRef(initValue !== undefined ? "".concat(initValue) : '');
1670
1662
  /********************************************************************************************************************
1671
1663
  * Memo
1672
1664
  * ******************************************************************************************************************/
@@ -1737,7 +1729,7 @@ FormMobile.displayName = 'FormMobile';var NumberFormatCustom = React.forwardRef(
1737
1729
  strValueRef.current = value;
1738
1730
  forceUpdate();
1739
1731
  }
1740
- }, [forceUpdate, onChange]);
1732
+ }, [forceUpdate, onChange, strValueRef]);
1741
1733
  var handleValue = useCallback(function (value) {
1742
1734
  var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
1743
1735
  if (onValue) {
package/dist/index.js CHANGED
@@ -966,13 +966,13 @@ var templateObject_1$f, templateObject_2$8, templateObject_3$4;var FormCol = Rea
966
966
  * ******************************************************************************************************************/
967
967
  return (React.createElement(FormContextProvider, { value: __assign(__assign({}, otherFormState), { variant: variant, size: size, color: color, spacing: spacing, focused: focused, labelShrink: labelShrink, fullWidth: fullWidth, formColGap: formColGap, formColXs: xs || formColAutoXs || 12, formColWidth: formColWidth, formColWithLabel: !!label, formColWithHelperText: !!helperText }) },
968
968
  React.createElement(material.Grid, { ref: gridRef, size: { xs: xs || formColAutoXs || 12 }, className: classNames(className, 'FormCol', !!label && 'with-label', !!helperText && 'with-helper-text'), style: hidden ? __assign(__assign({}, initStyle), { display: 'none' }) : initStyle, sx: sx },
969
- React.createElement(material.Grid, { container: true, direction: 'column' },
970
- label && (React.createElement(material.Grid, { className: 'FormCol-header' },
969
+ React.createElement("div", null,
970
+ label && (React.createElement("div", { className: 'FormCol-header' },
971
971
  React.createElement(StyledFormLabelContainerDiv, null,
972
972
  React.createElement(StyledFormLabel, { className: 'FormCol-FormLabel', size: size, icon: icon, focused: focused, color: color, error: error, warning: warning }, label)))),
973
- React.createElement(material.Grid, { size: { xs: 2, sm: 12 }, className: 'FormCol-content' },
973
+ React.createElement("div", { className: 'FormCol-content' },
974
974
  React.createElement(StyledContentContainerBox, { gap: formColGap }, children)),
975
- helperText && (React.createElement(material.Grid, { className: 'FormCol-helper-text' },
975
+ helperText && (React.createElement("div", { className: 'FormCol-helper-text' },
976
976
  React.createElement(material.FormHelperText, { component: 'div', error: error, style: { marginLeft: helperTextShift ? 14 : 5 } }, helperText)))))));
977
977
  });var StyledContainerDiv = material.styled('div')(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n flex: 1;\n position: relative;\n"], ["\n flex: 1;\n position: relative;\n"])));
978
978
  var StyledContentDiv = material.styled('div')(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n ::-webkit-scrollbar {\n width: 8px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: #e4e4e4;\n border-radius: 100px;\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background-color: #cfcfcf;\n border-radius: 100px;\n }\n"], ["\n ::-webkit-scrollbar {\n width: 8px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: #e4e4e4;\n border-radius: 100px;\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background-color: #cfcfcf;\n border-radius: 100px;\n }\n"])));
@@ -1658,15 +1658,7 @@ FormMobile.displayName = 'FormMobile';var NumberFormatCustom = React.forwardRef(
1658
1658
  /********************************************************************************************************************
1659
1659
  * Ref
1660
1660
  * ******************************************************************************************************************/
1661
- var strValueRef = React.useRef(undefined);
1662
- /********************************************************************************************************************
1663
- * Effect
1664
- * ******************************************************************************************************************/
1665
- React.useEffect(function () {
1666
- strValueRef.current = util.empty(initValue) ? '' : "".concat(initValue);
1667
- forceUpdate();
1668
- // eslint-disable-next-line react-hooks/exhaustive-deps
1669
- }, [initValue]);
1661
+ var strValueRef = reactHook.useAutoUpdateRef(initValue !== undefined ? "".concat(initValue) : '');
1670
1662
  /********************************************************************************************************************
1671
1663
  * Memo
1672
1664
  * ******************************************************************************************************************/
@@ -1737,7 +1729,7 @@ FormMobile.displayName = 'FormMobile';var NumberFormatCustom = React.forwardRef(
1737
1729
  strValueRef.current = value;
1738
1730
  forceUpdate();
1739
1731
  }
1740
- }, [forceUpdate, onChange]);
1732
+ }, [forceUpdate, onChange, strValueRef]);
1741
1733
  var handleValue = React.useCallback(function (value) {
1742
1734
  var finalValue = util.empty(value) || value === '-' || value === '.' ? undefined : Number(value);
1743
1735
  if (onValue) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdg/react-form",
3
3
  "title": "React Form",
4
- "version": "1.0.137",
4
+ "version": "1.0.139",
5
5
  "description": "React Form",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "@mui/material": "^7.0.2",
47
47
  "@mui/x-date-pickers": "^7.28.3",
48
48
  "@pdg/react-component": "^1.0.33",
49
- "@pdg/react-hook": "^1.0.27",
49
+ "@pdg/react-hook": "^1.0.28",
50
50
  "@pdg/util": "^1.0.23",
51
51
  "@tinymce/tinymce-react": "^6.1.0",
52
52
  "@types/react": ">=17.0.0",