@pdg/react-form 1.0.90 → 1.0.92

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,useMemo,useRef,useState,useCallback,useLayoutEffect,useEffect,useId}from'react';import classNames from'classnames';import {Box,Icon,Button,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,InputAdornment,IconButton,TextField,Chip,Autocomplete,CircularProgress,MenuItem,Checkbox,FormControl,Input,OutlinedInput,FilledInput,FormControlLabel,Typography,RadioGroup,Radio,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import dayjs from'dayjs';import {useAutoUpdateState,useFirstSkipEffect}from'@pdg/react-hook';import {useResizeDetector}from'react-resize-detector';import {NumericFormat}from'react-number-format';import {CheckBox,CheckBoxOutlineBlank,RadioButtonUnchecked,RadioButtonChecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import CircularProgress$1 from'@mui/material/CircularProgress';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import {IconText}from'@pdg/react-component';import SimpleBar from'simplebar-react';import'dayjs/locale/ko';/******************************************************************************
1
+ import React,{createContext,useContext,useMemo,useRef,useState,useCallback,useLayoutEffect,useEffect,useId}from'react';import classNames from'classnames';import {Box,Icon,Button,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,InputAdornment,IconButton,TextField,Chip,Autocomplete,CircularProgress,MenuItem,Checkbox,FormControl,Input,OutlinedInput,FilledInput,FormControlLabel,Typography,RadioGroup,Radio,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,nextTick,notEmpty,equal,telNoAutoDash,companyNoAutoDash,personalNoAutoDash}from'@pdg/util';import dayjs from'dayjs';import {useAutoUpdateState,useFirstSkipEffect}from'@pdg/react-hook';import {useResizeDetector}from'react-resize-detector';import {NumericFormat}from'react-number-format';import {CheckBox,CheckBoxOutlineBlank,RadioButtonUnchecked,RadioButtonChecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import CircularProgress$1 from'@mui/material/CircularProgress';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import {PickersDay,StaticDatePicker,LocalizationProvider,DesktopDatePicker,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import {PdgIconText}from'@pdg/react-component';import SimpleBar from'simplebar-react';import'dayjs/locale/ko';/******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -55,355 +55,6 @@ function __makeTemplateObject(cooked, raw) {
55
55
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
56
56
  var e = new Error(message);
57
57
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
58
- };var empty = function (v) {
59
- var result = false;
60
- if (v == null) {
61
- result = true;
62
- }
63
- else if (typeof v === 'string') {
64
- result = v === '';
65
- }
66
- else if (typeof v === 'object') {
67
- if (Array.isArray(v)) {
68
- result = v.length === 0;
69
- }
70
- else if (!(v instanceof Date)) {
71
- result = Object.entries(v).length === 0;
72
- }
73
- }
74
- return result;
75
- };
76
- var notEmpty = function (v) {
77
- return !empty(v);
78
- };
79
- var isSame = function (v1, v2) {
80
- if (v1 === v2)
81
- return true;
82
- if (typeof v1 !== typeof v2)
83
- return false;
84
- if (v1 == null || v2 == null)
85
- return false;
86
- if (Array.isArray(v1) && Array.isArray(v2)) {
87
- if (v1.length !== v2.length)
88
- return false;
89
- for (var i = 0; i < v1.length; i += 1) {
90
- if (v1[i] !== v2[i])
91
- return false;
92
- }
93
- }
94
- else {
95
- return v1 === v2;
96
- }
97
- return true;
98
- };function getDateValidationErrorText(error) {
99
- switch (error) {
100
- case 'invalidDate':
101
- return '형식이 일치하지 않습니다.';
102
- case 'shouldDisableDate':
103
- case 'shouldDisableMonth':
104
- case 'shouldDisableYear':
105
- case 'disableFuture':
106
- case 'disablePast':
107
- case 'minDate':
108
- case 'maxDate':
109
- return '선택할 수 없는 날짜입니다.';
110
- }
111
- }
112
- //--------------------------------------------------------------------------------------------------------------------
113
- var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD';
114
- var DEFAULT_DATE_FORM_VALUE_FORMAT = 'YYYY-MM-DD';
115
- var DEFAULT_DATE_TIME_HOUR_FORMAT = 'YYYY-MM-DD HH시';
116
- var DEFAULT_DATE_TIME_HOUR_FORM_VALUE_FORMAT = 'YYYY-MM-DD HH:00:00';
117
- var DEFAULT_DATE_TIME_MINUTE_FORMAT = 'YYYY-MM-DD HH:mm';
118
- var DEFAULT_DATE_TIME_MINUTE_FORM_VALUE_FORMAT = 'YYYY-MM-DD HH:mm:00';
119
- var DEFAULT_DATE_TIME_SECOND_FORMAT = 'YYYY-MM-DD HH:mm:ss';
120
- var DEFAULT_DATE_TIME_SECOND_FORM_VALUE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
121
- var DEFAULT_TIME_HOUR_FORMAT = 'HH시';
122
- var DEFAULT_TIME_HOUR_FORM_VALUE_FORMAT = 'HH:00:00';
123
- var DEFAULT_TIME_MINUTE_FORMAT = 'HH:mm';
124
- var DEFAULT_TIME_MINUTE_FORM_VALUE_FORMAT = 'HH:mm:00';
125
- var DEFAULT_TIME_SECOND_FORMAT = 'HH:mm:ss';
126
- var DEFAULT_TIME_SECOND_FORM_VALUE_FORMAT = 'HH:mm:ss';
127
- function getDateTimeFormat(type, time) {
128
- switch (type) {
129
- case 'date':
130
- return DEFAULT_DATE_FORMAT;
131
- case 'date_time':
132
- if (time) {
133
- switch (time) {
134
- case 'hour':
135
- return DEFAULT_DATE_TIME_HOUR_FORMAT;
136
- case 'minute':
137
- return DEFAULT_DATE_TIME_MINUTE_FORMAT;
138
- case 'second':
139
- return DEFAULT_DATE_TIME_SECOND_FORMAT;
140
- }
141
- }
142
- else {
143
- throw new Error("util::date_time::getDateTimeFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
144
- }
145
- break;
146
- case 'time':
147
- if (time) {
148
- switch (time) {
149
- case 'hour':
150
- return DEFAULT_TIME_HOUR_FORMAT;
151
- case 'minute':
152
- return DEFAULT_TIME_MINUTE_FORMAT;
153
- case 'second':
154
- return DEFAULT_TIME_SECOND_FORMAT;
155
- }
156
- }
157
- else {
158
- throw new Error("util::date_time::getDateTimeFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
159
- }
160
- break;
161
- }
162
- }
163
- function getDateTimeFormValueFormat(type, time) {
164
- switch (type) {
165
- case 'date':
166
- return DEFAULT_DATE_FORM_VALUE_FORMAT;
167
- case 'date_time':
168
- if (time) {
169
- switch (time) {
170
- case 'hour':
171
- return DEFAULT_DATE_TIME_HOUR_FORM_VALUE_FORMAT;
172
- case 'minute':
173
- return DEFAULT_DATE_TIME_MINUTE_FORM_VALUE_FORMAT;
174
- case 'second':
175
- return DEFAULT_DATE_TIME_SECOND_FORM_VALUE_FORMAT;
176
- }
177
- }
178
- else {
179
- throw new Error("util::date_time::getDateTimeFormValueFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
180
- }
181
- break;
182
- case 'time':
183
- if (time) {
184
- switch (time) {
185
- case 'hour':
186
- return DEFAULT_TIME_HOUR_FORM_VALUE_FORMAT;
187
- case 'minute':
188
- return DEFAULT_TIME_MINUTE_FORM_VALUE_FORMAT;
189
- case 'second':
190
- return DEFAULT_TIME_SECOND_FORM_VALUE_FORMAT;
191
- }
192
- }
193
- else {
194
- throw new Error("util::date_time::getDateTimeFormValueFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
195
- }
196
- break;
197
- }
198
- }
199
- function getAvailableDateValFormat(type, time) {
200
- var availableDateType;
201
- if (time) {
202
- availableDateType = getAvailableDateType(type, time);
203
- }
204
- else if (['date', 'date_time', 'time'].includes(type)) {
205
- availableDateType = getAvailableDateType(type, time);
206
- }
207
- else {
208
- availableDateType = type;
209
- }
210
- switch (availableDateType) {
211
- case 'year':
212
- return 'YYYY';
213
- case 'month':
214
- return 'YYYYMM';
215
- case 'day':
216
- return 'YYYYMMDD';
217
- case 'hour':
218
- return 'YYYYMMDDHH';
219
- case 'minute':
220
- return 'YYYYMMDDHHmm';
221
- case 'second':
222
- return 'YYYYMMDDHHmmss';
223
- }
224
- }
225
- /********************************************************************************************************************
226
- * getAvailableDateType
227
- * ******************************************************************************************************************/
228
- function getAvailableDateType(type, time) {
229
- switch (type) {
230
- case 'date':
231
- return 'day';
232
- case 'date_time':
233
- if (time) {
234
- switch (time) {
235
- case 'hour':
236
- return 'hour';
237
- case 'minute':
238
- return 'minute';
239
- case 'second':
240
- return 'second';
241
- }
242
- }
243
- else {
244
- throw new Error("util::date_time::getAvailableDateType - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
245
- }
246
- break;
247
- case 'time':
248
- throw new Error("util::date_time::getAvailableDateType - '".concat(type, "' type \uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."));
249
- }
250
- }
251
- /********************************************************************************************************************
252
- * makeAvailableDate
253
- * ******************************************************************************************************************/
254
- function makeAvailableDate(minDate, maxDate, disablePast, disableFuture) {
255
- var now = dayjs();
256
- var min = null;
257
- var max = null;
258
- if (disablePast) {
259
- min = now;
260
- }
261
- if (minDate) {
262
- if (min) {
263
- if (minDate.isAfter(min, 'date')) {
264
- min = minDate;
265
- }
266
- }
267
- else {
268
- min = minDate;
269
- }
270
- }
271
- if (disableFuture) {
272
- max = now;
273
- }
274
- if (maxDate) {
275
- if (max) {
276
- if (maxDate.isBefore(max, 'date')) {
277
- max = maxDate;
278
- }
279
- }
280
- else {
281
- max = maxDate;
282
- }
283
- }
284
- var minItem = min
285
- ? {
286
- date: min,
287
- year: Number(min.format(getAvailableDateValFormat('year'))),
288
- month: Number(min.format(getAvailableDateValFormat('month'))),
289
- day: Number(min.format(getAvailableDateValFormat('day'))),
290
- hour: Number(min.format(getAvailableDateValFormat('hour'))),
291
- minute: Number(min.format(getAvailableDateValFormat('minute'))),
292
- second: Number(min.format(getAvailableDateValFormat('second'))),
293
- }
294
- : null;
295
- var maxItem = max
296
- ? {
297
- date: max,
298
- year: Number(max.format(getAvailableDateValFormat('year'))),
299
- month: Number(max.format(getAvailableDateValFormat('month'))),
300
- day: Number(max.format(getAvailableDateValFormat('day'))),
301
- hour: Number(max.format(getAvailableDateValFormat('hour'))),
302
- minute: Number(max.format(getAvailableDateValFormat('minute'))),
303
- second: Number(max.format(getAvailableDateValFormat('second'))),
304
- }
305
- : null;
306
- return [minItem, maxItem];
307
- }
308
- function getAvailableDate(availableDate, type, time) {
309
- var availableDateType;
310
- if (time) {
311
- availableDateType = getAvailableDateType(type, time);
312
- }
313
- else if (['date', 'date_time', 'time'].includes(type)) {
314
- availableDateType = getAvailableDateType(type, time);
315
- }
316
- else {
317
- availableDateType = type;
318
- }
319
- var availableDateVal = getAvailableDateVal(availableDate, availableDateType);
320
- var availableDateValFormat = getAvailableDateValFormat(availableDateType);
321
- return [
322
- availableDateVal[0] ? dayjs(availableDateVal[0].toString(), availableDateValFormat) : null,
323
- availableDateVal[1] ? dayjs(availableDateVal[1].toString(), availableDateValFormat) : null,
324
- ];
325
- }
326
- function getAvailableDateVal(availableDate, type, time) {
327
- var availableDateType;
328
- if (time) {
329
- availableDateType = getAvailableDateType(type, time);
330
- }
331
- else if (['date', 'date_time', 'time'].includes(type)) {
332
- availableDateType = getAvailableDateType(type, time);
333
- }
334
- else {
335
- availableDateType = type;
336
- }
337
- return [
338
- availableDate[0] ? availableDate[0][availableDateType] : null,
339
- availableDate[1] ? availableDate[1][availableDateType] : null,
340
- ];
341
- }
342
- /********************************************************************************************************************
343
- * getDateVal
344
- * ******************************************************************************************************************/
345
- function getDateValForAvailableDate(date, type, time) {
346
- var format = getAvailableDateValFormat(type, time);
347
- return Number(date.format(format));
348
- }
349
- function isDateAvailable(date, availableDate, type, time) {
350
- var availableDateType;
351
- if (time) {
352
- availableDateType = getAvailableDateType(type, time);
353
- }
354
- else if (['date', 'date_time', 'time'].includes(type)) {
355
- availableDateType = getAvailableDateType(type, time);
356
- }
357
- else {
358
- availableDateType = type;
359
- }
360
- var dateVal = Number(date.format(getAvailableDateValFormat(availableDateType)));
361
- var availableDateVal = getAvailableDateVal(availableDate, availableDateType);
362
- return !((availableDateVal[0] && dateVal < availableDateVal[0]) ||
363
- (availableDateVal[1] && dateVal > availableDateVal[1]));
364
- }
365
- function checkDateAvailable(date, availableDate, type, time) {
366
- var availableDateType;
367
- if (time) {
368
- availableDateType = getAvailableDateType(type, time);
369
- }
370
- else if (['date', 'date_time', 'time'].includes(type)) {
371
- availableDateType = getAvailableDateType(type, time);
372
- }
373
- else {
374
- availableDateType = type;
375
- }
376
- var dateVal = Number(date.format(getAvailableDateValFormat(availableDateType)));
377
- var availableDateVal = getAvailableDateVal(availableDate, availableDateType);
378
- if (availableDateVal[0] && dateVal < availableDateVal[0])
379
- return 'min';
380
- if (availableDateVal[1] && dateVal > availableDateVal[1])
381
- return 'max';
382
- return 'available';
383
- }function getFileSizeText(bytes, dp) {
384
- if (dp === void 0) { dp = 1; }
385
- var thresh = 1024;
386
- if (Math.abs(bytes) < thresh) {
387
- return "".concat(bytes, " Byte");
388
- }
389
- var units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
390
- var u = -1;
391
- var r = Math.pow(10, dp);
392
- do {
393
- bytes /= thresh;
394
- u += 1;
395
- } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
396
- return "".concat(bytes.toFixed(dp), " ").concat(units[u]);
397
- }function ToForwardRefExoticComponent(component, ext) {
398
- var fComponent = component;
399
- fComponent.displayName = ext === null || ext === void 0 ? void 0 : ext.displayName;
400
- fComponent.defaultProps = ext === null || ext === void 0 ? void 0 : ext.defaultProps;
401
- return component;
402
- }
403
- function AutoTypeForwardRef(render) {
404
- return React.forwardRef(render);
405
- }var nextTick = function (callback) {
406
- setTimeout(callback, 1);
407
58
  };var FormDefaultProps = {
408
59
  variant: 'outlined',
409
60
  size: 'medium',
@@ -1797,7 +1448,7 @@ styleInject(css_248z$j);var FormTag = React.forwardRef(function (_a, ref) {
1797
1448
  * Effect
1798
1449
  * ******************************************************************************************************************/
1799
1450
  useEffect(function () {
1800
- if (!isSame(value, initValue)) {
1451
+ if (!equal(value, initValue)) {
1801
1452
  if (onChange)
1802
1453
  onChange(value);
1803
1454
  onValueChange(name, value);
@@ -1848,7 +1499,7 @@ styleInject(css_248z$j);var FormTag = React.forwardRef(function (_a, ref) {
1848
1499
  setValue(lastValue);
1849
1500
  }, getValue: function () { return lastValue; }, setValue: function (newValue) {
1850
1501
  var finalValue = getFinalValue(newValue);
1851
- if (!isSame(lastValue, finalValue)) {
1502
+ if (!equal(lastValue, finalValue)) {
1852
1503
  lastValue = finalValue;
1853
1504
  setValueSet(new Set(lastValue));
1854
1505
  setValue(lastValue);
@@ -1976,245 +1627,487 @@ FormTag.defaultProps = FormTagDefaultProps;var FormEmailDefaultProps = __assign(
1976
1627
  * ******************************************************************************************************************/
1977
1628
  return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormEmail'), type: 'email', onValue: handleValue }, props)));
1978
1629
  });
1979
- FormEmail.displayName = 'FormEmail';
1980
- FormEmail.defaultProps = FormEmailDefaultProps;var FormPasswordDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { clear: false, eye: true });var css_248z$i = ".FormPassword .eye-icon-button-wrap {\n visibility: hidden;\n}\n.FormPassword.variant-filled .eye-icon-button-wrap {\n margin-top: 9px;\n margin-bottom: -9px;\n}\n.FormPassword:hover .eye-icon-button-wrap.show,\n.FormPassword .MuiInputBase-root.Mui-focused .eye-icon-button-wrap.show {\n visibility: visible;\n}";
1981
- styleInject(css_248z$i);var StyledEyeInputAdornment = styled(InputAdornment)(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n visibility: hidden;\n"], ["\n visibility: hidden;\n"])));
1982
- var FormPassword = React.forwardRef(function (_a, ref) {
1630
+ FormEmail.displayName = 'FormEmail';
1631
+ FormEmail.defaultProps = FormEmailDefaultProps;var FormPasswordDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { clear: false, eye: true });var css_248z$i = ".FormPassword .eye-icon-button-wrap {\n visibility: hidden;\n}\n.FormPassword.variant-filled .eye-icon-button-wrap {\n margin-top: 9px;\n margin-bottom: -9px;\n}\n.FormPassword:hover .eye-icon-button-wrap.show,\n.FormPassword .MuiInputBase-root.Mui-focused .eye-icon-button-wrap.show {\n visibility: visible;\n}";
1632
+ styleInject(css_248z$i);var StyledEyeInputAdornment = styled(InputAdornment)(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n visibility: hidden;\n"], ["\n visibility: hidden;\n"])));
1633
+ var FormPassword = React.forwardRef(function (_a, ref) {
1634
+ /********************************************************************************************************************
1635
+ * State
1636
+ * ******************************************************************************************************************/
1637
+ var className = _a.className, initMuiInputProps = _a.InputProps, eye = _a.eye, onChange = _a.onChange, props = __rest(_a, ["className", "InputProps", "eye", "onChange"]);
1638
+ var _b = useState('password'), type = _b[0], setType = _b[1];
1639
+ var _c = useState(notEmpty(props.value)), showEye = _c[0], setShowEye = _c[1];
1640
+ /********************************************************************************************************************
1641
+ * Memo
1642
+ * ******************************************************************************************************************/
1643
+ var muiInputProps = useMemo(function () {
1644
+ if (eye) {
1645
+ var newProps = __assign({}, initMuiInputProps);
1646
+ newProps.endAdornment = (React.createElement(React.Fragment, null,
1647
+ React.createElement(StyledEyeInputAdornment, { position: 'end', className: classNames('eye-icon-button-wrap', showEye && 'show') },
1648
+ React.createElement(IconButton, { size: 'small', tabIndex: -1, onClick: function () {
1649
+ setType(type === 'password' ? 'text' : 'password');
1650
+ } },
1651
+ React.createElement(Icon, { fontSize: 'inherit' }, type === 'password' ? 'visibility' : 'visibility_off'))),
1652
+ newProps.endAdornment));
1653
+ return newProps;
1654
+ }
1655
+ else {
1656
+ return initMuiInputProps;
1657
+ }
1658
+ }, [eye, initMuiInputProps, showEye, type]);
1659
+ /********************************************************************************************************************
1660
+ * Event Handler
1661
+ * ******************************************************************************************************************/
1662
+ var handleChange = useCallback(function (value) {
1663
+ setShowEye(notEmpty(value));
1664
+ onChange && onChange(value);
1665
+ }, [onChange]);
1666
+ /********************************************************************************************************************
1667
+ * Render
1668
+ * ******************************************************************************************************************/
1669
+ return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormPassword'), onChange: handleChange, type: type, InputProps: muiInputProps }, props)));
1670
+ });
1671
+ FormPassword.displayName = 'FormPassword';
1672
+ FormPassword.defaultProps = FormPasswordDefaultProps;
1673
+ var templateObject_1$b;var FormTelDefaultProps = __assign(__assign({}, FormTextDefaultProps), { validPattern: /(^([0-9]{2,3})([0-9]{3,4})([0-9]{4})$)|(^([0-9]{2,3})-([0-9]{3,4})-([0-9]{4})$)|(^([0-9]{4})-([0-9]{4})$)|(^\+(?:[-]?[0-9]){8,}$)/ });var FormTel = React.forwardRef(function (_a, ref) {
1674
+ /********************************************************************************************************************
1675
+ * Event Handler
1676
+ * ******************************************************************************************************************/
1677
+ var className = _a.className, onValue = _a.onValue, props = __rest(_a, ["className", "onValue"]);
1678
+ var handleValue = useCallback(function (value) {
1679
+ var newValue = telNoAutoDash(value.replace(/[^0-9]/gi, ''));
1680
+ return onValue ? onValue(newValue) : newValue;
1681
+ }, [onValue]);
1682
+ /********************************************************************************************************************
1683
+ * Render
1684
+ * ******************************************************************************************************************/
1685
+ return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormTel'), onValue: handleValue, maxLength: 13 }, props)));
1686
+ });
1687
+ FormTel.displayName = 'FormTel';
1688
+ FormTel.defaultProps = FormTelDefaultProps;var FormMobileDefaultProps = __assign(__assign({}, FormTelDefaultProps), { validPattern: /(^(01(?:0|1|[6-9]))([0-9]{3,4})([0-9]{4,4})$)|(^(01(?:0|1|[6-9]))-([0-9]{3,4})-([0-9]{4,4})$)|(^\+(?:[-]?[0-9]){8,}$)/ });var FormMobile = React.forwardRef(function (_a, ref) {
1689
+ var className = _a.className, props = __rest(_a, ["className"]);
1690
+ return React.createElement(FormTel, __assign({ ref: ref, className: classNames(className, 'FormMobile') }, props));
1691
+ });
1692
+ FormMobile.displayName = 'FormMobile';
1693
+ FormMobile.defaultProps = FormMobileDefaultProps;var NumberFormatCustom = React.forwardRef(function (_a, ref) {
1694
+ var onChange = _a.onChange, props = __rest(_a, ["onChange"]);
1695
+ return (React.createElement(NumericFormat, __assign({}, props, { getInputRef: ref, onValueChange: function (values) {
1696
+ if (onChange)
1697
+ onChange({ target: { value: values.value } });
1698
+ } })));
1699
+ });
1700
+ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { clear: true });var FormNumber = React.forwardRef(function (_a, ref) {
1983
1701
  /********************************************************************************************************************
1984
1702
  * State
1985
1703
  * ******************************************************************************************************************/
1986
- var className = _a.className, initMuiInputProps = _a.InputProps, eye = _a.eye, onChange = _a.onChange, props = __rest(_a, ["className", "InputProps", "eye", "onChange"]);
1987
- var _b = useState('password'), type = _b[0], setType = _b[1];
1988
- var _c = useState(notEmpty(props.value)), showEye = _c[0], setShowEye = _c[1];
1704
+ var className = _a.className, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, tabIndex = _a.tabIndex, labelShrink = _a.labelShrink, initMuiInputProps = _a.InputProps, initInputProps = _a.inputProps, initValue = _a.value, onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate, props = __rest(_a, ["className", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "labelShrink", "InputProps", "inputProps", "value", "onChange", "onValue", "onValidate"]);
1705
+ var _b = useState(function () { return (empty(initValue) ? '' : "".concat(initValue)); }), strValue = _b[0], setStrValue = _b[1];
1706
+ /********************************************************************************************************************
1707
+ * Effect
1708
+ * ******************************************************************************************************************/
1709
+ useEffect(function () {
1710
+ setStrValue(empty(initValue) ? '' : "".concat(initValue));
1711
+ }, [initValue]);
1989
1712
  /********************************************************************************************************************
1990
1713
  * Memo
1991
1714
  * ******************************************************************************************************************/
1992
1715
  var muiInputProps = useMemo(function () {
1993
- if (eye) {
1994
- var newProps = __assign({}, initMuiInputProps);
1995
- newProps.endAdornment = (React.createElement(React.Fragment, null,
1996
- React.createElement(StyledEyeInputAdornment, { position: 'end', className: classNames('eye-icon-button-wrap', showEye && 'show') },
1997
- React.createElement(IconButton, { size: 'small', tabIndex: -1, onClick: function () {
1998
- setType(type === 'password' ? 'text' : 'password');
1999
- } },
2000
- React.createElement(Icon, { fontSize: 'inherit' }, type === 'password' ? 'visibility' : 'visibility_off'))),
2001
- newProps.endAdornment));
2002
- return newProps;
1716
+ var inputProps = {
1717
+ className: readOnly ? 'Mui-disabled' : undefined,
1718
+ allowNegative: !!allowNegative,
1719
+ thousandSeparator: thousandSeparator,
1720
+ prefix: prefix,
1721
+ suffix: suffix,
1722
+ readOnly: !!readOnly,
1723
+ tabIndex: readOnly ? -1 : tabIndex,
1724
+ };
1725
+ if (allowDecimal) {
1726
+ if (decimalScale) {
1727
+ inputProps.decimalScale = decimalScale;
1728
+ }
2003
1729
  }
2004
1730
  else {
2005
- return initMuiInputProps;
1731
+ inputProps.decimalScale = 0;
2006
1732
  }
2007
- }, [eye, initMuiInputProps, showEye, type]);
1733
+ return __assign(__assign({}, initMuiInputProps), { inputComponent: NumberFormatCustom, inputProps: __assign(__assign({}, initInputProps), inputProps) });
1734
+ }, [
1735
+ readOnly,
1736
+ allowNegative,
1737
+ thousandSeparator,
1738
+ prefix,
1739
+ suffix,
1740
+ tabIndex,
1741
+ allowDecimal,
1742
+ initMuiInputProps,
1743
+ initInputProps,
1744
+ decimalScale,
1745
+ ]);
2008
1746
  /********************************************************************************************************************
2009
1747
  * Event Handler
2010
1748
  * ******************************************************************************************************************/
2011
1749
  var handleChange = useCallback(function (value) {
2012
- setShowEye(notEmpty(value));
2013
- onChange && onChange(value);
1750
+ var newValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
1751
+ onChange && onChange(newValue);
1752
+ setStrValue(value);
2014
1753
  }, [onChange]);
1754
+ var handleValue = useCallback(function (value) {
1755
+ var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
1756
+ if (onValue) {
1757
+ finalValue = onValue(finalValue);
1758
+ }
1759
+ return finalValue !== undefined ? finalValue.toString() : undefined;
1760
+ }, [onValue]);
1761
+ var handleValidate = useCallback(function (value) {
1762
+ if (onValidate) {
1763
+ var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
1764
+ return onValidate(finalValue);
1765
+ }
1766
+ else {
1767
+ return true;
1768
+ }
1769
+ }, [onValidate]);
2015
1770
  /********************************************************************************************************************
2016
1771
  * Render
2017
1772
  * ******************************************************************************************************************/
2018
- return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormPassword'), onChange: handleChange, type: type, InputProps: muiInputProps }, props)));
1773
+ return (React.createElement(FormTextField, __assign({ ref: ref, className: classNames(className, 'FormNumber'), disableReturnKey: true, labelShrink: strValue === '' || strValue === undefined ? labelShrink : true, InputProps: muiInputProps, readOnly: readOnly, value: strValue, onChange: handleChange, onValue: handleValue, onValidate: handleValidate }, props)));
2019
1774
  });
2020
- FormPassword.displayName = 'FormPassword';
2021
- FormPassword.defaultProps = FormPasswordDefaultProps;
2022
- var templateObject_1$b;var FormTelDefaultProps = __assign(__assign({}, FormTextDefaultProps), { validPattern: /(^([0-9]{2,3})([0-9]{3,4})([0-9]{4})$)|(^([0-9]{2,3})-([0-9]{3,4})-([0-9]{4})$)|(^([0-9]{4})-([0-9]{4})$)|(^\+(?:[-]?[0-9]){8,}$)/ });var FormTel = React.forwardRef(function (_a, ref) {
1775
+ FormNumber.displayName = 'FormNumber';
1776
+ FormNumber.defaultProps = FormNumberDefaultProps;var FormSearchDefaultProps = __assign({}, FormTextDefaultProps);var css_248z$h = ".FormSearch input[type=search]::-webkit-search-decoration,\n.FormSearch input[type=search]::-webkit-search-cancel-button,\n.FormSearch input[type=search]::-webkit-search-results-button,\n.FormSearch input[type=search]::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}";
1777
+ styleInject(css_248z$h);var FormSearch = React.forwardRef(function (_a, ref) {
1778
+ var className = _a.className, props = __rest(_a, ["className"]);
1779
+ return React.createElement(FormText, __assign({ className: classNames(className, 'FormSearch'), ref: ref, type: 'search' }, props));
1780
+ });
1781
+ FormSearch.displayName = 'FormSearch';
1782
+ FormSearch.defaultProps = FormSearchDefaultProps;var FormTextareaDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { clear: false, rows: 3, value: '' });var css_248z$g = ".FormTextarea .MuiInputBase-root .MuiInputBase-input {\n overflow-y: scroll;\n}\n.FormTextarea .MuiInputBase-root .MuiInputBase-input::-webkit-scrollbar {\n width: 8px;\n}\n.FormTextarea .MuiInputBase-root .MuiInputBase-input::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.1882352941);\n background-clip: padding-box;\n border-left: 4px transparent solid;\n}";
1783
+ styleInject(css_248z$g);var FormTextarea = React.forwardRef(function (_a, ref) {
1784
+ var className = _a.className, props = __rest(_a, ["className"]);
1785
+ return (React.createElement(FormTextField, __assign({ ref: ref, className: classNames(className, 'FormTextarea') }, props, { multiline: true })));
1786
+ });
1787
+ FormTextarea.displayName = 'FormTextarea';
1788
+ FormTextarea.defaultProps = FormTextareaDefaultProps;var FormUrlDefaultProps = __assign(__assign({}, FormTextDefaultProps), { validPattern: /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'%()*+,;=.]+$/gim });var FormUrl = React.forwardRef(function (_a, ref) {
2023
1789
  /********************************************************************************************************************
2024
1790
  * Event Handler
2025
1791
  * ******************************************************************************************************************/
2026
1792
  var className = _a.className, onValue = _a.onValue, props = __rest(_a, ["className", "onValue"]);
2027
1793
  var handleValue = useCallback(function (value) {
2028
- var newValue = autoDash$2(value.replace(/[^0-9]/gi, ''));
1794
+ var newValue = value.replace(/ /gi, '');
2029
1795
  return onValue ? onValue(newValue) : newValue;
2030
1796
  }, [onValue]);
2031
1797
  /********************************************************************************************************************
2032
1798
  * Render
2033
1799
  * ******************************************************************************************************************/
2034
- return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormTel'), onValue: handleValue, maxLength: 13 }, props)));
1800
+ return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormUrl'), type: 'url', onValue: handleValue }, props)));
2035
1801
  });
2036
- FormTel.displayName = 'FormTel';
2037
- FormTel.defaultProps = FormTelDefaultProps;
2038
- function autoDash$2(tel) {
2039
- var str = tel.replace(/[^0-9*]/g, '');
2040
- var isLastDash = tel.substring(tel.length - 1, tel.length) === '-';
2041
- if (str.substring(0, 1) !== '0' && !['15', '16', '18'].includes(str.substring(0, 2))) {
2042
- return tel;
1802
+ FormUrl.displayName = 'FormUrl';
1803
+ FormUrl.defaultProps = FormUrlDefaultProps;function getDateValidationErrorText(error) {
1804
+ switch (error) {
1805
+ case 'invalidDate':
1806
+ return '형식이 일치하지 않습니다.';
1807
+ case 'shouldDisableDate':
1808
+ case 'shouldDisableMonth':
1809
+ case 'shouldDisableYear':
1810
+ case 'disableFuture':
1811
+ case 'disablePast':
1812
+ case 'minDate':
1813
+ case 'maxDate':
1814
+ return '선택할 수 없는 날짜입니다.';
1815
+ }
1816
+ }
1817
+ //--------------------------------------------------------------------------------------------------------------------
1818
+ var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD';
1819
+ var DEFAULT_DATE_FORM_VALUE_FORMAT = 'YYYY-MM-DD';
1820
+ var DEFAULT_DATE_TIME_HOUR_FORMAT = 'YYYY-MM-DD HH시';
1821
+ var DEFAULT_DATE_TIME_HOUR_FORM_VALUE_FORMAT = 'YYYY-MM-DD HH:00:00';
1822
+ var DEFAULT_DATE_TIME_MINUTE_FORMAT = 'YYYY-MM-DD HH:mm';
1823
+ var DEFAULT_DATE_TIME_MINUTE_FORM_VALUE_FORMAT = 'YYYY-MM-DD HH:mm:00';
1824
+ var DEFAULT_DATE_TIME_SECOND_FORMAT = 'YYYY-MM-DD HH:mm:ss';
1825
+ var DEFAULT_DATE_TIME_SECOND_FORM_VALUE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
1826
+ var DEFAULT_TIME_HOUR_FORMAT = 'HH시';
1827
+ var DEFAULT_TIME_HOUR_FORM_VALUE_FORMAT = 'HH:00:00';
1828
+ var DEFAULT_TIME_MINUTE_FORMAT = 'HH:mm';
1829
+ var DEFAULT_TIME_MINUTE_FORM_VALUE_FORMAT = 'HH:mm:00';
1830
+ var DEFAULT_TIME_SECOND_FORMAT = 'HH:mm:ss';
1831
+ var DEFAULT_TIME_SECOND_FORM_VALUE_FORMAT = 'HH:mm:ss';
1832
+ function getDateTimeFormat(type, time) {
1833
+ switch (type) {
1834
+ case 'date':
1835
+ return DEFAULT_DATE_FORMAT;
1836
+ case 'date_time':
1837
+ if (time) {
1838
+ switch (time) {
1839
+ case 'hour':
1840
+ return DEFAULT_DATE_TIME_HOUR_FORMAT;
1841
+ case 'minute':
1842
+ return DEFAULT_DATE_TIME_MINUTE_FORMAT;
1843
+ case 'second':
1844
+ return DEFAULT_DATE_TIME_SECOND_FORMAT;
1845
+ }
1846
+ }
1847
+ else {
1848
+ throw new Error("util::date_time::getDateTimeFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
1849
+ }
1850
+ break;
1851
+ case 'time':
1852
+ if (time) {
1853
+ switch (time) {
1854
+ case 'hour':
1855
+ return DEFAULT_TIME_HOUR_FORMAT;
1856
+ case 'minute':
1857
+ return DEFAULT_TIME_MINUTE_FORMAT;
1858
+ case 'second':
1859
+ return DEFAULT_TIME_SECOND_FORMAT;
1860
+ }
1861
+ }
1862
+ else {
1863
+ throw new Error("util::date_time::getDateTimeFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
1864
+ }
1865
+ break;
2043
1866
  }
2044
- var tmp = '';
2045
- var preLen;
2046
- switch (str.substring(0, 2)) {
2047
- case '02':
2048
- preLen = 2;
1867
+ }
1868
+ function getDateTimeFormValueFormat(type, time) {
1869
+ switch (type) {
1870
+ case 'date':
1871
+ return DEFAULT_DATE_FORM_VALUE_FORMAT;
1872
+ case 'date_time':
1873
+ if (time) {
1874
+ switch (time) {
1875
+ case 'hour':
1876
+ return DEFAULT_DATE_TIME_HOUR_FORM_VALUE_FORMAT;
1877
+ case 'minute':
1878
+ return DEFAULT_DATE_TIME_MINUTE_FORM_VALUE_FORMAT;
1879
+ case 'second':
1880
+ return DEFAULT_DATE_TIME_SECOND_FORM_VALUE_FORMAT;
1881
+ }
1882
+ }
1883
+ else {
1884
+ throw new Error("util::date_time::getDateTimeFormValueFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
1885
+ }
1886
+ break;
1887
+ case 'time':
1888
+ if (time) {
1889
+ switch (time) {
1890
+ case 'hour':
1891
+ return DEFAULT_TIME_HOUR_FORM_VALUE_FORMAT;
1892
+ case 'minute':
1893
+ return DEFAULT_TIME_MINUTE_FORM_VALUE_FORMAT;
1894
+ case 'second':
1895
+ return DEFAULT_TIME_SECOND_FORM_VALUE_FORMAT;
1896
+ }
1897
+ }
1898
+ else {
1899
+ throw new Error("util::date_time::getDateTimeFormValueFormat - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
1900
+ }
2049
1901
  break;
2050
- case '15':
2051
- case '16':
2052
- case '18':
2053
- preLen = 4;
1902
+ }
1903
+ }
1904
+ function getAvailableDateValFormat(type, time) {
1905
+ var availableDateType;
1906
+ if (time) {
1907
+ availableDateType = getAvailableDateType(type, time);
1908
+ }
1909
+ else if (['date', 'date_time', 'time'].includes(type)) {
1910
+ availableDateType = getAvailableDateType(type, time);
1911
+ }
1912
+ else {
1913
+ availableDateType = type;
1914
+ }
1915
+ switch (availableDateType) {
1916
+ case 'year':
1917
+ return 'YYYY';
1918
+ case 'month':
1919
+ return 'YYYYMM';
1920
+ case 'day':
1921
+ return 'YYYYMMDD';
1922
+ case 'hour':
1923
+ return 'YYYYMMDDHH';
1924
+ case 'minute':
1925
+ return 'YYYYMMDDHHmm';
1926
+ case 'second':
1927
+ return 'YYYYMMDDHHmmss';
1928
+ }
1929
+ }
1930
+ /********************************************************************************************************************
1931
+ * getAvailableDateType
1932
+ * ******************************************************************************************************************/
1933
+ function getAvailableDateType(type, time) {
1934
+ switch (type) {
1935
+ case 'date':
1936
+ return 'day';
1937
+ case 'date_time':
1938
+ if (time) {
1939
+ switch (time) {
1940
+ case 'hour':
1941
+ return 'hour';
1942
+ case 'minute':
1943
+ return 'minute';
1944
+ case 'second':
1945
+ return 'second';
1946
+ }
1947
+ }
1948
+ else {
1949
+ throw new Error("util::date_time::getAvailableDateType - type \uC774 '".concat(type, "' \uC77C \uACBD\uC6B0 time \uAC12\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4."));
1950
+ }
2054
1951
  break;
2055
- default:
2056
- preLen = 3;
1952
+ case 'time':
1953
+ throw new Error("util::date_time::getAvailableDateType - '".concat(type, "' type \uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."));
1954
+ }
1955
+ }
1956
+ /********************************************************************************************************************
1957
+ * makeAvailableDate
1958
+ * ******************************************************************************************************************/
1959
+ function makeAvailableDate(minDate, maxDate, disablePast, disableFuture) {
1960
+ var now = dayjs();
1961
+ var min = null;
1962
+ var max = null;
1963
+ if (disablePast) {
1964
+ min = now;
2057
1965
  }
2058
- if (['15', '16', '18'].includes(str.substring(0, 2))) {
2059
- if (str.length <= preLen) {
2060
- tmp = str;
1966
+ if (minDate) {
1967
+ if (min) {
1968
+ if (minDate.isAfter(min, 'date')) {
1969
+ min = minDate;
1970
+ }
2061
1971
  }
2062
- else if (str.length <= preLen + 4) {
2063
- tmp += str.substring(0, preLen);
2064
- tmp += '-';
2065
- tmp += str.substring(preLen);
1972
+ else {
1973
+ min = minDate;
1974
+ }
1975
+ }
1976
+ if (disableFuture) {
1977
+ max = now;
1978
+ }
1979
+ if (maxDate) {
1980
+ if (max) {
1981
+ if (maxDate.isBefore(max, 'date')) {
1982
+ max = maxDate;
1983
+ }
2066
1984
  }
2067
1985
  else {
2068
- tmp = str;
1986
+ max = maxDate;
1987
+ }
1988
+ }
1989
+ var minItem = min
1990
+ ? {
1991
+ date: min,
1992
+ year: Number(min.format(getAvailableDateValFormat('year'))),
1993
+ month: Number(min.format(getAvailableDateValFormat('month'))),
1994
+ day: Number(min.format(getAvailableDateValFormat('day'))),
1995
+ hour: Number(min.format(getAvailableDateValFormat('hour'))),
1996
+ minute: Number(min.format(getAvailableDateValFormat('minute'))),
1997
+ second: Number(min.format(getAvailableDateValFormat('second'))),
1998
+ }
1999
+ : null;
2000
+ var maxItem = max
2001
+ ? {
2002
+ date: max,
2003
+ year: Number(max.format(getAvailableDateValFormat('year'))),
2004
+ month: Number(max.format(getAvailableDateValFormat('month'))),
2005
+ day: Number(max.format(getAvailableDateValFormat('day'))),
2006
+ hour: Number(max.format(getAvailableDateValFormat('hour'))),
2007
+ minute: Number(max.format(getAvailableDateValFormat('minute'))),
2008
+ second: Number(max.format(getAvailableDateValFormat('second'))),
2069
2009
  }
2010
+ : null;
2011
+ return [minItem, maxItem];
2012
+ }
2013
+ function getAvailableDate(availableDate, type, time) {
2014
+ var availableDateType;
2015
+ if (time) {
2016
+ availableDateType = getAvailableDateType(type, time);
2070
2017
  }
2071
- else if (str.length <= preLen) {
2072
- tmp = str;
2018
+ else if (['date', 'date_time', 'time'].includes(type)) {
2019
+ availableDateType = getAvailableDateType(type, time);
2073
2020
  }
2074
- else if (str.length <= preLen + 3) {
2075
- tmp += str.substring(0, preLen);
2076
- tmp += '-';
2077
- tmp += str.substring(preLen);
2021
+ else {
2022
+ availableDateType = type;
2078
2023
  }
2079
- else if (str.length <= preLen + 7) {
2080
- tmp += str.substring(0, preLen);
2081
- tmp += '-';
2082
- tmp += str.substring(preLen, preLen + 3);
2083
- tmp += '-';
2084
- tmp += str.substring(preLen + 3);
2024
+ var availableDateVal = getAvailableDateVal(availableDate, availableDateType);
2025
+ var availableDateValFormat = getAvailableDateValFormat(availableDateType);
2026
+ return [
2027
+ availableDateVal[0] ? dayjs(availableDateVal[0].toString(), availableDateValFormat) : null,
2028
+ availableDateVal[1] ? dayjs(availableDateVal[1].toString(), availableDateValFormat) : null,
2029
+ ];
2030
+ }
2031
+ function getAvailableDateVal(availableDate, type, time) {
2032
+ var availableDateType;
2033
+ if (time) {
2034
+ availableDateType = getAvailableDateType(type, time);
2085
2035
  }
2086
- else if (str.length <= preLen + 8) {
2087
- tmp += str.substring(0, preLen);
2088
- tmp += '-';
2089
- tmp += str.substring(preLen, preLen + 4);
2090
- tmp += '-';
2091
- tmp += str.substring(preLen + 4);
2036
+ else if (['date', 'date_time', 'time'].includes(type)) {
2037
+ availableDateType = getAvailableDateType(type, time);
2092
2038
  }
2093
2039
  else {
2094
- tmp = str;
2040
+ availableDateType = type;
2095
2041
  }
2096
- if (isLastDash) {
2097
- if (str.length === preLen) {
2098
- tmp += '-';
2099
- }
2042
+ return [
2043
+ availableDate[0] ? availableDate[0][availableDateType] : null,
2044
+ availableDate[1] ? availableDate[1][availableDateType] : null,
2045
+ ];
2046
+ }
2047
+ /********************************************************************************************************************
2048
+ * getDateVal
2049
+ * ******************************************************************************************************************/
2050
+ function getDateValForAvailableDate(date, type, time) {
2051
+ var format = getAvailableDateValFormat(type, time);
2052
+ return Number(date.format(format));
2053
+ }
2054
+ function isDateAvailable(date, availableDate, type, time) {
2055
+ var availableDateType;
2056
+ if (time) {
2057
+ availableDateType = getAvailableDateType(type, time);
2100
2058
  }
2101
- return tmp;
2102
- }var FormMobileDefaultProps = __assign(__assign({}, FormTelDefaultProps), { validPattern: /(^(01(?:0|1|[6-9]))([0-9]{3,4})([0-9]{4,4})$)|(^(01(?:0|1|[6-9]))-([0-9]{3,4})-([0-9]{4,4})$)|(^\+(?:[-]?[0-9]){8,}$)/ });var FormMobile = React.forwardRef(function (_a, ref) {
2103
- var className = _a.className, props = __rest(_a, ["className"]);
2104
- return React.createElement(FormTel, __assign({ ref: ref, className: classNames(className, 'FormMobile') }, props));
2105
- });
2106
- FormMobile.displayName = 'FormMobile';
2107
- FormMobile.defaultProps = FormMobileDefaultProps;var NumberFormatCustom = React.forwardRef(function (_a, ref) {
2108
- var onChange = _a.onChange, props = __rest(_a, ["onChange"]);
2109
- return (React.createElement(NumericFormat, __assign({}, props, { getInputRef: ref, onValueChange: function (values) {
2110
- if (onChange)
2111
- onChange({ target: { value: values.value } });
2112
- } })));
2113
- });
2114
- NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { clear: true });var FormNumber = React.forwardRef(function (_a, ref) {
2115
- /********************************************************************************************************************
2116
- * State
2117
- * ******************************************************************************************************************/
2118
- var className = _a.className, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, tabIndex = _a.tabIndex, labelShrink = _a.labelShrink, initMuiInputProps = _a.InputProps, initInputProps = _a.inputProps, initValue = _a.value, onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate, props = __rest(_a, ["className", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "labelShrink", "InputProps", "inputProps", "value", "onChange", "onValue", "onValidate"]);
2119
- var _b = useState(function () { return (empty(initValue) ? '' : "".concat(initValue)); }), strValue = _b[0], setStrValue = _b[1];
2120
- /********************************************************************************************************************
2121
- * Effect
2122
- * ******************************************************************************************************************/
2123
- useEffect(function () {
2124
- setStrValue(empty(initValue) ? '' : "".concat(initValue));
2125
- }, [initValue]);
2126
- /********************************************************************************************************************
2127
- * Memo
2128
- * ******************************************************************************************************************/
2129
- var muiInputProps = useMemo(function () {
2130
- var inputProps = {
2131
- className: readOnly ? 'Mui-disabled' : undefined,
2132
- allowNegative: !!allowNegative,
2133
- thousandSeparator: thousandSeparator,
2134
- prefix: prefix,
2135
- suffix: suffix,
2136
- readOnly: !!readOnly,
2137
- tabIndex: readOnly ? -1 : tabIndex,
2138
- };
2139
- if (allowDecimal) {
2140
- if (decimalScale) {
2141
- inputProps.decimalScale = decimalScale;
2142
- }
2143
- }
2144
- else {
2145
- inputProps.decimalScale = 0;
2146
- }
2147
- return __assign(__assign({}, initMuiInputProps), { inputComponent: NumberFormatCustom, inputProps: __assign(__assign({}, initInputProps), inputProps) });
2148
- }, [
2149
- readOnly,
2150
- allowNegative,
2151
- thousandSeparator,
2152
- prefix,
2153
- suffix,
2154
- tabIndex,
2155
- allowDecimal,
2156
- initMuiInputProps,
2157
- initInputProps,
2158
- decimalScale,
2159
- ]);
2160
- /********************************************************************************************************************
2161
- * Event Handler
2162
- * ******************************************************************************************************************/
2163
- var handleChange = useCallback(function (value) {
2164
- var newValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
2165
- onChange && onChange(newValue);
2166
- setStrValue(value);
2167
- }, [onChange]);
2168
- var handleValue = useCallback(function (value) {
2169
- var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
2170
- if (onValue) {
2171
- finalValue = onValue(finalValue);
2172
- }
2173
- return finalValue !== undefined ? finalValue.toString() : undefined;
2174
- }, [onValue]);
2175
- var handleValidate = useCallback(function (value) {
2176
- if (onValidate) {
2177
- var finalValue = empty(value) || value === '-' || value === '.' ? undefined : Number(value);
2178
- return onValidate(finalValue);
2179
- }
2180
- else {
2181
- return true;
2182
- }
2183
- }, [onValidate]);
2184
- /********************************************************************************************************************
2185
- * Render
2186
- * ******************************************************************************************************************/
2187
- return (React.createElement(FormTextField, __assign({ ref: ref, className: classNames(className, 'FormNumber'), disableReturnKey: true, labelShrink: strValue === '' || strValue === undefined ? labelShrink : true, InputProps: muiInputProps, readOnly: readOnly, value: strValue, onChange: handleChange, onValue: handleValue, onValidate: handleValidate }, props)));
2188
- });
2189
- FormNumber.displayName = 'FormNumber';
2190
- FormNumber.defaultProps = FormNumberDefaultProps;var FormSearchDefaultProps = __assign({}, FormTextDefaultProps);var css_248z$h = ".FormSearch input[type=search]::-webkit-search-decoration,\n.FormSearch input[type=search]::-webkit-search-cancel-button,\n.FormSearch input[type=search]::-webkit-search-results-button,\n.FormSearch input[type=search]::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}";
2191
- styleInject(css_248z$h);var FormSearch = React.forwardRef(function (_a, ref) {
2192
- var className = _a.className, props = __rest(_a, ["className"]);
2193
- return React.createElement(FormText, __assign({ className: classNames(className, 'FormSearch'), ref: ref, type: 'search' }, props));
2194
- });
2195
- FormSearch.displayName = 'FormSearch';
2196
- FormSearch.defaultProps = FormSearchDefaultProps;var FormTextareaDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { clear: false, rows: 3, value: '' });var css_248z$g = ".FormTextarea .MuiInputBase-root .MuiInputBase-input {\n overflow-y: scroll;\n}\n.FormTextarea .MuiInputBase-root .MuiInputBase-input::-webkit-scrollbar {\n width: 8px;\n}\n.FormTextarea .MuiInputBase-root .MuiInputBase-input::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.1882352941);\n background-clip: padding-box;\n border-left: 4px transparent solid;\n}";
2197
- styleInject(css_248z$g);var FormTextarea = React.forwardRef(function (_a, ref) {
2198
- var className = _a.className, props = __rest(_a, ["className"]);
2199
- return (React.createElement(FormTextField, __assign({ ref: ref, className: classNames(className, 'FormTextarea') }, props, { multiline: true })));
2200
- });
2201
- FormTextarea.displayName = 'FormTextarea';
2202
- FormTextarea.defaultProps = FormTextareaDefaultProps;var FormUrlDefaultProps = __assign(__assign({}, FormTextDefaultProps), { validPattern: /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'%()*+,;=.]+$/gim });var FormUrl = React.forwardRef(function (_a, ref) {
2203
- /********************************************************************************************************************
2204
- * Event Handler
2205
- * ******************************************************************************************************************/
2206
- var className = _a.className, onValue = _a.onValue, props = __rest(_a, ["className", "onValue"]);
2207
- var handleValue = useCallback(function (value) {
2208
- var newValue = value.replace(/ /gi, '');
2209
- return onValue ? onValue(newValue) : newValue;
2210
- }, [onValue]);
2211
- /********************************************************************************************************************
2212
- * Render
2213
- * ******************************************************************************************************************/
2214
- return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormUrl'), type: 'url', onValue: handleValue }, props)));
2215
- });
2216
- FormUrl.displayName = 'FormUrl';
2217
- FormUrl.defaultProps = FormUrlDefaultProps;var FormSelectDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { formValueSeparator: ',', minWidth: 120 });var css_248z$f = ".FormSelect.is-selected-placeholder .MuiSelect-select {\n opacity: 0.38;\n}\n.FormSelect .MuiInputBase-root.MuiInputBase-adornedEnd {\n padding-right: 25px;\n}\n.FormSelect .MuiSelect-select.MuiSelect-multiple .selected-list:not(:empty) {\n margin-top: -3px;\n margin-bottom: -3px;\n}\n.FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar {\n width: 12px;\n}\n.FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.1882352941);\n background-clip: padding-box;\n border-left: 4px transparent solid;\n border-right: 4px transparent solid;\n}\n.FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar-button:start:decrement, .FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar-button:end:increment {\n display: block;\n height: 4px;\n background-color: transparent;\n}";
2059
+ else if (['date', 'date_time', 'time'].includes(type)) {
2060
+ availableDateType = getAvailableDateType(type, time);
2061
+ }
2062
+ else {
2063
+ availableDateType = type;
2064
+ }
2065
+ var dateVal = Number(date.format(getAvailableDateValFormat(availableDateType)));
2066
+ var availableDateVal = getAvailableDateVal(availableDate, availableDateType);
2067
+ return !((availableDateVal[0] && dateVal < availableDateVal[0]) ||
2068
+ (availableDateVal[1] && dateVal > availableDateVal[1]));
2069
+ }
2070
+ function checkDateAvailable(date, availableDate, type, time) {
2071
+ var availableDateType;
2072
+ if (time) {
2073
+ availableDateType = getAvailableDateType(type, time);
2074
+ }
2075
+ else if (['date', 'date_time', 'time'].includes(type)) {
2076
+ availableDateType = getAvailableDateType(type, time);
2077
+ }
2078
+ else {
2079
+ availableDateType = type;
2080
+ }
2081
+ var dateVal = Number(date.format(getAvailableDateValFormat(availableDateType)));
2082
+ var availableDateVal = getAvailableDateVal(availableDate, availableDateType);
2083
+ if (availableDateVal[0] && dateVal < availableDateVal[0])
2084
+ return 'min';
2085
+ if (availableDateVal[1] && dateVal > availableDateVal[1])
2086
+ return 'max';
2087
+ return 'available';
2088
+ }function getFileSizeText(bytes, dp) {
2089
+ if (dp === void 0) { dp = 1; }
2090
+ var thresh = 1024;
2091
+ if (Math.abs(bytes) < thresh) {
2092
+ return "".concat(bytes, " Byte");
2093
+ }
2094
+ var units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
2095
+ var u = -1;
2096
+ var r = Math.pow(10, dp);
2097
+ do {
2098
+ bytes /= thresh;
2099
+ u += 1;
2100
+ } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
2101
+ return "".concat(bytes.toFixed(dp), " ").concat(units[u]);
2102
+ }function ToForwardRefExoticComponent(component, ext) {
2103
+ var fComponent = component;
2104
+ fComponent.displayName = ext === null || ext === void 0 ? void 0 : ext.displayName;
2105
+ fComponent.defaultProps = ext === null || ext === void 0 ? void 0 : ext.defaultProps;
2106
+ return component;
2107
+ }
2108
+ function AutoTypeForwardRef(render) {
2109
+ return React.forwardRef(render);
2110
+ }var FormSelectDefaultProps = __assign(__assign({}, FormTextFieldDefaultProps), { formValueSeparator: ',', minWidth: 120 });var css_248z$f = ".FormSelect.is-selected-placeholder .MuiSelect-select {\n opacity: 0.38;\n}\n.FormSelect .MuiInputBase-root.MuiInputBase-adornedEnd {\n padding-right: 25px;\n}\n.FormSelect .MuiSelect-select.MuiSelect-multiple .selected-list:not(:empty) {\n margin-top: -3px;\n margin-bottom: -3px;\n}\n.FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar {\n width: 12px;\n}\n.FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.1882352941);\n background-clip: padding-box;\n border-left: 4px transparent solid;\n border-right: 4px transparent solid;\n}\n.FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar-button:start:decrement, .FormSelect-Menu-Popover > .MuiPaper-root::-webkit-scrollbar-button:end:increment {\n display: block;\n height: 4px;\n background-color: transparent;\n}";
2218
2111
  styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeForwardRef(function (_a, ref) {
2219
2112
  /********************************************************************************************************************
2220
2113
  * type
@@ -2364,7 +2257,7 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
2364
2257
  * Effect
2365
2258
  * ******************************************************************************************************************/
2366
2259
  useEffect(function () {
2367
- if (!isSame(value, initValue)) {
2260
+ if (!equal(value, initValue)) {
2368
2261
  if (onChange)
2369
2262
  onChange(value);
2370
2263
  onValueChange(name, value);
@@ -2498,7 +2391,7 @@ FormSelect.defaultProps = FormSelectDefaultProps;var FormCompanyNoDefaultProps =
2498
2391
  * ******************************************************************************************************************/
2499
2392
  var className = _a.className, onValue = _a.onValue, props = __rest(_a, ["className", "onValue"]);
2500
2393
  var handleValue = useCallback(function (value) {
2501
- var newValue = autoDash$1(value.replace(/[^0-9]/gi, ''));
2394
+ var newValue = companyNoAutoDash(value.replace(/[^0-9]/gi, ''));
2502
2395
  return onValue ? onValue(newValue) : newValue;
2503
2396
  }, [onValue]);
2504
2397
  /********************************************************************************************************************
@@ -2507,24 +2400,13 @@ FormSelect.defaultProps = FormSelectDefaultProps;var FormCompanyNoDefaultProps =
2507
2400
  return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormCompanyNo'), maxLength: 12, onValue: handleValue }, props)));
2508
2401
  });
2509
2402
  FormCompanyNo.displayName = 'FormCompanyNo';
2510
- FormCompanyNo.defaultProps = FormCompanyNoDefaultProps;
2511
- function autoDash$1(companyNo) {
2512
- var str = companyNo.replace(/[^0-9]/g, '');
2513
- var tmp = '';
2514
- for (var i = 0; i < str.length; i += 1) {
2515
- if (i === 3 || i === 5) {
2516
- tmp += '-';
2517
- }
2518
- tmp += str[i];
2519
- }
2520
- return tmp;
2521
- }var FormPersonalNoDefaultProps = __assign(__assign({}, FormTextDefaultProps), { validPattern: /(([0-9]{6})([0-9]{7}))|(([0-9]{6})-([0-9]{7}))/ });var FormPersonalNo = React.forwardRef(function (_a, ref) {
2403
+ FormCompanyNo.defaultProps = FormCompanyNoDefaultProps;var FormPersonalNoDefaultProps = __assign(__assign({}, FormTextDefaultProps), { validPattern: /(([0-9]{6})([0-9]{7}))|(([0-9]{6})-([0-9]{7}))/ });var FormPersonalNo = React.forwardRef(function (_a, ref) {
2522
2404
  /********************************************************************************************************************
2523
2405
  * Event Handler
2524
2406
  * ******************************************************************************************************************/
2525
2407
  var className = _a.className, skipPersonalNumberValidateCheck = _a.skipPersonalNumberValidateCheck, onValue = _a.onValue, onValidate = _a.onValidate, props = __rest(_a, ["className", "skipPersonalNumberValidateCheck", "onValue", "onValidate"]);
2526
2408
  var handleValue = useCallback(function (value) {
2527
- var newValue = autoDash(value.replace(/[^0-9]/gi, ''));
2409
+ var newValue = personalNoAutoDash(value.replace(/[^0-9]/gi, ''));
2528
2410
  return onValue ? onValue(newValue) : newValue;
2529
2411
  }, [onValue]);
2530
2412
  var handleValidate = useCallback(function (value) {
@@ -2567,18 +2449,7 @@ function autoDash$1(companyNo) {
2567
2449
  return (React.createElement(FormText, __assign({ ref: ref, className: classNames(className, 'FormPersonalNo'), maxLength: 14, onValue: handleValue, onValidate: handleValidate }, props)));
2568
2450
  });
2569
2451
  FormPersonalNo.displayName = 'FormPersonalNo';
2570
- FormPersonalNo.defaultProps = FormPersonalNoDefaultProps;
2571
- function autoDash(personalNo) {
2572
- var str = personalNo.replace(/[^0-9]/g, '');
2573
- var tmp = '';
2574
- for (var i = 0; i < str.length; i += 1) {
2575
- if (i === 6) {
2576
- tmp += '-';
2577
- }
2578
- tmp += str[i];
2579
- }
2580
- return tmp;
2581
- }var FormCheckboxDefaultProps = {
2452
+ FormPersonalNo.defaultProps = FormPersonalNoDefaultProps;var FormCheckboxDefaultProps = {
2582
2453
  checked: false,
2583
2454
  value: 1,
2584
2455
  uncheckedValue: 0,
@@ -3695,7 +3566,7 @@ styleInject(css_248z$d);var FormToggleButtonGroup = ToForwardRefExoticComponent(
3695
3566
  }
3696
3567
  }
3697
3568
  finalValue_1 = getFinalValue(finalValue_1);
3698
- if (!isSame(value, finalValue_1)) {
3569
+ if (!equal(value, finalValue_1)) {
3699
3570
  setValue(finalValue_1);
3700
3571
  nextTick(function () {
3701
3572
  onValueChangeByUser(name, finalValue_1);
@@ -4412,9 +4283,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
4412
4283
  }
4413
4284
  }
4414
4285
  }
4415
- if (oldComponentValueRef.current &&
4416
- newComponentValue &&
4417
- isSame(oldComponentValueRef.current, newComponentValue)) {
4286
+ if (oldComponentValueRef.current && newComponentValue && equal(oldComponentValueRef.current, newComponentValue)) {
4418
4287
  return oldComponentValueRef.current;
4419
4288
  }
4420
4289
  else {
@@ -4693,7 +4562,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
4693
4562
  }
4694
4563
  }
4695
4564
  var finalValue = getFinalValue(newValue);
4696
- if (!isSame(value, finalValue)) {
4565
+ if (!equal(value, finalValue)) {
4697
4566
  setValue(finalValue);
4698
4567
  setValueItem(componentValue);
4699
4568
  nextTick(function () {
@@ -5327,7 +5196,7 @@ styleInject(css_248z$7);var PrivateDatePicker = React.forwardRef(function (_a, r
5327
5196
  * ******************************************************************************************************************/
5328
5197
  var label = useMemo(function () {
5329
5198
  if (labelIcon) {
5330
- return React.createElement(IconText, { icon: labelIcon }, initLabel);
5199
+ return React.createElement(PdgIconText, { icon: labelIcon }, initLabel);
5331
5200
  }
5332
5201
  else {
5333
5202
  return initLabel;
@@ -6095,7 +5964,7 @@ PrivateStaticDateTimePicker.defaultProps = PrivateStaticDateTimePickerDefaultPro
6095
5964
  * ******************************************************************************************************************/
6096
5965
  var label = useMemo(function () {
6097
5966
  if (labelIcon) {
6098
- return React.createElement(IconText, { icon: labelIcon }, initLabel);
5967
+ return React.createElement(PdgIconText, { icon: labelIcon }, initLabel);
6099
5968
  }
6100
5969
  else {
6101
5970
  return initLabel;