@pdg/react-form 1.0.155 → 1.0.157

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,businessNoAutoDash,personalNoAutoDash}from'@pdg/util';import dayjs from'dayjs';import {useAutoUpdateLayoutRef,useAutoUpdateState,useAutoUpdateRefState,useForceUpdate,useAutoUpdateRef,useFirstSkipEffect}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 {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';function insertStyle(css) {
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 dayjs from'dayjs';import {useAutoUpdateLayoutRef,useAutoUpdateState,useAutoUpdateRefState,useForceUpdate,useAutoUpdateRef,useFirstSkipEffect}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 {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';function insertStyle(css) {
2
2
  if (!css || typeof window === 'undefined')
3
3
  return;
4
4
  const style = document.createElement('style');
@@ -63,7 +63,179 @@ function __makeTemplateObject(cooked, raw) {
63
63
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
64
64
  var e = new Error(message);
65
65
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
66
- };var FormContextDefaultValue = {
66
+ };function businessNoAutoDash(businessNo, allowCharacters) {
67
+ if (allowCharacters === void 0) { allowCharacters = '*'; }
68
+ var str = businessNo.replace(new RegExp("[^0-9".concat(allowCharacters, "]"), 'g'), '');
69
+ var values = [str.slice(0, 3)];
70
+ if (str.length > 3)
71
+ values.push(str.slice(3, 5));
72
+ if (str.length > 5)
73
+ values.push(str.slice(5));
74
+ return values.join('-');
75
+ }/********************************************************************************************************************
76
+ * 값이 비어있는지 확인하는 함수
77
+ * - Array 값이 비어있거나, Object 값이 비어있거나, 문자열이 비어있거나, null 또는 undefined 인 경우 true 반환
78
+ * @param v 확인할 값
79
+ * @returns 값이 비어있는지 여부
80
+ * ******************************************************************************************************************/
81
+ function empty(v) {
82
+ var result = false;
83
+ if (v == null) {
84
+ result = true;
85
+ }
86
+ else if (typeof v === 'string') {
87
+ result = v === '';
88
+ }
89
+ else if (typeof v === 'object') {
90
+ if (Array.isArray(v)) {
91
+ result = v.length === 0;
92
+ }
93
+ else if (!(v instanceof Date)) {
94
+ result = Object.entries(v).length === 0;
95
+ }
96
+ }
97
+ return result;
98
+ }/********************************************************************************************************************
99
+ * 값이 비어있지 않은지 확인합니다.
100
+ * - Array 값이 비어있지 않거나, Object 값이 비어있지 않거나, 문자열이 비어있지 않거나, null 또는 undefined 가 아닌 경우 true 반환
101
+ * @param v 확인할 값
102
+ * @returns 값이 비어있는지 여부
103
+ * ******************************************************************************************************************/
104
+ function notEmpty(v) {
105
+ return !empty(v);
106
+ }/********************************************************************************************************************
107
+ * 두 값이 동일한지 확인하는 함수
108
+ * @param v1 비교할 첫 번째 값
109
+ * @param v2 비교할 두 번째 값
110
+ * @returns 두 값이 동일한지 여부
111
+ * ******************************************************************************************************************/
112
+ function equal(v1, v2) {
113
+ if (v1 === v2)
114
+ return true;
115
+ if (typeof v1 !== typeof v2)
116
+ return false;
117
+ if (v1 == null || v2 == null)
118
+ return false;
119
+ if (typeof v1 === 'object' && typeof v2 === 'object') {
120
+ return JSON.stringify(v1) === JSON.stringify(v2);
121
+ }
122
+ else {
123
+ return v1 === v2;
124
+ }
125
+ }/********************************************************************************************************************
126
+ * 배열에 특정 값이 포함되어 있는지 여부를 반환하는 함수
127
+ * @param list 확인할 배열 또는 문자열
128
+ * @param value 확인할 값
129
+ * @returns 포함 여부
130
+ * ******************************************************************************************************************/
131
+ function ifUndefined(v, v2) {
132
+ return v === undefined ? v2 : v;
133
+ }/********************************************************************************************************************
134
+ * 값이 undefined 이 아닌 경우 대체 값을 반환하는 함수
135
+ * @param v 확인할 값
136
+ * @param v2 대체 값
137
+ * @returns 최종 값
138
+ * ******************************************************************************************************************/
139
+
140
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
141
+ var e = new Error(message);
142
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
143
+ };/********************************************************************************************************************
144
+ * {label, value, ...other} 객체 생성하여 반환하는 함수
145
+ * @param label - label
146
+ * @param value - value
147
+ * @param other - 기타 속성
148
+ * @returns 생성된 객체
149
+ * ******************************************************************************************************************/
150
+ function nextTick(callback, delay) {
151
+ return setTimeout(callback, delay === undefined ? 1 : delay);
152
+ }/********************************************************************************************************************
153
+ * UUID 생성하는 함수
154
+ * @param removeDash 하이픈 제거 여부
155
+ * @returns UUID
156
+ * ******************************************************************************************************************/
157
+ function telNoAutoDash(v, allowCharacters) {
158
+ if (allowCharacters === void 0) { allowCharacters = '*'; }
159
+ if (v === undefined)
160
+ return undefined;
161
+ if (v === null)
162
+ return null;
163
+ var str = v.replace(new RegExp("[^0-9".concat(allowCharacters, "]"), 'g'), '');
164
+ var isLastDash = v.substring(v.length - 1, v.length) === '-';
165
+ if (str.substring(0, 1) !== '0' && !['15', '16', '18'].includes(str.substring(0, 2))) {
166
+ return str;
167
+ }
168
+ var tmp = '';
169
+ var preLen;
170
+ switch (str.substring(0, 2)) {
171
+ case '02':
172
+ preLen = 2;
173
+ break;
174
+ case '15':
175
+ case '16':
176
+ case '18':
177
+ preLen = 4;
178
+ break;
179
+ default:
180
+ preLen = 3;
181
+ }
182
+ if (['15', '16', '18'].includes(str.substring(0, 2))) {
183
+ if (str.length <= preLen) {
184
+ tmp = str;
185
+ }
186
+ else if (str.length <= preLen + 4) {
187
+ tmp += str.substring(0, preLen);
188
+ tmp += '-';
189
+ tmp += str.substring(preLen);
190
+ }
191
+ else {
192
+ tmp = str;
193
+ }
194
+ }
195
+ else if (str.length <= preLen) {
196
+ tmp = str;
197
+ }
198
+ else if (str.length <= preLen + 3) {
199
+ tmp += str.substring(0, preLen);
200
+ tmp += '-';
201
+ tmp += str.substring(preLen);
202
+ }
203
+ else if (str.length <= preLen + 7) {
204
+ tmp += str.substring(0, preLen);
205
+ tmp += '-';
206
+ tmp += str.substring(preLen, preLen + 3);
207
+ tmp += '-';
208
+ tmp += str.substring(preLen + 3);
209
+ }
210
+ else if (str.length <= preLen + 8) {
211
+ tmp += str.substring(0, preLen);
212
+ tmp += '-';
213
+ tmp += str.substring(preLen, preLen + 4);
214
+ tmp += '-';
215
+ tmp += str.substring(preLen + 4);
216
+ }
217
+ else {
218
+ tmp = str;
219
+ }
220
+ if (isLastDash) {
221
+ if (str.length === preLen) {
222
+ tmp += '-';
223
+ }
224
+ }
225
+ return tmp;
226
+ }/********************************************************************************************************************
227
+ * 전화번호 마스킹
228
+ * ******************************************************************************************************************/
229
+ function personalNoAutoDash(personalNo, allowCharacters) {
230
+ if (allowCharacters === void 0) { allowCharacters = '*'; }
231
+ var str = personalNo.replace(new RegExp("[^0-9".concat(allowCharacters, "]"), 'g'), '');
232
+ var values = [str.slice(0, 6)];
233
+ if (str.length > 6)
234
+ values.push(str.slice(6));
235
+ return values.join('-');
236
+ }/********************************************************************************************************************
237
+ * 주민등록번호 마스킹
238
+ * ******************************************************************************************************************/var FormContextDefaultValue = {
67
239
  id: 'init',
68
240
  variant: 'outlined',
69
241
  size: 'medium',