formik-form-components 0.2.28 → 0.2.29
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/README.md +0 -2
- package/dist/index.d.ts +19 -201
- package/dist/index.js +102 -639
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -635
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
|
|
2
2
|
import React4, { forwardRef, createElement, memo, useState, useMemo, useEffect } from 'react';
|
|
3
|
-
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, Autocomplete, Checkbox, Chip, Select, MenuItem, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating,
|
|
3
|
+
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, Autocomplete, Checkbox, Chip, Select, MenuItem, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Switch, InputAdornment, IconButton, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Menu } from '@mui/material';
|
|
4
4
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
5
5
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
6
6
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
7
7
|
import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
|
|
8
|
-
import
|
|
8
|
+
import _17, { get } from 'lodash';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
11
11
|
import Autocomplete3 from '@mui/material/Autocomplete';
|
|
@@ -49,9 +49,9 @@ var AppDatePicker = forwardRef(
|
|
|
49
49
|
...otherProps
|
|
50
50
|
}, ref) => {
|
|
51
51
|
const { values, setFieldValue, touched, errors, setFieldTouched } = useFormikContext();
|
|
52
|
-
const fieldValue =
|
|
53
|
-
const fieldError =
|
|
54
|
-
const isTouched =
|
|
52
|
+
const fieldValue = _17.get(values, name);
|
|
53
|
+
const fieldError = _17.get(errors, name);
|
|
54
|
+
const isTouched = _17.get(touched, name);
|
|
55
55
|
const handleChange = (newValue) => {
|
|
56
56
|
setFieldValue(name, newValue);
|
|
57
57
|
};
|
|
@@ -285,8 +285,8 @@ function AppFormErrorMessage({
|
|
|
285
285
|
textSx
|
|
286
286
|
}) {
|
|
287
287
|
const { errors, touched } = useFormikContext();
|
|
288
|
-
const fieldError =
|
|
289
|
-
const isTouched =
|
|
288
|
+
const fieldError = _17.get(errors, name);
|
|
289
|
+
const isTouched = _17.get(touched, name);
|
|
290
290
|
const showError = fieldError && typeof fieldError === "string";
|
|
291
291
|
if (alwaysShow) {
|
|
292
292
|
return showError ? /* @__PURE__ */ jsx(
|
|
@@ -363,9 +363,9 @@ var AppTextArea = forwardRef(({
|
|
|
363
363
|
}, ref) => {
|
|
364
364
|
var _a, _b, _c, _d;
|
|
365
365
|
const { errors, getFieldProps, touched, setFieldValue } = useFormikContext();
|
|
366
|
-
const fieldError =
|
|
367
|
-
const isTouched =
|
|
368
|
-
const value =
|
|
366
|
+
const fieldError = _17.get(errors, name);
|
|
367
|
+
const isTouched = _17.get(touched, name);
|
|
368
|
+
const value = _17.get(getFieldProps(name), "value", "");
|
|
369
369
|
const handleChange = (e) => {
|
|
370
370
|
const newValue = e.target.value;
|
|
371
371
|
if (maxLength && newValue.length > maxLength)
|
|
@@ -519,9 +519,9 @@ function AppTagsCreator({
|
|
|
519
519
|
inputSx
|
|
520
520
|
}) {
|
|
521
521
|
const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = useFormikContext();
|
|
522
|
-
const fieldError =
|
|
523
|
-
const isTouched =
|
|
524
|
-
const val =
|
|
522
|
+
const fieldError = _17.get(errors, name);
|
|
523
|
+
const isTouched = _17.get(touched, name);
|
|
524
|
+
const val = _17.get(values, name);
|
|
525
525
|
return /* @__PURE__ */ jsxs(
|
|
526
526
|
FormControl,
|
|
527
527
|
{
|
|
@@ -644,8 +644,8 @@ function AppSwitchInput({
|
|
|
644
644
|
...otherProps
|
|
645
645
|
}) {
|
|
646
646
|
const { errors, touched, setFieldValue, values } = useFormikContext();
|
|
647
|
-
const fieldError =
|
|
648
|
-
const isTouched =
|
|
647
|
+
const fieldError = _17.get(errors, name);
|
|
648
|
+
const isTouched = _17.get(touched, name);
|
|
649
649
|
return /* @__PURE__ */ jsxs(
|
|
650
650
|
Box,
|
|
651
651
|
{
|
|
@@ -743,9 +743,9 @@ function AppSwitch({
|
|
|
743
743
|
...otherProps
|
|
744
744
|
}) {
|
|
745
745
|
const { errors, touched, setFieldValue, values } = useFormikContext();
|
|
746
|
-
const fieldValue =
|
|
747
|
-
const fieldError =
|
|
748
|
-
const isTouched =
|
|
746
|
+
const fieldValue = _17.get(values, name);
|
|
747
|
+
const fieldError = _17.get(errors, name);
|
|
748
|
+
const isTouched = _17.get(touched, name);
|
|
749
749
|
return /* @__PURE__ */ jsxs(
|
|
750
750
|
Stack,
|
|
751
751
|
{
|
|
@@ -851,9 +851,9 @@ function AppAutoComplete({
|
|
|
851
851
|
errorSx
|
|
852
852
|
}) {
|
|
853
853
|
const { errors, touched, getFieldProps, values, setFieldValue } = useFormikContext();
|
|
854
|
-
const fieldError =
|
|
855
|
-
const isTouched =
|
|
856
|
-
const formikValue =
|
|
854
|
+
const fieldError = _17.get(errors, name);
|
|
855
|
+
const isTouched = _17.get(touched, name);
|
|
856
|
+
const formikValue = _17.get(values, name);
|
|
857
857
|
const val = propValue !== void 0 ? propValue : formikValue || [];
|
|
858
858
|
return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
|
|
859
859
|
/* @__PURE__ */ jsx(
|
|
@@ -925,9 +925,9 @@ function AppAutoCompleter({
|
|
|
925
925
|
errorSx
|
|
926
926
|
}) {
|
|
927
927
|
const { errors, touched, values, setFieldValue } = useFormikContext();
|
|
928
|
-
const fieldError =
|
|
929
|
-
const isTouched =
|
|
930
|
-
const value =
|
|
928
|
+
const fieldError = _17.get(errors, name);
|
|
929
|
+
const isTouched = _17.get(touched, name);
|
|
930
|
+
const value = _17.get(values, name);
|
|
931
931
|
const selectedOption = options.find((opt) => opt.value === value) || null;
|
|
932
932
|
return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
|
|
933
933
|
/* @__PURE__ */ jsx(
|
|
@@ -939,7 +939,7 @@ function AppAutoCompleter({
|
|
|
939
939
|
getOptionLabel: (option) => (option == null ? void 0 : option.label) || "",
|
|
940
940
|
isOptionEqualToValue: (option, value2) => option.value === value2.value,
|
|
941
941
|
autoHighlight: true,
|
|
942
|
-
onChange: (
|
|
942
|
+
onChange: (_18, newValue) => {
|
|
943
943
|
setFieldValue(name, newValue ? newValue.value : null);
|
|
944
944
|
},
|
|
945
945
|
renderOption: (props, option) => /* @__PURE__ */ createElement(Box, { component: "li", ...props, key: option.value, sx: listboxSx }, option.label),
|
|
@@ -990,8 +990,8 @@ var AppCheckBox = ({
|
|
|
990
990
|
...rest
|
|
991
991
|
}) => {
|
|
992
992
|
const { getFieldProps, setFieldValue, touched, errors } = useFormikContext();
|
|
993
|
-
const fieldError =
|
|
994
|
-
const isTouched =
|
|
993
|
+
const fieldError = _17.get(errors, name);
|
|
994
|
+
const isTouched = _17.get(touched, name);
|
|
995
995
|
useTheme();
|
|
996
996
|
const value = getFieldProps(name).value;
|
|
997
997
|
const checkedValues = (() => {
|
|
@@ -1154,8 +1154,8 @@ function AppInputField({
|
|
|
1154
1154
|
...otherProps
|
|
1155
1155
|
}) {
|
|
1156
1156
|
const { errors, getFieldProps, touched } = useFormikContext();
|
|
1157
|
-
const fieldError =
|
|
1158
|
-
const isTouched =
|
|
1157
|
+
const fieldError = _17.get(errors, name);
|
|
1158
|
+
const isTouched = _17.get(touched, name);
|
|
1159
1159
|
const [showPassword, setShowPassword] = useState(false);
|
|
1160
1160
|
const handleShowPassword = () => {
|
|
1161
1161
|
setShowPassword(!showPassword);
|
|
@@ -1240,10 +1240,10 @@ var AppMultiSelector = forwardRef(
|
|
|
1240
1240
|
}, ref) => {
|
|
1241
1241
|
const theme = useTheme();
|
|
1242
1242
|
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
1243
|
-
const fieldError =
|
|
1244
|
-
const isTouched = Boolean(
|
|
1243
|
+
const fieldError = _17.get(errors, name);
|
|
1244
|
+
const isTouched = Boolean(_17.get(touched, name));
|
|
1245
1245
|
const hasError = Boolean(fieldError) && isTouched;
|
|
1246
|
-
const currentValue =
|
|
1246
|
+
const currentValue = _17.get(values, name);
|
|
1247
1247
|
const selectedValues = Array.isArray(currentValue) ? currentValue : [];
|
|
1248
1248
|
const selectedCount = selectedValues.length;
|
|
1249
1249
|
const isMaxReached = maxSelections ? selectedCount >= maxSelections : false;
|
|
@@ -1282,10 +1282,7 @@ var AppMultiSelector = forwardRef(
|
|
|
1282
1282
|
return options2;
|
|
1283
1283
|
const inputValueLower = inputValue.toLowerCase();
|
|
1284
1284
|
return options2.filter(
|
|
1285
|
-
(option) =>
|
|
1286
|
-
var _a, _b, _c;
|
|
1287
|
-
return option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower) || ((_a = option.searchAbleValue1) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || ((_b = option.searchAbleValue2) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option.searchAbleValue3) == null ? void 0 : _c.toLowerCase().includes(inputValueLower));
|
|
1288
|
-
}
|
|
1285
|
+
(option) => option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower)
|
|
1289
1286
|
);
|
|
1290
1287
|
};
|
|
1291
1288
|
const selectedOptions = getSelectedOptions();
|
|
@@ -1346,28 +1343,31 @@ var AppMultiSelector = forwardRef(
|
|
|
1346
1343
|
}
|
|
1347
1344
|
}
|
|
1348
1345
|
),
|
|
1349
|
-
renderOption: (props, option, { selected }) =>
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1346
|
+
renderOption: (props, option, { selected }) => {
|
|
1347
|
+
const { key, ...restProps } = props;
|
|
1348
|
+
return /* @__PURE__ */ jsxs("li", { ...restProps, children: [
|
|
1349
|
+
/* @__PURE__ */ jsx(
|
|
1350
|
+
Checkbox,
|
|
1351
|
+
{
|
|
1352
|
+
checked: selected,
|
|
1353
|
+
disabled: option.disabled || isMaxReached && !selected,
|
|
1354
|
+
sx: checkboxSx
|
|
1355
|
+
}
|
|
1356
|
+
),
|
|
1357
|
+
option.icon,
|
|
1358
|
+
/* @__PURE__ */ jsx(
|
|
1359
|
+
Typography,
|
|
1360
|
+
{
|
|
1361
|
+
variant: "body2",
|
|
1362
|
+
sx: {
|
|
1363
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
1364
|
+
...option.textSx
|
|
1365
|
+
},
|
|
1366
|
+
children: option.label
|
|
1367
|
+
}
|
|
1368
|
+
)
|
|
1369
|
+
] }, key);
|
|
1370
|
+
},
|
|
1371
1371
|
renderTags: (value, getTagProps) => /* @__PURE__ */ jsx(
|
|
1372
1372
|
Box,
|
|
1373
1373
|
{
|
|
@@ -1550,8 +1550,8 @@ var AppPhoneNoInput = ({
|
|
|
1550
1550
|
withCountryCallingCode = true
|
|
1551
1551
|
}) => {
|
|
1552
1552
|
const { values, errors, touched, setFieldValue, setFieldTouched } = useFormikContext();
|
|
1553
|
-
const fieldError = useMemo(() =>
|
|
1554
|
-
const isTouched = useMemo(() =>
|
|
1553
|
+
const fieldError = useMemo(() => _17.get(errors, name), [errors, name]);
|
|
1554
|
+
const isTouched = useMemo(() => _17.get(touched, name), [touched, name]);
|
|
1555
1555
|
return /* @__PURE__ */ jsxs(
|
|
1556
1556
|
Box,
|
|
1557
1557
|
{
|
|
@@ -1661,9 +1661,9 @@ var AppRadioGroup = forwardRef(({
|
|
|
1661
1661
|
...rest
|
|
1662
1662
|
}, ref) => {
|
|
1663
1663
|
const { errors, touched, getFieldProps, setFieldValue } = useFormikContext();
|
|
1664
|
-
const fieldError =
|
|
1665
|
-
const isTouched =
|
|
1666
|
-
const value =
|
|
1664
|
+
const fieldError = _17.get(errors, name);
|
|
1665
|
+
const isTouched = _17.get(touched, name);
|
|
1666
|
+
const value = _17.get(getFieldProps(name), "value");
|
|
1667
1667
|
const handleChange = (event) => {
|
|
1668
1668
|
const newValue = event.target.value;
|
|
1669
1669
|
setFieldValue(name, newValue);
|
|
@@ -1842,9 +1842,9 @@ var AppRating = forwardRef(
|
|
|
1842
1842
|
}, ref) => {
|
|
1843
1843
|
useTheme();
|
|
1844
1844
|
const { errors, touched, setFieldValue, values, setFieldTouched } = useFormikContext();
|
|
1845
|
-
const val =
|
|
1846
|
-
const fieldError =
|
|
1847
|
-
const isTouched =
|
|
1845
|
+
const val = _17.get(values, name);
|
|
1846
|
+
const fieldError = _17.get(errors, name);
|
|
1847
|
+
const isTouched = _17.get(touched, name);
|
|
1848
1848
|
const hasError = Boolean(fieldError) && isTouched;
|
|
1849
1849
|
const handleChange = (event, newValue) => {
|
|
1850
1850
|
setFieldValue(name, newValue);
|
|
@@ -2586,7 +2586,7 @@ var Mark = class {
|
|
|
2586
2586
|
*/
|
|
2587
2587
|
toJSON() {
|
|
2588
2588
|
let obj = { type: this.type.name };
|
|
2589
|
-
for (let
|
|
2589
|
+
for (let _18 in this.attrs) {
|
|
2590
2590
|
obj.attrs = this.attrs;
|
|
2591
2591
|
break;
|
|
2592
2592
|
}
|
|
@@ -3534,7 +3534,7 @@ var Node = class {
|
|
|
3534
3534
|
*/
|
|
3535
3535
|
toJSON() {
|
|
3536
3536
|
let obj = { type: this.type.name };
|
|
3537
|
-
for (let
|
|
3537
|
+
for (let _18 in this.attrs) {
|
|
3538
3538
|
obj.attrs = this.attrs;
|
|
3539
3539
|
break;
|
|
3540
3540
|
}
|
|
@@ -4263,7 +4263,7 @@ var NodeType = class {
|
|
|
4263
4263
|
throw new RangeError("Schema is missing its top node type ('" + topType + "')");
|
|
4264
4264
|
if (!result.text)
|
|
4265
4265
|
throw new RangeError("Every schema needs a 'text' type");
|
|
4266
|
-
for (let
|
|
4266
|
+
for (let _18 in result.text.attrs)
|
|
4267
4267
|
throw new RangeError("The text node type should not have attributes");
|
|
4268
4268
|
return result;
|
|
4269
4269
|
}
|
|
@@ -9272,7 +9272,7 @@ function removeDuplicates(array, by = JSON.stringify) {
|
|
|
9272
9272
|
function simplifyChangedRanges(changes) {
|
|
9273
9273
|
const uniqueChanges = removeDuplicates(changes);
|
|
9274
9274
|
return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
|
|
9275
|
-
const rest = uniqueChanges.filter((
|
|
9275
|
+
const rest = uniqueChanges.filter((_18, i) => i !== index);
|
|
9276
9276
|
return !rest.some((otherChange) => {
|
|
9277
9277
|
return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;
|
|
9278
9278
|
});
|
|
@@ -10297,7 +10297,7 @@ var Drop = Extension.create({
|
|
|
10297
10297
|
new Plugin({
|
|
10298
10298
|
key: new PluginKey("tiptapDrop"),
|
|
10299
10299
|
props: {
|
|
10300
|
-
handleDrop: (
|
|
10300
|
+
handleDrop: (_18, e, slice, moved) => {
|
|
10301
10301
|
this.editor.emit("drop", {
|
|
10302
10302
|
editor: this.editor,
|
|
10303
10303
|
event: e,
|
|
@@ -11463,541 +11463,6 @@ var AppRichTextEditor = ({
|
|
|
11463
11463
|
] });
|
|
11464
11464
|
};
|
|
11465
11465
|
var AppRichTextEditor_default = AppRichTextEditor;
|
|
11466
|
-
var AppSearchableMultiSelector = forwardRef(
|
|
11467
|
-
({
|
|
11468
|
-
name,
|
|
11469
|
-
label,
|
|
11470
|
-
multiple = true,
|
|
11471
|
-
options = [],
|
|
11472
|
-
setSearchQuery,
|
|
11473
|
-
required = false,
|
|
11474
|
-
variant = "outlined",
|
|
11475
|
-
disabled = false,
|
|
11476
|
-
readOnly = false,
|
|
11477
|
-
showHelperText = false,
|
|
11478
|
-
helperText,
|
|
11479
|
-
maxSelections,
|
|
11480
|
-
showSelectedCount = false,
|
|
11481
|
-
sx,
|
|
11482
|
-
formControlSx,
|
|
11483
|
-
labelSx,
|
|
11484
|
-
inputSx,
|
|
11485
|
-
textFieldSx,
|
|
11486
|
-
autocompleteSx,
|
|
11487
|
-
listboxSx,
|
|
11488
|
-
optionSx,
|
|
11489
|
-
chipSx,
|
|
11490
|
-
errorSx,
|
|
11491
|
-
helperTextSx,
|
|
11492
|
-
selectedCountSx,
|
|
11493
|
-
renderInput: externalRenderInput,
|
|
11494
|
-
renderOption: externalRenderOption,
|
|
11495
|
-
renderTags: externalRenderTags,
|
|
11496
|
-
renderGroup: externalRenderGroup,
|
|
11497
|
-
labelComponent: LabelComponent = InputLabel,
|
|
11498
|
-
inputComponent: InputComponent = "input",
|
|
11499
|
-
errorComponent: ErrorComponent = Typography,
|
|
11500
|
-
helperTextComponent: HelperTextComponent = FormHelperText,
|
|
11501
|
-
labelProps = {},
|
|
11502
|
-
inputProps = {},
|
|
11503
|
-
textFieldProps = {},
|
|
11504
|
-
autocompleteProps = {},
|
|
11505
|
-
checkboxProps = {},
|
|
11506
|
-
chipProps = {},
|
|
11507
|
-
errorProps = {},
|
|
11508
|
-
helperTextProps = {},
|
|
11509
|
-
className = "",
|
|
11510
|
-
formControlClassName = "",
|
|
11511
|
-
labelClassName = "",
|
|
11512
|
-
inputClassName = "",
|
|
11513
|
-
textFieldClassName = "",
|
|
11514
|
-
autocompleteClassName = "",
|
|
11515
|
-
listboxClassName = "",
|
|
11516
|
-
optionClassName = "",
|
|
11517
|
-
chipClassName = "",
|
|
11518
|
-
errorClassName = "",
|
|
11519
|
-
helperTextClassName = "",
|
|
11520
|
-
onInputChange: externalOnInputChange,
|
|
11521
|
-
onChange: externalOnChange,
|
|
11522
|
-
onOpen,
|
|
11523
|
-
onClose,
|
|
11524
|
-
onBlur: externalOnBlur,
|
|
11525
|
-
onFocus: externalOnFocus,
|
|
11526
|
-
onClear,
|
|
11527
|
-
onMaxSelectionsReached,
|
|
11528
|
-
onRemove,
|
|
11529
|
-
onAdd,
|
|
11530
|
-
...otherProps
|
|
11531
|
-
}, ref) => {
|
|
11532
|
-
useTheme();
|
|
11533
|
-
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
11534
|
-
const fieldError = _19.get(errors, name);
|
|
11535
|
-
const isTouched = Boolean(_19.get(touched, name));
|
|
11536
|
-
const hasError = Boolean(fieldError) && isTouched;
|
|
11537
|
-
const val = _19.get(values, name);
|
|
11538
|
-
const selectedValues = Array.isArray(val) ? val : [];
|
|
11539
|
-
const selectedCount = selectedValues.length;
|
|
11540
|
-
const handleChange = (event, value, reason, details) => {
|
|
11541
|
-
const normalizedValue = (() => {
|
|
11542
|
-
if (value === null)
|
|
11543
|
-
return [];
|
|
11544
|
-
const arr = Array.isArray(value) ? value : [value];
|
|
11545
|
-
return arr.map(
|
|
11546
|
-
(item) => typeof item === "string" ? { value: item, label: item } : item
|
|
11547
|
-
);
|
|
11548
|
-
})();
|
|
11549
|
-
if (maxSelections && normalizedValue.length > maxSelections) {
|
|
11550
|
-
if (onMaxSelectionsReached) {
|
|
11551
|
-
onMaxSelectionsReached(maxSelections);
|
|
11552
|
-
}
|
|
11553
|
-
return;
|
|
11554
|
-
}
|
|
11555
|
-
if (reason === "selectOption" || reason === "removeOption") {
|
|
11556
|
-
const added = normalizedValue.filter(
|
|
11557
|
-
(item) => !selectedValues.some((v) => v.value === item.value)
|
|
11558
|
-
);
|
|
11559
|
-
const removed = selectedValues.filter(
|
|
11560
|
-
(item) => !normalizedValue.some((v) => v.value === item.value)
|
|
11561
|
-
);
|
|
11562
|
-
if (added.length > 0 && onAdd) {
|
|
11563
|
-
added.forEach((item) => onAdd(item));
|
|
11564
|
-
}
|
|
11565
|
-
if (removed.length > 0 && onRemove) {
|
|
11566
|
-
removed.forEach((item) => onRemove(item));
|
|
11567
|
-
}
|
|
11568
|
-
}
|
|
11569
|
-
setFieldValue(name, normalizedValue, true);
|
|
11570
|
-
if (externalOnChange) {
|
|
11571
|
-
externalOnChange(event, normalizedValue, reason);
|
|
11572
|
-
}
|
|
11573
|
-
};
|
|
11574
|
-
const handleInputChange = (event, value, reason) => {
|
|
11575
|
-
if (setSearchQuery) {
|
|
11576
|
-
setSearchQuery(value);
|
|
11577
|
-
}
|
|
11578
|
-
if (externalOnInputChange) {
|
|
11579
|
-
externalOnInputChange(event, value, reason);
|
|
11580
|
-
}
|
|
11581
|
-
};
|
|
11582
|
-
const handleBlur = (event) => {
|
|
11583
|
-
setFieldTouched(name, true, true);
|
|
11584
|
-
if (externalOnBlur) {
|
|
11585
|
-
externalOnBlur(event);
|
|
11586
|
-
}
|
|
11587
|
-
};
|
|
11588
|
-
const handleFocus = (event) => {
|
|
11589
|
-
if (externalOnFocus) {
|
|
11590
|
-
externalOnFocus(event);
|
|
11591
|
-
}
|
|
11592
|
-
};
|
|
11593
|
-
const filterOptions = (options2, { inputValue }) => {
|
|
11594
|
-
if (!inputValue)
|
|
11595
|
-
return options2;
|
|
11596
|
-
const inputValueLower = inputValue.toLowerCase();
|
|
11597
|
-
return options2.filter(
|
|
11598
|
-
(option) => {
|
|
11599
|
-
var _a, _b, _c, _d;
|
|
11600
|
-
return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || String(option.value).toLowerCase().includes(inputValueLower) || ((_b = option == null ? void 0 : option.searchAbleValue1) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option == null ? void 0 : option.searchAbleValue2) == null ? void 0 : _c.toLowerCase().includes(inputValueLower)) || ((_d = option == null ? void 0 : option.searchAbleValue3) == null ? void 0 : _d.toLowerCase().includes(inputValueLower));
|
|
11601
|
-
}
|
|
11602
|
-
);
|
|
11603
|
-
};
|
|
11604
|
-
const defaultRenderInput = (params) => /* @__PURE__ */ jsx(
|
|
11605
|
-
TextField,
|
|
11606
|
-
{
|
|
11607
|
-
...params,
|
|
11608
|
-
variant,
|
|
11609
|
-
error: hasError,
|
|
11610
|
-
helperText: "",
|
|
11611
|
-
placeholder: "",
|
|
11612
|
-
inputRef: inputProps.ref,
|
|
11613
|
-
inputProps: {
|
|
11614
|
-
...params.inputProps,
|
|
11615
|
-
...inputProps,
|
|
11616
|
-
className: `${params.inputProps.className || ""} ${inputClassName}`.trim()
|
|
11617
|
-
},
|
|
11618
|
-
InputProps: {
|
|
11619
|
-
...params.InputProps,
|
|
11620
|
-
...textFieldProps.InputProps,
|
|
11621
|
-
className: `${params.InputProps.className || ""} ${textFieldClassName}`.trim()
|
|
11622
|
-
},
|
|
11623
|
-
sx: [
|
|
11624
|
-
{
|
|
11625
|
-
"& .MuiOutlinedInput-root": {
|
|
11626
|
-
borderRadius: "8px",
|
|
11627
|
-
"& fieldset": {
|
|
11628
|
-
borderColor: hasError ? "error.main" : "divider"
|
|
11629
|
-
},
|
|
11630
|
-
"&:hover fieldset": {
|
|
11631
|
-
borderColor: hasError ? "error.main" : "text.primary"
|
|
11632
|
-
},
|
|
11633
|
-
"&.Mui-focused fieldset": {
|
|
11634
|
-
borderColor: hasError ? "error.main" : "primary.main"
|
|
11635
|
-
},
|
|
11636
|
-
"& .MuiInputLabel-root": {
|
|
11637
|
-
// Your label styles here
|
|
11638
|
-
}
|
|
11639
|
-
}
|
|
11640
|
-
},
|
|
11641
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
11642
|
-
],
|
|
11643
|
-
...textFieldProps
|
|
11644
|
-
}
|
|
11645
|
-
);
|
|
11646
|
-
const defaultRenderOption = (props, option, { selected }) => /* @__PURE__ */ createElement(
|
|
11647
|
-
"li",
|
|
11648
|
-
{
|
|
11649
|
-
...props,
|
|
11650
|
-
key: option.value,
|
|
11651
|
-
className: `${props.className || ""} ${optionClassName}`.trim(),
|
|
11652
|
-
style: {
|
|
11653
|
-
...props.style,
|
|
11654
|
-
opacity: option.disabled ? 0.5 : 1,
|
|
11655
|
-
pointerEvents: option.disabled ? "none" : "auto"
|
|
11656
|
-
}
|
|
11657
|
-
},
|
|
11658
|
-
/* @__PURE__ */ jsx(
|
|
11659
|
-
Checkbox,
|
|
11660
|
-
{
|
|
11661
|
-
checked: selected,
|
|
11662
|
-
disabled: option.disabled,
|
|
11663
|
-
sx: {
|
|
11664
|
-
color: "text.secondary",
|
|
11665
|
-
"&.Mui-checked": {
|
|
11666
|
-
color: "primary.main"
|
|
11667
|
-
},
|
|
11668
|
-
"&.Mui-disabled": {
|
|
11669
|
-
color: "text.disabled"
|
|
11670
|
-
},
|
|
11671
|
-
mr: 1,
|
|
11672
|
-
...checkboxProps.sx
|
|
11673
|
-
},
|
|
11674
|
-
...checkboxProps
|
|
11675
|
-
}
|
|
11676
|
-
),
|
|
11677
|
-
option.icon && /* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
|
|
11678
|
-
/* @__PURE__ */ jsx(
|
|
11679
|
-
Typography,
|
|
11680
|
-
{
|
|
11681
|
-
variant: "body2",
|
|
11682
|
-
sx: [
|
|
11683
|
-
{
|
|
11684
|
-
color: option.disabled ? "text.disabled" : "text.primary",
|
|
11685
|
-
...option.textSx
|
|
11686
|
-
},
|
|
11687
|
-
...Array.isArray(optionSx) ? optionSx : [optionSx]
|
|
11688
|
-
],
|
|
11689
|
-
children: option.label
|
|
11690
|
-
}
|
|
11691
|
-
)
|
|
11692
|
-
);
|
|
11693
|
-
const defaultRenderTags = (value, getTagProps) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 }, children: value.map((option, index) => {
|
|
11694
|
-
const { key, ...tagProps } = getTagProps({ index });
|
|
11695
|
-
return /* @__PURE__ */ createElement(
|
|
11696
|
-
Chip,
|
|
11697
|
-
{
|
|
11698
|
-
...tagProps,
|
|
11699
|
-
key: option.value,
|
|
11700
|
-
label: option.label,
|
|
11701
|
-
disabled: disabled || option.disabled,
|
|
11702
|
-
sx: [
|
|
11703
|
-
{
|
|
11704
|
-
height: "24px",
|
|
11705
|
-
borderRadius: "4px",
|
|
11706
|
-
"& .MuiChip-deleteIcon": {
|
|
11707
|
-
color: "text.secondary",
|
|
11708
|
-
"&:hover": {
|
|
11709
|
-
color: "text.primary"
|
|
11710
|
-
}
|
|
11711
|
-
},
|
|
11712
|
-
...chipSx
|
|
11713
|
-
},
|
|
11714
|
-
...Array.isArray(chipSx) ? chipSx : [chipSx]
|
|
11715
|
-
],
|
|
11716
|
-
className: `${chipClassName} ${option.disabled ? "Mui-disabled" : ""}`.trim(),
|
|
11717
|
-
...chipProps
|
|
11718
|
-
}
|
|
11719
|
-
);
|
|
11720
|
-
}) });
|
|
11721
|
-
const renderSelectedCount = () => {
|
|
11722
|
-
if (!showSelectedCount || !multiple)
|
|
11723
|
-
return null;
|
|
11724
|
-
return /* @__PURE__ */ jsxs(
|
|
11725
|
-
Typography,
|
|
11726
|
-
{
|
|
11727
|
-
variant: "caption",
|
|
11728
|
-
sx: [
|
|
11729
|
-
{
|
|
11730
|
-
mt: 0.5,
|
|
11731
|
-
color: "text.secondary",
|
|
11732
|
-
...selectedCountSx
|
|
11733
|
-
},
|
|
11734
|
-
...Array.isArray(selectedCountSx) ? selectedCountSx : [selectedCountSx]
|
|
11735
|
-
],
|
|
11736
|
-
children: [
|
|
11737
|
-
`${selectedCount} selected`,
|
|
11738
|
-
maxSelections ? ` (max ${maxSelections})` : ""
|
|
11739
|
-
]
|
|
11740
|
-
}
|
|
11741
|
-
);
|
|
11742
|
-
};
|
|
11743
|
-
return /* @__PURE__ */ jsx(
|
|
11744
|
-
Box,
|
|
11745
|
-
{
|
|
11746
|
-
ref,
|
|
11747
|
-
className: `app-searchable-multi-selector ${className}`.trim(),
|
|
11748
|
-
sx: [
|
|
11749
|
-
{
|
|
11750
|
-
width: "100%"
|
|
11751
|
-
},
|
|
11752
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
11753
|
-
],
|
|
11754
|
-
children: /* @__PURE__ */ jsxs(
|
|
11755
|
-
FormControl,
|
|
11756
|
-
{
|
|
11757
|
-
fullWidth: true,
|
|
11758
|
-
error: hasError,
|
|
11759
|
-
disabled,
|
|
11760
|
-
className: `app-searchable-multi-selector-form-control ${formControlClassName}`.trim(),
|
|
11761
|
-
sx: [
|
|
11762
|
-
{
|
|
11763
|
-
"& .MuiAutocomplete-root": {
|
|
11764
|
-
"& .MuiOutlinedInput-root": {
|
|
11765
|
-
padding: "4px"
|
|
11766
|
-
},
|
|
11767
|
-
"& .MuiAutocomplete-input": {
|
|
11768
|
-
padding: "8.5px 4px"
|
|
11769
|
-
}
|
|
11770
|
-
}
|
|
11771
|
-
},
|
|
11772
|
-
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
11773
|
-
],
|
|
11774
|
-
children: [
|
|
11775
|
-
label && /* @__PURE__ */ jsxs(
|
|
11776
|
-
LabelComponent,
|
|
11777
|
-
{
|
|
11778
|
-
shrink: true,
|
|
11779
|
-
htmlFor: `autocomplete-${name}`,
|
|
11780
|
-
className: `app-searchable-multi-selector-label ${labelClassName}`.trim(),
|
|
11781
|
-
sx: [
|
|
11782
|
-
{
|
|
11783
|
-
mb: 1,
|
|
11784
|
-
color: hasError ? "error.main" : "text.primary",
|
|
11785
|
-
"&.Mui-focused": {
|
|
11786
|
-
color: hasError ? "error.main" : "primary.main"
|
|
11787
|
-
},
|
|
11788
|
-
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
11789
|
-
}
|
|
11790
|
-
],
|
|
11791
|
-
...labelProps,
|
|
11792
|
-
children: [
|
|
11793
|
-
label,
|
|
11794
|
-
required && /* @__PURE__ */ jsx(
|
|
11795
|
-
Box,
|
|
11796
|
-
{
|
|
11797
|
-
component: "span",
|
|
11798
|
-
sx: {
|
|
11799
|
-
color: "error.main",
|
|
11800
|
-
ml: 0.5
|
|
11801
|
-
},
|
|
11802
|
-
children: "*"
|
|
11803
|
-
}
|
|
11804
|
-
)
|
|
11805
|
-
]
|
|
11806
|
-
}
|
|
11807
|
-
),
|
|
11808
|
-
/* @__PURE__ */ jsx(
|
|
11809
|
-
Autocomplete,
|
|
11810
|
-
{
|
|
11811
|
-
multiple,
|
|
11812
|
-
id: `autocomplete-${name}`,
|
|
11813
|
-
options,
|
|
11814
|
-
value: selectedValues,
|
|
11815
|
-
filterOptions,
|
|
11816
|
-
onInputChange: handleInputChange,
|
|
11817
|
-
onChange: handleChange,
|
|
11818
|
-
onOpen,
|
|
11819
|
-
onClose,
|
|
11820
|
-
onBlur: handleBlur,
|
|
11821
|
-
onFocus: handleFocus,
|
|
11822
|
-
disableCloseOnSelect: multiple,
|
|
11823
|
-
readOnly,
|
|
11824
|
-
disabled,
|
|
11825
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
11826
|
-
getOptionLabel: (option) => typeof option === "string" ? option : option.label,
|
|
11827
|
-
getOptionDisabled: (option) => !!option.disabled,
|
|
11828
|
-
renderInput: externalRenderInput || defaultRenderInput,
|
|
11829
|
-
renderOption: externalRenderOption || defaultRenderOption,
|
|
11830
|
-
renderTags: externalRenderTags || defaultRenderTags,
|
|
11831
|
-
renderGroup: externalRenderGroup,
|
|
11832
|
-
ListboxProps: {
|
|
11833
|
-
className: `app-searchable-multi-selector-listbox ${listboxClassName}`.trim(),
|
|
11834
|
-
sx: {
|
|
11835
|
-
"& .MuiAutocomplete-option": {
|
|
11836
|
-
px: 2,
|
|
11837
|
-
py: 1,
|
|
11838
|
-
'&[aria-selected="true"]': {
|
|
11839
|
-
backgroundColor: "action.selected",
|
|
11840
|
-
"&.Mui-focused": {
|
|
11841
|
-
backgroundColor: "action.hover"
|
|
11842
|
-
}
|
|
11843
|
-
},
|
|
11844
|
-
"&.Mui-focused": {
|
|
11845
|
-
backgroundColor: "action.hover"
|
|
11846
|
-
}
|
|
11847
|
-
},
|
|
11848
|
-
...Array.isArray(optionSx) ? optionSx : optionSx ? [optionSx] : [],
|
|
11849
|
-
...Array.isArray(listboxSx) ? listboxSx : listboxSx ? [listboxSx] : []
|
|
11850
|
-
}
|
|
11851
|
-
},
|
|
11852
|
-
className: `app-searchable-multi-selector-autocomplete ${autocompleteClassName}`.trim(),
|
|
11853
|
-
sx: [
|
|
11854
|
-
{
|
|
11855
|
-
"& .MuiAutocomplete-tag": {
|
|
11856
|
-
margin: 0,
|
|
11857
|
-
height: "auto"
|
|
11858
|
-
},
|
|
11859
|
-
"& .MuiAutocomplete-endAdornment": {
|
|
11860
|
-
right: 8
|
|
11861
|
-
}
|
|
11862
|
-
},
|
|
11863
|
-
...Array.isArray(autocompleteSx) ? autocompleteSx : autocompleteSx ? [autocompleteSx] : []
|
|
11864
|
-
],
|
|
11865
|
-
...autocompleteProps,
|
|
11866
|
-
...otherProps
|
|
11867
|
-
}
|
|
11868
|
-
),
|
|
11869
|
-
(showHelperText || hasError) && /* @__PURE__ */ jsx(
|
|
11870
|
-
HelperTextComponent,
|
|
11871
|
-
{
|
|
11872
|
-
error: hasError,
|
|
11873
|
-
sx: [
|
|
11874
|
-
{
|
|
11875
|
-
mx: 0,
|
|
11876
|
-
mt: 0.5,
|
|
11877
|
-
...hasError ? {
|
|
11878
|
-
color: "error.main",
|
|
11879
|
-
...errorSx
|
|
11880
|
-
} : {
|
|
11881
|
-
color: "text.secondary",
|
|
11882
|
-
...helperTextSx
|
|
11883
|
-
}
|
|
11884
|
-
}
|
|
11885
|
-
],
|
|
11886
|
-
className: `app-searchable-multi-selector-helper-text ${helperTextClassName} ${hasError ? "Mui-error" : ""}`.trim(),
|
|
11887
|
-
...helperTextProps,
|
|
11888
|
-
children: hasError ? fieldError : helperText
|
|
11889
|
-
}
|
|
11890
|
-
),
|
|
11891
|
-
renderSelectedCount()
|
|
11892
|
-
]
|
|
11893
|
-
}
|
|
11894
|
-
)
|
|
11895
|
-
}
|
|
11896
|
-
);
|
|
11897
|
-
}
|
|
11898
|
-
);
|
|
11899
|
-
AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
|
|
11900
|
-
var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
|
|
11901
|
-
function AppSearchableSelectInput({
|
|
11902
|
-
name,
|
|
11903
|
-
label,
|
|
11904
|
-
options = [],
|
|
11905
|
-
required = false,
|
|
11906
|
-
variant = "outlined",
|
|
11907
|
-
placeholder,
|
|
11908
|
-
setSearchQuery,
|
|
11909
|
-
isResetRequired,
|
|
11910
|
-
...otherProps
|
|
11911
|
-
}) {
|
|
11912
|
-
const { errors, touched, setFieldValue, values } = useFormikContext();
|
|
11913
|
-
const fieldError = _19.get(errors, name);
|
|
11914
|
-
const isTouched = _19.get(touched, name);
|
|
11915
|
-
const val = _19.get(values, name);
|
|
11916
|
-
const selectedOption = options.find((option) => option.value === val) || null;
|
|
11917
|
-
const handleChange = (event, newValue) => {
|
|
11918
|
-
setFieldValue(name, newValue ? newValue.value : "");
|
|
11919
|
-
};
|
|
11920
|
-
const handleSearchChange = (event) => {
|
|
11921
|
-
const { value } = event.target;
|
|
11922
|
-
if (setSearchQuery) {
|
|
11923
|
-
setSearchQuery(value);
|
|
11924
|
-
}
|
|
11925
|
-
};
|
|
11926
|
-
return /* @__PURE__ */ jsx(
|
|
11927
|
-
FormControl,
|
|
11928
|
-
{
|
|
11929
|
-
fullWidth: true,
|
|
11930
|
-
variant,
|
|
11931
|
-
error: isTouched && Boolean(fieldError),
|
|
11932
|
-
sx: {
|
|
11933
|
-
padding: "0px !important",
|
|
11934
|
-
".MuiAutocomplete-endAdornment": { right: "0 !important" },
|
|
11935
|
-
".MuiInputBase-root": {
|
|
11936
|
-
padding: "0px !important",
|
|
11937
|
-
pr: "39px !important",
|
|
11938
|
-
pl: "10px !important"
|
|
11939
|
-
},
|
|
11940
|
-
".MuiOutlinedInput-root": {
|
|
11941
|
-
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
11942
|
-
}
|
|
11943
|
-
},
|
|
11944
|
-
children: /* @__PURE__ */ jsx(
|
|
11945
|
-
Autocomplete,
|
|
11946
|
-
{
|
|
11947
|
-
options,
|
|
11948
|
-
getOptionLabel: (option) => option.label || String(option.value),
|
|
11949
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
11950
|
-
value: selectedOption,
|
|
11951
|
-
onChange: handleChange,
|
|
11952
|
-
filterOptions: (options2, { inputValue }) => {
|
|
11953
|
-
return options2.filter(
|
|
11954
|
-
(option) => {
|
|
11955
|
-
var _a, _b, _c, _d;
|
|
11956
|
-
return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().includes(inputValue.toLowerCase())) || String(option.value).toLowerCase().includes(inputValue.toLowerCase()) || ((_b = option == null ? void 0 : option.searchAbleValue1) == null ? void 0 : _b.toLowerCase().includes(inputValue.toLowerCase())) || ((_c = option == null ? void 0 : option.searchAbleValue2) == null ? void 0 : _c.toLowerCase().includes(inputValue.toLowerCase())) || ((_d = option == null ? void 0 : option.searchAbleValue3) == null ? void 0 : _d.toLowerCase().includes(inputValue.toLowerCase()));
|
|
11957
|
-
}
|
|
11958
|
-
);
|
|
11959
|
-
},
|
|
11960
|
-
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
11961
|
-
TextField,
|
|
11962
|
-
{
|
|
11963
|
-
...params,
|
|
11964
|
-
onChange: handleSearchChange,
|
|
11965
|
-
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11966
|
-
label,
|
|
11967
|
-
required && /* @__PURE__ */ jsx(Typography, { sx: { color: "red" }, component: "span", children: " *" })
|
|
11968
|
-
] }),
|
|
11969
|
-
variant,
|
|
11970
|
-
placeholder,
|
|
11971
|
-
error: Boolean(fieldError) && isTouched,
|
|
11972
|
-
helperText: isTouched && fieldError ? fieldError : "",
|
|
11973
|
-
FormHelperTextProps: {
|
|
11974
|
-
sx: { color: "#FF5630" }
|
|
11975
|
-
},
|
|
11976
|
-
sx: {
|
|
11977
|
-
"& .MuiInputLabel-root": {
|
|
11978
|
-
color: "text.primary"
|
|
11979
|
-
},
|
|
11980
|
-
"& .MuiInputLabel-root.Mui-focused": {
|
|
11981
|
-
color: "text.primary"
|
|
11982
|
-
},
|
|
11983
|
-
"& .MuiOutlinedInput-input": {
|
|
11984
|
-
color: "common.black"
|
|
11985
|
-
},
|
|
11986
|
-
"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
11987
|
-
borderColor: "common.white"
|
|
11988
|
-
},
|
|
11989
|
-
"& .MuiSvgIcon-root": {
|
|
11990
|
-
color: "common.black"
|
|
11991
|
-
}
|
|
11992
|
-
}
|
|
11993
|
-
}
|
|
11994
|
-
),
|
|
11995
|
-
...otherProps
|
|
11996
|
-
}
|
|
11997
|
-
)
|
|
11998
|
-
}
|
|
11999
|
-
);
|
|
12000
|
-
}
|
|
12001
11466
|
var AppSelectInput = forwardRef(
|
|
12002
11467
|
({
|
|
12003
11468
|
name,
|
|
@@ -12021,10 +11486,10 @@ var AppSelectInput = forwardRef(
|
|
|
12021
11486
|
}, ref) => {
|
|
12022
11487
|
const theme = useTheme();
|
|
12023
11488
|
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
12024
|
-
const fieldError =
|
|
12025
|
-
const isTouched = Boolean(
|
|
11489
|
+
const fieldError = _17.get(errors, name);
|
|
11490
|
+
const isTouched = Boolean(_17.get(touched, name));
|
|
12026
11491
|
const hasError = Boolean(fieldError) && isTouched;
|
|
12027
|
-
const currentValue =
|
|
11492
|
+
const currentValue = _17.get(values, name);
|
|
12028
11493
|
const handleValueChange = (newValue) => {
|
|
12029
11494
|
setFieldValue(name, newValue, true);
|
|
12030
11495
|
if (externalOnChange) {
|
|
@@ -12052,10 +11517,7 @@ var AppSelectInput = forwardRef(
|
|
|
12052
11517
|
return options2;
|
|
12053
11518
|
const inputValueLower = inputValue.toLowerCase();
|
|
12054
11519
|
return options2.filter(
|
|
12055
|
-
(option) =>
|
|
12056
|
-
var _a, _b, _c;
|
|
12057
|
-
return option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower) || ((_a = option.searchAbleValue1) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || ((_b = option.searchAbleValue2) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option.searchAbleValue3) == null ? void 0 : _c.toLowerCase().includes(inputValueLower));
|
|
12058
|
-
}
|
|
11520
|
+
(option) => option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower)
|
|
12059
11521
|
);
|
|
12060
11522
|
};
|
|
12061
11523
|
return /* @__PURE__ */ jsx(Box, { ref, sx, children: /* @__PURE__ */ jsx(
|
|
@@ -12111,20 +11573,23 @@ var AppSelectInput = forwardRef(
|
|
|
12111
11573
|
}
|
|
12112
11574
|
}
|
|
12113
11575
|
),
|
|
12114
|
-
renderOption: (props, option) =>
|
|
12115
|
-
|
|
12116
|
-
/* @__PURE__ */
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
11576
|
+
renderOption: (props, option) => {
|
|
11577
|
+
const { key, ...restProps } = props;
|
|
11578
|
+
return /* @__PURE__ */ jsxs("li", { ...restProps, children: [
|
|
11579
|
+
option.icon,
|
|
11580
|
+
/* @__PURE__ */ jsx(
|
|
11581
|
+
Typography,
|
|
11582
|
+
{
|
|
11583
|
+
variant: "body2",
|
|
11584
|
+
sx: {
|
|
11585
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
11586
|
+
...option.textSx
|
|
11587
|
+
},
|
|
11588
|
+
children: option.label
|
|
11589
|
+
}
|
|
11590
|
+
)
|
|
11591
|
+
] }, key);
|
|
11592
|
+
}
|
|
12128
11593
|
}
|
|
12129
11594
|
)
|
|
12130
11595
|
}
|
|
@@ -12238,8 +11703,8 @@ var AppSimpleUploadFile = ({
|
|
|
12238
11703
|
onError
|
|
12239
11704
|
}) => {
|
|
12240
11705
|
const { setFieldValue, values, errors, touched } = useFormikContext();
|
|
12241
|
-
const fieldValue =
|
|
12242
|
-
const fieldError =
|
|
11706
|
+
const fieldValue = _17.get(values, name);
|
|
11707
|
+
const fieldError = _17.get(touched, name) ? _17.get(errors, name) : void 0;
|
|
12243
11708
|
const handleChange = (event) => {
|
|
12244
11709
|
const files = event.target.files;
|
|
12245
11710
|
if (!files || files.length === 0)
|
|
@@ -12266,7 +11731,7 @@ var AppSimpleUploadFile = ({
|
|
|
12266
11731
|
if (!fieldValue || index < 0 || index >= fieldValue.length)
|
|
12267
11732
|
return;
|
|
12268
11733
|
const fileToRemove = fieldValue[index];
|
|
12269
|
-
const newFiles = fieldValue.filter((
|
|
11734
|
+
const newFiles = fieldValue.filter((_18, i) => i !== index);
|
|
12270
11735
|
setFieldValue(name, newFiles);
|
|
12271
11736
|
onRemove == null ? void 0 : onRemove(fileToRemove);
|
|
12272
11737
|
if (fileToRemove.preview) {
|
|
@@ -13818,12 +13283,12 @@ function Placeholder({ sx, ...other }) {
|
|
|
13818
13283
|
var AppUploadFile = ({ name, ...rest }) => {
|
|
13819
13284
|
var _a, _b, _c;
|
|
13820
13285
|
const { errors, touched, setFieldValue, values } = useFormikContext();
|
|
13821
|
-
const fieldError =
|
|
13822
|
-
const isTouched =
|
|
13823
|
-
let val =
|
|
13286
|
+
const fieldError = _17.get(errors, name);
|
|
13287
|
+
const isTouched = _17.get(touched, name);
|
|
13288
|
+
let val = _17.get(values, name);
|
|
13824
13289
|
if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
|
|
13825
13290
|
val = val ? [val] : [];
|
|
13826
|
-
} else if (!((_b = rest.multiple) != null ? _b : false) &&
|
|
13291
|
+
} else if (!((_b = rest.multiple) != null ? _b : false) && _17.isArray(val)) {
|
|
13827
13292
|
val = val[0];
|
|
13828
13293
|
}
|
|
13829
13294
|
((_c = rest.multiple) != null ? _c : false) ? (val != null ? val : []).map((__) => (__ == null ? void 0 : __.file) ? __ == null ? void 0 : __.file : __) : val;
|
|
@@ -13980,6 +13445,6 @@ var SubmitButton = ({
|
|
|
13980
13445
|
};
|
|
13981
13446
|
var SubmitButton_default = SubmitButton;
|
|
13982
13447
|
|
|
13983
|
-
export { AppAutoComplete, AppAutoCompleter, AppCheckBox_default as AppCheckBox, AppDateAndTimePicker_default as AppDateAndTimePicker, AppDatePicker_default as AppDatePicker, AppFormErrorMessage_default as AppFormErrorMessage, AppInputField, AppMultiSelector_default as AppMultiSelector, AppPhoneNoInput_default as AppPhoneNoInput, AppRadioGroup_default as AppRadioGroup, AppRating_default as AppRating, AppRichTextEditor_default as AppRichTextEditor,
|
|
13448
|
+
export { AppAutoComplete, AppAutoCompleter, AppCheckBox_default as AppCheckBox, AppDateAndTimePicker_default as AppDateAndTimePicker, AppDatePicker_default as AppDatePicker, AppFormErrorMessage_default as AppFormErrorMessage, AppInputField, AppMultiSelector_default as AppMultiSelector, AppPhoneNoInput_default as AppPhoneNoInput, AppRadioGroup_default as AppRadioGroup, AppRating_default as AppRating, AppRichTextEditor_default as AppRichTextEditor, AppSelectInput_default as AppSelectInput, AppSimpleUploadFile_default as AppSimpleUploadFile, AppSwitch, AppSwitchInput, AppTagsCreator, AppTextArea_default as AppTextArea, AppUploadFile_default as AppUploadFile, Form_default as Form, Iconify_default as Iconify, SubmitButton_default as SubmitButton };
|
|
13984
13449
|
//# sourceMappingURL=out.js.map
|
|
13985
13450
|
//# sourceMappingURL=index.mjs.map
|