formik-form-components 0.2.26 → 0.2.28
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.d.ts +91 -184
- package/dist/index.js +761 -1122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +731 -1092
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField,
|
|
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, InputLabel, 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';
|
|
@@ -11,7 +11,6 @@ import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
|
11
11
|
import Autocomplete3 from '@mui/material/Autocomplete';
|
|
12
12
|
import Typography9 from '@mui/material/Typography';
|
|
13
13
|
import { Icon } from '@iconify/react';
|
|
14
|
-
import Select from '@mui/material/Select';
|
|
15
14
|
import PhoneInput from 'react-phone-number-input';
|
|
16
15
|
import 'react-phone-number-input/style.css';
|
|
17
16
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
@@ -651,25 +650,30 @@ function AppSwitchInput({
|
|
|
651
650
|
Box,
|
|
652
651
|
{
|
|
653
652
|
className,
|
|
654
|
-
sx: [
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
653
|
+
sx: [
|
|
654
|
+
{
|
|
655
|
+
display: "flex",
|
|
656
|
+
flexDirection: labelPlacement === "start" || labelPlacement === "end" ? "row" : "column",
|
|
657
|
+
alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
|
|
658
|
+
justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
|
|
659
|
+
gap: 1,
|
|
660
|
+
my: 1,
|
|
661
|
+
...containerSx
|
|
662
|
+
},
|
|
663
|
+
sx
|
|
664
|
+
],
|
|
663
665
|
children: [
|
|
664
666
|
label && /* @__PURE__ */ jsx(
|
|
665
667
|
Typography,
|
|
666
668
|
{
|
|
667
669
|
variant: "body2",
|
|
668
|
-
sx: [
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
670
|
+
sx: [
|
|
671
|
+
{
|
|
672
|
+
color: "text.primary",
|
|
673
|
+
order: labelPlacement === "start" ? 0 : 1,
|
|
674
|
+
...labelSx
|
|
675
|
+
}
|
|
676
|
+
],
|
|
673
677
|
children: label
|
|
674
678
|
}
|
|
675
679
|
),
|
|
@@ -682,25 +686,27 @@ function AppSwitchInput({
|
|
|
682
686
|
onChange: () => {
|
|
683
687
|
setFieldValue(name, !values[name], true);
|
|
684
688
|
},
|
|
685
|
-
sx: [
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
689
|
+
sx: [
|
|
690
|
+
{
|
|
691
|
+
"& .MuiSwitch-switchBase": {
|
|
692
|
+
color: "text.secondary",
|
|
693
|
+
"&.Mui-checked": {
|
|
694
|
+
color: "primary.main",
|
|
695
|
+
"& + .MuiSwitch-track": {
|
|
696
|
+
backgroundColor: "primary.main",
|
|
697
|
+
opacity: 0.5
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
"&.Mui-disabled": {
|
|
701
|
+
color: "action.disabled",
|
|
702
|
+
"& + .MuiSwitch-track": {
|
|
703
|
+
backgroundColor: "action.disabledBackground"
|
|
704
|
+
}
|
|
693
705
|
}
|
|
694
706
|
},
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
backgroundColor: "action.disabledBackground"
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
...switchSx
|
|
703
|
-
}],
|
|
707
|
+
...switchSx
|
|
708
|
+
}
|
|
709
|
+
],
|
|
704
710
|
...otherProps
|
|
705
711
|
}
|
|
706
712
|
),
|
|
@@ -708,12 +714,14 @@ function AppSwitchInput({
|
|
|
708
714
|
Typography,
|
|
709
715
|
{
|
|
710
716
|
variant: "caption",
|
|
711
|
-
sx: [
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
+
sx: [
|
|
718
|
+
{
|
|
719
|
+
color: "error.main",
|
|
720
|
+
display: "block",
|
|
721
|
+
mt: 0.5,
|
|
722
|
+
...errorSx
|
|
723
|
+
}
|
|
724
|
+
],
|
|
717
725
|
gutterBottom: true,
|
|
718
726
|
children: fieldError
|
|
719
727
|
}
|
|
@@ -745,21 +753,26 @@ function AppSwitch({
|
|
|
745
753
|
alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
|
|
746
754
|
justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
|
|
747
755
|
spacing: 1,
|
|
748
|
-
sx: [
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
756
|
+
sx: [
|
|
757
|
+
{
|
|
758
|
+
width: "100%",
|
|
759
|
+
...labelPlacement === "top" || labelPlacement === "bottom" ? { alignItems: "flex-start" } : {},
|
|
760
|
+
...containerSx
|
|
761
|
+
},
|
|
762
|
+
sx
|
|
763
|
+
],
|
|
753
764
|
children: [
|
|
754
765
|
/* @__PURE__ */ jsx(
|
|
755
766
|
Typography,
|
|
756
767
|
{
|
|
757
768
|
variant: "body2",
|
|
758
|
-
sx: [
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
769
|
+
sx: [
|
|
770
|
+
{
|
|
771
|
+
color: "text.primary",
|
|
772
|
+
order: labelPlacement === "start" ? 0 : 1,
|
|
773
|
+
...labelSx
|
|
774
|
+
}
|
|
775
|
+
],
|
|
763
776
|
children: label
|
|
764
777
|
}
|
|
765
778
|
),
|
|
@@ -771,25 +784,27 @@ function AppSwitch({
|
|
|
771
784
|
onChange: () => {
|
|
772
785
|
setFieldValue(name, !fieldValue, true);
|
|
773
786
|
},
|
|
774
|
-
sx: [
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
787
|
+
sx: [
|
|
788
|
+
{
|
|
789
|
+
"& .MuiSwitch-switchBase": {
|
|
790
|
+
color: "text.secondary",
|
|
791
|
+
"&.Mui-checked": {
|
|
792
|
+
color: "primary.main",
|
|
793
|
+
"& + .MuiSwitch-track": {
|
|
794
|
+
backgroundColor: "primary.main",
|
|
795
|
+
opacity: 0.5
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
"&.Mui-disabled": {
|
|
799
|
+
color: "action.disabled",
|
|
800
|
+
"& + .MuiSwitch-track": {
|
|
801
|
+
backgroundColor: "action.disabledBackground"
|
|
802
|
+
}
|
|
782
803
|
}
|
|
783
804
|
},
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
backgroundColor: "action.disabledBackground"
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
},
|
|
791
|
-
...switchSx
|
|
792
|
-
}],
|
|
805
|
+
...switchSx
|
|
806
|
+
}
|
|
807
|
+
],
|
|
793
808
|
...otherProps
|
|
794
809
|
}
|
|
795
810
|
),
|
|
@@ -797,12 +812,14 @@ function AppSwitch({
|
|
|
797
812
|
Typography,
|
|
798
813
|
{
|
|
799
814
|
variant: "caption",
|
|
800
|
-
sx: [
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
815
|
+
sx: [
|
|
816
|
+
{
|
|
817
|
+
color: "error.main",
|
|
818
|
+
display: "block",
|
|
819
|
+
mt: 0.5,
|
|
820
|
+
...errorSx
|
|
821
|
+
}
|
|
822
|
+
],
|
|
806
823
|
gutterBottom: true,
|
|
807
824
|
children: fieldError
|
|
808
825
|
}
|
|
@@ -1199,280 +1216,321 @@ function AppInputField({
|
|
|
1199
1216
|
}
|
|
1200
1217
|
var AppMultiSelector = forwardRef(
|
|
1201
1218
|
({
|
|
1202
|
-
multiple = true,
|
|
1203
1219
|
name,
|
|
1204
1220
|
label,
|
|
1221
|
+
mode = "autocomplete",
|
|
1205
1222
|
options = [],
|
|
1206
1223
|
required = false,
|
|
1207
|
-
variant = "outlined",
|
|
1208
1224
|
disabled = false,
|
|
1209
1225
|
maxSelections,
|
|
1210
1226
|
showSelectedCount = true,
|
|
1211
|
-
showHelperText = false,
|
|
1212
1227
|
helperText,
|
|
1228
|
+
variant = "outlined",
|
|
1229
|
+
placeholder = "Select options...",
|
|
1230
|
+
onSearchChange,
|
|
1231
|
+
onChange: externalOnChange,
|
|
1232
|
+
onMaxSelectionsReached,
|
|
1213
1233
|
sx,
|
|
1214
1234
|
formControlSx,
|
|
1215
|
-
selectSx,
|
|
1216
1235
|
labelSx,
|
|
1217
1236
|
chipSx,
|
|
1218
1237
|
checkboxSx,
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
helperTextSx,
|
|
1222
|
-
iconSx,
|
|
1223
|
-
onChange: externalOnChange,
|
|
1224
|
-
onOpen,
|
|
1225
|
-
onClose,
|
|
1226
|
-
renderValue: externalRenderValue,
|
|
1227
|
-
renderMenuItem,
|
|
1228
|
-
...otherProps
|
|
1238
|
+
searchDebounce = 300,
|
|
1239
|
+
clearable = true
|
|
1229
1240
|
}, ref) => {
|
|
1230
1241
|
const theme = useTheme();
|
|
1231
|
-
const {
|
|
1242
|
+
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
1232
1243
|
const fieldError = _19.get(errors, name);
|
|
1233
|
-
const isTouched = _19.get(touched, name);
|
|
1234
|
-
const
|
|
1235
|
-
const
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
|
|
1244
|
+
const isTouched = Boolean(_19.get(touched, name));
|
|
1245
|
+
const hasError = Boolean(fieldError) && isTouched;
|
|
1246
|
+
const currentValue = _19.get(values, name);
|
|
1247
|
+
const selectedValues = Array.isArray(currentValue) ? currentValue : [];
|
|
1248
|
+
const selectedCount = selectedValues.length;
|
|
1249
|
+
const isMaxReached = maxSelections ? selectedCount >= maxSelections : false;
|
|
1250
|
+
const handleValueChange = (newValues) => {
|
|
1251
|
+
if (maxSelections && newValues.length > maxSelections) {
|
|
1252
|
+
if (onMaxSelectionsReached) {
|
|
1253
|
+
onMaxSelectionsReached(maxSelections);
|
|
1254
|
+
}
|
|
1239
1255
|
return;
|
|
1240
1256
|
}
|
|
1241
|
-
setFieldValue(name,
|
|
1257
|
+
setFieldValue(name, newValues, true);
|
|
1242
1258
|
if (externalOnChange) {
|
|
1243
|
-
externalOnChange(
|
|
1259
|
+
externalOnChange(newValues);
|
|
1244
1260
|
}
|
|
1245
1261
|
};
|
|
1246
1262
|
const handleBlur = () => {
|
|
1247
1263
|
setFieldTouched(name, true, true);
|
|
1248
1264
|
};
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
"&.Mui-disabled": {
|
|
1294
|
-
opacity: 0.5
|
|
1295
|
-
},
|
|
1296
|
-
...option.sx
|
|
1297
|
-
},
|
|
1298
|
-
menuItemSx
|
|
1299
|
-
],
|
|
1300
|
-
children: [
|
|
1301
|
-
/* @__PURE__ */ jsx(
|
|
1302
|
-
Checkbox,
|
|
1303
|
-
{
|
|
1304
|
-
checked: isSelected,
|
|
1305
|
-
disabled: option.disabled,
|
|
1306
|
-
sx: [
|
|
1307
|
-
{
|
|
1308
|
-
color: "text.secondary",
|
|
1309
|
-
"&.Mui-checked": {
|
|
1310
|
-
color: "primary.main"
|
|
1311
|
-
},
|
|
1312
|
-
...option.disabled && {
|
|
1313
|
-
color: "action.disabled"
|
|
1314
|
-
}
|
|
1265
|
+
const getSelectedOptions = () => {
|
|
1266
|
+
return options.filter((opt) => selectedValues.includes(opt.value));
|
|
1267
|
+
};
|
|
1268
|
+
if (mode === "autocomplete") {
|
|
1269
|
+
const debouncedSearch = React4.useRef();
|
|
1270
|
+
const handleSearchChange = (query) => {
|
|
1271
|
+
if (debouncedSearch.current) {
|
|
1272
|
+
clearTimeout(debouncedSearch.current);
|
|
1273
|
+
}
|
|
1274
|
+
debouncedSearch.current = setTimeout(() => {
|
|
1275
|
+
if (onSearchChange) {
|
|
1276
|
+
onSearchChange(query);
|
|
1277
|
+
}
|
|
1278
|
+
}, searchDebounce);
|
|
1279
|
+
};
|
|
1280
|
+
const filterOptions = (options2, { inputValue }) => {
|
|
1281
|
+
if (!inputValue)
|
|
1282
|
+
return options2;
|
|
1283
|
+
const inputValueLower = inputValue.toLowerCase();
|
|
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
|
+
}
|
|
1289
|
+
);
|
|
1290
|
+
};
|
|
1291
|
+
const selectedOptions = getSelectedOptions();
|
|
1292
|
+
return /* @__PURE__ */ jsx(Box, { ref, sx, children: /* @__PURE__ */ jsxs(
|
|
1293
|
+
FormControl,
|
|
1294
|
+
{
|
|
1295
|
+
fullWidth: true,
|
|
1296
|
+
error: hasError,
|
|
1297
|
+
disabled,
|
|
1298
|
+
sx: formControlSx,
|
|
1299
|
+
children: [
|
|
1300
|
+
/* @__PURE__ */ jsx(
|
|
1301
|
+
Autocomplete,
|
|
1302
|
+
{
|
|
1303
|
+
multiple: true,
|
|
1304
|
+
options,
|
|
1305
|
+
value: selectedOptions,
|
|
1306
|
+
onChange: (event, newValues) => {
|
|
1307
|
+
const values2 = newValues.map((opt) => opt.value);
|
|
1308
|
+
handleValueChange(values2);
|
|
1315
1309
|
},
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
),
|
|
1320
|
-
/* @__PURE__ */ jsx(
|
|
1321
|
-
Typography,
|
|
1322
|
-
{
|
|
1323
|
-
variant: "body2",
|
|
1324
|
-
sx: [
|
|
1325
|
-
{
|
|
1326
|
-
color: option.disabled ? "text.disabled" : "text.primary",
|
|
1327
|
-
...option.textSx
|
|
1328
|
-
}
|
|
1329
|
-
],
|
|
1330
|
-
children: option.label || String(option.value)
|
|
1331
|
-
}
|
|
1332
|
-
)
|
|
1333
|
-
]
|
|
1334
|
-
},
|
|
1335
|
-
option.value
|
|
1336
|
-
);
|
|
1337
|
-
const displayLabel = showSelectedCount && selectedValues.length > 0 ? `${label} (${selectedValues.length} selected)` : label;
|
|
1338
|
-
return /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsxs(
|
|
1339
|
-
FormControl,
|
|
1340
|
-
{
|
|
1341
|
-
fullWidth: true,
|
|
1342
|
-
variant,
|
|
1343
|
-
error: isTouched && Boolean(fieldError),
|
|
1344
|
-
disabled,
|
|
1345
|
-
sx: [
|
|
1346
|
-
{
|
|
1347
|
-
"& .MuiInputLabel-root": {
|
|
1348
|
-
"&.Mui-focused": {
|
|
1349
|
-
color: "primary.main"
|
|
1350
|
-
},
|
|
1351
|
-
"&.Mui-error": {
|
|
1352
|
-
color: "error.main"
|
|
1353
|
-
},
|
|
1354
|
-
"&.Mui-disabled": {
|
|
1355
|
-
color: "text.disabled"
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
},
|
|
1359
|
-
formControlSx
|
|
1360
|
-
],
|
|
1361
|
-
children: [
|
|
1362
|
-
label && /* @__PURE__ */ jsxs(
|
|
1363
|
-
InputLabel,
|
|
1364
|
-
{
|
|
1365
|
-
id: `select-${name}`,
|
|
1366
|
-
sx: [
|
|
1367
|
-
{
|
|
1368
|
-
color: "text.secondary",
|
|
1369
|
-
"&.Mui-focused": {
|
|
1370
|
-
color: "primary.main"
|
|
1371
|
-
},
|
|
1372
|
-
"&.Mui-disabled": {
|
|
1373
|
-
color: "text.disabled"
|
|
1310
|
+
onInputChange: (event, value, reason) => {
|
|
1311
|
+
if (reason === "input" && onSearchChange) {
|
|
1312
|
+
handleSearchChange(value);
|
|
1374
1313
|
}
|
|
1375
1314
|
},
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1315
|
+
filterOptions,
|
|
1316
|
+
onBlur: handleBlur,
|
|
1317
|
+
disabled: disabled || isMaxReached,
|
|
1318
|
+
disableCloseOnSelect: true,
|
|
1319
|
+
clearOnBlur: false,
|
|
1320
|
+
clearOnEscape: true,
|
|
1321
|
+
disableClearable: !clearable,
|
|
1322
|
+
getOptionLabel: (option) => option.label,
|
|
1323
|
+
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
1324
|
+
getOptionDisabled: (option) => !!option.disabled,
|
|
1325
|
+
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
1326
|
+
TextField,
|
|
1382
1327
|
{
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
value: selectedValues,
|
|
1402
|
-
onChange: handleChange,
|
|
1403
|
-
onBlur: handleBlur,
|
|
1404
|
-
onOpen,
|
|
1405
|
-
onClose,
|
|
1406
|
-
renderValue: externalRenderValue || defaultRenderValue,
|
|
1407
|
-
MenuProps: {
|
|
1408
|
-
PaperProps: {
|
|
1409
|
-
sx: {
|
|
1410
|
-
mt: 1,
|
|
1411
|
-
boxShadow: theme.shadows[3],
|
|
1412
|
-
"& .MuiMenuItem-root": {
|
|
1413
|
-
px: 2,
|
|
1414
|
-
py: 1
|
|
1328
|
+
...params,
|
|
1329
|
+
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1330
|
+
label,
|
|
1331
|
+
required && /* @__PURE__ */ jsx(
|
|
1332
|
+
Typography,
|
|
1333
|
+
{
|
|
1334
|
+
sx: { color: "error.main" },
|
|
1335
|
+
component: "span",
|
|
1336
|
+
children: " *"
|
|
1337
|
+
}
|
|
1338
|
+
)
|
|
1339
|
+
] }),
|
|
1340
|
+
variant,
|
|
1341
|
+
placeholder,
|
|
1342
|
+
error: hasError,
|
|
1343
|
+
helperText: hasError ? fieldError : helperText,
|
|
1344
|
+
FormHelperTextProps: {
|
|
1345
|
+
sx: { mx: 0, mt: 0.5 }
|
|
1415
1346
|
}
|
|
1416
1347
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
...iconSx
|
|
1426
|
-
},
|
|
1427
|
-
"& .MuiSelect-icon": {
|
|
1428
|
-
color: "text.secondary"
|
|
1429
|
-
},
|
|
1430
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
1431
|
-
borderColor: "divider"
|
|
1432
|
-
},
|
|
1433
|
-
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
1434
|
-
borderColor: "primary.main"
|
|
1435
|
-
},
|
|
1436
|
-
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
1437
|
-
borderColor: "primary.main"
|
|
1438
|
-
},
|
|
1439
|
-
"&.Mui-error .MuiOutlinedInput-notchedOutline": {
|
|
1440
|
-
borderColor: "error.main"
|
|
1441
|
-
},
|
|
1442
|
-
"&.Mui-disabled": {
|
|
1443
|
-
backgroundColor: "action.disabledBackground",
|
|
1444
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
1445
|
-
borderColor: "action.disabled"
|
|
1348
|
+
),
|
|
1349
|
+
renderOption: (props, option, { selected }) => /* @__PURE__ */ jsxs("li", { ...props, children: [
|
|
1350
|
+
/* @__PURE__ */ jsx(
|
|
1351
|
+
Checkbox,
|
|
1352
|
+
{
|
|
1353
|
+
checked: selected,
|
|
1354
|
+
disabled: option.disabled || isMaxReached && !selected,
|
|
1355
|
+
sx: checkboxSx
|
|
1446
1356
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1357
|
+
),
|
|
1358
|
+
option.icon,
|
|
1359
|
+
/* @__PURE__ */ jsx(
|
|
1360
|
+
Typography,
|
|
1361
|
+
{
|
|
1362
|
+
variant: "body2",
|
|
1363
|
+
sx: {
|
|
1364
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
1365
|
+
...option.textSx
|
|
1366
|
+
},
|
|
1367
|
+
children: option.label
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
] }),
|
|
1371
|
+
renderTags: (value, getTagProps) => /* @__PURE__ */ jsx(
|
|
1372
|
+
Box,
|
|
1373
|
+
{
|
|
1374
|
+
sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 },
|
|
1375
|
+
children: value.map((option, index) => /* @__PURE__ */ createElement(
|
|
1376
|
+
Chip,
|
|
1377
|
+
{
|
|
1378
|
+
...getTagProps({ index }),
|
|
1379
|
+
key: option.value,
|
|
1380
|
+
label: option.label,
|
|
1381
|
+
disabled: disabled || option.disabled,
|
|
1382
|
+
sx: chipSx,
|
|
1383
|
+
onDelete: !disabled && !option.disabled ? () => {
|
|
1384
|
+
const newValues = selectedValues.filter(
|
|
1385
|
+
(v) => v !== option.value
|
|
1386
|
+
);
|
|
1387
|
+
handleValueChange(newValues);
|
|
1388
|
+
} : void 0
|
|
1389
|
+
}
|
|
1390
|
+
))
|
|
1391
|
+
}
|
|
1392
|
+
)
|
|
1393
|
+
}
|
|
1394
|
+
),
|
|
1395
|
+
showSelectedCount && /* @__PURE__ */ jsxs(
|
|
1396
|
+
Typography,
|
|
1397
|
+
{
|
|
1398
|
+
variant: "caption",
|
|
1399
|
+
sx: {
|
|
1465
1400
|
mt: 0.5,
|
|
1466
|
-
color:
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1401
|
+
color: isMaxReached ? "error.main" : "text.secondary"
|
|
1402
|
+
},
|
|
1403
|
+
children: [
|
|
1404
|
+
selectedCount,
|
|
1405
|
+
" selected",
|
|
1406
|
+
maxSelections ? ` (max ${maxSelections})` : ""
|
|
1407
|
+
]
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1410
|
+
]
|
|
1411
|
+
}
|
|
1412
|
+
) });
|
|
1413
|
+
}
|
|
1414
|
+
if (mode === "dropdown") {
|
|
1415
|
+
const handleSelectChange = (event) => {
|
|
1416
|
+
const {
|
|
1417
|
+
target: { value }
|
|
1418
|
+
} = event;
|
|
1419
|
+
const newValues = typeof value === "string" ? value.split(",") : value;
|
|
1420
|
+
handleValueChange(newValues);
|
|
1421
|
+
};
|
|
1422
|
+
return /* @__PURE__ */ jsx(Box, { ref, sx, children: /* @__PURE__ */ jsxs(
|
|
1423
|
+
FormControl,
|
|
1424
|
+
{
|
|
1425
|
+
fullWidth: true,
|
|
1426
|
+
variant,
|
|
1427
|
+
error: hasError,
|
|
1428
|
+
disabled,
|
|
1429
|
+
sx: formControlSx,
|
|
1430
|
+
children: [
|
|
1431
|
+
label && /* @__PURE__ */ jsxs(
|
|
1432
|
+
Typography,
|
|
1433
|
+
{
|
|
1434
|
+
variant: "body2",
|
|
1435
|
+
sx: {
|
|
1436
|
+
mb: 1,
|
|
1437
|
+
color: hasError ? "error.main" : "text.secondary",
|
|
1438
|
+
...labelSx
|
|
1439
|
+
},
|
|
1440
|
+
children: [
|
|
1441
|
+
label,
|
|
1442
|
+
required && /* @__PURE__ */ jsx(Typography, { sx: { color: "error.main" }, component: "span", children: " *" })
|
|
1443
|
+
]
|
|
1444
|
+
}
|
|
1445
|
+
),
|
|
1446
|
+
/* @__PURE__ */ jsx(
|
|
1447
|
+
Select,
|
|
1448
|
+
{
|
|
1449
|
+
multiple: true,
|
|
1450
|
+
value: selectedValues,
|
|
1451
|
+
onChange: handleSelectChange,
|
|
1452
|
+
onBlur: handleBlur,
|
|
1453
|
+
displayEmpty: true,
|
|
1454
|
+
renderValue: (selected) => {
|
|
1455
|
+
if (selected.length === 0) {
|
|
1456
|
+
return /* @__PURE__ */ jsx("em", { children: placeholder });
|
|
1457
|
+
}
|
|
1458
|
+
return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5 }, children: selected.map((value) => {
|
|
1459
|
+
const option = options.find((opt) => opt.value === value);
|
|
1460
|
+
return option ? /* @__PURE__ */ jsx(
|
|
1461
|
+
Chip,
|
|
1462
|
+
{
|
|
1463
|
+
label: option.label,
|
|
1464
|
+
size: "small",
|
|
1465
|
+
sx: chipSx
|
|
1466
|
+
},
|
|
1467
|
+
value
|
|
1468
|
+
) : null;
|
|
1469
|
+
}) });
|
|
1470
|
+
},
|
|
1471
|
+
MenuProps: {
|
|
1472
|
+
PaperProps: {
|
|
1473
|
+
sx: {
|
|
1474
|
+
mt: 1,
|
|
1475
|
+
boxShadow: theme.shadows[3],
|
|
1476
|
+
maxHeight: 300
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
1481
|
+
MenuItem,
|
|
1482
|
+
{
|
|
1483
|
+
value: option.value,
|
|
1484
|
+
disabled: option.disabled || isMaxReached && !selectedValues.includes(option.value),
|
|
1485
|
+
sx: option.sx,
|
|
1486
|
+
children: [
|
|
1487
|
+
/* @__PURE__ */ jsx(
|
|
1488
|
+
Checkbox,
|
|
1489
|
+
{
|
|
1490
|
+
checked: selectedValues.includes(option.value),
|
|
1491
|
+
disabled: option.disabled,
|
|
1492
|
+
sx: checkboxSx
|
|
1493
|
+
}
|
|
1494
|
+
),
|
|
1495
|
+
option.icon,
|
|
1496
|
+
/* @__PURE__ */ jsx(
|
|
1497
|
+
Typography,
|
|
1498
|
+
{
|
|
1499
|
+
variant: "body2",
|
|
1500
|
+
sx: {
|
|
1501
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
1502
|
+
...option.textSx
|
|
1503
|
+
},
|
|
1504
|
+
children: option.label
|
|
1505
|
+
}
|
|
1506
|
+
)
|
|
1507
|
+
]
|
|
1508
|
+
},
|
|
1509
|
+
option.value
|
|
1510
|
+
))
|
|
1511
|
+
}
|
|
1512
|
+
),
|
|
1513
|
+
(helperText || hasError) && /* @__PURE__ */ jsx(FormHelperText, { error: hasError, sx: { mx: 0, mt: 0.5 }, children: hasError ? fieldError : helperText }),
|
|
1514
|
+
showSelectedCount && /* @__PURE__ */ jsxs(
|
|
1515
|
+
Typography,
|
|
1516
|
+
{
|
|
1517
|
+
variant: "caption",
|
|
1518
|
+
sx: {
|
|
1519
|
+
mt: 0.5,
|
|
1520
|
+
color: isMaxReached ? "error.main" : "text.secondary"
|
|
1521
|
+
},
|
|
1522
|
+
children: [
|
|
1523
|
+
selectedCount,
|
|
1524
|
+
" selected",
|
|
1525
|
+
maxSelections ? ` (max ${maxSelections})` : ""
|
|
1526
|
+
]
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
]
|
|
1530
|
+
}
|
|
1531
|
+
) });
|
|
1532
|
+
}
|
|
1533
|
+
return null;
|
|
1476
1534
|
}
|
|
1477
1535
|
);
|
|
1478
1536
|
AppMultiSelector.displayName = "AppMultiSelector";
|
|
@@ -2131,7 +2189,7 @@ function findDiffEnd(a, b, posA, posB) {
|
|
|
2131
2189
|
posB -= size;
|
|
2132
2190
|
}
|
|
2133
2191
|
}
|
|
2134
|
-
var
|
|
2192
|
+
var Fragment3 = class {
|
|
2135
2193
|
/**
|
|
2136
2194
|
@internal
|
|
2137
2195
|
*/
|
|
@@ -2199,7 +2257,7 @@ var Fragment2 = class {
|
|
|
2199
2257
|
}
|
|
2200
2258
|
for (; i < other.content.length; i++)
|
|
2201
2259
|
content.push(other.content[i]);
|
|
2202
|
-
return new
|
|
2260
|
+
return new Fragment3(content, this.size + other.size);
|
|
2203
2261
|
}
|
|
2204
2262
|
/**
|
|
2205
2263
|
Cut out the sub-fragment between the two given positions.
|
|
@@ -2223,17 +2281,17 @@ var Fragment2 = class {
|
|
|
2223
2281
|
}
|
|
2224
2282
|
pos = end;
|
|
2225
2283
|
}
|
|
2226
|
-
return new
|
|
2284
|
+
return new Fragment3(result, size);
|
|
2227
2285
|
}
|
|
2228
2286
|
/**
|
|
2229
2287
|
@internal
|
|
2230
2288
|
*/
|
|
2231
2289
|
cutByIndex(from, to) {
|
|
2232
2290
|
if (from == to)
|
|
2233
|
-
return
|
|
2291
|
+
return Fragment3.empty;
|
|
2234
2292
|
if (from == 0 && to == this.content.length)
|
|
2235
2293
|
return this;
|
|
2236
|
-
return new
|
|
2294
|
+
return new Fragment3(this.content.slice(from, to));
|
|
2237
2295
|
}
|
|
2238
2296
|
/**
|
|
2239
2297
|
Create a new fragment in which the node at the given index is
|
|
@@ -2246,21 +2304,21 @@ var Fragment2 = class {
|
|
|
2246
2304
|
let copy2 = this.content.slice();
|
|
2247
2305
|
let size = this.size + node.nodeSize - current.nodeSize;
|
|
2248
2306
|
copy2[index] = node;
|
|
2249
|
-
return new
|
|
2307
|
+
return new Fragment3(copy2, size);
|
|
2250
2308
|
}
|
|
2251
2309
|
/**
|
|
2252
2310
|
Create a new fragment by prepending the given node to this
|
|
2253
2311
|
fragment.
|
|
2254
2312
|
*/
|
|
2255
2313
|
addToStart(node) {
|
|
2256
|
-
return new
|
|
2314
|
+
return new Fragment3([node].concat(this.content), this.size + node.nodeSize);
|
|
2257
2315
|
}
|
|
2258
2316
|
/**
|
|
2259
2317
|
Create a new fragment by appending the given node to this
|
|
2260
2318
|
fragment.
|
|
2261
2319
|
*/
|
|
2262
2320
|
addToEnd(node) {
|
|
2263
|
-
return new
|
|
2321
|
+
return new Fragment3(this.content.concat(node), this.size + node.nodeSize);
|
|
2264
2322
|
}
|
|
2265
2323
|
/**
|
|
2266
2324
|
Compare this fragment to another one.
|
|
@@ -2379,10 +2437,10 @@ var Fragment2 = class {
|
|
|
2379
2437
|
*/
|
|
2380
2438
|
static fromJSON(schema, value) {
|
|
2381
2439
|
if (!value)
|
|
2382
|
-
return
|
|
2440
|
+
return Fragment3.empty;
|
|
2383
2441
|
if (!Array.isArray(value))
|
|
2384
2442
|
throw new RangeError("Invalid input for Fragment.fromJSON");
|
|
2385
|
-
return new
|
|
2443
|
+
return new Fragment3(value.map(schema.nodeFromJSON));
|
|
2386
2444
|
}
|
|
2387
2445
|
/**
|
|
2388
2446
|
Build a fragment from an array of nodes. Ensures that adjacent
|
|
@@ -2390,7 +2448,7 @@ var Fragment2 = class {
|
|
|
2390
2448
|
*/
|
|
2391
2449
|
static fromArray(array) {
|
|
2392
2450
|
if (!array.length)
|
|
2393
|
-
return
|
|
2451
|
+
return Fragment3.empty;
|
|
2394
2452
|
let joined, size = 0;
|
|
2395
2453
|
for (let i = 0; i < array.length; i++) {
|
|
2396
2454
|
let node = array[i];
|
|
@@ -2403,7 +2461,7 @@ var Fragment2 = class {
|
|
|
2403
2461
|
joined.push(node);
|
|
2404
2462
|
}
|
|
2405
2463
|
}
|
|
2406
|
-
return new
|
|
2464
|
+
return new Fragment3(joined || array, size);
|
|
2407
2465
|
}
|
|
2408
2466
|
/**
|
|
2409
2467
|
Create a fragment from something that can be interpreted as a
|
|
@@ -2413,17 +2471,17 @@ var Fragment2 = class {
|
|
|
2413
2471
|
*/
|
|
2414
2472
|
static from(nodes) {
|
|
2415
2473
|
if (!nodes)
|
|
2416
|
-
return
|
|
2417
|
-
if (nodes instanceof
|
|
2474
|
+
return Fragment3.empty;
|
|
2475
|
+
if (nodes instanceof Fragment3)
|
|
2418
2476
|
return nodes;
|
|
2419
2477
|
if (Array.isArray(nodes))
|
|
2420
2478
|
return this.fromArray(nodes);
|
|
2421
2479
|
if (nodes.attrs)
|
|
2422
|
-
return new
|
|
2480
|
+
return new Fragment3([nodes], nodes.nodeSize);
|
|
2423
2481
|
throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
2424
2482
|
}
|
|
2425
2483
|
};
|
|
2426
|
-
|
|
2484
|
+
Fragment3.empty = new Fragment3([], 0);
|
|
2427
2485
|
var found = { index: 0, offset: 0 };
|
|
2428
2486
|
function retIndex(index, offset) {
|
|
2429
2487
|
found.index = index;
|
|
@@ -2648,7 +2706,7 @@ var Slice = class {
|
|
|
2648
2706
|
let openStart = json.openStart || 0, openEnd = json.openEnd || 0;
|
|
2649
2707
|
if (typeof openStart != "number" || typeof openEnd != "number")
|
|
2650
2708
|
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
2651
|
-
return new Slice(
|
|
2709
|
+
return new Slice(Fragment3.fromJSON(schema, json.content), openStart, openEnd);
|
|
2652
2710
|
}
|
|
2653
2711
|
/**
|
|
2654
2712
|
Create a slice from a fragment by taking the maximum possible
|
|
@@ -2663,7 +2721,7 @@ var Slice = class {
|
|
|
2663
2721
|
return new Slice(fragment, openStart, openEnd);
|
|
2664
2722
|
}
|
|
2665
2723
|
};
|
|
2666
|
-
Slice.empty = new Slice(
|
|
2724
|
+
Slice.empty = new Slice(Fragment3.empty, 0, 0);
|
|
2667
2725
|
function removeRange(content, from, to) {
|
|
2668
2726
|
let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
|
|
2669
2727
|
let { index: indexTo, offset: offsetTo } = content.findIndex(to);
|
|
@@ -2761,7 +2819,7 @@ function replaceThreeWay($from, $start, $end, $to, depth) {
|
|
|
2761
2819
|
addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
|
|
2762
2820
|
}
|
|
2763
2821
|
addRange($to, null, depth, content);
|
|
2764
|
-
return new
|
|
2822
|
+
return new Fragment3(content);
|
|
2765
2823
|
}
|
|
2766
2824
|
function replaceTwoWay($from, $to, depth) {
|
|
2767
2825
|
let content = [];
|
|
@@ -2771,13 +2829,13 @@ function replaceTwoWay($from, $to, depth) {
|
|
|
2771
2829
|
addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);
|
|
2772
2830
|
}
|
|
2773
2831
|
addRange($to, null, depth, content);
|
|
2774
|
-
return new
|
|
2832
|
+
return new Fragment3(content);
|
|
2775
2833
|
}
|
|
2776
2834
|
function prepareSliceForReplace(slice, $along) {
|
|
2777
2835
|
let extra = $along.depth - slice.openStart, parent = $along.node(extra);
|
|
2778
2836
|
let node = parent.copy(slice.content);
|
|
2779
2837
|
for (let i = extra - 1; i >= 0; i--)
|
|
2780
|
-
node = $along.node(i).copy(
|
|
2838
|
+
node = $along.node(i).copy(Fragment3.from(node));
|
|
2781
2839
|
return {
|
|
2782
2840
|
start: node.resolveNoCache(slice.openStart + extra),
|
|
2783
2841
|
end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
|
|
@@ -3116,7 +3174,7 @@ var Node = class {
|
|
|
3116
3174
|
this.type = type;
|
|
3117
3175
|
this.attrs = attrs;
|
|
3118
3176
|
this.marks = marks;
|
|
3119
|
-
this.content = content ||
|
|
3177
|
+
this.content = content || Fragment3.empty;
|
|
3120
3178
|
}
|
|
3121
3179
|
/**
|
|
3122
3180
|
The array of this node's child nodes.
|
|
@@ -3421,7 +3479,7 @@ var Node = class {
|
|
|
3421
3479
|
can optionally pass `start` and `end` indices into the
|
|
3422
3480
|
replacement fragment.
|
|
3423
3481
|
*/
|
|
3424
|
-
canReplace(from, to, replacement =
|
|
3482
|
+
canReplace(from, to, replacement = Fragment3.empty, start = 0, end = replacement.childCount) {
|
|
3425
3483
|
let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
|
|
3426
3484
|
let two = one && one.matchFragment(this.content, to);
|
|
3427
3485
|
if (!two || !two.validEnd)
|
|
@@ -3503,7 +3561,7 @@ var Node = class {
|
|
|
3503
3561
|
throw new RangeError("Invalid text node in JSON");
|
|
3504
3562
|
return schema.text(json.text, marks);
|
|
3505
3563
|
}
|
|
3506
|
-
let content =
|
|
3564
|
+
let content = Fragment3.fromJSON(schema, json.content);
|
|
3507
3565
|
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
3508
3566
|
node.type.checkAttrs(node.attrs);
|
|
3509
3567
|
return node;
|
|
@@ -3645,7 +3703,7 @@ var ContentMatch = class {
|
|
|
3645
3703
|
function search(match, types) {
|
|
3646
3704
|
let finished = match.matchFragment(after, startIndex);
|
|
3647
3705
|
if (finished && (!toEnd || finished.validEnd))
|
|
3648
|
-
return
|
|
3706
|
+
return Fragment3.from(types.map((tp) => tp.createAndFill()));
|
|
3649
3707
|
for (let i = 0; i < match.next.length; i++) {
|
|
3650
3708
|
let { type, next } = match.next[i];
|
|
3651
3709
|
if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
|
|
@@ -4097,7 +4155,7 @@ var NodeType = class {
|
|
|
4097
4155
|
create(attrs = null, content, marks) {
|
|
4098
4156
|
if (this.isText)
|
|
4099
4157
|
throw new Error("NodeType.create can't construct text nodes");
|
|
4100
|
-
return new Node(this, this.computeAttrs(attrs),
|
|
4158
|
+
return new Node(this, this.computeAttrs(attrs), Fragment3.from(content), Mark.setFrom(marks));
|
|
4101
4159
|
}
|
|
4102
4160
|
/**
|
|
4103
4161
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -4105,7 +4163,7 @@ var NodeType = class {
|
|
|
4105
4163
|
if it doesn't match.
|
|
4106
4164
|
*/
|
|
4107
4165
|
createChecked(attrs = null, content, marks) {
|
|
4108
|
-
content =
|
|
4166
|
+
content = Fragment3.from(content);
|
|
4109
4167
|
this.checkContent(content);
|
|
4110
4168
|
return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));
|
|
4111
4169
|
}
|
|
@@ -4119,7 +4177,7 @@ var NodeType = class {
|
|
|
4119
4177
|
*/
|
|
4120
4178
|
createAndFill(attrs = null, content, marks) {
|
|
4121
4179
|
attrs = this.computeAttrs(attrs);
|
|
4122
|
-
content =
|
|
4180
|
+
content = Fragment3.from(content);
|
|
4123
4181
|
if (content.size) {
|
|
4124
4182
|
let before = this.contentMatch.fillBefore(content);
|
|
4125
4183
|
if (!before)
|
|
@@ -4127,7 +4185,7 @@ var NodeType = class {
|
|
|
4127
4185
|
content = before.append(content);
|
|
4128
4186
|
}
|
|
4129
4187
|
let matched = this.contentMatch.matchFragment(content);
|
|
4130
|
-
let after = matched && matched.fillBefore(
|
|
4188
|
+
let after = matched && matched.fillBefore(Fragment3.empty, true);
|
|
4131
4189
|
if (!after)
|
|
4132
4190
|
return null;
|
|
4133
4191
|
return new Node(this, attrs, content.append(after), Mark.setFrom(marks));
|
|
@@ -4591,7 +4649,7 @@ var NodeContext = class {
|
|
|
4591
4649
|
if (!this.match) {
|
|
4592
4650
|
if (!this.type)
|
|
4593
4651
|
return [];
|
|
4594
|
-
let fill = this.type.contentMatch.fillBefore(
|
|
4652
|
+
let fill = this.type.contentMatch.fillBefore(Fragment3.from(node));
|
|
4595
4653
|
if (fill) {
|
|
4596
4654
|
this.match = this.type.contentMatch.matchFragment(fill);
|
|
4597
4655
|
} else {
|
|
@@ -4617,9 +4675,9 @@ var NodeContext = class {
|
|
|
4617
4675
|
this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m2[0].length));
|
|
4618
4676
|
}
|
|
4619
4677
|
}
|
|
4620
|
-
let content =
|
|
4678
|
+
let content = Fragment3.from(this.content);
|
|
4621
4679
|
if (!openEnd && this.match)
|
|
4622
|
-
content = content.append(this.match.fillBefore(
|
|
4680
|
+
content = content.append(this.match.fillBefore(Fragment3.empty, true));
|
|
4623
4681
|
return this.type ? this.type.create(this.attrs, content, this.marks) : content;
|
|
4624
4682
|
}
|
|
4625
4683
|
inlineContext(node) {
|
|
@@ -5436,7 +5494,7 @@ function mapFragment(fragment, f, parent) {
|
|
|
5436
5494
|
child = f(child, parent, i);
|
|
5437
5495
|
mapped.push(child);
|
|
5438
5496
|
}
|
|
5439
|
-
return
|
|
5497
|
+
return Fragment3.fromArray(mapped);
|
|
5440
5498
|
}
|
|
5441
5499
|
var AddMarkStep = class extends Step {
|
|
5442
5500
|
/**
|
|
@@ -5553,7 +5611,7 @@ var AddNodeMarkStep = class extends Step {
|
|
|
5553
5611
|
if (!node)
|
|
5554
5612
|
return StepResult.fail("No node at mark step's position");
|
|
5555
5613
|
let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
5556
|
-
return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(
|
|
5614
|
+
return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment3.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
5557
5615
|
}
|
|
5558
5616
|
invert(doc2) {
|
|
5559
5617
|
let node = doc2.nodeAt(this.pos);
|
|
@@ -5599,7 +5657,7 @@ var RemoveNodeMarkStep = class extends Step {
|
|
|
5599
5657
|
if (!node)
|
|
5600
5658
|
return StepResult.fail("No node at mark step's position");
|
|
5601
5659
|
let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
5602
|
-
return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(
|
|
5660
|
+
return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment3.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
5603
5661
|
}
|
|
5604
5662
|
invert(doc2) {
|
|
5605
5663
|
let node = doc2.nodeAt(this.pos);
|
|
@@ -5864,7 +5922,7 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
|
|
|
5864
5922
|
let m2, newline = /\r?\n|\r/g, slice;
|
|
5865
5923
|
while (m2 = newline.exec(child.text)) {
|
|
5866
5924
|
if (!slice)
|
|
5867
|
-
slice = new Slice(
|
|
5925
|
+
slice = new Slice(Fragment3.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
|
|
5868
5926
|
replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice));
|
|
5869
5927
|
}
|
|
5870
5928
|
}
|
|
@@ -5872,7 +5930,7 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
|
|
|
5872
5930
|
cur = end;
|
|
5873
5931
|
}
|
|
5874
5932
|
if (!match.validEnd) {
|
|
5875
|
-
let fill = match.fillBefore(
|
|
5933
|
+
let fill = match.fillBefore(Fragment3.empty, true);
|
|
5876
5934
|
tr.replace(cur, cur, new Slice(fill, 0, 0));
|
|
5877
5935
|
}
|
|
5878
5936
|
for (let i = replSteps.length - 1; i >= 0; i--)
|
|
@@ -5902,20 +5960,20 @@ function lift(tr, range, target) {
|
|
|
5902
5960
|
let { $from, $to, depth } = range;
|
|
5903
5961
|
let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
|
|
5904
5962
|
let start = gapStart, end = gapEnd;
|
|
5905
|
-
let before =
|
|
5963
|
+
let before = Fragment3.empty, openStart = 0;
|
|
5906
5964
|
for (let d = depth, splitting = false; d > target; d--)
|
|
5907
5965
|
if (splitting || $from.index(d) > 0) {
|
|
5908
5966
|
splitting = true;
|
|
5909
|
-
before =
|
|
5967
|
+
before = Fragment3.from($from.node(d).copy(before));
|
|
5910
5968
|
openStart++;
|
|
5911
5969
|
} else {
|
|
5912
5970
|
start--;
|
|
5913
5971
|
}
|
|
5914
|
-
let after =
|
|
5972
|
+
let after = Fragment3.empty, openEnd = 0;
|
|
5915
5973
|
for (let d = depth, splitting = false; d > target; d--)
|
|
5916
5974
|
if (splitting || $to.after(d + 1) < $to.end(d)) {
|
|
5917
5975
|
splitting = true;
|
|
5918
|
-
after =
|
|
5976
|
+
after = Fragment3.from($to.node(d).copy(after));
|
|
5919
5977
|
openEnd++;
|
|
5920
5978
|
} else {
|
|
5921
5979
|
end++;
|
|
@@ -5955,14 +6013,14 @@ function findWrappingInside(range, type) {
|
|
|
5955
6013
|
return inside;
|
|
5956
6014
|
}
|
|
5957
6015
|
function wrap(tr, range, wrappers) {
|
|
5958
|
-
let content =
|
|
6016
|
+
let content = Fragment3.empty;
|
|
5959
6017
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
5960
6018
|
if (content.size) {
|
|
5961
6019
|
let match = wrappers[i].type.contentMatch.matchFragment(content);
|
|
5962
6020
|
if (!match || !match.validEnd)
|
|
5963
6021
|
throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
|
|
5964
6022
|
}
|
|
5965
|
-
content =
|
|
6023
|
+
content = Fragment3.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
5966
6024
|
}
|
|
5967
6025
|
let start = range.start, end = range.end;
|
|
5968
6026
|
tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
|
|
@@ -5987,7 +6045,7 @@ function setBlockType(tr, from, to, type, attrs) {
|
|
|
5987
6045
|
clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
|
|
5988
6046
|
let mapping = tr.mapping.slice(mapFrom);
|
|
5989
6047
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
5990
|
-
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(
|
|
6048
|
+
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment3.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
|
|
5991
6049
|
if (convertNewlines === true)
|
|
5992
6050
|
replaceNewlines(tr, node, pos, mapFrom);
|
|
5993
6051
|
return false;
|
|
@@ -6028,7 +6086,7 @@ function setNodeMarkup(tr, pos, type, attrs, marks) {
|
|
|
6028
6086
|
return tr.replaceWith(pos, pos + node.nodeSize, newNode);
|
|
6029
6087
|
if (!type.validContent(node.content))
|
|
6030
6088
|
throw new RangeError("Invalid content for node type " + type.name);
|
|
6031
|
-
tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(
|
|
6089
|
+
tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment3.from(newNode), 0, 0), 1, true));
|
|
6032
6090
|
}
|
|
6033
6091
|
function canSplit(doc2, pos, depth = 1, typesAfter) {
|
|
6034
6092
|
let $pos = doc2.resolve(pos), base2 = $pos.depth - depth;
|
|
@@ -6052,11 +6110,11 @@ function canSplit(doc2, pos, depth = 1, typesAfter) {
|
|
|
6052
6110
|
return $pos.node(base2).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base2 + 1).type);
|
|
6053
6111
|
}
|
|
6054
6112
|
function split(tr, pos, depth = 1, typesAfter) {
|
|
6055
|
-
let $pos = tr.doc.resolve(pos), before =
|
|
6113
|
+
let $pos = tr.doc.resolve(pos), before = Fragment3.empty, after = Fragment3.empty;
|
|
6056
6114
|
for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
|
|
6057
|
-
before =
|
|
6115
|
+
before = Fragment3.from($pos.node(d).copy(before));
|
|
6058
6116
|
let typeAfter = typesAfter && typesAfter[i];
|
|
6059
|
-
after =
|
|
6117
|
+
after = Fragment3.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
|
|
6060
6118
|
}
|
|
6061
6119
|
tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
|
|
6062
6120
|
}
|
|
@@ -6171,7 +6229,7 @@ var Fitter = class {
|
|
|
6171
6229
|
this.$to = $to;
|
|
6172
6230
|
this.unplaced = unplaced;
|
|
6173
6231
|
this.frontier = [];
|
|
6174
|
-
this.placed =
|
|
6232
|
+
this.placed = Fragment3.empty;
|
|
6175
6233
|
for (let i = 0; i <= $from.depth; i++) {
|
|
6176
6234
|
let node = $from.node(i);
|
|
6177
6235
|
this.frontier.push({
|
|
@@ -6180,7 +6238,7 @@ var Fitter = class {
|
|
|
6180
6238
|
});
|
|
6181
6239
|
}
|
|
6182
6240
|
for (let i = $from.depth; i > 0; i--)
|
|
6183
|
-
this.placed =
|
|
6241
|
+
this.placed = Fragment3.from($from.node(i).copy(this.placed));
|
|
6184
6242
|
}
|
|
6185
6243
|
get depth() {
|
|
6186
6244
|
return this.frontier.length - 1;
|
|
@@ -6237,7 +6295,7 @@ var Fitter = class {
|
|
|
6237
6295
|
let first2 = fragment.firstChild;
|
|
6238
6296
|
for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
|
|
6239
6297
|
let { type, match } = this.frontier[frontierDepth], wrap2, inject = null;
|
|
6240
|
-
if (pass == 1 && (first2 ? match.matchType(first2.type) || (inject = match.fillBefore(
|
|
6298
|
+
if (pass == 1 && (first2 ? match.matchType(first2.type) || (inject = match.fillBefore(Fragment3.from(first2), false)) : parent && type.compatibleContent(parent.type)))
|
|
6241
6299
|
return { sliceDepth, frontierDepth, parent, inject };
|
|
6242
6300
|
else if (pass == 2 && first2 && (wrap2 = match.findWrapping(first2.type)))
|
|
6243
6301
|
return { sliceDepth, frontierDepth, parent, wrap: wrap2 };
|
|
@@ -6297,7 +6355,7 @@ var Fitter = class {
|
|
|
6297
6355
|
let toEnd = taken == fragment.childCount;
|
|
6298
6356
|
if (!toEnd)
|
|
6299
6357
|
openEndCount = -1;
|
|
6300
|
-
this.placed = addToFragment(this.placed, frontierDepth,
|
|
6358
|
+
this.placed = addToFragment(this.placed, frontierDepth, Fragment3.from(add));
|
|
6301
6359
|
this.frontier[frontierDepth].match = match;
|
|
6302
6360
|
if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
|
|
6303
6361
|
this.closeFrontierNode();
|
|
@@ -6354,12 +6412,12 @@ var Fitter = class {
|
|
|
6354
6412
|
openFrontierNode(type, attrs = null, content) {
|
|
6355
6413
|
let top = this.frontier[this.depth];
|
|
6356
6414
|
top.match = top.match.matchType(type);
|
|
6357
|
-
this.placed = addToFragment(this.placed, this.depth,
|
|
6415
|
+
this.placed = addToFragment(this.placed, this.depth, Fragment3.from(type.create(attrs, content)));
|
|
6358
6416
|
this.frontier.push({ type, match: type.contentMatch });
|
|
6359
6417
|
}
|
|
6360
6418
|
closeFrontierNode() {
|
|
6361
6419
|
let open = this.frontier.pop();
|
|
6362
|
-
let add = open.match.fillBefore(
|
|
6420
|
+
let add = open.match.fillBefore(Fragment3.empty, true);
|
|
6363
6421
|
if (add.childCount)
|
|
6364
6422
|
this.placed = addToFragment(this.placed, this.frontier.length, add);
|
|
6365
6423
|
}
|
|
@@ -6388,7 +6446,7 @@ function closeNodeStart(node, openStart, openEnd) {
|
|
|
6388
6446
|
if (openStart > 0) {
|
|
6389
6447
|
frag = node.type.contentMatch.fillBefore(frag).append(frag);
|
|
6390
6448
|
if (openEnd <= 0)
|
|
6391
|
-
frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(
|
|
6449
|
+
frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment3.empty, true));
|
|
6392
6450
|
}
|
|
6393
6451
|
return node.copy(frag);
|
|
6394
6452
|
}
|
|
@@ -6480,7 +6538,7 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
|
|
|
6480
6538
|
if (depth > newOpen) {
|
|
6481
6539
|
let match = parent.contentMatchAt(0);
|
|
6482
6540
|
let start = match.fillBefore(fragment).append(fragment);
|
|
6483
|
-
fragment = start.append(match.matchFragment(start).fillBefore(
|
|
6541
|
+
fragment = start.append(match.matchFragment(start).fillBefore(Fragment3.empty, true));
|
|
6484
6542
|
}
|
|
6485
6543
|
return fragment;
|
|
6486
6544
|
}
|
|
@@ -6490,7 +6548,7 @@ function replaceRangeWith(tr, from, to, node) {
|
|
|
6490
6548
|
if (point != null)
|
|
6491
6549
|
from = to = point;
|
|
6492
6550
|
}
|
|
6493
|
-
tr.replaceRange(from, to, new Slice(
|
|
6551
|
+
tr.replaceRange(from, to, new Slice(Fragment3.from(node), 0, 0));
|
|
6494
6552
|
}
|
|
6495
6553
|
function deleteRange(tr, from, to) {
|
|
6496
6554
|
let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
|
|
@@ -6538,7 +6596,7 @@ var AttrStep = class extends Step {
|
|
|
6538
6596
|
attrs[name] = node.attrs[name];
|
|
6539
6597
|
attrs[this.attr] = this.value;
|
|
6540
6598
|
let updated = node.type.create(attrs, null, node.marks);
|
|
6541
|
-
return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(
|
|
6599
|
+
return StepResult.fromReplace(doc2, this.pos, this.pos + 1, new Slice(Fragment3.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
6542
6600
|
}
|
|
6543
6601
|
getMap() {
|
|
6544
6602
|
return StepMap.empty;
|
|
@@ -6673,7 +6731,7 @@ var Transform = class {
|
|
|
6673
6731
|
fragment, node, or array of nodes.
|
|
6674
6732
|
*/
|
|
6675
6733
|
replaceWith(from, to, content) {
|
|
6676
|
-
return this.replace(from, to, new Slice(
|
|
6734
|
+
return this.replace(from, to, new Slice(Fragment3.from(content), 0, 0));
|
|
6677
6735
|
}
|
|
6678
6736
|
/**
|
|
6679
6737
|
Delete the content between the given positions.
|
|
@@ -7175,7 +7233,7 @@ var NodeSelection = class extends Selection {
|
|
|
7175
7233
|
return new NodeSelection($pos);
|
|
7176
7234
|
}
|
|
7177
7235
|
content() {
|
|
7178
|
-
return new Slice(
|
|
7236
|
+
return new Slice(Fragment3.from(this.node), 0, 0);
|
|
7179
7237
|
}
|
|
7180
7238
|
eq(other) {
|
|
7181
7239
|
return other instanceof NodeSelection && other.anchor == this.anchor;
|
|
@@ -7733,10 +7791,10 @@ function deleteBarrier(state, $cut, dispatch, dir) {
|
|
|
7733
7791
|
let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
|
|
7734
7792
|
if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {
|
|
7735
7793
|
if (dispatch) {
|
|
7736
|
-
let end = $cut.pos + after.nodeSize, wrap2 =
|
|
7794
|
+
let end = $cut.pos + after.nodeSize, wrap2 = Fragment3.empty;
|
|
7737
7795
|
for (let i = conn.length - 1; i >= 0; i--)
|
|
7738
|
-
wrap2 =
|
|
7739
|
-
wrap2 =
|
|
7796
|
+
wrap2 = Fragment3.from(conn[i].create(null, wrap2));
|
|
7797
|
+
wrap2 = Fragment3.from(before.copy(wrap2));
|
|
7740
7798
|
let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap2, 1, 0), conn.length, true));
|
|
7741
7799
|
let $joinAt = tr.doc.resolve(end + 2 * conn.length);
|
|
7742
7800
|
if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos))
|
|
@@ -7765,9 +7823,9 @@ function deleteBarrier(state, $cut, dispatch, dir) {
|
|
|
7765
7823
|
afterDepth++;
|
|
7766
7824
|
if (at.canReplace(at.childCount, at.childCount, afterText.content)) {
|
|
7767
7825
|
if (dispatch) {
|
|
7768
|
-
let end =
|
|
7826
|
+
let end = Fragment3.empty;
|
|
7769
7827
|
for (let i = wrap2.length - 1; i >= 0; i--)
|
|
7770
|
-
end =
|
|
7828
|
+
end = Fragment3.from(wrap2[i].copy(end));
|
|
7771
7829
|
let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap2.length, 0), 0, true));
|
|
7772
7830
|
dispatch(tr.scrollIntoView());
|
|
7773
7831
|
}
|
|
@@ -7872,9 +7930,9 @@ function wrapRangeInList(tr, range, listType, attrs = null) {
|
|
|
7872
7930
|
return true;
|
|
7873
7931
|
}
|
|
7874
7932
|
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
|
|
7875
|
-
let content =
|
|
7933
|
+
let content = Fragment3.empty;
|
|
7876
7934
|
for (let i = wrappers.length - 1; i >= 0; i--)
|
|
7877
|
-
content =
|
|
7935
|
+
content = Fragment3.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
7878
7936
|
tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
|
|
7879
7937
|
let found2 = 0;
|
|
7880
7938
|
for (let i = 0; i < wrappers.length; i++)
|
|
@@ -7908,7 +7966,7 @@ function liftListItem(itemType) {
|
|
|
7908
7966
|
function liftToOuterList(state, dispatch, itemType, range) {
|
|
7909
7967
|
let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
|
|
7910
7968
|
if (end < endOfList) {
|
|
7911
|
-
tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(
|
|
7969
|
+
tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment3.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
|
|
7912
7970
|
range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
|
|
7913
7971
|
}
|
|
7914
7972
|
const target = liftTarget(range);
|
|
@@ -7932,10 +7990,10 @@ function liftOutOfList(state, dispatch, range) {
|
|
|
7932
7990
|
return false;
|
|
7933
7991
|
let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
|
|
7934
7992
|
let parent = $start.node(-1), indexBefore = $start.index(-1);
|
|
7935
|
-
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ?
|
|
7993
|
+
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment3.empty : Fragment3.from(list))))
|
|
7936
7994
|
return false;
|
|
7937
7995
|
let start = $start.pos, end = start + item.nodeSize;
|
|
7938
|
-
tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ?
|
|
7996
|
+
tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment3.empty : Fragment3.from(list.copy(Fragment3.empty))).append(atEnd ? Fragment3.empty : Fragment3.from(list.copy(Fragment3.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
|
|
7939
7997
|
dispatch(tr.scrollIntoView());
|
|
7940
7998
|
return true;
|
|
7941
7999
|
}
|
|
@@ -7953,8 +8011,8 @@ function sinkListItem(itemType) {
|
|
|
7953
8011
|
return false;
|
|
7954
8012
|
if (dispatch) {
|
|
7955
8013
|
let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
|
|
7956
|
-
let inner =
|
|
7957
|
-
let slice = new Slice(
|
|
8014
|
+
let inner = Fragment3.from(nestedBefore ? itemType.create() : null);
|
|
8015
|
+
let slice = new Slice(Fragment3.from(itemType.create(null, Fragment3.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
|
|
7958
8016
|
let before = range.start, after = range.end;
|
|
7959
8017
|
dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView());
|
|
7960
8018
|
}
|
|
@@ -8573,7 +8631,7 @@ function elementFromString(value) {
|
|
|
8573
8631
|
return removeWhitespaces(html);
|
|
8574
8632
|
}
|
|
8575
8633
|
function createNodeFromContent(content, schema, options) {
|
|
8576
|
-
if (content instanceof Node || content instanceof
|
|
8634
|
+
if (content instanceof Node || content instanceof Fragment3) {
|
|
8577
8635
|
return content;
|
|
8578
8636
|
}
|
|
8579
8637
|
options = {
|
|
@@ -8587,7 +8645,7 @@ function createNodeFromContent(content, schema, options) {
|
|
|
8587
8645
|
try {
|
|
8588
8646
|
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
8589
8647
|
if (isArrayContent) {
|
|
8590
|
-
return
|
|
8648
|
+
return Fragment3.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
8591
8649
|
}
|
|
8592
8650
|
const node = schema.nodeFromJSON(content);
|
|
8593
8651
|
if (options.errorOnInvalidContent) {
|
|
@@ -8734,7 +8792,7 @@ var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) =
|
|
|
8734
8792
|
if (isOnlyTextContent) {
|
|
8735
8793
|
if (Array.isArray(value)) {
|
|
8736
8794
|
newContent = value.map((v) => v.text || "").join("");
|
|
8737
|
-
} else if (value instanceof
|
|
8795
|
+
} else if (value instanceof Fragment3) {
|
|
8738
8796
|
let text = "";
|
|
8739
8797
|
value.forEach((node) => {
|
|
8740
8798
|
if (node.text) {
|
|
@@ -9605,10 +9663,10 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
|
|
|
9605
9663
|
return false;
|
|
9606
9664
|
}
|
|
9607
9665
|
if (dispatch) {
|
|
9608
|
-
let wrap2 =
|
|
9666
|
+
let wrap2 = Fragment3.empty;
|
|
9609
9667
|
const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
9610
9668
|
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
|
|
9611
|
-
wrap2 =
|
|
9669
|
+
wrap2 = Fragment3.from($from.node(d).copy(wrap2));
|
|
9612
9670
|
}
|
|
9613
9671
|
const depthAfter = (
|
|
9614
9672
|
// eslint-disable-next-line no-nested-ternary
|
|
@@ -9619,7 +9677,7 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
|
|
|
9619
9677
|
...overrideAttrs
|
|
9620
9678
|
};
|
|
9621
9679
|
const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
|
|
9622
|
-
wrap2 = wrap2.append(
|
|
9680
|
+
wrap2 = wrap2.append(Fragment3.from(type.createAndFill(null, nextType2) || void 0));
|
|
9623
9681
|
const start = $from.before($from.depth - (depthBefore - 1));
|
|
9624
9682
|
tr.replace(start, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0));
|
|
9625
9683
|
let sel = -1;
|
|
@@ -11840,743 +11898,324 @@ var AppSearchableMultiSelector = forwardRef(
|
|
|
11840
11898
|
);
|
|
11841
11899
|
AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
|
|
11842
11900
|
var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
|
|
11843
|
-
|
|
11844
|
-
|
|
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
|
+
var AppSelectInput = forwardRef(
|
|
12002
|
+
({
|
|
11845
12003
|
name,
|
|
11846
12004
|
label,
|
|
11847
|
-
|
|
12005
|
+
mode = "autocomplete",
|
|
11848
12006
|
options = [],
|
|
11849
|
-
setSearchQuery,
|
|
11850
12007
|
required = false,
|
|
11851
|
-
variant = "outlined",
|
|
11852
12008
|
disabled = false,
|
|
11853
|
-
|
|
11854
|
-
|
|
12009
|
+
showNoneOption = false,
|
|
12010
|
+
noneOptionText = "None",
|
|
11855
12011
|
helperText,
|
|
11856
|
-
|
|
11857
|
-
|
|
12012
|
+
variant = "outlined",
|
|
12013
|
+
placeholder,
|
|
12014
|
+
onSearchChange,
|
|
12015
|
+
onChange: externalOnChange,
|
|
11858
12016
|
sx,
|
|
11859
12017
|
formControlSx,
|
|
11860
12018
|
labelSx,
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
labelComponent: LabelComponent = InputLabel,
|
|
11875
|
-
inputComponent: InputComponent = "input",
|
|
11876
|
-
errorComponent: ErrorComponent = Typography,
|
|
11877
|
-
helperTextComponent: HelperTextComponent = FormHelperText,
|
|
11878
|
-
labelProps = {},
|
|
11879
|
-
inputProps = {},
|
|
11880
|
-
textFieldProps = {},
|
|
11881
|
-
autocompleteProps = {},
|
|
11882
|
-
checkboxProps = {},
|
|
11883
|
-
chipProps = {},
|
|
11884
|
-
errorProps = {},
|
|
11885
|
-
helperTextProps = {},
|
|
11886
|
-
className = "",
|
|
11887
|
-
formControlClassName = "",
|
|
11888
|
-
labelClassName = "",
|
|
11889
|
-
inputClassName = "",
|
|
11890
|
-
textFieldClassName = "",
|
|
11891
|
-
autocompleteClassName = "",
|
|
11892
|
-
listboxClassName = "",
|
|
11893
|
-
optionClassName = "",
|
|
11894
|
-
chipClassName = "",
|
|
11895
|
-
errorClassName = "",
|
|
11896
|
-
helperTextClassName = "",
|
|
11897
|
-
onInputChange: externalOnInputChange,
|
|
11898
|
-
onChange: externalOnChange,
|
|
11899
|
-
onOpen,
|
|
11900
|
-
onClose,
|
|
11901
|
-
onBlur: externalOnBlur,
|
|
11902
|
-
onFocus: externalOnFocus,
|
|
11903
|
-
onClear,
|
|
11904
|
-
onMaxSelectionsReached,
|
|
11905
|
-
onRemove,
|
|
11906
|
-
onAdd,
|
|
11907
|
-
...otherProps
|
|
11908
|
-
} = props;
|
|
11909
|
-
useTheme();
|
|
11910
|
-
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
11911
|
-
const fieldError = _19.get(errors, name);
|
|
11912
|
-
const isTouched = Boolean(_19.get(touched, name));
|
|
11913
|
-
const hasError = Boolean(fieldError) && isTouched;
|
|
11914
|
-
const val = _19.get(values, name);
|
|
11915
|
-
const selectedValues = Array.isArray(val) ? val : [];
|
|
11916
|
-
const selectedCount = selectedValues.length;
|
|
11917
|
-
const handleChange = useCallback(
|
|
11918
|
-
(event, value, reason, details) => {
|
|
11919
|
-
const normalizedValue = (() => {
|
|
11920
|
-
if (value === null)
|
|
11921
|
-
return [];
|
|
11922
|
-
const arr = Array.isArray(value) ? value : [value];
|
|
11923
|
-
return arr.map(
|
|
11924
|
-
(item) => typeof item === "string" ? { value: item, label: item } : item
|
|
11925
|
-
);
|
|
11926
|
-
})();
|
|
11927
|
-
if (maxSelections && normalizedValue.length > maxSelections) {
|
|
11928
|
-
onMaxSelectionsReached == null ? void 0 : onMaxSelectionsReached(maxSelections);
|
|
11929
|
-
return;
|
|
11930
|
-
}
|
|
11931
|
-
if (reason === "selectOption" || reason === "removeOption") {
|
|
11932
|
-
const added = normalizedValue.filter(
|
|
11933
|
-
(item) => !selectedValues.some((v) => v.value === item.value)
|
|
11934
|
-
);
|
|
11935
|
-
const removed = selectedValues.filter(
|
|
11936
|
-
(item) => !normalizedValue.some((v) => v.value === item.value)
|
|
11937
|
-
);
|
|
11938
|
-
added.forEach((item) => onAdd == null ? void 0 : onAdd(item));
|
|
11939
|
-
removed.forEach((item) => onRemove == null ? void 0 : onRemove(item));
|
|
12019
|
+
searchDebounce = 300,
|
|
12020
|
+
clearable = true
|
|
12021
|
+
}, ref) => {
|
|
12022
|
+
const theme = useTheme();
|
|
12023
|
+
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
12024
|
+
const fieldError = _19.get(errors, name);
|
|
12025
|
+
const isTouched = Boolean(_19.get(touched, name));
|
|
12026
|
+
const hasError = Boolean(fieldError) && isTouched;
|
|
12027
|
+
const currentValue = _19.get(values, name);
|
|
12028
|
+
const handleValueChange = (newValue) => {
|
|
12029
|
+
setFieldValue(name, newValue, true);
|
|
12030
|
+
if (externalOnChange) {
|
|
12031
|
+
externalOnChange(newValue);
|
|
11940
12032
|
}
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
},
|
|
11944
|
-
[
|
|
11945
|
-
maxSelections,
|
|
11946
|
-
selectedValues,
|
|
11947
|
-
setFieldValue,
|
|
11948
|
-
name,
|
|
11949
|
-
onMaxSelectionsReached,
|
|
11950
|
-
onAdd,
|
|
11951
|
-
onRemove,
|
|
11952
|
-
externalOnChange
|
|
11953
|
-
]
|
|
11954
|
-
);
|
|
11955
|
-
const handleInputChange = useCallback(
|
|
11956
|
-
(event, value, reason) => {
|
|
11957
|
-
setSearchQuery == null ? void 0 : setSearchQuery(value);
|
|
11958
|
-
externalOnInputChange == null ? void 0 : externalOnInputChange(event, value, reason);
|
|
11959
|
-
},
|
|
11960
|
-
[setSearchQuery, externalOnInputChange]
|
|
11961
|
-
);
|
|
11962
|
-
const handleBlur = useCallback(
|
|
11963
|
-
(event) => {
|
|
12033
|
+
};
|
|
12034
|
+
const handleBlur = () => {
|
|
11964
12035
|
setFieldTouched(name, true, true);
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
},
|
|
11973
|
-
[externalOnFocus]
|
|
11974
|
-
);
|
|
11975
|
-
const filterOptions = useCallback(
|
|
11976
|
-
(options2, { inputValue }) => {
|
|
11977
|
-
if (!inputValue)
|
|
11978
|
-
return options2;
|
|
11979
|
-
const inputValueLower = inputValue.toLowerCase();
|
|
11980
|
-
return options2.filter(
|
|
11981
|
-
(option) => {
|
|
11982
|
-
var _a, _b, _c, _d;
|
|
11983
|
-
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));
|
|
12036
|
+
};
|
|
12037
|
+
const selectedOption = options.find((opt) => opt.value === currentValue) || null;
|
|
12038
|
+
if (mode === "autocomplete") {
|
|
12039
|
+
const debouncedSearch = React4.useRef();
|
|
12040
|
+
const handleSearchChange = (query) => {
|
|
12041
|
+
if (debouncedSearch.current) {
|
|
12042
|
+
clearTimeout(debouncedSearch.current);
|
|
11984
12043
|
}
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
InputProps: {
|
|
12005
|
-
...params.InputProps,
|
|
12006
|
-
...textFieldProps.InputProps,
|
|
12007
|
-
className: `${params.InputProps.className || ""} ${textFieldClassName}`.trim()
|
|
12008
|
-
},
|
|
12009
|
-
sx: [
|
|
12010
|
-
{
|
|
12011
|
-
"& .MuiOutlinedInput-root": {
|
|
12012
|
-
borderRadius: "8px",
|
|
12013
|
-
"& fieldset": {
|
|
12014
|
-
borderColor: hasError ? "error.main" : "divider"
|
|
12015
|
-
},
|
|
12016
|
-
"&:hover fieldset": {
|
|
12017
|
-
borderColor: hasError ? "error.main" : "text.primary"
|
|
12018
|
-
},
|
|
12019
|
-
"&.Mui-focused fieldset": {
|
|
12020
|
-
borderColor: hasError ? "error.main" : "primary.main"
|
|
12021
|
-
}
|
|
12022
|
-
}
|
|
12023
|
-
},
|
|
12024
|
-
...Array.isArray(textFieldSx) ? textFieldSx : textFieldSx ? [textFieldSx] : []
|
|
12025
|
-
],
|
|
12026
|
-
...textFieldProps
|
|
12027
|
-
}
|
|
12028
|
-
),
|
|
12029
|
-
[
|
|
12030
|
-
variant,
|
|
12031
|
-
hasError,
|
|
12032
|
-
inputProps,
|
|
12033
|
-
inputClassName,
|
|
12034
|
-
textFieldProps,
|
|
12035
|
-
textFieldClassName,
|
|
12036
|
-
textFieldSx
|
|
12037
|
-
]
|
|
12038
|
-
);
|
|
12039
|
-
const defaultRenderOption = useCallback(
|
|
12040
|
-
(props2, option, { selected }) => /* @__PURE__ */ createElement(
|
|
12041
|
-
"li",
|
|
12042
|
-
{
|
|
12043
|
-
...props2,
|
|
12044
|
-
key: option.value,
|
|
12045
|
-
className: `${props2.className || ""} ${optionClassName}`.trim(),
|
|
12046
|
-
style: {
|
|
12047
|
-
...props2.style,
|
|
12048
|
-
opacity: option.disabled ? 0.5 : 1,
|
|
12049
|
-
pointerEvents: option.disabled ? "none" : "auto"
|
|
12050
|
-
}
|
|
12051
|
-
},
|
|
12052
|
-
/* @__PURE__ */ jsx(
|
|
12053
|
-
Checkbox,
|
|
12054
|
-
{
|
|
12055
|
-
checked: selected,
|
|
12056
|
-
disabled: option.disabled,
|
|
12057
|
-
sx: {
|
|
12058
|
-
color: "text.secondary",
|
|
12059
|
-
"&.Mui-checked": {
|
|
12060
|
-
color: "primary.main"
|
|
12061
|
-
},
|
|
12062
|
-
"&.Mui-disabled": {
|
|
12063
|
-
color: "text.disabled"
|
|
12064
|
-
},
|
|
12065
|
-
mr: 1,
|
|
12066
|
-
...checkboxProps.sx
|
|
12067
|
-
},
|
|
12068
|
-
...checkboxProps
|
|
12069
|
-
}
|
|
12070
|
-
),
|
|
12071
|
-
option.icon && /* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
|
|
12072
|
-
/* @__PURE__ */ jsx(
|
|
12073
|
-
Typography,
|
|
12074
|
-
{
|
|
12075
|
-
variant: "body2",
|
|
12076
|
-
sx: [
|
|
12077
|
-
{
|
|
12078
|
-
color: option.disabled ? "text.disabled" : "text.primary",
|
|
12079
|
-
...option.textSx
|
|
12080
|
-
},
|
|
12081
|
-
...Array.isArray(optionSx) ? optionSx : [optionSx]
|
|
12082
|
-
],
|
|
12083
|
-
children: option.label
|
|
12084
|
-
}
|
|
12085
|
-
)
|
|
12086
|
-
),
|
|
12087
|
-
[optionClassName, checkboxProps, optionSx]
|
|
12088
|
-
);
|
|
12089
|
-
const defaultRenderTags = useCallback(
|
|
12090
|
-
(value, getTagProps) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 }, children: value.map((option, index) => {
|
|
12091
|
-
const { key, ...tagProps } = getTagProps({ index });
|
|
12092
|
-
return /* @__PURE__ */ createElement(
|
|
12093
|
-
Chip,
|
|
12044
|
+
debouncedSearch.current = setTimeout(() => {
|
|
12045
|
+
if (onSearchChange) {
|
|
12046
|
+
onSearchChange(query);
|
|
12047
|
+
}
|
|
12048
|
+
}, searchDebounce);
|
|
12049
|
+
};
|
|
12050
|
+
const filterOptions = (options2, { inputValue }) => {
|
|
12051
|
+
if (!inputValue)
|
|
12052
|
+
return options2;
|
|
12053
|
+
const inputValueLower = inputValue.toLowerCase();
|
|
12054
|
+
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
|
+
}
|
|
12059
|
+
);
|
|
12060
|
+
};
|
|
12061
|
+
return /* @__PURE__ */ jsx(Box, { ref, sx, children: /* @__PURE__ */ jsx(
|
|
12062
|
+
FormControl,
|
|
12094
12063
|
{
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12064
|
+
fullWidth: true,
|
|
12065
|
+
error: hasError,
|
|
12066
|
+
disabled,
|
|
12067
|
+
sx: formControlSx,
|
|
12068
|
+
children: /* @__PURE__ */ jsx(
|
|
12069
|
+
Autocomplete,
|
|
12100
12070
|
{
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12071
|
+
options,
|
|
12072
|
+
value: selectedOption,
|
|
12073
|
+
onChange: (event, newValue) => {
|
|
12074
|
+
handleValueChange((newValue == null ? void 0 : newValue.value) || "");
|
|
12075
|
+
},
|
|
12076
|
+
onInputChange: (event, value, reason) => {
|
|
12077
|
+
if (reason === "input" && onSearchChange) {
|
|
12078
|
+
handleSearchChange(value);
|
|
12107
12079
|
}
|
|
12108
|
-
}
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12080
|
+
},
|
|
12081
|
+
filterOptions,
|
|
12082
|
+
onBlur: handleBlur,
|
|
12083
|
+
disabled,
|
|
12084
|
+
clearOnBlur: false,
|
|
12085
|
+
clearOnEscape: true,
|
|
12086
|
+
disableClearable: !clearable,
|
|
12087
|
+
getOptionLabel: (option) => option.label,
|
|
12088
|
+
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
12089
|
+
getOptionDisabled: (option) => !!option.disabled,
|
|
12090
|
+
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
12091
|
+
TextField,
|
|
12092
|
+
{
|
|
12093
|
+
...params,
|
|
12094
|
+
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12095
|
+
label,
|
|
12096
|
+
required && /* @__PURE__ */ jsx(
|
|
12097
|
+
Typography,
|
|
12098
|
+
{
|
|
12099
|
+
sx: { color: "error.main" },
|
|
12100
|
+
component: "span",
|
|
12101
|
+
children: " *"
|
|
12102
|
+
}
|
|
12103
|
+
)
|
|
12104
|
+
] }),
|
|
12105
|
+
variant,
|
|
12106
|
+
placeholder,
|
|
12107
|
+
error: hasError,
|
|
12108
|
+
helperText: hasError ? fieldError : helperText,
|
|
12109
|
+
FormHelperTextProps: {
|
|
12110
|
+
sx: { mx: 0, mt: 0.5 }
|
|
12111
|
+
}
|
|
12112
|
+
}
|
|
12113
|
+
),
|
|
12114
|
+
renderOption: (props, option) => /* @__PURE__ */ jsxs("li", { ...props, children: [
|
|
12115
|
+
option.icon,
|
|
12116
|
+
/* @__PURE__ */ jsx(
|
|
12117
|
+
Typography,
|
|
12118
|
+
{
|
|
12119
|
+
variant: "body2",
|
|
12120
|
+
sx: {
|
|
12121
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
12122
|
+
...option.textSx
|
|
12123
|
+
},
|
|
12124
|
+
children: option.label
|
|
12125
|
+
}
|
|
12126
|
+
)
|
|
12127
|
+
] })
|
|
12128
|
+
}
|
|
12129
|
+
)
|
|
12114
12130
|
}
|
|
12115
|
-
);
|
|
12116
|
-
}
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
Typography,
|
|
12124
|
-
{
|
|
12125
|
-
variant: "caption",
|
|
12126
|
-
sx: [
|
|
12127
|
-
{
|
|
12128
|
-
mt: 0.5,
|
|
12129
|
-
color: "text.secondary"
|
|
12130
|
-
},
|
|
12131
|
-
...Array.isArray(selectedCountSx) ? selectedCountSx : [selectedCountSx]
|
|
12132
|
-
],
|
|
12133
|
-
children: [
|
|
12134
|
-
`${selectedCount} selected`,
|
|
12135
|
-
maxSelections ? ` (max ${maxSelections})` : ""
|
|
12136
|
-
]
|
|
12137
|
-
}
|
|
12138
|
-
);
|
|
12139
|
-
}, [
|
|
12140
|
-
showSelectedCount,
|
|
12141
|
-
multiple,
|
|
12142
|
-
selectedCount,
|
|
12143
|
-
maxSelections,
|
|
12144
|
-
selectedCountSx
|
|
12145
|
-
]);
|
|
12146
|
-
return /* @__PURE__ */ jsx(
|
|
12147
|
-
Box,
|
|
12148
|
-
{
|
|
12149
|
-
ref,
|
|
12150
|
-
className: `app-searchable-multi-selector ${className}`.trim(),
|
|
12151
|
-
sx: [{ width: "100%" }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
12152
|
-
children: /* @__PURE__ */ jsxs(
|
|
12131
|
+
) });
|
|
12132
|
+
}
|
|
12133
|
+
if (mode === "dropdown") {
|
|
12134
|
+
const handleSelectChange = (event) => {
|
|
12135
|
+
const newValue = event.target.value;
|
|
12136
|
+
handleValueChange(newValue);
|
|
12137
|
+
};
|
|
12138
|
+
return /* @__PURE__ */ jsx(Box, { ref, sx, children: /* @__PURE__ */ jsxs(
|
|
12153
12139
|
FormControl,
|
|
12154
12140
|
{
|
|
12155
12141
|
fullWidth: true,
|
|
12142
|
+
variant,
|
|
12156
12143
|
error: hasError,
|
|
12157
12144
|
disabled,
|
|
12158
|
-
|
|
12159
|
-
sx: [
|
|
12160
|
-
{
|
|
12161
|
-
"& .MuiAutocomplete-root": {
|
|
12162
|
-
"& .MuiOutlinedInput-root": {
|
|
12163
|
-
padding: "4px"
|
|
12164
|
-
},
|
|
12165
|
-
"& .MuiAutocomplete-input": {
|
|
12166
|
-
padding: "8.5px 4px"
|
|
12167
|
-
}
|
|
12168
|
-
}
|
|
12169
|
-
},
|
|
12170
|
-
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
12171
|
-
],
|
|
12145
|
+
sx: formControlSx,
|
|
12172
12146
|
children: [
|
|
12173
12147
|
label && /* @__PURE__ */ jsxs(
|
|
12174
|
-
|
|
12148
|
+
Typography,
|
|
12175
12149
|
{
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
color: hasError ? "error.main" : "text.primary",
|
|
12183
|
-
"&.Mui-focused": {
|
|
12184
|
-
color: hasError ? "error.main" : "primary.main"
|
|
12185
|
-
}
|
|
12186
|
-
},
|
|
12187
|
-
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
12188
|
-
],
|
|
12189
|
-
...labelProps,
|
|
12150
|
+
variant: "body2",
|
|
12151
|
+
sx: {
|
|
12152
|
+
mb: 1,
|
|
12153
|
+
color: hasError ? "error.main" : "text.secondary",
|
|
12154
|
+
...labelSx
|
|
12155
|
+
},
|
|
12190
12156
|
children: [
|
|
12191
12157
|
label,
|
|
12192
|
-
required && /* @__PURE__ */ jsx(
|
|
12158
|
+
required && /* @__PURE__ */ jsx(Typography, { sx: { color: "error.main" }, component: "span", children: " *" })
|
|
12193
12159
|
]
|
|
12194
12160
|
}
|
|
12195
12161
|
),
|
|
12196
|
-
/* @__PURE__ */
|
|
12197
|
-
|
|
12162
|
+
/* @__PURE__ */ jsxs(
|
|
12163
|
+
Select,
|
|
12198
12164
|
{
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
options,
|
|
12202
|
-
value: selectedValues,
|
|
12203
|
-
filterOptions,
|
|
12204
|
-
onInputChange: handleInputChange,
|
|
12205
|
-
onChange: handleChange,
|
|
12206
|
-
onOpen,
|
|
12207
|
-
onClose,
|
|
12165
|
+
value: currentValue != null ? currentValue : "",
|
|
12166
|
+
onChange: handleSelectChange,
|
|
12208
12167
|
onBlur: handleBlur,
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
renderInput: externalRenderInput || defaultRenderInput,
|
|
12217
|
-
renderOption: externalRenderOption || defaultRenderOption,
|
|
12218
|
-
renderTags: externalRenderTags || defaultRenderTags,
|
|
12219
|
-
renderGroup: externalRenderGroup,
|
|
12220
|
-
ListboxProps: {
|
|
12221
|
-
className: `app-searchable-multi-selector-listbox ${listboxClassName}`.trim(),
|
|
12222
|
-
sx: [
|
|
12223
|
-
{
|
|
12224
|
-
"& .MuiAutocomplete-option": {
|
|
12225
|
-
px: 2,
|
|
12226
|
-
py: 1,
|
|
12227
|
-
'&[aria-selected="true"]': {
|
|
12228
|
-
backgroundColor: "action.selected",
|
|
12229
|
-
"&.Mui-focused": {
|
|
12230
|
-
backgroundColor: "action.hover"
|
|
12231
|
-
}
|
|
12232
|
-
},
|
|
12233
|
-
"&.Mui-focused": {
|
|
12234
|
-
backgroundColor: "action.hover"
|
|
12235
|
-
}
|
|
12236
|
-
}
|
|
12237
|
-
},
|
|
12238
|
-
...Array.isArray(optionSx) ? optionSx : optionSx ? [optionSx] : [],
|
|
12239
|
-
...Array.isArray(listboxSx) ? listboxSx : listboxSx ? [listboxSx] : []
|
|
12240
|
-
]
|
|
12168
|
+
displayEmpty: true,
|
|
12169
|
+
renderValue: (selected) => {
|
|
12170
|
+
if (selected === "") {
|
|
12171
|
+
return /* @__PURE__ */ jsx("em", { children: placeholder || noneOptionText });
|
|
12172
|
+
}
|
|
12173
|
+
const option = options.find((opt) => opt.value === selected);
|
|
12174
|
+
return (option == null ? void 0 : option.label) || String(selected);
|
|
12241
12175
|
},
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
},
|
|
12249
|
-
"& .MuiAutocomplete-endAdornment": {
|
|
12250
|
-
right: 8
|
|
12176
|
+
MenuProps: {
|
|
12177
|
+
PaperProps: {
|
|
12178
|
+
sx: {
|
|
12179
|
+
mt: 1,
|
|
12180
|
+
boxShadow: theme.shadows[3],
|
|
12181
|
+
maxHeight: 300
|
|
12251
12182
|
}
|
|
12252
|
-
},
|
|
12253
|
-
...Array.isArray(autocompleteSx) ? autocompleteSx : autocompleteSx ? [autocompleteSx] : []
|
|
12254
|
-
],
|
|
12255
|
-
...autocompleteProps,
|
|
12256
|
-
...otherProps
|
|
12257
|
-
}
|
|
12258
|
-
),
|
|
12259
|
-
(showHelperText || hasError) && /* @__PURE__ */ jsx(
|
|
12260
|
-
HelperTextComponent,
|
|
12261
|
-
{
|
|
12262
|
-
error: hasError,
|
|
12263
|
-
sx: [
|
|
12264
|
-
{
|
|
12265
|
-
mx: 0,
|
|
12266
|
-
mt: 0.5,
|
|
12267
|
-
...hasError ? { color: "error.main", ...errorSx } : { color: "text.secondary", ...helperTextSx }
|
|
12268
12183
|
}
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12184
|
+
},
|
|
12185
|
+
children: [
|
|
12186
|
+
showNoneOption && /* @__PURE__ */ jsx(MenuItem, { value: "", children: /* @__PURE__ */ jsx("em", { children: noneOptionText }) }),
|
|
12187
|
+
options.map((option) => /* @__PURE__ */ jsxs(
|
|
12188
|
+
MenuItem,
|
|
12189
|
+
{
|
|
12190
|
+
value: option.value,
|
|
12191
|
+
disabled: option.disabled,
|
|
12192
|
+
sx: option.sx,
|
|
12193
|
+
children: [
|
|
12194
|
+
option.icon,
|
|
12195
|
+
/* @__PURE__ */ jsx(
|
|
12196
|
+
Typography,
|
|
12197
|
+
{
|
|
12198
|
+
variant: "body2",
|
|
12199
|
+
sx: {
|
|
12200
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
12201
|
+
...option.textSx
|
|
12202
|
+
},
|
|
12203
|
+
children: option.label
|
|
12204
|
+
}
|
|
12205
|
+
)
|
|
12206
|
+
]
|
|
12207
|
+
},
|
|
12208
|
+
option.value
|
|
12209
|
+
))
|
|
12210
|
+
]
|
|
12273
12211
|
}
|
|
12274
12212
|
),
|
|
12275
|
-
|
|
12213
|
+
(helperText || hasError) && /* @__PURE__ */ jsx(FormHelperText, { error: hasError, sx: { mx: 0, mt: 0.5 }, children: hasError ? fieldError : helperText })
|
|
12276
12214
|
]
|
|
12277
12215
|
}
|
|
12278
|
-
)
|
|
12216
|
+
) });
|
|
12279
12217
|
}
|
|
12280
|
-
|
|
12281
|
-
});
|
|
12282
|
-
AppSearchableMultiSelector2.displayName = "AppSearchableMultiSelector";
|
|
12283
|
-
var AppSearchableSelect_default = AppSearchableMultiSelector2;
|
|
12284
|
-
var AppSelectInput = forwardRef(
|
|
12285
|
-
({
|
|
12286
|
-
name,
|
|
12287
|
-
variant = "outlined",
|
|
12288
|
-
label,
|
|
12289
|
-
fullWidth = true,
|
|
12290
|
-
required = false,
|
|
12291
|
-
disabled = false,
|
|
12292
|
-
readOnly = false,
|
|
12293
|
-
options = [],
|
|
12294
|
-
showNoneOption = false,
|
|
12295
|
-
noneOptionText = "None",
|
|
12296
|
-
showHelperText = false,
|
|
12297
|
-
helperText,
|
|
12298
|
-
sx,
|
|
12299
|
-
formControlSx,
|
|
12300
|
-
selectSx,
|
|
12301
|
-
inputSx,
|
|
12302
|
-
labelSx,
|
|
12303
|
-
menuPaperSx,
|
|
12304
|
-
menuItemSx,
|
|
12305
|
-
selectedMenuItemSx,
|
|
12306
|
-
errorSx,
|
|
12307
|
-
helperTextSx,
|
|
12308
|
-
iconSx,
|
|
12309
|
-
labelComponent: LabelComponent = InputLabel,
|
|
12310
|
-
errorComponent: ErrorComponent = Typography,
|
|
12311
|
-
helperTextComponent: HelperTextComponent = FormHelperText,
|
|
12312
|
-
onChange: externalOnChange,
|
|
12313
|
-
onOpen,
|
|
12314
|
-
onClose,
|
|
12315
|
-
onBlur: externalOnBlur,
|
|
12316
|
-
renderValue,
|
|
12317
|
-
renderMenuItem,
|
|
12318
|
-
MenuProps,
|
|
12319
|
-
inputProps,
|
|
12320
|
-
...otherProps
|
|
12321
|
-
}, ref) => {
|
|
12322
|
-
const theme = useTheme();
|
|
12323
|
-
const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
|
|
12324
|
-
const fieldError = _19.get(errors, name);
|
|
12325
|
-
const isTouched = _19.get(touched, name);
|
|
12326
|
-
const hasError = Boolean(fieldError) && isTouched;
|
|
12327
|
-
const value = _19.get(values, name);
|
|
12328
|
-
const handleChange = (event, child) => {
|
|
12329
|
-
setFieldValue(name, event.target.value, true);
|
|
12330
|
-
if (externalOnChange) {
|
|
12331
|
-
externalOnChange(event, child);
|
|
12332
|
-
}
|
|
12333
|
-
};
|
|
12334
|
-
const handleBlur = (event) => {
|
|
12335
|
-
setFieldTouched(name, true, true);
|
|
12336
|
-
if (externalOnBlur) {
|
|
12337
|
-
externalOnBlur(event);
|
|
12338
|
-
}
|
|
12339
|
-
};
|
|
12340
|
-
const renderDefaultMenuItem = (option, index) => {
|
|
12341
|
-
const MenuItemComponent = option.component || MenuItem;
|
|
12342
|
-
const menuItemProps = option.component ? option.componentProps : {};
|
|
12343
|
-
return /* @__PURE__ */ jsxs(
|
|
12344
|
-
MenuItemComponent,
|
|
12345
|
-
{
|
|
12346
|
-
value: option.value,
|
|
12347
|
-
disabled: option.disabled,
|
|
12348
|
-
...menuItemProps,
|
|
12349
|
-
sx: [
|
|
12350
|
-
{
|
|
12351
|
-
color: "text.primary",
|
|
12352
|
-
"&.Mui-selected": {
|
|
12353
|
-
backgroundColor: "action.selected",
|
|
12354
|
-
"&:hover": {
|
|
12355
|
-
backgroundColor: "action.hover"
|
|
12356
|
-
},
|
|
12357
|
-
...selectedMenuItemSx
|
|
12358
|
-
},
|
|
12359
|
-
"&.Mui-disabled": {
|
|
12360
|
-
opacity: 0.5,
|
|
12361
|
-
pointerEvents: "none"
|
|
12362
|
-
},
|
|
12363
|
-
...option.sx
|
|
12364
|
-
},
|
|
12365
|
-
...Array.isArray(menuItemSx) ? menuItemSx : [menuItemSx]
|
|
12366
|
-
],
|
|
12367
|
-
children: [
|
|
12368
|
-
option.icon && /* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
|
|
12369
|
-
/* @__PURE__ */ jsx(
|
|
12370
|
-
Typography,
|
|
12371
|
-
{
|
|
12372
|
-
variant: "body2",
|
|
12373
|
-
sx: [
|
|
12374
|
-
{
|
|
12375
|
-
color: option.disabled ? "text.disabled" : "text.primary",
|
|
12376
|
-
...option.textSx
|
|
12377
|
-
}
|
|
12378
|
-
],
|
|
12379
|
-
children: option.label
|
|
12380
|
-
}
|
|
12381
|
-
)
|
|
12382
|
-
]
|
|
12383
|
-
},
|
|
12384
|
-
`${option.value}-${index}`
|
|
12385
|
-
);
|
|
12386
|
-
};
|
|
12387
|
-
return /* @__PURE__ */ jsx(
|
|
12388
|
-
Box,
|
|
12389
|
-
{
|
|
12390
|
-
ref,
|
|
12391
|
-
className: "app-select-input",
|
|
12392
|
-
sx: [
|
|
12393
|
-
{
|
|
12394
|
-
width: fullWidth ? "100%" : "auto"
|
|
12395
|
-
},
|
|
12396
|
-
...Array.isArray(sx) ? sx : [sx].filter(Boolean)
|
|
12397
|
-
],
|
|
12398
|
-
children: /* @__PURE__ */ jsxs(
|
|
12399
|
-
FormControl,
|
|
12400
|
-
{
|
|
12401
|
-
fullWidth,
|
|
12402
|
-
variant,
|
|
12403
|
-
error: hasError,
|
|
12404
|
-
disabled,
|
|
12405
|
-
className: "app-select-form-control",
|
|
12406
|
-
sx: [
|
|
12407
|
-
{
|
|
12408
|
-
position: "relative",
|
|
12409
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
12410
|
-
borderWidth: "1px"
|
|
12411
|
-
},
|
|
12412
|
-
"& .MuiInputLabel-root": {
|
|
12413
|
-
position: "relative",
|
|
12414
|
-
transform: "none",
|
|
12415
|
-
fontSize: "0.875rem",
|
|
12416
|
-
mb: 1,
|
|
12417
|
-
"&.Mui-focused": {
|
|
12418
|
-
color: hasError ? "error.main" : "primary.main"
|
|
12419
|
-
},
|
|
12420
|
-
"&.Mui-disabled": {
|
|
12421
|
-
color: "text.disabled"
|
|
12422
|
-
}
|
|
12423
|
-
},
|
|
12424
|
-
"& .MuiInputLabel-shrink": {
|
|
12425
|
-
transform: "none"
|
|
12426
|
-
}
|
|
12427
|
-
},
|
|
12428
|
-
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
12429
|
-
],
|
|
12430
|
-
children: [
|
|
12431
|
-
label && /* @__PURE__ */ jsxs(
|
|
12432
|
-
LabelComponent,
|
|
12433
|
-
{
|
|
12434
|
-
id: `select-${name}-label`,
|
|
12435
|
-
htmlFor: `select-${name}`,
|
|
12436
|
-
className: "app-select-label",
|
|
12437
|
-
shrink: false,
|
|
12438
|
-
sx: [
|
|
12439
|
-
{
|
|
12440
|
-
position: "relative",
|
|
12441
|
-
transform: "none",
|
|
12442
|
-
fontSize: "0.875rem",
|
|
12443
|
-
fontWeight: 500,
|
|
12444
|
-
color: hasError ? "error.main" : "text.secondary",
|
|
12445
|
-
mb: 1,
|
|
12446
|
-
"&.Mui-focused": {
|
|
12447
|
-
color: hasError ? "error.main" : "primary.main"
|
|
12448
|
-
},
|
|
12449
|
-
"&.Mui-disabled": {
|
|
12450
|
-
color: "text.disabled"
|
|
12451
|
-
}
|
|
12452
|
-
},
|
|
12453
|
-
...Array.isArray(labelSx) ? labelSx : [labelSx].filter(Boolean)
|
|
12454
|
-
],
|
|
12455
|
-
children: [
|
|
12456
|
-
label,
|
|
12457
|
-
required && /* @__PURE__ */ jsx(
|
|
12458
|
-
Box,
|
|
12459
|
-
{
|
|
12460
|
-
component: "span",
|
|
12461
|
-
sx: {
|
|
12462
|
-
color: "error.main",
|
|
12463
|
-
ml: 0.5
|
|
12464
|
-
},
|
|
12465
|
-
children: "*"
|
|
12466
|
-
}
|
|
12467
|
-
)
|
|
12468
|
-
]
|
|
12469
|
-
}
|
|
12470
|
-
),
|
|
12471
|
-
/* @__PURE__ */ jsxs(
|
|
12472
|
-
Select,
|
|
12473
|
-
{
|
|
12474
|
-
variant: "outlined",
|
|
12475
|
-
labelId: label ? `select-${name}-label` : void 0,
|
|
12476
|
-
id: `select-${name}`,
|
|
12477
|
-
name,
|
|
12478
|
-
value: value != null ? value : "",
|
|
12479
|
-
onChange: handleChange,
|
|
12480
|
-
onBlur: handleBlur,
|
|
12481
|
-
onOpen,
|
|
12482
|
-
onClose,
|
|
12483
|
-
renderValue,
|
|
12484
|
-
label: void 0,
|
|
12485
|
-
displayEmpty: true,
|
|
12486
|
-
inputProps: {
|
|
12487
|
-
readOnly,
|
|
12488
|
-
...inputProps
|
|
12489
|
-
},
|
|
12490
|
-
MenuProps: {
|
|
12491
|
-
PaperProps: {
|
|
12492
|
-
sx: [
|
|
12493
|
-
{
|
|
12494
|
-
mt: 1,
|
|
12495
|
-
boxShadow: theme.shadows[3],
|
|
12496
|
-
maxHeight: 300,
|
|
12497
|
-
"& .MuiMenuItem-root": {
|
|
12498
|
-
px: 2,
|
|
12499
|
-
py: 1,
|
|
12500
|
-
"&.Mui-selected": {
|
|
12501
|
-
backgroundColor: "action.selected",
|
|
12502
|
-
"&:hover": {
|
|
12503
|
-
backgroundColor: "action.hover"
|
|
12504
|
-
}
|
|
12505
|
-
}
|
|
12506
|
-
},
|
|
12507
|
-
...Array.isArray(menuPaperSx) ? menuPaperSx : [menuPaperSx]
|
|
12508
|
-
}
|
|
12509
|
-
]
|
|
12510
|
-
},
|
|
12511
|
-
...MenuProps
|
|
12512
|
-
},
|
|
12513
|
-
sx: [
|
|
12514
|
-
{
|
|
12515
|
-
"& .MuiSelect-select": {
|
|
12516
|
-
minHeight: "1.4375em",
|
|
12517
|
-
padding: "16.5px 14px",
|
|
12518
|
-
"&.MuiInputBase-input": {
|
|
12519
|
-
padding: "16.5px 14px"
|
|
12520
|
-
}
|
|
12521
|
-
},
|
|
12522
|
-
"&.MuiOutlinedInput-root": {
|
|
12523
|
-
"& fieldset": {
|
|
12524
|
-
borderWidth: "1px"
|
|
12525
|
-
},
|
|
12526
|
-
"&:hover fieldset": {
|
|
12527
|
-
borderWidth: "1px"
|
|
12528
|
-
},
|
|
12529
|
-
"&.Mui-focused fieldset": {
|
|
12530
|
-
borderWidth: "2px"
|
|
12531
|
-
}
|
|
12532
|
-
},
|
|
12533
|
-
"&.Mui-disabled": {
|
|
12534
|
-
backgroundColor: "action.disabledBackground",
|
|
12535
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
12536
|
-
borderColor: "action.disabled"
|
|
12537
|
-
},
|
|
12538
|
-
"& .MuiSelect-icon": {
|
|
12539
|
-
color: "action.disabled"
|
|
12540
|
-
}
|
|
12541
|
-
}
|
|
12542
|
-
},
|
|
12543
|
-
...Array.isArray(selectSx) ? selectSx : selectSx ? [selectSx] : []
|
|
12544
|
-
],
|
|
12545
|
-
...otherProps,
|
|
12546
|
-
children: [
|
|
12547
|
-
showNoneOption && /* @__PURE__ */ jsx(MenuItem, { value: "", children: /* @__PURE__ */ jsx("em", { children: noneOptionText }) }),
|
|
12548
|
-
options.map(
|
|
12549
|
-
(option, index) => renderMenuItem ? renderMenuItem(option, index) : renderDefaultMenuItem(option, index)
|
|
12550
|
-
)
|
|
12551
|
-
]
|
|
12552
|
-
}
|
|
12553
|
-
),
|
|
12554
|
-
(showHelperText || hasError) && /* @__PURE__ */ jsx(
|
|
12555
|
-
HelperTextComponent,
|
|
12556
|
-
{
|
|
12557
|
-
error: hasError,
|
|
12558
|
-
sx: [
|
|
12559
|
-
{
|
|
12560
|
-
mx: 0,
|
|
12561
|
-
mt: 0.5,
|
|
12562
|
-
fontSize: "0.75rem",
|
|
12563
|
-
...hasError ? {
|
|
12564
|
-
color: "error.main",
|
|
12565
|
-
...errorSx
|
|
12566
|
-
} : {
|
|
12567
|
-
color: "text.secondary",
|
|
12568
|
-
...helperTextSx
|
|
12569
|
-
}
|
|
12570
|
-
}
|
|
12571
|
-
],
|
|
12572
|
-
children: hasError ? fieldError : helperText
|
|
12573
|
-
}
|
|
12574
|
-
)
|
|
12575
|
-
]
|
|
12576
|
-
}
|
|
12577
|
-
)
|
|
12578
|
-
}
|
|
12579
|
-
);
|
|
12218
|
+
return null;
|
|
12580
12219
|
}
|
|
12581
12220
|
);
|
|
12582
12221
|
AppSelectInput.displayName = "AppSelectInput";
|
|
@@ -14341,6 +13980,6 @@ var SubmitButton = ({
|
|
|
14341
13980
|
};
|
|
14342
13981
|
var SubmitButton_default = SubmitButton;
|
|
14343
13982
|
|
|
14344
|
-
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, AppSearchableMultiSelector_default as AppSearchableMultiSelector,
|
|
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, AppSearchableMultiSelector_default as AppSearchableMultiSelector, AppSearchableSelectInput, 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 };
|
|
14345
13984
|
//# sourceMappingURL=out.js.map
|
|
14346
13985
|
//# sourceMappingURL=index.mjs.map
|