@pdg/react-form 1.0.101 → 1.0.102
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 +193 -145
- package/dist/index.js +193 -145
- package/package.json +1 -1
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,Button,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,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,nextTick,notEmpty,equal,telNoAutoDash,ifUndefined,companyNoAutoDash,personalNoAutoDash}from'@pdg/util';import dayjs from'dayjs';import {PdgIcon,PdgIconText}from'@pdg/react-component';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
|
|
1
|
+
import React,{createContext,useContext,useMemo,useRef,useState,useCallback,useLayoutEffect,useEffect,useId}from'react';import classNames from'classnames';import {Box,Button,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,Tooltip,tooltipClasses,ClickAwayListener,Dialog,DialogTitle,DialogContent,DialogActions,Switch,Paper,Menu}from'@mui/material';import {empty,nextTick,notEmpty,equal,telNoAutoDash,ifUndefined,companyNoAutoDash,personalNoAutoDash}from'@pdg/util';import dayjs from'dayjs';import {PdgIcon,PdgIconText}from'@pdg/react-component';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 {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';/******************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1065,9 +1065,37 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1065
1065
|
var _d = useAutoUpdateState(initError), error = _d[0], setError = _d[1];
|
|
1066
1066
|
var _e = useState(), errorHelperText = _e[0], setErrorHelperText = _e[1];
|
|
1067
1067
|
var _f = useState(false), showClear = _f[0], setShowClear = _f[1];
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
/********************************************************************************************************************
|
|
1069
|
+
* disabled
|
|
1070
|
+
* ******************************************************************************************************************/
|
|
1071
|
+
var disabledRef = useRef(initDisabled == null ? formDisabled : initDisabled);
|
|
1072
|
+
var _g = useState(initDisabled == null ? formDisabled : initDisabled), disabled = _g[0], setDisabled = _g[1];
|
|
1073
|
+
var changeDisabled = useCallback(function (newDisabled) {
|
|
1074
|
+
disabledRef.current = newDisabled;
|
|
1075
|
+
setDisabled(newDisabled);
|
|
1076
|
+
}, []);
|
|
1077
|
+
useFirstSkipEffect(function () {
|
|
1078
|
+
changeDisabled(initDisabled == null ? formDisabled : initDisabled);
|
|
1079
|
+
}, [initDisabled, formDisabled]);
|
|
1080
|
+
/********************************************************************************************************************
|
|
1081
|
+
* hidden
|
|
1082
|
+
* ******************************************************************************************************************/
|
|
1083
|
+
var hiddenRef = useRef(initHidden);
|
|
1084
|
+
var _h = useState(initHidden), hidden = _h[0], setHidden = _h[1];
|
|
1085
|
+
var changeHidden = useCallback(function (newHidden) {
|
|
1086
|
+
hiddenRef.current = newHidden;
|
|
1087
|
+
setHidden(newHidden);
|
|
1088
|
+
}, []);
|
|
1089
|
+
useFirstSkipEffect(function () {
|
|
1090
|
+
changeHidden(initHidden);
|
|
1091
|
+
}, [initHidden]);
|
|
1092
|
+
/********************************************************************************************************************
|
|
1093
|
+
* data
|
|
1094
|
+
* ******************************************************************************************************************/
|
|
1095
|
+
var dataRef = useRef(initData);
|
|
1096
|
+
useFirstSkipEffect(function () {
|
|
1097
|
+
dataRef.current = initData;
|
|
1098
|
+
}, [initData]);
|
|
1071
1099
|
/********************************************************************************************************************
|
|
1072
1100
|
* Memo - muiInputLabelProps
|
|
1073
1101
|
* ******************************************************************************************************************/
|
|
@@ -1122,8 +1150,8 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1122
1150
|
/********************************************************************************************************************
|
|
1123
1151
|
* Function - getFinalValue
|
|
1124
1152
|
* ******************************************************************************************************************/
|
|
1125
|
-
var getFinalValue = useCallback(function (
|
|
1126
|
-
return onValue ? onValue(
|
|
1153
|
+
var getFinalValue = useCallback(function (newValue) {
|
|
1154
|
+
return onValue ? onValue(newValue) : newValue;
|
|
1127
1155
|
}, [onValue]);
|
|
1128
1156
|
/********************************************************************************************************************
|
|
1129
1157
|
* Function - setErrorErrorHelperText
|
|
@@ -1165,9 +1193,11 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1165
1193
|
/********************************************************************************************************************
|
|
1166
1194
|
* State - value
|
|
1167
1195
|
* ******************************************************************************************************************/
|
|
1168
|
-
var
|
|
1196
|
+
var valueRef = useRef(getFinalValue(initValue));
|
|
1197
|
+
var _j = useState(function () { return getFinalValue(initValue); }), value = _j[0], setValue = _j[1];
|
|
1169
1198
|
var changeValue = useCallback(function (newValue) {
|
|
1170
|
-
if (!equal(
|
|
1199
|
+
if (!equal(valueRef.current, newValue)) {
|
|
1200
|
+
valueRef.current = newValue;
|
|
1171
1201
|
setValue(newValue);
|
|
1172
1202
|
nextTick(function () {
|
|
1173
1203
|
if (error)
|
|
@@ -1179,7 +1209,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1179
1209
|
}
|
|
1180
1210
|
});
|
|
1181
1211
|
}
|
|
1182
|
-
}, [error, name, noFormValueItem, onChange, onValueChange, validate
|
|
1212
|
+
}, [error, name, noFormValueItem, onChange, onValueChange, validate]);
|
|
1183
1213
|
useFirstSkipEffect(function () {
|
|
1184
1214
|
changeValue(getFinalValue(initValue));
|
|
1185
1215
|
}, [initValue]);
|
|
@@ -1252,42 +1282,33 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1252
1282
|
* ******************************************************************************************************************/
|
|
1253
1283
|
useLayoutEffect(function () {
|
|
1254
1284
|
if (ref || (!noFormValueItem && onAddValueItem)) {
|
|
1255
|
-
var lastValue_1 = value;
|
|
1256
|
-
var lastData_1 = data;
|
|
1257
|
-
var lastDisabled_1 = !!disabled;
|
|
1258
|
-
var lastHidden_1 = !!hidden;
|
|
1259
1285
|
var commands = {
|
|
1260
1286
|
getType: function () { return 'default'; },
|
|
1261
1287
|
getName: function () { return name; },
|
|
1262
1288
|
getReset: function () { return getFinalValue(initValue); },
|
|
1263
1289
|
reset: function () {
|
|
1264
|
-
|
|
1265
|
-
changeValue(lastValue_1);
|
|
1290
|
+
changeValue(getFinalValue(initValue));
|
|
1266
1291
|
},
|
|
1267
|
-
getValue: function () { return
|
|
1292
|
+
getValue: function () { return valueRef.current; },
|
|
1268
1293
|
setValue: function (value) {
|
|
1269
|
-
|
|
1270
|
-
changeValue(lastValue_1);
|
|
1294
|
+
changeValue(getFinalValue(value));
|
|
1271
1295
|
},
|
|
1272
|
-
getData: function () { return
|
|
1296
|
+
getData: function () { return dataRef.current; },
|
|
1273
1297
|
setData: function (data) {
|
|
1274
|
-
|
|
1275
|
-
setData(data);
|
|
1298
|
+
dataRef.current = data;
|
|
1276
1299
|
},
|
|
1277
1300
|
isExceptValue: function () { return !!exceptValue; },
|
|
1278
|
-
isDisabled: function () { return
|
|
1301
|
+
isDisabled: function () { return !!disabledRef.current; },
|
|
1279
1302
|
setDisabled: function (disabled) {
|
|
1280
|
-
|
|
1281
|
-
setDisabled(disabled);
|
|
1303
|
+
changeDisabled(disabled);
|
|
1282
1304
|
},
|
|
1283
|
-
isHidden: function () { return
|
|
1305
|
+
isHidden: function () { return !!hiddenRef.current; },
|
|
1284
1306
|
setHidden: function (hidden) {
|
|
1285
|
-
|
|
1286
|
-
setHidden(hidden);
|
|
1307
|
+
changeHidden(hidden);
|
|
1287
1308
|
},
|
|
1288
1309
|
focus: focus,
|
|
1289
1310
|
focusValidate: focus,
|
|
1290
|
-
validate: function () { return validate(
|
|
1311
|
+
validate: function () { return validate(valueRef.current); },
|
|
1291
1312
|
setError: function (error, errorText) {
|
|
1292
1313
|
return setErrorErrorHelperText(error, error ? errorText : undefined);
|
|
1293
1314
|
},
|
|
@@ -1316,26 +1337,21 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1316
1337
|
};
|
|
1317
1338
|
}
|
|
1318
1339
|
}, [
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
data,
|
|
1323
|
-
getFinalValue,
|
|
1340
|
+
changeDisabled,
|
|
1341
|
+
changeHidden,
|
|
1342
|
+
changeValue,
|
|
1324
1343
|
exceptValue,
|
|
1325
|
-
disabled,
|
|
1326
1344
|
focus,
|
|
1327
|
-
|
|
1328
|
-
|
|
1345
|
+
getFinalValue,
|
|
1346
|
+
id,
|
|
1347
|
+
initValue,
|
|
1348
|
+
name,
|
|
1329
1349
|
noFormValueItem,
|
|
1330
1350
|
onAddValueItem,
|
|
1331
1351
|
onRemoveValueItem,
|
|
1332
|
-
|
|
1333
|
-
setDisabled,
|
|
1352
|
+
ref,
|
|
1334
1353
|
setErrorErrorHelperText,
|
|
1335
|
-
|
|
1336
|
-
hidden,
|
|
1337
|
-
setHidden,
|
|
1338
|
-
changeValue,
|
|
1354
|
+
validate,
|
|
1339
1355
|
]);
|
|
1340
1356
|
/********************************************************************************************************************
|
|
1341
1357
|
* Event Handler
|
|
@@ -1354,10 +1370,10 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1354
1370
|
}, [getFinalValue, changeValue, noFormValueItem, onValueChangeByUser, name, select, onRequestSearchSubmit]);
|
|
1355
1371
|
var handleBlur = useCallback(function (e) {
|
|
1356
1372
|
if (error)
|
|
1357
|
-
validate(
|
|
1373
|
+
validate(valueRef.current);
|
|
1358
1374
|
if (onBlur)
|
|
1359
1375
|
onBlur(e);
|
|
1360
|
-
}, [error,
|
|
1376
|
+
}, [error, validate, onBlur]);
|
|
1361
1377
|
var handleKeyDown = useCallback(function (e) {
|
|
1362
1378
|
if (['Enter'].includes(e.key) &&
|
|
1363
1379
|
!select &&
|
|
@@ -1365,11 +1381,11 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1365
1381
|
!noFormValueItem) {
|
|
1366
1382
|
e.preventDefault();
|
|
1367
1383
|
e.stopPropagation();
|
|
1368
|
-
onRequestSearchSubmit(name,
|
|
1384
|
+
onRequestSearchSubmit(name, valueRef.current);
|
|
1369
1385
|
}
|
|
1370
1386
|
if (onKeyDown)
|
|
1371
1387
|
onKeyDown(e);
|
|
1372
|
-
}, [select, multiline, disableReturnKey, noFormValueItem, onKeyDown, onRequestSearchSubmit, name
|
|
1388
|
+
}, [select, multiline, disableReturnKey, noFormValueItem, onKeyDown, onRequestSearchSubmit, name]);
|
|
1373
1389
|
/********************************************************************************************************************
|
|
1374
1390
|
* Render
|
|
1375
1391
|
* ******************************************************************************************************************/
|
|
@@ -2182,8 +2198,8 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2182
2198
|
/********************************************************************************************************************
|
|
2183
2199
|
* Function - getFinalValue
|
|
2184
2200
|
* ******************************************************************************************************************/
|
|
2185
|
-
var getFinalValue = useCallback(function (
|
|
2186
|
-
var finalValue =
|
|
2201
|
+
var getFinalValue = useCallback(function (newValue) {
|
|
2202
|
+
var finalValue = newValue == null ? '' : newValue;
|
|
2187
2203
|
if (multiple) {
|
|
2188
2204
|
if (!Array.isArray(finalValue)) {
|
|
2189
2205
|
if (empty(finalValue)) {
|
|
@@ -2228,17 +2244,19 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2228
2244
|
}
|
|
2229
2245
|
}
|
|
2230
2246
|
finalValue = onValue ? onValue(finalValue) : finalValue;
|
|
2231
|
-
return equal(
|
|
2247
|
+
return equal(newValue, finalValue) ? newValue : finalValue;
|
|
2232
2248
|
}, [multiple, formValueSeparator, itemsValues, onValue]);
|
|
2233
2249
|
/********************************************************************************************************************
|
|
2234
2250
|
* State - value
|
|
2235
2251
|
* ******************************************************************************************************************/
|
|
2252
|
+
var valueRef = useRef(getFinalValue(initValue));
|
|
2236
2253
|
var _h = useState(function () { return getFinalValue(initValue); }), value = _h[0], setValue = _h[1];
|
|
2237
2254
|
/********************************************************************************************************************
|
|
2238
2255
|
* Function
|
|
2239
2256
|
* ******************************************************************************************************************/
|
|
2240
2257
|
var changeValue = useCallback(function (newValue) {
|
|
2241
|
-
if (!equal(
|
|
2258
|
+
if (!equal(valueRef.current, newValue)) {
|
|
2259
|
+
valueRef.current = newValue;
|
|
2242
2260
|
setValue(newValue);
|
|
2243
2261
|
nextTick(function () {
|
|
2244
2262
|
if (onChange)
|
|
@@ -2246,12 +2264,12 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2246
2264
|
onValueChange(name, newValue);
|
|
2247
2265
|
});
|
|
2248
2266
|
}
|
|
2249
|
-
}, [name, onChange, onValueChange
|
|
2267
|
+
}, [name, onChange, onValueChange]);
|
|
2250
2268
|
useFirstSkipEffect(function () {
|
|
2251
2269
|
changeValue(getFinalValue(initValue));
|
|
2252
2270
|
}, [initValue]);
|
|
2253
2271
|
useFirstSkipEffect(function () {
|
|
2254
|
-
changeValue(getFinalValue(
|
|
2272
|
+
changeValue(getFinalValue(valueRef.current));
|
|
2255
2273
|
}, [multiple]);
|
|
2256
2274
|
/********************************************************************************************************************
|
|
2257
2275
|
* State - isSelectedPlaceholder
|
|
@@ -2285,12 +2303,12 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2285
2303
|
}
|
|
2286
2304
|
else {
|
|
2287
2305
|
return (React.createElement(Box, { className: 'selected-list', sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, Array.isArray(selected) &&
|
|
2288
|
-
selected.map(function (
|
|
2306
|
+
selected.map(function (selectedValue) {
|
|
2289
2307
|
if (isSelectedPlaceholder) {
|
|
2290
|
-
return React.createElement(Chip, { key:
|
|
2308
|
+
return React.createElement(Chip, { key: selectedValue || '$$$EmptyValuePlaceholder$$$', label: 'hahaha', size: 'small' });
|
|
2291
2309
|
}
|
|
2292
2310
|
else {
|
|
2293
|
-
return React.createElement(Chip, { key:
|
|
2311
|
+
return React.createElement(Chip, { key: selectedValue, label: itemValueLabels["".concat(selectedValue)], size: 'small' });
|
|
2294
2312
|
}
|
|
2295
2313
|
})));
|
|
2296
2314
|
}
|
|
@@ -2306,20 +2324,17 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2306
2324
|
* Function - getExtraCommands
|
|
2307
2325
|
* ******************************************************************************************************************/
|
|
2308
2326
|
var getBaseCommands = useCallback(function () {
|
|
2309
|
-
var lastValue = value;
|
|
2310
2327
|
return {
|
|
2311
2328
|
getReset: function () { return getFinalValue(initValue); },
|
|
2312
2329
|
reset: function () {
|
|
2313
|
-
|
|
2314
|
-
changeValue(lastValue);
|
|
2330
|
+
changeValue(getFinalValue(initValue));
|
|
2315
2331
|
},
|
|
2316
|
-
getValue: function () { return
|
|
2332
|
+
getValue: function () { return valueRef.current; },
|
|
2317
2333
|
setValue: function (value) {
|
|
2318
|
-
|
|
2319
|
-
changeValue(lastValue);
|
|
2334
|
+
changeValue(getFinalValue(value));
|
|
2320
2335
|
},
|
|
2321
2336
|
};
|
|
2322
|
-
}, [
|
|
2337
|
+
}, [getFinalValue, initValue, changeValue]);
|
|
2323
2338
|
var getExtraCommands = useCallback(function () {
|
|
2324
2339
|
var lastItems = items;
|
|
2325
2340
|
var lastLoading = loading;
|
|
@@ -4191,14 +4206,57 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4191
4206
|
* State
|
|
4192
4207
|
* ******************************************************************************************************************/
|
|
4193
4208
|
var _c = useState(false), isOnGetItemLoading = _c[0], setIsOnGetItemLoading = _c[1];
|
|
4194
|
-
var _d = useAutoUpdateState(
|
|
4195
|
-
var _e =
|
|
4196
|
-
var _f = useState(),
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
var
|
|
4201
|
-
var
|
|
4209
|
+
var _d = useAutoUpdateState(initError), error = _d[0], setError = _d[1];
|
|
4210
|
+
var _e = useState(), errorHelperText = _e[0], setErrorHelperText = _e[1];
|
|
4211
|
+
var _f = useState(undefined), inputValue = _f[0], setInputValue = _f[1];
|
|
4212
|
+
/********************************************************************************************************************
|
|
4213
|
+
* disabled
|
|
4214
|
+
* ******************************************************************************************************************/
|
|
4215
|
+
var disabledRef = useRef(initDisabled == null ? formDisabled : initDisabled);
|
|
4216
|
+
var _g = useState(initDisabled == null ? formDisabled : initDisabled), disabled = _g[0], setDisabled = _g[1];
|
|
4217
|
+
var changeDisabled = useCallback(function (newDisabled) {
|
|
4218
|
+
disabledRef.current = newDisabled;
|
|
4219
|
+
setDisabled(newDisabled);
|
|
4220
|
+
}, []);
|
|
4221
|
+
useFirstSkipEffect(function () {
|
|
4222
|
+
changeDisabled(initDisabled == null ? formDisabled : initDisabled);
|
|
4223
|
+
}, [initDisabled, formDisabled]);
|
|
4224
|
+
/********************************************************************************************************************
|
|
4225
|
+
* hidden
|
|
4226
|
+
* ******************************************************************************************************************/
|
|
4227
|
+
var hiddenRef = useRef(initHidden);
|
|
4228
|
+
var _h = useState(initHidden), hidden = _h[0], setHidden = _h[1];
|
|
4229
|
+
var changeHidden = useCallback(function (newHidden) {
|
|
4230
|
+
hiddenRef.current = newHidden;
|
|
4231
|
+
setHidden(newHidden);
|
|
4232
|
+
}, []);
|
|
4233
|
+
useFirstSkipEffect(function () {
|
|
4234
|
+
changeHidden(initHidden);
|
|
4235
|
+
}, [initHidden]);
|
|
4236
|
+
/********************************************************************************************************************
|
|
4237
|
+
* loading
|
|
4238
|
+
* ******************************************************************************************************************/
|
|
4239
|
+
var loadingRef = useRef(initLoading);
|
|
4240
|
+
var _j = useState(initLoading), loading = _j[0], setLoading = _j[1];
|
|
4241
|
+
var changeLoading = useCallback(function (newLoading) {
|
|
4242
|
+
loadingRef.current = newLoading;
|
|
4243
|
+
setLoading(newLoading);
|
|
4244
|
+
}, []);
|
|
4245
|
+
useFirstSkipEffect(function () {
|
|
4246
|
+
changeLoading(initLoading);
|
|
4247
|
+
}, [initLoading]);
|
|
4248
|
+
/********************************************************************************************************************
|
|
4249
|
+
* items
|
|
4250
|
+
* ******************************************************************************************************************/
|
|
4251
|
+
var itemsRef = useRef(initItems);
|
|
4252
|
+
var _k = useState(initItems), items = _k[0], setItems = _k[1];
|
|
4253
|
+
var changeItems = useCallback(function (newItems) {
|
|
4254
|
+
itemsRef.current = newItems;
|
|
4255
|
+
setItems(newItems);
|
|
4256
|
+
}, []);
|
|
4257
|
+
useFirstSkipEffect(function () {
|
|
4258
|
+
changeItems(initItems);
|
|
4259
|
+
}, [initItems]);
|
|
4202
4260
|
/********************************************************************************************************************
|
|
4203
4261
|
* Memo
|
|
4204
4262
|
* ******************************************************************************************************************/
|
|
@@ -4299,13 +4357,22 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4299
4357
|
setErrorErrorHelperText(false, undefined);
|
|
4300
4358
|
return true;
|
|
4301
4359
|
}, [required, onValidate, setErrorErrorHelperText]);
|
|
4360
|
+
/********************************************************************************************************************
|
|
4361
|
+
* Data
|
|
4362
|
+
* ******************************************************************************************************************/
|
|
4363
|
+
var dataRef = useRef(initData);
|
|
4364
|
+
useFirstSkipEffect(function () {
|
|
4365
|
+
dataRef.current = initData;
|
|
4366
|
+
}, [initData]);
|
|
4302
4367
|
/********************************************************************************************************************
|
|
4303
4368
|
* State - value
|
|
4304
4369
|
* ******************************************************************************************************************/
|
|
4305
|
-
var
|
|
4306
|
-
var
|
|
4370
|
+
var valueRef = useRef(getFinalValue(initValue));
|
|
4371
|
+
var _l = useState(function () { return getFinalValue(initValue); }), value = _l[0], setValue = _l[1];
|
|
4372
|
+
var _m = useState(null), valueItem = _m[0], setValueItem = _m[1];
|
|
4307
4373
|
var changeValue = useCallback(function (newValue) {
|
|
4308
|
-
if (!equal(
|
|
4374
|
+
if (!equal(valueRef.current, newValue)) {
|
|
4375
|
+
valueRef.current = newValue;
|
|
4309
4376
|
setValue(newValue);
|
|
4310
4377
|
nextTick(function () {
|
|
4311
4378
|
if (error)
|
|
@@ -4315,12 +4382,12 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4315
4382
|
onValueChange(name, newValue);
|
|
4316
4383
|
});
|
|
4317
4384
|
}
|
|
4318
|
-
}, [error, name, onChange, onValueChange, validate
|
|
4385
|
+
}, [error, name, onChange, onValueChange, validate]);
|
|
4319
4386
|
useFirstSkipEffect(function () {
|
|
4320
4387
|
changeValue(getFinalValue(initValue));
|
|
4321
4388
|
}, [initValue]);
|
|
4322
4389
|
useFirstSkipEffect(function () {
|
|
4323
|
-
changeValue(getFinalValue(
|
|
4390
|
+
changeValue(getFinalValue(valueRef.current));
|
|
4324
4391
|
}, [multiple]);
|
|
4325
4392
|
var componentValue = useMemo(function () {
|
|
4326
4393
|
var finalValue = value;
|
|
@@ -4379,10 +4446,10 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4379
4446
|
setValueItem(valueItem);
|
|
4380
4447
|
if (valueItem) {
|
|
4381
4448
|
if (Array.isArray(valueItem)) {
|
|
4382
|
-
|
|
4449
|
+
changeItems(valueItem);
|
|
4383
4450
|
}
|
|
4384
4451
|
else {
|
|
4385
|
-
|
|
4452
|
+
changeItems([valueItem]);
|
|
4386
4453
|
}
|
|
4387
4454
|
}
|
|
4388
4455
|
});
|
|
@@ -4410,7 +4477,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4410
4477
|
if (!async && onLoadItems) {
|
|
4411
4478
|
showOnGetItemLoading();
|
|
4412
4479
|
onLoadItems().then(function (items) {
|
|
4413
|
-
|
|
4480
|
+
changeItems(items);
|
|
4414
4481
|
hideOnGetItemLoading();
|
|
4415
4482
|
});
|
|
4416
4483
|
}
|
|
@@ -4437,15 +4504,15 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4437
4504
|
if (componentValue) {
|
|
4438
4505
|
if (Array.isArray(componentValue)) {
|
|
4439
4506
|
var exceptValues_1 = componentValue.map(function (info) { return info.value; });
|
|
4440
|
-
|
|
4507
|
+
changeItems(__spreadArray(__spreadArray([], componentValue, true), items.filter(function (info) { return !exceptValues_1.includes(info.value); }), true));
|
|
4441
4508
|
}
|
|
4442
4509
|
else {
|
|
4443
4510
|
var exceptValue_1 = componentValue.value;
|
|
4444
|
-
|
|
4511
|
+
changeItems(__spreadArray([componentValue], items.filter(function (info) { return info.value !== exceptValue_1; }), true));
|
|
4445
4512
|
}
|
|
4446
4513
|
}
|
|
4447
4514
|
else {
|
|
4448
|
-
|
|
4515
|
+
changeItems(items);
|
|
4449
4516
|
}
|
|
4450
4517
|
})
|
|
4451
4518
|
.finally(function () {
|
|
@@ -4455,14 +4522,14 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4455
4522
|
}
|
|
4456
4523
|
else {
|
|
4457
4524
|
if (Array.isArray(componentValue)) {
|
|
4458
|
-
|
|
4525
|
+
changeItems(componentValue);
|
|
4459
4526
|
}
|
|
4460
4527
|
else {
|
|
4461
4528
|
if (componentValue) {
|
|
4462
|
-
|
|
4529
|
+
changeItems([componentValue]);
|
|
4463
4530
|
}
|
|
4464
4531
|
else {
|
|
4465
|
-
|
|
4532
|
+
changeItems([]);
|
|
4466
4533
|
}
|
|
4467
4534
|
}
|
|
4468
4535
|
hideOnGetItemLoading();
|
|
@@ -4482,59 +4549,46 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4482
4549
|
* ******************************************************************************************************************/
|
|
4483
4550
|
useLayoutEffect(function () {
|
|
4484
4551
|
if (ref || onAddValueItem) {
|
|
4485
|
-
var lastValue_1 = value;
|
|
4486
|
-
var lastData_1 = data;
|
|
4487
|
-
var lastItems_1 = items;
|
|
4488
|
-
var lastLoading_1 = loading;
|
|
4489
|
-
var lastDisabled_1 = !!disabled;
|
|
4490
|
-
var lastHidden_1 = !!hidden;
|
|
4491
4552
|
var commands = {
|
|
4492
4553
|
getType: function () { return 'FormAutocomplete'; },
|
|
4493
4554
|
getName: function () { return name; },
|
|
4494
4555
|
getReset: function () { return getFinalValue(initValue); },
|
|
4495
4556
|
reset: function () {
|
|
4496
|
-
|
|
4497
|
-
changeValue(lastValue_1);
|
|
4557
|
+
changeValue(getFinalValue(initValue));
|
|
4498
4558
|
},
|
|
4499
|
-
getValue: function () { return
|
|
4500
|
-
setValue: function (
|
|
4501
|
-
|
|
4502
|
-
changeValue(lastValue_1);
|
|
4559
|
+
getValue: function () { return valueRef.current; },
|
|
4560
|
+
setValue: function (newValue) {
|
|
4561
|
+
changeValue(getFinalValue(newValue));
|
|
4503
4562
|
},
|
|
4504
|
-
getData: function () { return
|
|
4563
|
+
getData: function () { return dataRef.current; },
|
|
4505
4564
|
setData: function (data) {
|
|
4506
|
-
|
|
4507
|
-
setData(data);
|
|
4565
|
+
dataRef.current = data;
|
|
4508
4566
|
},
|
|
4509
4567
|
isExceptValue: function () { return !!exceptValue; },
|
|
4510
|
-
isDisabled: function () { return
|
|
4568
|
+
isDisabled: function () { return !!disabledRef.current; },
|
|
4511
4569
|
setDisabled: function (disabled) {
|
|
4512
|
-
|
|
4513
|
-
setDisabled(disabled);
|
|
4570
|
+
changeDisabled(disabled);
|
|
4514
4571
|
},
|
|
4515
|
-
isHidden: function () { return
|
|
4572
|
+
isHidden: function () { return !!hiddenRef.current; },
|
|
4516
4573
|
setHidden: function (hidden) {
|
|
4517
|
-
|
|
4518
|
-
setHidden(hidden);
|
|
4574
|
+
changeHidden(hidden);
|
|
4519
4575
|
},
|
|
4520
4576
|
focus: focus,
|
|
4521
4577
|
focusValidate: focus,
|
|
4522
|
-
validate: function () { return validate(
|
|
4578
|
+
validate: function () { return validate(valueRef.current); },
|
|
4523
4579
|
setError: function (error, errorText) {
|
|
4524
4580
|
return setErrorErrorHelperText(error, error ? errorText : undefined);
|
|
4525
4581
|
},
|
|
4526
4582
|
getFormValueSeparator: function () { return formValueSeparator; },
|
|
4527
4583
|
isFormValueSort: function () { return !!formValueSort; },
|
|
4528
|
-
getItems: function () { return
|
|
4584
|
+
getItems: function () { return itemsRef.current; },
|
|
4529
4585
|
setItems: function (items) {
|
|
4530
|
-
|
|
4531
|
-
setItems(lastItems_1);
|
|
4586
|
+
changeItems(items);
|
|
4532
4587
|
},
|
|
4533
4588
|
isMultiple: function () { return !!multiple; },
|
|
4534
|
-
getLoading: function () { return !!
|
|
4589
|
+
getLoading: function () { return !!loadingRef.current; },
|
|
4535
4590
|
setLoading: function (loading) {
|
|
4536
|
-
|
|
4537
|
-
setLoading(lastLoading_1);
|
|
4591
|
+
changeLoading(loading);
|
|
4538
4592
|
},
|
|
4539
4593
|
};
|
|
4540
4594
|
if (ref) {
|
|
@@ -4561,32 +4615,25 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4561
4615
|
};
|
|
4562
4616
|
}
|
|
4563
4617
|
}, [
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4618
|
+
changeDisabled,
|
|
4619
|
+
changeHidden,
|
|
4620
|
+
changeItems,
|
|
4621
|
+
changeLoading,
|
|
4622
|
+
changeValue,
|
|
4568
4623
|
exceptValue,
|
|
4569
|
-
disabled,
|
|
4570
|
-
multiple,
|
|
4571
4624
|
focus,
|
|
4572
|
-
validate,
|
|
4573
4625
|
formValueSeparator,
|
|
4574
4626
|
formValueSort,
|
|
4575
|
-
|
|
4576
|
-
|
|
4627
|
+
getFinalValue,
|
|
4628
|
+
id,
|
|
4629
|
+
initValue,
|
|
4630
|
+
multiple,
|
|
4631
|
+
name,
|
|
4577
4632
|
onAddValueItem,
|
|
4578
4633
|
onRemoveValueItem,
|
|
4579
|
-
|
|
4580
|
-
id,
|
|
4581
|
-
setDisabled,
|
|
4634
|
+
ref,
|
|
4582
4635
|
setErrorErrorHelperText,
|
|
4583
|
-
|
|
4584
|
-
setLoading,
|
|
4585
|
-
data,
|
|
4586
|
-
setData,
|
|
4587
|
-
hidden,
|
|
4588
|
-
setHidden,
|
|
4589
|
-
changeValue,
|
|
4636
|
+
validate,
|
|
4590
4637
|
]);
|
|
4591
4638
|
/********************************************************************************************************************
|
|
4592
4639
|
* Event Handler
|
|
@@ -4646,18 +4693,19 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4646
4693
|
/********************************************************************************************************************
|
|
4647
4694
|
* Render
|
|
4648
4695
|
* ******************************************************************************************************************/
|
|
4649
|
-
return (React.createElement(
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4696
|
+
return (React.createElement(React.Fragment, null,
|
|
4697
|
+
React.createElement(Autocomplete, { options: items || [], className: classNames(className, 'FormValueItem', 'FormAutocomplete'), sx: sx, multiple: multiple, fullWidth: !width && fullWidth, openOnFocus: openOnFocus, disableClearable: disableClearable, disablePortal: disablePortal, noOptionsText: noOptionsText, value: componentValue, style: style, isOptionEqualToValue: function (option, value) { return option.value === value.value; }, getOptionDisabled: handleGetOptionDisabled, disabled: disabled, readOnly: readOnly, loading: loading || isOnGetItemLoading, loadingText: loadingText, limitTags: limitTags, onChange: function (e, value, reason, details) { return handleChange(value, reason, details); }, renderOption: function (props, option) { return (React.createElement("li", __assign({}, props, { key: "".concat(option.value) }), onRenderItem ? onRenderItem(option) : option.label)); }, onInputChange: function (event, newInputValue, reason) {
|
|
4698
|
+
if (reason === 'input') {
|
|
4699
|
+
setInputValue(newInputValue);
|
|
4700
|
+
}
|
|
4701
|
+
else if (reason === 'reset') {
|
|
4702
|
+
setInputValue(undefined);
|
|
4703
|
+
}
|
|
4704
|
+
}, renderTags: function (value, getTagProps) {
|
|
4705
|
+
return value.map(function (option, index) { return (React.createElement(Chip, __assign({ size: 'small', label: onRenderTag ? onRenderTag(option) : option.label }, getTagProps({ index: index })))); });
|
|
4706
|
+
}, renderInput: function (params) { return (React.createElement(FormTextField, __assign({}, params, { ref: textFieldRef, name: name, variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, labelShrink: labelShrink, required: required, focused: focused, error: error, readOnly: readOnly, helperText: error ? errorHelperText : helperText, placeholder: placeholder, noFormValueItem: true, InputProps: __assign(__assign({}, params.InputProps), { endAdornment: (React.createElement(React.Fragment, null,
|
|
4707
|
+
loading || isOnGetItemLoading ? React.createElement(CircularProgress, { color: 'inherit', size: 20 }) : null,
|
|
4708
|
+
params.InputProps.endAdornment)) }), inputProps: readOnly || disabled ? __assign(__assign({}, params.inputProps), { tabIndex: -1 }) : params.inputProps }))); } })));
|
|
4661
4709
|
}));
|
|
4662
4710
|
FormAutocomplete.displayName = 'FormAutocomplete';
|
|
4663
4711
|
FormAutocomplete.defaultProps = FormAutocompleteDefaultProps;var FormDatePickerDefaultProps = {};var PrivateDatePickerDefaultProps = {
|
|
@@ -10139,8 +10187,8 @@ var FormYearPicker = React.forwardRef(function (_a, ref) {
|
|
|
10139
10187
|
/********************************************************************************************************************
|
|
10140
10188
|
* Function - getFinalValue
|
|
10141
10189
|
* ******************************************************************************************************************/
|
|
10142
|
-
var getFinalValue = useCallback(function (
|
|
10143
|
-
return
|
|
10190
|
+
var getFinalValue = useCallback(function (newValue) {
|
|
10191
|
+
return newValue || DEFAULT_VALUE$1;
|
|
10144
10192
|
}, []);
|
|
10145
10193
|
var setErrorErrorHelperText = useCallback(function (error, errorHelperText) {
|
|
10146
10194
|
setError(error);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var React=require('react'),classNames=require('classnames'),material=require('@mui/material'),util=require('@pdg/util'),dayjs=require('dayjs'),reactComponent=require('@pdg/react-component'),reactHook=require('@pdg/react-hook'),reactResizeDetector=require('react-resize-detector'),reactNumberFormat=require('react-number-format'),iconsMaterial=require('@mui/icons-material'),tinymceReact=require('@tinymce/tinymce-react'),
|
|
1
|
+
'use strict';var React=require('react'),classNames=require('classnames'),material=require('@mui/material'),util=require('@pdg/util'),dayjs=require('dayjs'),reactComponent=require('@pdg/react-component'),reactHook=require('@pdg/react-hook'),reactResizeDetector=require('react-resize-detector'),reactNumberFormat=require('react-number-format'),iconsMaterial=require('@mui/icons-material'),tinymceReact=require('@tinymce/tinymce-react'),AdapterDayjs=require('@mui/x-date-pickers/AdapterDayjs'),xDatePickers=require('@mui/x-date-pickers'),SimpleBar=require('simplebar-react');require('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
|
|
@@ -1065,9 +1065,37 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1065
1065
|
var _d = reactHook.useAutoUpdateState(initError), error = _d[0], setError = _d[1];
|
|
1066
1066
|
var _e = React.useState(), errorHelperText = _e[0], setErrorHelperText = _e[1];
|
|
1067
1067
|
var _f = React.useState(false), showClear = _f[0], setShowClear = _f[1];
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
/********************************************************************************************************************
|
|
1069
|
+
* disabled
|
|
1070
|
+
* ******************************************************************************************************************/
|
|
1071
|
+
var disabledRef = React.useRef(initDisabled == null ? formDisabled : initDisabled);
|
|
1072
|
+
var _g = React.useState(initDisabled == null ? formDisabled : initDisabled), disabled = _g[0], setDisabled = _g[1];
|
|
1073
|
+
var changeDisabled = React.useCallback(function (newDisabled) {
|
|
1074
|
+
disabledRef.current = newDisabled;
|
|
1075
|
+
setDisabled(newDisabled);
|
|
1076
|
+
}, []);
|
|
1077
|
+
reactHook.useFirstSkipEffect(function () {
|
|
1078
|
+
changeDisabled(initDisabled == null ? formDisabled : initDisabled);
|
|
1079
|
+
}, [initDisabled, formDisabled]);
|
|
1080
|
+
/********************************************************************************************************************
|
|
1081
|
+
* hidden
|
|
1082
|
+
* ******************************************************************************************************************/
|
|
1083
|
+
var hiddenRef = React.useRef(initHidden);
|
|
1084
|
+
var _h = React.useState(initHidden), hidden = _h[0], setHidden = _h[1];
|
|
1085
|
+
var changeHidden = React.useCallback(function (newHidden) {
|
|
1086
|
+
hiddenRef.current = newHidden;
|
|
1087
|
+
setHidden(newHidden);
|
|
1088
|
+
}, []);
|
|
1089
|
+
reactHook.useFirstSkipEffect(function () {
|
|
1090
|
+
changeHidden(initHidden);
|
|
1091
|
+
}, [initHidden]);
|
|
1092
|
+
/********************************************************************************************************************
|
|
1093
|
+
* data
|
|
1094
|
+
* ******************************************************************************************************************/
|
|
1095
|
+
var dataRef = React.useRef(initData);
|
|
1096
|
+
reactHook.useFirstSkipEffect(function () {
|
|
1097
|
+
dataRef.current = initData;
|
|
1098
|
+
}, [initData]);
|
|
1071
1099
|
/********************************************************************************************************************
|
|
1072
1100
|
* Memo - muiInputLabelProps
|
|
1073
1101
|
* ******************************************************************************************************************/
|
|
@@ -1122,8 +1150,8 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1122
1150
|
/********************************************************************************************************************
|
|
1123
1151
|
* Function - getFinalValue
|
|
1124
1152
|
* ******************************************************************************************************************/
|
|
1125
|
-
var getFinalValue = React.useCallback(function (
|
|
1126
|
-
return onValue ? onValue(
|
|
1153
|
+
var getFinalValue = React.useCallback(function (newValue) {
|
|
1154
|
+
return onValue ? onValue(newValue) : newValue;
|
|
1127
1155
|
}, [onValue]);
|
|
1128
1156
|
/********************************************************************************************************************
|
|
1129
1157
|
* Function - setErrorErrorHelperText
|
|
@@ -1165,9 +1193,11 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1165
1193
|
/********************************************************************************************************************
|
|
1166
1194
|
* State - value
|
|
1167
1195
|
* ******************************************************************************************************************/
|
|
1168
|
-
var
|
|
1196
|
+
var valueRef = React.useRef(getFinalValue(initValue));
|
|
1197
|
+
var _j = React.useState(function () { return getFinalValue(initValue); }), value = _j[0], setValue = _j[1];
|
|
1169
1198
|
var changeValue = React.useCallback(function (newValue) {
|
|
1170
|
-
if (!util.equal(
|
|
1199
|
+
if (!util.equal(valueRef.current, newValue)) {
|
|
1200
|
+
valueRef.current = newValue;
|
|
1171
1201
|
setValue(newValue);
|
|
1172
1202
|
util.nextTick(function () {
|
|
1173
1203
|
if (error)
|
|
@@ -1179,7 +1209,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1179
1209
|
}
|
|
1180
1210
|
});
|
|
1181
1211
|
}
|
|
1182
|
-
}, [error, name, noFormValueItem, onChange, onValueChange, validate
|
|
1212
|
+
}, [error, name, noFormValueItem, onChange, onValueChange, validate]);
|
|
1183
1213
|
reactHook.useFirstSkipEffect(function () {
|
|
1184
1214
|
changeValue(getFinalValue(initValue));
|
|
1185
1215
|
}, [initValue]);
|
|
@@ -1252,42 +1282,33 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1252
1282
|
* ******************************************************************************************************************/
|
|
1253
1283
|
React.useLayoutEffect(function () {
|
|
1254
1284
|
if (ref || (!noFormValueItem && onAddValueItem)) {
|
|
1255
|
-
var lastValue_1 = value;
|
|
1256
|
-
var lastData_1 = data;
|
|
1257
|
-
var lastDisabled_1 = !!disabled;
|
|
1258
|
-
var lastHidden_1 = !!hidden;
|
|
1259
1285
|
var commands = {
|
|
1260
1286
|
getType: function () { return 'default'; },
|
|
1261
1287
|
getName: function () { return name; },
|
|
1262
1288
|
getReset: function () { return getFinalValue(initValue); },
|
|
1263
1289
|
reset: function () {
|
|
1264
|
-
|
|
1265
|
-
changeValue(lastValue_1);
|
|
1290
|
+
changeValue(getFinalValue(initValue));
|
|
1266
1291
|
},
|
|
1267
|
-
getValue: function () { return
|
|
1292
|
+
getValue: function () { return valueRef.current; },
|
|
1268
1293
|
setValue: function (value) {
|
|
1269
|
-
|
|
1270
|
-
changeValue(lastValue_1);
|
|
1294
|
+
changeValue(getFinalValue(value));
|
|
1271
1295
|
},
|
|
1272
|
-
getData: function () { return
|
|
1296
|
+
getData: function () { return dataRef.current; },
|
|
1273
1297
|
setData: function (data) {
|
|
1274
|
-
|
|
1275
|
-
setData(data);
|
|
1298
|
+
dataRef.current = data;
|
|
1276
1299
|
},
|
|
1277
1300
|
isExceptValue: function () { return !!exceptValue; },
|
|
1278
|
-
isDisabled: function () { return
|
|
1301
|
+
isDisabled: function () { return !!disabledRef.current; },
|
|
1279
1302
|
setDisabled: function (disabled) {
|
|
1280
|
-
|
|
1281
|
-
setDisabled(disabled);
|
|
1303
|
+
changeDisabled(disabled);
|
|
1282
1304
|
},
|
|
1283
|
-
isHidden: function () { return
|
|
1305
|
+
isHidden: function () { return !!hiddenRef.current; },
|
|
1284
1306
|
setHidden: function (hidden) {
|
|
1285
|
-
|
|
1286
|
-
setHidden(hidden);
|
|
1307
|
+
changeHidden(hidden);
|
|
1287
1308
|
},
|
|
1288
1309
|
focus: focus,
|
|
1289
1310
|
focusValidate: focus,
|
|
1290
|
-
validate: function () { return validate(
|
|
1311
|
+
validate: function () { return validate(valueRef.current); },
|
|
1291
1312
|
setError: function (error, errorText) {
|
|
1292
1313
|
return setErrorErrorHelperText(error, error ? errorText : undefined);
|
|
1293
1314
|
},
|
|
@@ -1316,26 +1337,21 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1316
1337
|
};
|
|
1317
1338
|
}
|
|
1318
1339
|
}, [
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
data,
|
|
1323
|
-
getFinalValue,
|
|
1340
|
+
changeDisabled,
|
|
1341
|
+
changeHidden,
|
|
1342
|
+
changeValue,
|
|
1324
1343
|
exceptValue,
|
|
1325
|
-
disabled,
|
|
1326
1344
|
focus,
|
|
1327
|
-
|
|
1328
|
-
|
|
1345
|
+
getFinalValue,
|
|
1346
|
+
id,
|
|
1347
|
+
initValue,
|
|
1348
|
+
name,
|
|
1329
1349
|
noFormValueItem,
|
|
1330
1350
|
onAddValueItem,
|
|
1331
1351
|
onRemoveValueItem,
|
|
1332
|
-
|
|
1333
|
-
setDisabled,
|
|
1352
|
+
ref,
|
|
1334
1353
|
setErrorErrorHelperText,
|
|
1335
|
-
|
|
1336
|
-
hidden,
|
|
1337
|
-
setHidden,
|
|
1338
|
-
changeValue,
|
|
1354
|
+
validate,
|
|
1339
1355
|
]);
|
|
1340
1356
|
/********************************************************************************************************************
|
|
1341
1357
|
* Event Handler
|
|
@@ -1354,10 +1370,10 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1354
1370
|
}, [getFinalValue, changeValue, noFormValueItem, onValueChangeByUser, name, select, onRequestSearchSubmit]);
|
|
1355
1371
|
var handleBlur = React.useCallback(function (e) {
|
|
1356
1372
|
if (error)
|
|
1357
|
-
validate(
|
|
1373
|
+
validate(valueRef.current);
|
|
1358
1374
|
if (onBlur)
|
|
1359
1375
|
onBlur(e);
|
|
1360
|
-
}, [error,
|
|
1376
|
+
}, [error, validate, onBlur]);
|
|
1361
1377
|
var handleKeyDown = React.useCallback(function (e) {
|
|
1362
1378
|
if (['Enter'].includes(e.key) &&
|
|
1363
1379
|
!select &&
|
|
@@ -1365,11 +1381,11 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1365
1381
|
!noFormValueItem) {
|
|
1366
1382
|
e.preventDefault();
|
|
1367
1383
|
e.stopPropagation();
|
|
1368
|
-
onRequestSearchSubmit(name,
|
|
1384
|
+
onRequestSearchSubmit(name, valueRef.current);
|
|
1369
1385
|
}
|
|
1370
1386
|
if (onKeyDown)
|
|
1371
1387
|
onKeyDown(e);
|
|
1372
|
-
}, [select, multiline, disableReturnKey, noFormValueItem, onKeyDown, onRequestSearchSubmit, name
|
|
1388
|
+
}, [select, multiline, disableReturnKey, noFormValueItem, onKeyDown, onRequestSearchSubmit, name]);
|
|
1373
1389
|
/********************************************************************************************************************
|
|
1374
1390
|
* Render
|
|
1375
1391
|
* ******************************************************************************************************************/
|
|
@@ -2182,8 +2198,8 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2182
2198
|
/********************************************************************************************************************
|
|
2183
2199
|
* Function - getFinalValue
|
|
2184
2200
|
* ******************************************************************************************************************/
|
|
2185
|
-
var getFinalValue = React.useCallback(function (
|
|
2186
|
-
var finalValue =
|
|
2201
|
+
var getFinalValue = React.useCallback(function (newValue) {
|
|
2202
|
+
var finalValue = newValue == null ? '' : newValue;
|
|
2187
2203
|
if (multiple) {
|
|
2188
2204
|
if (!Array.isArray(finalValue)) {
|
|
2189
2205
|
if (util.empty(finalValue)) {
|
|
@@ -2228,17 +2244,19 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2228
2244
|
}
|
|
2229
2245
|
}
|
|
2230
2246
|
finalValue = onValue ? onValue(finalValue) : finalValue;
|
|
2231
|
-
return util.equal(
|
|
2247
|
+
return util.equal(newValue, finalValue) ? newValue : finalValue;
|
|
2232
2248
|
}, [multiple, formValueSeparator, itemsValues, onValue]);
|
|
2233
2249
|
/********************************************************************************************************************
|
|
2234
2250
|
* State - value
|
|
2235
2251
|
* ******************************************************************************************************************/
|
|
2252
|
+
var valueRef = React.useRef(getFinalValue(initValue));
|
|
2236
2253
|
var _h = React.useState(function () { return getFinalValue(initValue); }), value = _h[0], setValue = _h[1];
|
|
2237
2254
|
/********************************************************************************************************************
|
|
2238
2255
|
* Function
|
|
2239
2256
|
* ******************************************************************************************************************/
|
|
2240
2257
|
var changeValue = React.useCallback(function (newValue) {
|
|
2241
|
-
if (!util.equal(
|
|
2258
|
+
if (!util.equal(valueRef.current, newValue)) {
|
|
2259
|
+
valueRef.current = newValue;
|
|
2242
2260
|
setValue(newValue);
|
|
2243
2261
|
util.nextTick(function () {
|
|
2244
2262
|
if (onChange)
|
|
@@ -2246,12 +2264,12 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2246
2264
|
onValueChange(name, newValue);
|
|
2247
2265
|
});
|
|
2248
2266
|
}
|
|
2249
|
-
}, [name, onChange, onValueChange
|
|
2267
|
+
}, [name, onChange, onValueChange]);
|
|
2250
2268
|
reactHook.useFirstSkipEffect(function () {
|
|
2251
2269
|
changeValue(getFinalValue(initValue));
|
|
2252
2270
|
}, [initValue]);
|
|
2253
2271
|
reactHook.useFirstSkipEffect(function () {
|
|
2254
|
-
changeValue(getFinalValue(
|
|
2272
|
+
changeValue(getFinalValue(valueRef.current));
|
|
2255
2273
|
}, [multiple]);
|
|
2256
2274
|
/********************************************************************************************************************
|
|
2257
2275
|
* State - isSelectedPlaceholder
|
|
@@ -2285,12 +2303,12 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2285
2303
|
}
|
|
2286
2304
|
else {
|
|
2287
2305
|
return (React.createElement(material.Box, { className: 'selected-list', sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, Array.isArray(selected) &&
|
|
2288
|
-
selected.map(function (
|
|
2306
|
+
selected.map(function (selectedValue) {
|
|
2289
2307
|
if (isSelectedPlaceholder) {
|
|
2290
|
-
return React.createElement(material.Chip, { key:
|
|
2308
|
+
return React.createElement(material.Chip, { key: selectedValue || '$$$EmptyValuePlaceholder$$$', label: 'hahaha', size: 'small' });
|
|
2291
2309
|
}
|
|
2292
2310
|
else {
|
|
2293
|
-
return React.createElement(material.Chip, { key:
|
|
2311
|
+
return React.createElement(material.Chip, { key: selectedValue, label: itemValueLabels["".concat(selectedValue)], size: 'small' });
|
|
2294
2312
|
}
|
|
2295
2313
|
})));
|
|
2296
2314
|
}
|
|
@@ -2306,20 +2324,17 @@ styleInject(css_248z$f);var FormSelect = ToForwardRefExoticComponent(AutoTypeFor
|
|
|
2306
2324
|
* Function - getExtraCommands
|
|
2307
2325
|
* ******************************************************************************************************************/
|
|
2308
2326
|
var getBaseCommands = React.useCallback(function () {
|
|
2309
|
-
var lastValue = value;
|
|
2310
2327
|
return {
|
|
2311
2328
|
getReset: function () { return getFinalValue(initValue); },
|
|
2312
2329
|
reset: function () {
|
|
2313
|
-
|
|
2314
|
-
changeValue(lastValue);
|
|
2330
|
+
changeValue(getFinalValue(initValue));
|
|
2315
2331
|
},
|
|
2316
|
-
getValue: function () { return
|
|
2332
|
+
getValue: function () { return valueRef.current; },
|
|
2317
2333
|
setValue: function (value) {
|
|
2318
|
-
|
|
2319
|
-
changeValue(lastValue);
|
|
2334
|
+
changeValue(getFinalValue(value));
|
|
2320
2335
|
},
|
|
2321
2336
|
};
|
|
2322
|
-
}, [
|
|
2337
|
+
}, [getFinalValue, initValue, changeValue]);
|
|
2323
2338
|
var getExtraCommands = React.useCallback(function () {
|
|
2324
2339
|
var lastItems = items;
|
|
2325
2340
|
var lastLoading = loading;
|
|
@@ -4191,14 +4206,57 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4191
4206
|
* State
|
|
4192
4207
|
* ******************************************************************************************************************/
|
|
4193
4208
|
var _c = React.useState(false), isOnGetItemLoading = _c[0], setIsOnGetItemLoading = _c[1];
|
|
4194
|
-
var _d = reactHook.useAutoUpdateState(
|
|
4195
|
-
var _e =
|
|
4196
|
-
var _f = React.useState(),
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
var
|
|
4201
|
-
var
|
|
4209
|
+
var _d = reactHook.useAutoUpdateState(initError), error = _d[0], setError = _d[1];
|
|
4210
|
+
var _e = React.useState(), errorHelperText = _e[0], setErrorHelperText = _e[1];
|
|
4211
|
+
var _f = React.useState(undefined), inputValue = _f[0], setInputValue = _f[1];
|
|
4212
|
+
/********************************************************************************************************************
|
|
4213
|
+
* disabled
|
|
4214
|
+
* ******************************************************************************************************************/
|
|
4215
|
+
var disabledRef = React.useRef(initDisabled == null ? formDisabled : initDisabled);
|
|
4216
|
+
var _g = React.useState(initDisabled == null ? formDisabled : initDisabled), disabled = _g[0], setDisabled = _g[1];
|
|
4217
|
+
var changeDisabled = React.useCallback(function (newDisabled) {
|
|
4218
|
+
disabledRef.current = newDisabled;
|
|
4219
|
+
setDisabled(newDisabled);
|
|
4220
|
+
}, []);
|
|
4221
|
+
reactHook.useFirstSkipEffect(function () {
|
|
4222
|
+
changeDisabled(initDisabled == null ? formDisabled : initDisabled);
|
|
4223
|
+
}, [initDisabled, formDisabled]);
|
|
4224
|
+
/********************************************************************************************************************
|
|
4225
|
+
* hidden
|
|
4226
|
+
* ******************************************************************************************************************/
|
|
4227
|
+
var hiddenRef = React.useRef(initHidden);
|
|
4228
|
+
var _h = React.useState(initHidden), hidden = _h[0], setHidden = _h[1];
|
|
4229
|
+
var changeHidden = React.useCallback(function (newHidden) {
|
|
4230
|
+
hiddenRef.current = newHidden;
|
|
4231
|
+
setHidden(newHidden);
|
|
4232
|
+
}, []);
|
|
4233
|
+
reactHook.useFirstSkipEffect(function () {
|
|
4234
|
+
changeHidden(initHidden);
|
|
4235
|
+
}, [initHidden]);
|
|
4236
|
+
/********************************************************************************************************************
|
|
4237
|
+
* loading
|
|
4238
|
+
* ******************************************************************************************************************/
|
|
4239
|
+
var loadingRef = React.useRef(initLoading);
|
|
4240
|
+
var _j = React.useState(initLoading), loading = _j[0], setLoading = _j[1];
|
|
4241
|
+
var changeLoading = React.useCallback(function (newLoading) {
|
|
4242
|
+
loadingRef.current = newLoading;
|
|
4243
|
+
setLoading(newLoading);
|
|
4244
|
+
}, []);
|
|
4245
|
+
reactHook.useFirstSkipEffect(function () {
|
|
4246
|
+
changeLoading(initLoading);
|
|
4247
|
+
}, [initLoading]);
|
|
4248
|
+
/********************************************************************************************************************
|
|
4249
|
+
* items
|
|
4250
|
+
* ******************************************************************************************************************/
|
|
4251
|
+
var itemsRef = React.useRef(initItems);
|
|
4252
|
+
var _k = React.useState(initItems), items = _k[0], setItems = _k[1];
|
|
4253
|
+
var changeItems = React.useCallback(function (newItems) {
|
|
4254
|
+
itemsRef.current = newItems;
|
|
4255
|
+
setItems(newItems);
|
|
4256
|
+
}, []);
|
|
4257
|
+
reactHook.useFirstSkipEffect(function () {
|
|
4258
|
+
changeItems(initItems);
|
|
4259
|
+
}, [initItems]);
|
|
4202
4260
|
/********************************************************************************************************************
|
|
4203
4261
|
* Memo
|
|
4204
4262
|
* ******************************************************************************************************************/
|
|
@@ -4299,13 +4357,22 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4299
4357
|
setErrorErrorHelperText(false, undefined);
|
|
4300
4358
|
return true;
|
|
4301
4359
|
}, [required, onValidate, setErrorErrorHelperText]);
|
|
4360
|
+
/********************************************************************************************************************
|
|
4361
|
+
* Data
|
|
4362
|
+
* ******************************************************************************************************************/
|
|
4363
|
+
var dataRef = React.useRef(initData);
|
|
4364
|
+
reactHook.useFirstSkipEffect(function () {
|
|
4365
|
+
dataRef.current = initData;
|
|
4366
|
+
}, [initData]);
|
|
4302
4367
|
/********************************************************************************************************************
|
|
4303
4368
|
* State - value
|
|
4304
4369
|
* ******************************************************************************************************************/
|
|
4305
|
-
var
|
|
4306
|
-
var
|
|
4370
|
+
var valueRef = React.useRef(getFinalValue(initValue));
|
|
4371
|
+
var _l = React.useState(function () { return getFinalValue(initValue); }), value = _l[0], setValue = _l[1];
|
|
4372
|
+
var _m = React.useState(null), valueItem = _m[0], setValueItem = _m[1];
|
|
4307
4373
|
var changeValue = React.useCallback(function (newValue) {
|
|
4308
|
-
if (!util.equal(
|
|
4374
|
+
if (!util.equal(valueRef.current, newValue)) {
|
|
4375
|
+
valueRef.current = newValue;
|
|
4309
4376
|
setValue(newValue);
|
|
4310
4377
|
util.nextTick(function () {
|
|
4311
4378
|
if (error)
|
|
@@ -4315,12 +4382,12 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4315
4382
|
onValueChange(name, newValue);
|
|
4316
4383
|
});
|
|
4317
4384
|
}
|
|
4318
|
-
}, [error, name, onChange, onValueChange, validate
|
|
4385
|
+
}, [error, name, onChange, onValueChange, validate]);
|
|
4319
4386
|
reactHook.useFirstSkipEffect(function () {
|
|
4320
4387
|
changeValue(getFinalValue(initValue));
|
|
4321
4388
|
}, [initValue]);
|
|
4322
4389
|
reactHook.useFirstSkipEffect(function () {
|
|
4323
|
-
changeValue(getFinalValue(
|
|
4390
|
+
changeValue(getFinalValue(valueRef.current));
|
|
4324
4391
|
}, [multiple]);
|
|
4325
4392
|
var componentValue = React.useMemo(function () {
|
|
4326
4393
|
var finalValue = value;
|
|
@@ -4379,10 +4446,10 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4379
4446
|
setValueItem(valueItem);
|
|
4380
4447
|
if (valueItem) {
|
|
4381
4448
|
if (Array.isArray(valueItem)) {
|
|
4382
|
-
|
|
4449
|
+
changeItems(valueItem);
|
|
4383
4450
|
}
|
|
4384
4451
|
else {
|
|
4385
|
-
|
|
4452
|
+
changeItems([valueItem]);
|
|
4386
4453
|
}
|
|
4387
4454
|
}
|
|
4388
4455
|
});
|
|
@@ -4410,7 +4477,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4410
4477
|
if (!async && onLoadItems) {
|
|
4411
4478
|
showOnGetItemLoading();
|
|
4412
4479
|
onLoadItems().then(function (items) {
|
|
4413
|
-
|
|
4480
|
+
changeItems(items);
|
|
4414
4481
|
hideOnGetItemLoading();
|
|
4415
4482
|
});
|
|
4416
4483
|
}
|
|
@@ -4437,15 +4504,15 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4437
4504
|
if (componentValue) {
|
|
4438
4505
|
if (Array.isArray(componentValue)) {
|
|
4439
4506
|
var exceptValues_1 = componentValue.map(function (info) { return info.value; });
|
|
4440
|
-
|
|
4507
|
+
changeItems(__spreadArray(__spreadArray([], componentValue, true), items.filter(function (info) { return !exceptValues_1.includes(info.value); }), true));
|
|
4441
4508
|
}
|
|
4442
4509
|
else {
|
|
4443
4510
|
var exceptValue_1 = componentValue.value;
|
|
4444
|
-
|
|
4511
|
+
changeItems(__spreadArray([componentValue], items.filter(function (info) { return info.value !== exceptValue_1; }), true));
|
|
4445
4512
|
}
|
|
4446
4513
|
}
|
|
4447
4514
|
else {
|
|
4448
|
-
|
|
4515
|
+
changeItems(items);
|
|
4449
4516
|
}
|
|
4450
4517
|
})
|
|
4451
4518
|
.finally(function () {
|
|
@@ -4455,14 +4522,14 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4455
4522
|
}
|
|
4456
4523
|
else {
|
|
4457
4524
|
if (Array.isArray(componentValue)) {
|
|
4458
|
-
|
|
4525
|
+
changeItems(componentValue);
|
|
4459
4526
|
}
|
|
4460
4527
|
else {
|
|
4461
4528
|
if (componentValue) {
|
|
4462
|
-
|
|
4529
|
+
changeItems([componentValue]);
|
|
4463
4530
|
}
|
|
4464
4531
|
else {
|
|
4465
|
-
|
|
4532
|
+
changeItems([]);
|
|
4466
4533
|
}
|
|
4467
4534
|
}
|
|
4468
4535
|
hideOnGetItemLoading();
|
|
@@ -4482,59 +4549,46 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4482
4549
|
* ******************************************************************************************************************/
|
|
4483
4550
|
React.useLayoutEffect(function () {
|
|
4484
4551
|
if (ref || onAddValueItem) {
|
|
4485
|
-
var lastValue_1 = value;
|
|
4486
|
-
var lastData_1 = data;
|
|
4487
|
-
var lastItems_1 = items;
|
|
4488
|
-
var lastLoading_1 = loading;
|
|
4489
|
-
var lastDisabled_1 = !!disabled;
|
|
4490
|
-
var lastHidden_1 = !!hidden;
|
|
4491
4552
|
var commands = {
|
|
4492
4553
|
getType: function () { return 'FormAutocomplete'; },
|
|
4493
4554
|
getName: function () { return name; },
|
|
4494
4555
|
getReset: function () { return getFinalValue(initValue); },
|
|
4495
4556
|
reset: function () {
|
|
4496
|
-
|
|
4497
|
-
changeValue(lastValue_1);
|
|
4557
|
+
changeValue(getFinalValue(initValue));
|
|
4498
4558
|
},
|
|
4499
|
-
getValue: function () { return
|
|
4500
|
-
setValue: function (
|
|
4501
|
-
|
|
4502
|
-
changeValue(lastValue_1);
|
|
4559
|
+
getValue: function () { return valueRef.current; },
|
|
4560
|
+
setValue: function (newValue) {
|
|
4561
|
+
changeValue(getFinalValue(newValue));
|
|
4503
4562
|
},
|
|
4504
|
-
getData: function () { return
|
|
4563
|
+
getData: function () { return dataRef.current; },
|
|
4505
4564
|
setData: function (data) {
|
|
4506
|
-
|
|
4507
|
-
setData(data);
|
|
4565
|
+
dataRef.current = data;
|
|
4508
4566
|
},
|
|
4509
4567
|
isExceptValue: function () { return !!exceptValue; },
|
|
4510
|
-
isDisabled: function () { return
|
|
4568
|
+
isDisabled: function () { return !!disabledRef.current; },
|
|
4511
4569
|
setDisabled: function (disabled) {
|
|
4512
|
-
|
|
4513
|
-
setDisabled(disabled);
|
|
4570
|
+
changeDisabled(disabled);
|
|
4514
4571
|
},
|
|
4515
|
-
isHidden: function () { return
|
|
4572
|
+
isHidden: function () { return !!hiddenRef.current; },
|
|
4516
4573
|
setHidden: function (hidden) {
|
|
4517
|
-
|
|
4518
|
-
setHidden(hidden);
|
|
4574
|
+
changeHidden(hidden);
|
|
4519
4575
|
},
|
|
4520
4576
|
focus: focus,
|
|
4521
4577
|
focusValidate: focus,
|
|
4522
|
-
validate: function () { return validate(
|
|
4578
|
+
validate: function () { return validate(valueRef.current); },
|
|
4523
4579
|
setError: function (error, errorText) {
|
|
4524
4580
|
return setErrorErrorHelperText(error, error ? errorText : undefined);
|
|
4525
4581
|
},
|
|
4526
4582
|
getFormValueSeparator: function () { return formValueSeparator; },
|
|
4527
4583
|
isFormValueSort: function () { return !!formValueSort; },
|
|
4528
|
-
getItems: function () { return
|
|
4584
|
+
getItems: function () { return itemsRef.current; },
|
|
4529
4585
|
setItems: function (items) {
|
|
4530
|
-
|
|
4531
|
-
setItems(lastItems_1);
|
|
4586
|
+
changeItems(items);
|
|
4532
4587
|
},
|
|
4533
4588
|
isMultiple: function () { return !!multiple; },
|
|
4534
|
-
getLoading: function () { return !!
|
|
4589
|
+
getLoading: function () { return !!loadingRef.current; },
|
|
4535
4590
|
setLoading: function (loading) {
|
|
4536
|
-
|
|
4537
|
-
setLoading(lastLoading_1);
|
|
4591
|
+
changeLoading(loading);
|
|
4538
4592
|
},
|
|
4539
4593
|
};
|
|
4540
4594
|
if (ref) {
|
|
@@ -4561,32 +4615,25 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4561
4615
|
};
|
|
4562
4616
|
}
|
|
4563
4617
|
}, [
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4618
|
+
changeDisabled,
|
|
4619
|
+
changeHidden,
|
|
4620
|
+
changeItems,
|
|
4621
|
+
changeLoading,
|
|
4622
|
+
changeValue,
|
|
4568
4623
|
exceptValue,
|
|
4569
|
-
disabled,
|
|
4570
|
-
multiple,
|
|
4571
4624
|
focus,
|
|
4572
|
-
validate,
|
|
4573
4625
|
formValueSeparator,
|
|
4574
4626
|
formValueSort,
|
|
4575
|
-
|
|
4576
|
-
|
|
4627
|
+
getFinalValue,
|
|
4628
|
+
id,
|
|
4629
|
+
initValue,
|
|
4630
|
+
multiple,
|
|
4631
|
+
name,
|
|
4577
4632
|
onAddValueItem,
|
|
4578
4633
|
onRemoveValueItem,
|
|
4579
|
-
|
|
4580
|
-
id,
|
|
4581
|
-
setDisabled,
|
|
4634
|
+
ref,
|
|
4582
4635
|
setErrorErrorHelperText,
|
|
4583
|
-
|
|
4584
|
-
setLoading,
|
|
4585
|
-
data,
|
|
4586
|
-
setData,
|
|
4587
|
-
hidden,
|
|
4588
|
-
setHidden,
|
|
4589
|
-
changeValue,
|
|
4636
|
+
validate,
|
|
4590
4637
|
]);
|
|
4591
4638
|
/********************************************************************************************************************
|
|
4592
4639
|
* Event Handler
|
|
@@ -4646,18 +4693,19 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
|
|
|
4646
4693
|
/********************************************************************************************************************
|
|
4647
4694
|
* Render
|
|
4648
4695
|
* ******************************************************************************************************************/
|
|
4649
|
-
return (React.createElement(
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4696
|
+
return (React.createElement(React.Fragment, null,
|
|
4697
|
+
React.createElement(material.Autocomplete, { options: items || [], className: classNames(className, 'FormValueItem', 'FormAutocomplete'), sx: sx, multiple: multiple, fullWidth: !width && fullWidth, openOnFocus: openOnFocus, disableClearable: disableClearable, disablePortal: disablePortal, noOptionsText: noOptionsText, value: componentValue, style: style, isOptionEqualToValue: function (option, value) { return option.value === value.value; }, getOptionDisabled: handleGetOptionDisabled, disabled: disabled, readOnly: readOnly, loading: loading || isOnGetItemLoading, loadingText: loadingText, limitTags: limitTags, onChange: function (e, value, reason, details) { return handleChange(value, reason, details); }, renderOption: function (props, option) { return (React.createElement("li", __assign({}, props, { key: "".concat(option.value) }), onRenderItem ? onRenderItem(option) : option.label)); }, onInputChange: function (event, newInputValue, reason) {
|
|
4698
|
+
if (reason === 'input') {
|
|
4699
|
+
setInputValue(newInputValue);
|
|
4700
|
+
}
|
|
4701
|
+
else if (reason === 'reset') {
|
|
4702
|
+
setInputValue(undefined);
|
|
4703
|
+
}
|
|
4704
|
+
}, renderTags: function (value, getTagProps) {
|
|
4705
|
+
return value.map(function (option, index) { return (React.createElement(material.Chip, __assign({ size: 'small', label: onRenderTag ? onRenderTag(option) : option.label }, getTagProps({ index: index })))); });
|
|
4706
|
+
}, renderInput: function (params) { return (React.createElement(FormTextField, __assign({}, params, { ref: textFieldRef, name: name, variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, labelShrink: labelShrink, required: required, focused: focused, error: error, readOnly: readOnly, helperText: error ? errorHelperText : helperText, placeholder: placeholder, noFormValueItem: true, InputProps: __assign(__assign({}, params.InputProps), { endAdornment: (React.createElement(React.Fragment, null,
|
|
4707
|
+
loading || isOnGetItemLoading ? React.createElement(material.CircularProgress, { color: 'inherit', size: 20 }) : null,
|
|
4708
|
+
params.InputProps.endAdornment)) }), inputProps: readOnly || disabled ? __assign(__assign({}, params.inputProps), { tabIndex: -1 }) : params.inputProps }))); } })));
|
|
4661
4709
|
}));
|
|
4662
4710
|
FormAutocomplete.displayName = 'FormAutocomplete';
|
|
4663
4711
|
FormAutocomplete.defaultProps = FormAutocompleteDefaultProps;var FormDatePickerDefaultProps = {};var PrivateDatePickerDefaultProps = {
|
|
@@ -10139,8 +10187,8 @@ var FormYearPicker = React.forwardRef(function (_a, ref) {
|
|
|
10139
10187
|
/********************************************************************************************************************
|
|
10140
10188
|
* Function - getFinalValue
|
|
10141
10189
|
* ******************************************************************************************************************/
|
|
10142
|
-
var getFinalValue = React.useCallback(function (
|
|
10143
|
-
return
|
|
10190
|
+
var getFinalValue = React.useCallback(function (newValue) {
|
|
10191
|
+
return newValue || DEFAULT_VALUE$1;
|
|
10144
10192
|
}, []);
|
|
10145
10193
|
var setErrorErrorHelperText = React.useCallback(function (error, errorHelperText) {
|
|
10146
10194
|
setError(error);
|