dynamic-mui 2.5.3 → 2.6.1
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/accordion-BSh2h2a_.js +1 -0
- package/dist/accordion-Cqu-4mCj.mjs +22 -0
- package/dist/addressfield-BYisUY6y.mjs +242 -0
- package/dist/addressfield-CRd4lfdV.js +1 -0
- package/dist/ai/index.cjs +1 -1
- package/dist/ai/index.mjs +1 -14
- package/dist/ai/react/AIForm.d.ts +2 -1
- package/dist/ai/react/AIFormGenerator.d.ts +1 -1
- package/dist/ai/react/AISchemaReview.d.ts +1 -1
- package/dist/ai/react/AITextAssist.d.ts +1 -1
- package/dist/ai/react/AIVisionImport.d.ts +2 -1
- package/dist/ai-CXI0Rnu8.js +29 -0
- package/dist/ai-D6hkfd_f.mjs +4533 -0
- package/dist/asyncautocomplete-B1fK0nUW.js +1 -0
- package/dist/asyncautocomplete-D4oCW2B0.mjs +72 -0
- package/dist/bar-CgYZxXHl.js +1 -0
- package/dist/bar-LVtZP6Ui.mjs +4 -0
- package/dist/cascadeselect-CYzYzmqv.js +1 -0
- package/dist/cascadeselect-s-LY4P0l.mjs +66 -0
- package/dist/chartControl-IQafKpDk.mjs +29 -0
- package/dist/chartControl-ifHiG3nr.js +1 -0
- package/dist/collection-Ccj0OayP.js +1 -0
- package/dist/collection-DGq2rxDx.mjs +1692 -0
- package/dist/colorpicker-TDpxW59g.mjs +110 -0
- package/dist/colorpicker-q2FYP06A.js +1 -0
- package/dist/components/DynamicComponent.d.ts +2 -1
- package/dist/components/FormGenerator.d.ts +1 -1
- package/dist/components/charts/Bar/bar.d.ts +6 -2
- package/dist/components/charts/Line/line.d.ts +6 -2
- package/dist/components/charts/Mixchart/mixChart.d.ts +2 -1
- package/dist/components/charts/Pie/pie.d.ts +6 -2
- package/dist/components/charts/chartControl.d.ts +15 -0
- package/dist/components/controls/Accordion/accordion.d.ts +2 -1
- package/dist/components/controls/AddressField/addressfield.d.ts +2 -1
- package/dist/components/controls/Alert/alert.d.ts +1 -1
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +1 -1
- package/dist/components/controls/Autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/controls/Button/button.d.ts +1 -1
- package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -1
- package/dist/components/controls/CheckBox/checkbox.d.ts +2 -2
- package/dist/components/controls/CheckBox/toggleInput.d.ts +25 -0
- package/dist/components/controls/Chip/chip.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +2 -1
- package/dist/components/controls/Collection/CollectionList.d.ts +1 -1
- package/dist/components/controls/Collection/ItemDialog.d.ts +1 -1
- package/dist/components/controls/Collection/collection.d.ts +1 -1
- package/dist/components/controls/Collection/parts.d.ts +6 -6
- package/dist/components/controls/ColorPicker/colorpicker.d.ts +2 -1
- package/dist/components/controls/Computed/computed.d.ts +1 -1
- package/dist/components/controls/ConsentField/consentfield.d.ts +2 -1
- package/dist/components/controls/CurrencyField/currencyfield.d.ts +1 -1
- package/dist/components/controls/DataTable/datatable.d.ts +2 -1
- package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +1 -1
- package/dist/components/controls/DateTime/datetime.d.ts +15 -1
- package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +6 -2
- package/dist/components/controls/Divider/divider.d.ts +1 -1
- package/dist/components/controls/EditableTable/editabletable.d.ts +1 -1
- package/dist/components/controls/FileUpload/fileupload.d.ts +1 -1
- package/dist/components/controls/FormRepeater/formrepeater.d.ts +1 -1
- package/dist/components/controls/FormWizard/formwizard.d.ts +1 -1
- package/dist/components/controls/GeoField/geofield.d.ts +1 -1
- package/dist/components/controls/Group/group.d.ts +2 -1
- package/dist/components/controls/Hyperlink/hyperlink.d.ts +1 -1
- package/dist/components/controls/ImageList/imagelist.d.ts +1 -1
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -1
- package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -1
- package/dist/components/controls/LineItemList/lineitemlist.d.ts +1 -1
- package/dist/components/controls/List/list.d.ts +1 -1
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +2 -1
- package/dist/components/controls/MatrixField/matrixfield.d.ts +2 -1
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +2 -1
- package/dist/components/controls/NumberField/numberfield.d.ts +2 -1
- package/dist/components/controls/NumberStepper/numberstepper.d.ts +1 -1
- package/dist/components/controls/OtpField/otpfield.d.ts +2 -1
- package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -1
- package/dist/components/controls/PhoneField/phonefield.d.ts +1 -1
- package/dist/components/controls/Radio/radio.d.ts +2 -1
- package/dist/components/controls/Rating/rating.d.ts +2 -1
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +2 -1
- package/dist/components/controls/Select/select.d.ts +2 -1
- package/dist/components/controls/Signature/signature.d.ts +1 -1
- package/dist/components/controls/Slider/slider.d.ts +1 -1
- package/dist/components/controls/Stepper/stepper.d.ts +1 -1
- package/dist/components/controls/SummaryField/summaryfield.d.ts +2 -1
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/Tabs/tabs.d.ts +2 -1
- package/dist/components/controls/TagsInput/tagsinput.d.ts +1 -1
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/TextField/useTextInput.d.ts +18 -0
- package/dist/components/controls/TimePicker/timepicker.d.ts +6 -2
- package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +1 -1
- package/dist/components/controls/Typography/typography.d.ts +1 -1
- package/dist/components/controls/index.d.ts +24 -9
- package/dist/consentfield-C0qlg4CV.js +1 -0
- package/dist/consentfield-D3eHFCZf.mjs +68 -0
- package/dist/datatable-CMjaTDPM.js +1 -0
- package/dist/datatable-lZIwHx6a.mjs +29 -0
- package/dist/dynamic-mui.cjs +1 -1
- package/dist/dynamic-mui.d.ts +1 -1
- package/dist/dynamic-mui.mjs +264 -204
- package/dist/editabletable-B3Cl38Qm.js +1 -0
- package/dist/editabletable-BEnZM9qt.mjs +117 -0
- package/dist/fileupload-BLH0wrc2.mjs +191 -0
- package/dist/fileupload-D0TsC9DF.js +1 -0
- package/dist/formrepeater-BEFYw5ly.js +1 -0
- package/dist/formrepeater-BvW1lZ2k.mjs +82 -0
- package/dist/formwizard-BWdnCsJz.js +1 -0
- package/dist/formwizard-I6M99opg.mjs +82 -0
- package/dist/geofield-CcbP9EtG.mjs +116 -0
- package/dist/geofield-HXXeV9Bm.js +1 -0
- package/dist/group-BCGjUNL2.mjs +30 -0
- package/dist/group-saCPFLuL.js +1 -0
- package/dist/imagelist-CNe1Dp_M.mjs +23 -0
- package/dist/imagelist-Wm5Qa6wA.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/intlphone-Bj5nEUMa.mjs +341 -0
- package/dist/intlphone-D1V7m6MV.js +1 -0
- package/dist/keyvaluefield-ArJ4QM5z.js +1 -0
- package/dist/keyvaluefield-C-a0MGDM.mjs +128 -0
- package/dist/line-BGSi1tvf.js +1 -0
- package/dist/line-cK6taoCA.mjs +4 -0
- package/dist/lineitemlist-bmk7fEf9.mjs +169 -0
- package/dist/lineitemlist-mulPt3cO.js +1 -0
- package/dist/list-5wGZK7wa.js +1 -0
- package/dist/list-CIFEhaTq.mjs +20 -0
- package/dist/locationfield-DtWkxnX-.js +1 -0
- package/dist/locationfield-SPonkbMU.mjs +90 -0
- package/dist/markdowneditor-C0KQgAWY.js +2 -0
- package/dist/markdowneditor-C3l0_zuX.mjs +82 -0
- package/dist/matrixfield-BZ_3KcSk.js +1 -0
- package/dist/matrixfield-DQHet7LH.mjs +119 -0
- package/dist/mixChart-CSq7pQqJ.mjs +49 -0
- package/dist/mixChart-DoehYa8V.js +1 -0
- package/dist/muiX-BHOKpogF.mjs +12 -0
- package/dist/muiX-CG_D1XQ2.js +1 -0
- package/dist/multitextbox-Bsr8mHo5.mjs +96 -0
- package/dist/multitextbox-CkhPGI9i.js +1 -0
- package/dist/npsscale-BgU-fVZ4.mjs +111 -0
- package/dist/npsscale-CFtQ5Dkk.js +1 -0
- package/dist/numberstepper-B4ZS7GY_.js +1 -0
- package/dist/numberstepper-c0raw-fV.mjs +111 -0
- package/dist/pie-CueMspFX.js +1 -0
- package/dist/pie-DFO89j-z.mjs +4 -0
- package/dist/richtexteditor-B8NFysnM.js +1 -0
- package/dist/richtexteditor-aF2uky8O.mjs +178 -0
- package/dist/rolldown-runtime-5iZMYShA.js +1 -0
- package/dist/s3Upload-C3-wcrua.js +1 -0
- package/dist/s3Upload-HtE088XA.mjs +39 -0
- package/dist/signature-DjYfiNzq.js +3 -0
- package/dist/signature-HiL8FJ6C.mjs +1116 -0
- package/dist/stepper-BQB-Zpl2.js +1 -0
- package/dist/stepper-C8VaX9xu.mjs +166 -0
- package/dist/summaryfield-BN-NhzA6.mjs +65 -0
- package/dist/summaryfield-BqpfzvHe.js +1 -0
- package/dist/tabs-BBBpbfqk.js +1 -0
- package/dist/tabs-DvIbQ1qg.mjs +50 -0
- package/dist/tagsinput-CXmsu8K9.mjs +49 -0
- package/dist/tagsinput-CYoOBbY1.js +1 -0
- package/dist/useSyncedState-CzAO4D1o.mjs +17 -0
- package/dist/useSyncedState-DYNKkpDv.js +1 -0
- package/dist/useTextInput-Cm0_Ps2V.js +1 -0
- package/dist/useTextInput-Dr-ncTE8.mjs +1683 -0
- package/dist/useUpdateEffect-CNBo9hj8.js +1 -0
- package/dist/useUpdateEffect-CXAhttj7.mjs +14 -0
- package/dist/util/helper.d.ts +18 -1
- package/dist/util/muiVersion.d.ts +13 -0
- package/dist/util/stepperComponents.d.ts +1 -1
- package/dist/util/useSyncedState.d.ts +22 -0
- package/dist/util/validation.d.ts +40 -0
- package/dist/v4-Dyp-SQ1c.js +1 -0
- package/dist/v4-YCkfo8OR.mjs +27 -0
- package/dist/validation-B7DPZ218.js +7 -0
- package/dist/validation-BRcYhhsT.mjs +4991 -0
- package/package.json +35 -35
- package/dist/AIForm-D204ogdw.js +0 -44
- package/dist/AIForm-IafSvW2_.mjs +0 -12281
- package/dist/accordion-DA8VpkJ_.mjs +0 -23
- package/dist/accordion-yIxiSIl4.js +0 -1
- package/dist/addressfield-DCzPapIx.mjs +0 -164
- package/dist/addressfield-EFiWgeWB.js +0 -1
- package/dist/asyncautocomplete-5-8SXotM.mjs +0 -92
- package/dist/asyncautocomplete-BmHm-S4u.js +0 -1
- package/dist/bar-BvwjqB4v.mjs +0 -21
- package/dist/bar-DRjoPCtv.js +0 -1
- package/dist/cascadeselect-BEaoupK6.js +0 -1
- package/dist/cascadeselect-CzSf78Pg.mjs +0 -66
- package/dist/collection-CthMZ0Go.js +0 -1
- package/dist/collection-n9eBOioi.mjs +0 -1157
- package/dist/colorpicker-Bm9M38_c.mjs +0 -111
- package/dist/colorpicker-DHkdM8Q2.js +0 -1
- package/dist/consentfield-B2-UFm5n.mjs +0 -80
- package/dist/consentfield-DV8Gz0k9.js +0 -1
- package/dist/datatable-BVZFBd-8.mjs +0 -21
- package/dist/datatable-DnnyVWJm.js +0 -1
- package/dist/editabletable-B_JS4UZ9.js +0 -1
- package/dist/editabletable-BwvIvAt7.mjs +0 -128
- package/dist/fileupload-BHT7K0YT.mjs +0 -185
- package/dist/fileupload-CugVG3o3.js +0 -1
- package/dist/formrepeater-CaJMPo3Q.mjs +0 -75
- package/dist/formrepeater-DiKPaOfi.js +0 -1
- package/dist/formwizard-BzvdbvBY.js +0 -1
- package/dist/formwizard-C9fOIHQv.mjs +0 -83
- package/dist/geofield-BM4b5Zwx.js +0 -1
- package/dist/geofield-DYXx9K9o.mjs +0 -108
- package/dist/group-D5fMqJTx.mjs +0 -23
- package/dist/group-mwS8FSGJ.js +0 -1
- package/dist/imagelist-Bn9QhIv7.js +0 -1
- package/dist/imagelist-rqmJajHt.mjs +0 -18
- package/dist/intlphone-BQYytFWy.js +0 -1
- package/dist/intlphone-DHDwdBbm.mjs +0 -144
- package/dist/keyvaluefield-DM0eSfPF.mjs +0 -127
- package/dist/keyvaluefield-DXyuqDba.js +0 -1
- package/dist/line-Dst2QjuI.mjs +0 -21
- package/dist/line-hM3OgPH7.js +0 -1
- package/dist/lineitemlist-89hrdS0p.mjs +0 -170
- package/dist/lineitemlist-DfEjbNCH.js +0 -1
- package/dist/list-B8S2MrOx.js +0 -1
- package/dist/list-C97cCc78.mjs +0 -20
- package/dist/locationfield-BEMe22_x.mjs +0 -118
- package/dist/locationfield-DlgLvvdU.js +0 -1
- package/dist/markdowneditor-JoiWE-qO.js +0 -2
- package/dist/markdowneditor-K4TAKJ3s.mjs +0 -94
- package/dist/matrixfield-D4sHu6rU.mjs +0 -121
- package/dist/matrixfield-szah6uOP.js +0 -1
- package/dist/mixChart-Doq4lt7Z.mjs +0 -75
- package/dist/mixChart-rgyMCdnp.js +0 -1
- package/dist/multitextbox-CBChuyw9.js +0 -1
- package/dist/multitextbox-Cnrwie5U.mjs +0 -78
- package/dist/npsscale-Cc2eD9Nk.js +0 -1
- package/dist/npsscale-DgQPa1eH.mjs +0 -91
- package/dist/numberstepper-BcuSZHwZ.js +0 -1
- package/dist/numberstepper-BqINnIm7.mjs +0 -132
- package/dist/pie-B6dXjc4o.mjs +0 -21
- package/dist/pie-a_dhmBUq.js +0 -1
- package/dist/richtexteditor-Bs5-VQj3.js +0 -1
- package/dist/richtexteditor-CveBdsmJ.mjs +0 -143
- package/dist/s3Upload-B0JeoLkS.js +0 -1
- package/dist/s3Upload-dpioZ2c8.mjs +0 -51
- package/dist/signature-BRWAWqeA.mjs +0 -1227
- package/dist/signature-Bj9GDrvy.js +0 -2
- package/dist/stepper-B9sSsbQD.js +0 -1
- package/dist/stepper-DTMAP67o.mjs +0 -140
- package/dist/summaryfield-JKL3ZLl2.js +0 -1
- package/dist/summaryfield-xhr0Q4RL.mjs +0 -96
- package/dist/tabs-ClkmKlV8.mjs +0 -39
- package/dist/tabs-DmEP_QW0.js +0 -1
- package/dist/tagsinput-B0yVrYgB.mjs +0 -58
- package/dist/tagsinput-COKkxIxg.js +0 -1
- package/dist/v4-BysszJq8.mjs +0 -30
- package/dist/v4-CqdK_b8Y.js +0 -1
|
@@ -0,0 +1,4533 @@
|
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./validation-BRcYhhsT.mjs";
|
|
2
|
+
import { O as c, T as l, a as u, c as d, d as f, i as p, n as m, o as h, r as g, s as _, t as v } from "./useTextInput-Dr-ncTE8.mjs";
|
|
3
|
+
import { t as y } from "./useUpdateEffect-CXAhttj7.mjs";
|
|
4
|
+
import { n as b, t as x } from "./useSyncedState-CzAO4D1o.mjs";
|
|
5
|
+
import S, { Suspense as C, lazy as w, useCallback as T, useEffect as E, useId as D, useImperativeHandle as O, useLayoutEffect as k, useMemo as A, useReducer as ee, useRef as j, useState as M } from "react";
|
|
6
|
+
import { Alert as te, Box as N, Button as P, Chip as ne, CircularProgress as F, Dialog as I, DialogActions as re, DialogContent as ie, DialogTitle as L, Grid as ae, Icon as R, IconButton as oe, Link as se, List as ce, ListItem as le, ListItemIcon as z, ListItemText as ue, Menu as de, MenuItem as fe, Stack as B, TextField as pe, Tooltip as me, Typography as V } from "@mui/material";
|
|
7
|
+
import { alpha as H, styled as he, useTheme as ge } from "@mui/material/styles";
|
|
8
|
+
import _e from "@mui/material/Typography";
|
|
9
|
+
import { Fragment as ve, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
10
|
+
import G from "@mui/material/TextField";
|
|
11
|
+
import { DatePicker as ye, LocalizationProvider as be } from "@mui/x-date-pickers";
|
|
12
|
+
import xe from "@mui/material/Checkbox";
|
|
13
|
+
import Se from "@mui/material/Autocomplete";
|
|
14
|
+
import K from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
15
|
+
import Ce from "@mui/icons-material/CheckBox";
|
|
16
|
+
import we from "@mui/material/FormControlLabel";
|
|
17
|
+
import q from "@mui/material/FormControl";
|
|
18
|
+
import Te from "@mui/material/FormHelperText";
|
|
19
|
+
import Ee from "@mui/material/Radio";
|
|
20
|
+
import J from "@mui/material/Box";
|
|
21
|
+
import De from "@mui/material/RadioGroup";
|
|
22
|
+
import Oe from "@mui/material/FormLabel";
|
|
23
|
+
import ke from "@mui/material/Switch";
|
|
24
|
+
import Ae from "@mui/material/Button";
|
|
25
|
+
import je from "@mui/material/Divider";
|
|
26
|
+
import Me from "@mui/material/Alert";
|
|
27
|
+
import Ne from "@mui/material/AlertTitle";
|
|
28
|
+
import { AdapterDayjs as Pe } from "@mui/x-date-pickers/AdapterDayjs";
|
|
29
|
+
import Fe from "dayjs";
|
|
30
|
+
import Ie from "dayjs/plugin/utc.js";
|
|
31
|
+
import Le from "dayjs/plugin/timezone.js";
|
|
32
|
+
import Re from "dayjs/plugin/customParseFormat.js";
|
|
33
|
+
import ze from "@mui/material/Stack";
|
|
34
|
+
import Be from "@mui/material/Chip";
|
|
35
|
+
import Ve from "@mui/material/Icon";
|
|
36
|
+
import He from "@mui/icons-material/CheckRounded";
|
|
37
|
+
import Ue from "@mui/material/Slider";
|
|
38
|
+
import We from "@mui/material/Rating";
|
|
39
|
+
import Ge from "@mui/material/ToggleButton";
|
|
40
|
+
import Ke from "@mui/material/ToggleButtonGroup";
|
|
41
|
+
import qe from "@mui/material/InputAdornment";
|
|
42
|
+
import Je from "@mui/material/IconButton";
|
|
43
|
+
import Ye from "@mui/material/LinearProgress";
|
|
44
|
+
import Xe from "@mui/icons-material/Visibility";
|
|
45
|
+
import Ze from "@mui/icons-material/VisibilityOff";
|
|
46
|
+
import Qe from "@mui/icons-material/AutoFixHigh";
|
|
47
|
+
import $e from "@mui/icons-material/AutoAwesome";
|
|
48
|
+
import et from "@mui/icons-material/EditNote";
|
|
49
|
+
import tt from "@mui/icons-material/ShortText";
|
|
50
|
+
import nt from "@mui/icons-material/Notes";
|
|
51
|
+
import rt from "@mui/icons-material/Spellcheck";
|
|
52
|
+
import it from "@mui/icons-material/WorkOutlined";
|
|
53
|
+
import at from "@mui/icons-material/Translate";
|
|
54
|
+
import ot from "@mui/material/CircularProgress";
|
|
55
|
+
import st from "@mui/icons-material/CloudUpload";
|
|
56
|
+
// node_modules/lodash/isEqual.js
|
|
57
|
+
var ct = /* @__PURE__ */ o(((e, t) => {
|
|
58
|
+
var n = l();
|
|
59
|
+
function r(e, t) {
|
|
60
|
+
return n(e, t);
|
|
61
|
+
}
|
|
62
|
+
t.exports = r;
|
|
63
|
+
})), lt = /* @__PURE__ */ t(c()), ut = /* @__PURE__ */ t(ct()), dt = {
|
|
64
|
+
textfield: {
|
|
65
|
+
type: "TextField",
|
|
66
|
+
map: "TextField"
|
|
67
|
+
},
|
|
68
|
+
typography: {
|
|
69
|
+
type: "Typography",
|
|
70
|
+
map: "Typography"
|
|
71
|
+
},
|
|
72
|
+
datatable: {
|
|
73
|
+
type: "Table",
|
|
74
|
+
map: "Table"
|
|
75
|
+
},
|
|
76
|
+
datetime: {
|
|
77
|
+
type: "DateTime",
|
|
78
|
+
map: "DateTime"
|
|
79
|
+
},
|
|
80
|
+
daterangepicker: {
|
|
81
|
+
type: "DateRangePicker",
|
|
82
|
+
map: "DateRangePicker"
|
|
83
|
+
},
|
|
84
|
+
datetimepicker: {
|
|
85
|
+
type: "DateTimePicker",
|
|
86
|
+
map: "DateTimePicker"
|
|
87
|
+
},
|
|
88
|
+
timepicker: {
|
|
89
|
+
type: "TimePicker",
|
|
90
|
+
map: "TimePicker"
|
|
91
|
+
},
|
|
92
|
+
select: {
|
|
93
|
+
type: "Select",
|
|
94
|
+
map: "Select"
|
|
95
|
+
},
|
|
96
|
+
checkbox: {
|
|
97
|
+
type: "CheckBox",
|
|
98
|
+
map: "CheckBox"
|
|
99
|
+
},
|
|
100
|
+
switch: {
|
|
101
|
+
type: "Switch",
|
|
102
|
+
map: "Switch"
|
|
103
|
+
},
|
|
104
|
+
radio: {
|
|
105
|
+
type: "Radio",
|
|
106
|
+
map: "Radio"
|
|
107
|
+
},
|
|
108
|
+
stepper: {
|
|
109
|
+
type: "Stepper",
|
|
110
|
+
map: "Stepper"
|
|
111
|
+
},
|
|
112
|
+
bar: {
|
|
113
|
+
type: "Bar",
|
|
114
|
+
map: "Bar"
|
|
115
|
+
},
|
|
116
|
+
line: {
|
|
117
|
+
type: "Line",
|
|
118
|
+
map: "Line"
|
|
119
|
+
},
|
|
120
|
+
pie: {
|
|
121
|
+
type: "Pie",
|
|
122
|
+
map: "Pie"
|
|
123
|
+
},
|
|
124
|
+
mixchart: {
|
|
125
|
+
type: "MixChart",
|
|
126
|
+
map: "MixChart"
|
|
127
|
+
},
|
|
128
|
+
divider: {
|
|
129
|
+
type: "Divider",
|
|
130
|
+
map: "Divider"
|
|
131
|
+
},
|
|
132
|
+
chip: {
|
|
133
|
+
type: "Chip",
|
|
134
|
+
map: "Chip"
|
|
135
|
+
},
|
|
136
|
+
chipselect: {
|
|
137
|
+
type: "ChipSelect",
|
|
138
|
+
map: "ChipSelect"
|
|
139
|
+
},
|
|
140
|
+
button: {
|
|
141
|
+
type: "Button",
|
|
142
|
+
map: "Button"
|
|
143
|
+
},
|
|
144
|
+
rating: {
|
|
145
|
+
type: "Rating",
|
|
146
|
+
map: "Rating"
|
|
147
|
+
},
|
|
148
|
+
slider: {
|
|
149
|
+
type: "Slider",
|
|
150
|
+
map: "Slider"
|
|
151
|
+
},
|
|
152
|
+
tagsinput: {
|
|
153
|
+
type: "TagsInput",
|
|
154
|
+
map: "TagsInput"
|
|
155
|
+
},
|
|
156
|
+
togglebuttons: {
|
|
157
|
+
type: "ToggleButtons",
|
|
158
|
+
map: "ToggleButtons"
|
|
159
|
+
},
|
|
160
|
+
password: {
|
|
161
|
+
type: "PasswordField",
|
|
162
|
+
map: "PasswordField"
|
|
163
|
+
},
|
|
164
|
+
otp: {
|
|
165
|
+
type: "OtpField",
|
|
166
|
+
map: "OtpField"
|
|
167
|
+
},
|
|
168
|
+
phone: {
|
|
169
|
+
type: "PhoneField",
|
|
170
|
+
map: "PhoneField"
|
|
171
|
+
},
|
|
172
|
+
currency: {
|
|
173
|
+
type: "CurrencyField",
|
|
174
|
+
map: "CurrencyField"
|
|
175
|
+
},
|
|
176
|
+
fileupload: {
|
|
177
|
+
type: "FileUpload",
|
|
178
|
+
map: "FileUpload"
|
|
179
|
+
},
|
|
180
|
+
alert: {
|
|
181
|
+
type: "Alert",
|
|
182
|
+
map: "Alert"
|
|
183
|
+
},
|
|
184
|
+
computed: {
|
|
185
|
+
type: "Computed",
|
|
186
|
+
map: "Computed"
|
|
187
|
+
},
|
|
188
|
+
keyvalue: {
|
|
189
|
+
type: "KeyValueField",
|
|
190
|
+
map: "KeyValueField"
|
|
191
|
+
},
|
|
192
|
+
numberstepper: {
|
|
193
|
+
type: "NumberStepper",
|
|
194
|
+
map: "NumberStepper"
|
|
195
|
+
},
|
|
196
|
+
matrix: {
|
|
197
|
+
type: "MatrixField",
|
|
198
|
+
map: "MatrixField"
|
|
199
|
+
},
|
|
200
|
+
consent: {
|
|
201
|
+
type: "ConsentField",
|
|
202
|
+
map: "ConsentField"
|
|
203
|
+
},
|
|
204
|
+
colorpicker: {
|
|
205
|
+
type: "ColorPicker",
|
|
206
|
+
map: "ColorPicker"
|
|
207
|
+
},
|
|
208
|
+
markdown: {
|
|
209
|
+
type: "MarkdownEditor",
|
|
210
|
+
map: "MarkdownEditor"
|
|
211
|
+
},
|
|
212
|
+
address: {
|
|
213
|
+
type: "AddressField",
|
|
214
|
+
map: "AddressField"
|
|
215
|
+
},
|
|
216
|
+
cascadeselect: {
|
|
217
|
+
type: "CascadeSelect",
|
|
218
|
+
map: "CascadeSelect"
|
|
219
|
+
},
|
|
220
|
+
formwizard: {
|
|
221
|
+
type: "FormWizard",
|
|
222
|
+
map: "FormWizard"
|
|
223
|
+
},
|
|
224
|
+
summary: {
|
|
225
|
+
type: "SummaryField",
|
|
226
|
+
map: "SummaryField"
|
|
227
|
+
},
|
|
228
|
+
geo: {
|
|
229
|
+
type: "GeoField",
|
|
230
|
+
map: "GeoField"
|
|
231
|
+
},
|
|
232
|
+
richtext: {
|
|
233
|
+
type: "RichTextEditor",
|
|
234
|
+
map: "RichTextEditor"
|
|
235
|
+
},
|
|
236
|
+
nps: {
|
|
237
|
+
type: "NpsScale",
|
|
238
|
+
map: "NpsScale"
|
|
239
|
+
},
|
|
240
|
+
editabletable: {
|
|
241
|
+
type: "EditableTable",
|
|
242
|
+
map: "EditableTable"
|
|
243
|
+
},
|
|
244
|
+
intlphone: {
|
|
245
|
+
type: "IntlPhone",
|
|
246
|
+
map: "IntlPhone"
|
|
247
|
+
},
|
|
248
|
+
asyncautocomplete: {
|
|
249
|
+
type: "AsyncAutocomplete",
|
|
250
|
+
map: "AsyncAutocomplete"
|
|
251
|
+
},
|
|
252
|
+
list: {
|
|
253
|
+
type: "List",
|
|
254
|
+
map: "List"
|
|
255
|
+
},
|
|
256
|
+
numberfield: {
|
|
257
|
+
type: "NumberField",
|
|
258
|
+
map: "NumberField"
|
|
259
|
+
},
|
|
260
|
+
multitextbox: {
|
|
261
|
+
type: "MultiTextbox",
|
|
262
|
+
map: "MultiTextbox"
|
|
263
|
+
},
|
|
264
|
+
lineitemlist: {
|
|
265
|
+
type: "LineItemList",
|
|
266
|
+
map: "LineItemList"
|
|
267
|
+
},
|
|
268
|
+
formrepeater: {
|
|
269
|
+
type: "FormRepeater",
|
|
270
|
+
map: "FormRepeater"
|
|
271
|
+
},
|
|
272
|
+
collection: {
|
|
273
|
+
type: "Collection",
|
|
274
|
+
map: "Collection"
|
|
275
|
+
},
|
|
276
|
+
signature: {
|
|
277
|
+
type: "Signature",
|
|
278
|
+
map: "Signature"
|
|
279
|
+
},
|
|
280
|
+
group: {
|
|
281
|
+
type: "Group",
|
|
282
|
+
map: "Group"
|
|
283
|
+
},
|
|
284
|
+
accordion: {
|
|
285
|
+
type: "Accordion",
|
|
286
|
+
map: "Accordion"
|
|
287
|
+
},
|
|
288
|
+
tabs: {
|
|
289
|
+
type: "Tabs",
|
|
290
|
+
map: "Tabs"
|
|
291
|
+
},
|
|
292
|
+
autocomplete: {
|
|
293
|
+
type: "AutoComplete",
|
|
294
|
+
map: "AutoComplete"
|
|
295
|
+
},
|
|
296
|
+
imagelist: {
|
|
297
|
+
type: "ImgList",
|
|
298
|
+
map: "ImgList"
|
|
299
|
+
},
|
|
300
|
+
hyperlink: {
|
|
301
|
+
type: "Hyperlink",
|
|
302
|
+
map: "Hyperlink"
|
|
303
|
+
},
|
|
304
|
+
locationfield: {
|
|
305
|
+
type: "LocationField",
|
|
306
|
+
map: "LocationField"
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
// src/components/controls/Typography/typography.tsx
|
|
310
|
+
function ft({ attributes: e = {} }) {
|
|
311
|
+
let { MuiAttributes: t = {}, text: n = "", MuiIcon: r = {}, value: i = "", MuiBox: a = {} } = e;
|
|
312
|
+
return r && r.icon ? /* @__PURE__ */ W(N, {
|
|
313
|
+
sx: {
|
|
314
|
+
display: "flex",
|
|
315
|
+
width: "100%"
|
|
316
|
+
},
|
|
317
|
+
...a,
|
|
318
|
+
children: [/* @__PURE__ */ U(R, {
|
|
319
|
+
...r.MuiIconAttributes,
|
|
320
|
+
children: r.icon
|
|
321
|
+
}, r.icon), /* @__PURE__ */ U(_e, {
|
|
322
|
+
...t,
|
|
323
|
+
children: n || i
|
|
324
|
+
})]
|
|
325
|
+
}) : /* @__PURE__ */ U(_e, {
|
|
326
|
+
...t,
|
|
327
|
+
children: n || i
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
// src/util/premiumStyles.ts
|
|
331
|
+
var Y = "cubic-bezier(0.4, 0, 0.2, 1)", X = (e, t) => [].concat(e ?? [], t ?? []), Z = (e) => ({
|
|
332
|
+
"& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root": {
|
|
333
|
+
borderRadius: "10px",
|
|
334
|
+
backgroundColor: e.palette.background.paper,
|
|
335
|
+
transition: `box-shadow .2s ${Y}, border-color .2s ${Y}`,
|
|
336
|
+
"& fieldset": {
|
|
337
|
+
borderColor: H(e.palette.text.primary, .12),
|
|
338
|
+
transition: `border-color .2s ${Y}`
|
|
339
|
+
},
|
|
340
|
+
"&:hover": { boxShadow: `0 2px 10px ${H(e.palette.common.black, .06)}` },
|
|
341
|
+
"&:hover fieldset": { borderColor: H(e.palette.primary.main, .5) },
|
|
342
|
+
"&.Mui-focused": { boxShadow: `0 0 0 3px ${H(e.palette.primary.main, .16)}` },
|
|
343
|
+
"&.Mui-focused fieldset": {
|
|
344
|
+
borderWidth: 1.5,
|
|
345
|
+
borderColor: e.palette.primary.main
|
|
346
|
+
},
|
|
347
|
+
"&.Mui-error.Mui-focused": { boxShadow: `0 0 0 3px ${H(e.palette.error.main, .16)}` }
|
|
348
|
+
},
|
|
349
|
+
"& .MuiFilledInput-root, & .MuiInput-root": { transition: `box-shadow .2s ${Y}` },
|
|
350
|
+
"& .MuiInputLabel-root": { fontWeight: 500 }
|
|
351
|
+
}), pt = (e) => ({
|
|
352
|
+
borderRadius: "10px",
|
|
353
|
+
marginLeft: 0,
|
|
354
|
+
marginRight: 0,
|
|
355
|
+
paddingRight: 1.25,
|
|
356
|
+
transition: `background-color .18s ${Y}`,
|
|
357
|
+
"&:hover": { backgroundColor: H(e.palette.primary.main, .06) }
|
|
358
|
+
}), mt = (e) => ({
|
|
359
|
+
"& .MuiSwitch-switchBase.Mui-checked": { "& + .MuiSwitch-track": { opacity: 1 } },
|
|
360
|
+
"& .MuiSwitch-thumb": { boxShadow: `0 2px 6px ${H(e.palette.common.black, .2)}` },
|
|
361
|
+
"& .MuiSwitch-track": {
|
|
362
|
+
borderRadius: 11,
|
|
363
|
+
transition: `background-color .2s ${Y}, opacity .2s ${Y}`
|
|
364
|
+
}
|
|
365
|
+
}), ht = (e) => ({
|
|
366
|
+
borderRadius: "999px",
|
|
367
|
+
fontWeight: 600,
|
|
368
|
+
transition: `transform .18s ${Y}, box-shadow .18s ${Y}`,
|
|
369
|
+
"&:hover": {
|
|
370
|
+
transform: "translateY(-1px)",
|
|
371
|
+
boxShadow: `0 4px 12px ${H(e.palette.common.black, .12)}`
|
|
372
|
+
}
|
|
373
|
+
}), gt = (e) => ({
|
|
374
|
+
borderRadius: "12px",
|
|
375
|
+
border: `1px solid ${H(e.palette.text.primary, .08)}`,
|
|
376
|
+
overflow: "hidden",
|
|
377
|
+
transition: `box-shadow .2s ${Y}`,
|
|
378
|
+
"&:hover": { boxShadow: `0 6px 20px ${H(e.palette.common.black, .08)}` }
|
|
379
|
+
});
|
|
380
|
+
// src/components/controls/TextField/textfield.tsx
|
|
381
|
+
function _t({ attributes: e = {}, rules: t = {}, onChange: n, submitTick: r, messages: i }) {
|
|
382
|
+
let { MuiAttributes: o = {}, InputProps: s = {}, format: c = "", id: l = "" } = e, { textData: u, handleOnChange: d, handleOnBlur: f } = v({
|
|
383
|
+
attributes: e,
|
|
384
|
+
rules: t,
|
|
385
|
+
onChange: n,
|
|
386
|
+
submitTick: r,
|
|
387
|
+
messages: i
|
|
388
|
+
}), p = () => {}, m = o?.type === "number" || e?.type === "number" || o?.inputMode === "numeric", h = (e) => {
|
|
389
|
+
let t = e.currentTarget;
|
|
390
|
+
t.blur(), setTimeout(() => t.focus(), 0);
|
|
391
|
+
}, y = o?.inputProps?.inputMode ?? o?.slotProps?.htmlInput?.inputMode ?? o?.slotProps?.input?.inputMode, b = {
|
|
392
|
+
...m ? { onWheel: h } : {},
|
|
393
|
+
...y ? { inputMode: y } : m || c ? { inputMode: "numeric" } : {}
|
|
394
|
+
}, x = { ...o }, S = _(s), C = {
|
|
395
|
+
...o.inputProps || o.slotProps?.htmlInput || {},
|
|
396
|
+
...b
|
|
397
|
+
}, w = {
|
|
398
|
+
...o.InputProps || o.slotProps?.input || {},
|
|
399
|
+
...S
|
|
400
|
+
}, T = {
|
|
401
|
+
...o.slotProps || {},
|
|
402
|
+
input: w,
|
|
403
|
+
htmlInput: C
|
|
404
|
+
};
|
|
405
|
+
delete x.slotProps, delete x.inputProps, delete x.InputProps;
|
|
406
|
+
let E = a(t), { sx: D, ...O } = x;
|
|
407
|
+
return /* @__PURE__ */ U(G, {
|
|
408
|
+
fullWidth: !0,
|
|
409
|
+
...O,
|
|
410
|
+
id: l,
|
|
411
|
+
sx: X(Z, D),
|
|
412
|
+
required: E,
|
|
413
|
+
slotProps: T,
|
|
414
|
+
...g ? {
|
|
415
|
+
inputProps: C,
|
|
416
|
+
InputProps: w
|
|
417
|
+
} : {},
|
|
418
|
+
onChange: d,
|
|
419
|
+
onBlur: f,
|
|
420
|
+
onFocus: p,
|
|
421
|
+
value: u.value,
|
|
422
|
+
error: u.error,
|
|
423
|
+
helperText: u.helperText
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
// node_modules/react-number-format/dist/react-number-format.es.js
|
|
427
|
+
function vt(e, t) {
|
|
428
|
+
var n = {};
|
|
429
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
430
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++) t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
|
|
431
|
+
return n;
|
|
432
|
+
}
|
|
433
|
+
var yt;
|
|
434
|
+
(function(e) {
|
|
435
|
+
e.event = "event", e.props = "prop";
|
|
436
|
+
})(yt ||= {});
|
|
437
|
+
function bt() {}
|
|
438
|
+
function xt(e) {
|
|
439
|
+
var t, n = void 0;
|
|
440
|
+
return function() {
|
|
441
|
+
for (var r = [], i = arguments.length; i--;) r[i] = arguments[i];
|
|
442
|
+
return t && r.length === t.length && r.every(function(e, n) {
|
|
443
|
+
return e === t[n];
|
|
444
|
+
}) || (t = r, n = e.apply(void 0, r)), n;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function St(e) {
|
|
448
|
+
return !!(e || "").match(/\d/);
|
|
449
|
+
}
|
|
450
|
+
function Ct(e) {
|
|
451
|
+
return e == null;
|
|
452
|
+
}
|
|
453
|
+
function wt(e) {
|
|
454
|
+
return typeof e == "number" && isNaN(e);
|
|
455
|
+
}
|
|
456
|
+
function Tt(e) {
|
|
457
|
+
return Ct(e) || wt(e) || typeof e == "number" && !isFinite(e);
|
|
458
|
+
}
|
|
459
|
+
function Et(e) {
|
|
460
|
+
return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
461
|
+
}
|
|
462
|
+
function Dt(e) {
|
|
463
|
+
switch (e) {
|
|
464
|
+
case "lakh": return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
|
|
465
|
+
case "wan": return /(\d)(?=(\d{4})+(?!\d))/g;
|
|
466
|
+
default: return /(\d)(?=(\d{3})+(?!\d))/g;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function Ot(e, t, n) {
|
|
470
|
+
var r = Dt(n), i = e.search(/[1-9]/);
|
|
471
|
+
return i = i === -1 ? e.length : i, e.substring(0, i) + e.substring(i, e.length).replace(r, "$1" + t);
|
|
472
|
+
}
|
|
473
|
+
function kt(e) {
|
|
474
|
+
var t = j(e);
|
|
475
|
+
return t.current = e, j(function() {
|
|
476
|
+
for (var e = [], n = arguments.length; n--;) e[n] = arguments[n];
|
|
477
|
+
return t.current.apply(t, e);
|
|
478
|
+
}).current;
|
|
479
|
+
}
|
|
480
|
+
function At(e, t) {
|
|
481
|
+
t === void 0 && (t = !0);
|
|
482
|
+
var n = e[0] === "-", r = n && t;
|
|
483
|
+
e = e.replace("-", "");
|
|
484
|
+
var i = e.split(".");
|
|
485
|
+
return {
|
|
486
|
+
beforeDecimal: i[0],
|
|
487
|
+
afterDecimal: i[1] || "",
|
|
488
|
+
hasNegation: n,
|
|
489
|
+
addNegation: r
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function jt(e) {
|
|
493
|
+
if (!e) return e;
|
|
494
|
+
var t = e[0] === "-";
|
|
495
|
+
t && (e = e.substring(1, e.length));
|
|
496
|
+
var n = e.split("."), r = n[0].replace(/^0+/, "") || "0", i = n[1] || "";
|
|
497
|
+
return (t ? "-" : "") + r + (i ? "." + i : "");
|
|
498
|
+
}
|
|
499
|
+
function Mt(e, t, n) {
|
|
500
|
+
for (var r = "", i = n ? "0" : "", a = 0; a <= t - 1; a++) r += e[a] || i;
|
|
501
|
+
return r;
|
|
502
|
+
}
|
|
503
|
+
function Nt(e, t) {
|
|
504
|
+
return Array(t + 1).join(e);
|
|
505
|
+
}
|
|
506
|
+
function Pt(e) {
|
|
507
|
+
var t = e + "", n = t[0] === "-" ? "-" : "";
|
|
508
|
+
n && (t = t.substring(1));
|
|
509
|
+
var r = t.split(/[eE]/g), i = r[0], a = r[1];
|
|
510
|
+
if (a = Number(a), !a) return n + i;
|
|
511
|
+
i = i.replace(".", "");
|
|
512
|
+
var o = 1 + a, s = i.length;
|
|
513
|
+
return o < 0 ? i = "0." + Nt("0", Math.abs(o)) + i : o >= s ? i += Nt("0", o - s) : i = (i.substring(0, o) || "0") + "." + i.substring(o), n + i;
|
|
514
|
+
}
|
|
515
|
+
function Ft(e, t, n) {
|
|
516
|
+
if (["", "-"].indexOf(e) !== -1) return e;
|
|
517
|
+
var r = (e.indexOf(".") !== -1 || n) && t, i = At(e), a = i.beforeDecimal, o = i.afterDecimal, s = i.hasNegation, c = parseFloat("0." + (o || "0")), l = (o.length <= t ? "0." + o : c.toFixed(t)).split("."), u = a;
|
|
518
|
+
a && Number(l[0]) && (u = a.split("").reverse().reduce(function(e, t, n) {
|
|
519
|
+
return e.length > n ? (Number(e[0]) + Number(t)).toString() + e.substring(1, e.length) : t + e;
|
|
520
|
+
}, l[0]));
|
|
521
|
+
var d = Mt(l[1] || "", t, n), f = s ? "-" : "", p = r ? "." : "";
|
|
522
|
+
return "" + f + u + p + d;
|
|
523
|
+
}
|
|
524
|
+
function It(e, t) {
|
|
525
|
+
if (e.value = e.value, e !== null) {
|
|
526
|
+
if (e.createTextRange) {
|
|
527
|
+
var n = e.createTextRange();
|
|
528
|
+
return n.move("character", t), n.select(), !0;
|
|
529
|
+
}
|
|
530
|
+
return e.selectionStart || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
var Lt = xt(function(e, t) {
|
|
534
|
+
for (var n = 0, r = 0, i = e.length, a = t.length; e[n] === t[n] && n < i;) n++;
|
|
535
|
+
for (; e[i - 1 - r] === t[a - 1 - r] && a - r > n && i - r > n;) r++;
|
|
536
|
+
return {
|
|
537
|
+
from: {
|
|
538
|
+
start: n,
|
|
539
|
+
end: i - r
|
|
540
|
+
},
|
|
541
|
+
to: {
|
|
542
|
+
start: n,
|
|
543
|
+
end: a - r
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
}), Rt = function(e, t) {
|
|
547
|
+
var n = Math.min(e.selectionStart, t);
|
|
548
|
+
return {
|
|
549
|
+
from: {
|
|
550
|
+
start: n,
|
|
551
|
+
end: e.selectionEnd
|
|
552
|
+
},
|
|
553
|
+
to: {
|
|
554
|
+
start: n,
|
|
555
|
+
end: t
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
function zt(e, t, n) {
|
|
560
|
+
return Math.min(Math.max(e, t), n);
|
|
561
|
+
}
|
|
562
|
+
function Bt(e) {
|
|
563
|
+
return Math.max(e.selectionStart, e.selectionEnd);
|
|
564
|
+
}
|
|
565
|
+
function Vt() {
|
|
566
|
+
return typeof navigator < "u" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
|
|
567
|
+
}
|
|
568
|
+
function Ht(e) {
|
|
569
|
+
return {
|
|
570
|
+
from: {
|
|
571
|
+
start: 0,
|
|
572
|
+
end: 0
|
|
573
|
+
},
|
|
574
|
+
to: {
|
|
575
|
+
start: 0,
|
|
576
|
+
end: e.length
|
|
577
|
+
},
|
|
578
|
+
lastValue: ""
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function Ut(e, t) {
|
|
582
|
+
return e === void 0 && (e = " "), typeof e == "string" ? e : e[t] || " ";
|
|
583
|
+
}
|
|
584
|
+
function Wt(e) {
|
|
585
|
+
var t = e.currentValue, n = e.formattedValue, r = e.currentValueIndex, i = e.formattedValueIndex;
|
|
586
|
+
return t[r] === n[i];
|
|
587
|
+
}
|
|
588
|
+
function Gt(e, t, n, r, i, a, o) {
|
|
589
|
+
o === void 0 && (o = Wt);
|
|
590
|
+
var s = i.findIndex(function(e) {
|
|
591
|
+
return e;
|
|
592
|
+
}), c = e.slice(0, s);
|
|
593
|
+
!t && !n.startsWith(c) && (t = c, n = c + n, r += c.length);
|
|
594
|
+
for (var l = n.length, u = e.length, d = {}, f = Array(l), p = 0; p < l; p++) {
|
|
595
|
+
f[p] = -1;
|
|
596
|
+
for (var m = 0, h = u; m < h; m++) if (o({
|
|
597
|
+
currentValue: n,
|
|
598
|
+
lastValue: t,
|
|
599
|
+
formattedValue: e,
|
|
600
|
+
currentValueIndex: p,
|
|
601
|
+
formattedValueIndex: m
|
|
602
|
+
}) && d[m] !== !0) {
|
|
603
|
+
f[p] = m, d[m] = !0;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
for (var g = r; g < l && (f[g] === -1 || !a(n[g]));) g++;
|
|
608
|
+
var _ = g === l || f[g] === -1 ? u : f[g];
|
|
609
|
+
for (g = r - 1; g > 0 && f[g] === -1;) g--;
|
|
610
|
+
var v = g === -1 || f[g] === -1 ? 0 : f[g] + 1;
|
|
611
|
+
return v > _ ? _ : r - v < _ - r ? v : _;
|
|
612
|
+
}
|
|
613
|
+
function Kt(e, t, n, r) {
|
|
614
|
+
var i = e.length;
|
|
615
|
+
if (t = zt(t, 0, i), r === "left") {
|
|
616
|
+
for (; t >= 0 && !n[t];) t--;
|
|
617
|
+
t === -1 && (t = n.indexOf(!0));
|
|
618
|
+
} else {
|
|
619
|
+
for (; t <= i && !n[t];) t++;
|
|
620
|
+
t > i && (t = n.lastIndexOf(!0));
|
|
621
|
+
}
|
|
622
|
+
return t === -1 && (t = i), t;
|
|
623
|
+
}
|
|
624
|
+
function qt(e) {
|
|
625
|
+
for (var t = Array.from({ length: e.length + 1 }).map(function() {
|
|
626
|
+
return !0;
|
|
627
|
+
}), n = 0, r = t.length; n < r; n++) t[n] = !!(St(e[n]) || St(e[n - 1]));
|
|
628
|
+
return t;
|
|
629
|
+
}
|
|
630
|
+
function Jt(e, t, n, r, i, a) {
|
|
631
|
+
a === void 0 && (a = bt);
|
|
632
|
+
var o = kt(function(e, t) {
|
|
633
|
+
var n, a;
|
|
634
|
+
return Tt(e) ? (a = "", n = "") : typeof e == "number" || t ? (a = typeof e == "number" ? Pt(e) : e, n = r(a)) : (a = i(e, void 0), n = r(a)), {
|
|
635
|
+
formattedValue: n,
|
|
636
|
+
numAsString: a
|
|
637
|
+
};
|
|
638
|
+
}), s = M(function() {
|
|
639
|
+
return o(Ct(e) ? t : e, n);
|
|
640
|
+
}), c = s[0], l = s[1], u = kt(function(e, t) {
|
|
641
|
+
e.formattedValue !== c.formattedValue && l({
|
|
642
|
+
formattedValue: e.formattedValue,
|
|
643
|
+
numAsString: e.value
|
|
644
|
+
}), a(e, t);
|
|
645
|
+
}), d = e, f = n;
|
|
646
|
+
Ct(e) && (d = c.numAsString, f = !0);
|
|
647
|
+
var p = o(d, f);
|
|
648
|
+
return A(function() {
|
|
649
|
+
l(p);
|
|
650
|
+
}, [p.formattedValue]), E(function() {
|
|
651
|
+
if (!Ct(t) && Ct(e) && c.formattedValue !== "") {
|
|
652
|
+
var n = parseFloat(c.numAsString);
|
|
653
|
+
u({
|
|
654
|
+
formattedValue: c.formattedValue,
|
|
655
|
+
value: c.numAsString,
|
|
656
|
+
floatValue: isNaN(n) ? void 0 : n
|
|
657
|
+
}, {
|
|
658
|
+
event: void 0,
|
|
659
|
+
source: yt.props
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
}, []), [c, u];
|
|
663
|
+
}
|
|
664
|
+
function Yt(e) {
|
|
665
|
+
return e.replace(/[^0-9]/g, "");
|
|
666
|
+
}
|
|
667
|
+
function Xt(e) {
|
|
668
|
+
return e;
|
|
669
|
+
}
|
|
670
|
+
function Zt(e) {
|
|
671
|
+
var t = e.type;
|
|
672
|
+
t === void 0 && (t = "text");
|
|
673
|
+
var n = e.displayType;
|
|
674
|
+
n === void 0 && (n = "input");
|
|
675
|
+
var r = e.customInput, i = e.renderText, a = e.getInputRef, o = e.format;
|
|
676
|
+
o === void 0 && (o = Xt);
|
|
677
|
+
var s = e.removeFormatting;
|
|
678
|
+
s === void 0 && (s = Yt);
|
|
679
|
+
var c = e.defaultValue, l = e.valueIsNumericString, u = e.onValueChange, d = e.isAllowed, f = e.onChange;
|
|
680
|
+
f === void 0 && (f = bt);
|
|
681
|
+
var p = e.onKeyDown;
|
|
682
|
+
p === void 0 && (p = bt);
|
|
683
|
+
var m = e.onMouseUp;
|
|
684
|
+
m === void 0 && (m = bt);
|
|
685
|
+
var h = e.onFocus;
|
|
686
|
+
h === void 0 && (h = bt);
|
|
687
|
+
var g = e.onBlur;
|
|
688
|
+
g === void 0 && (g = bt);
|
|
689
|
+
var _ = e.value, v = e.getCaretBoundary;
|
|
690
|
+
v === void 0 && (v = qt);
|
|
691
|
+
var y = e.isValidInputCharacter;
|
|
692
|
+
y === void 0 && (y = St);
|
|
693
|
+
var b = e.isCharacterSame, x = vt(e, [
|
|
694
|
+
"type",
|
|
695
|
+
"displayType",
|
|
696
|
+
"customInput",
|
|
697
|
+
"renderText",
|
|
698
|
+
"getInputRef",
|
|
699
|
+
"format",
|
|
700
|
+
"removeFormatting",
|
|
701
|
+
"defaultValue",
|
|
702
|
+
"valueIsNumericString",
|
|
703
|
+
"onValueChange",
|
|
704
|
+
"isAllowed",
|
|
705
|
+
"onChange",
|
|
706
|
+
"onKeyDown",
|
|
707
|
+
"onMouseUp",
|
|
708
|
+
"onFocus",
|
|
709
|
+
"onBlur",
|
|
710
|
+
"value",
|
|
711
|
+
"getCaretBoundary",
|
|
712
|
+
"isValidInputCharacter",
|
|
713
|
+
"isCharacterSame"
|
|
714
|
+
]), C = Jt(_, c, !!l, o, s, u), w = C[0], T = w.formattedValue, D = w.numAsString, O = C[1], A = j(), ee = j({
|
|
715
|
+
formattedValue: T,
|
|
716
|
+
numAsString: D
|
|
717
|
+
}), te = function(e, t) {
|
|
718
|
+
ee.current = {
|
|
719
|
+
formattedValue: e.formattedValue,
|
|
720
|
+
numAsString: e.value
|
|
721
|
+
}, O(e, t);
|
|
722
|
+
}, N = M(!1), P = N[0], ne = N[1], F = j(null), I = j({
|
|
723
|
+
setCaretTimeout: null,
|
|
724
|
+
focusTimeout: null
|
|
725
|
+
});
|
|
726
|
+
E(function() {
|
|
727
|
+
return ne(!0), function() {
|
|
728
|
+
clearTimeout(I.current.setCaretTimeout), clearTimeout(I.current.focusTimeout);
|
|
729
|
+
};
|
|
730
|
+
}, []);
|
|
731
|
+
var re = o, ie = function(e, t) {
|
|
732
|
+
var n = parseFloat(t);
|
|
733
|
+
return {
|
|
734
|
+
formattedValue: e,
|
|
735
|
+
value: t,
|
|
736
|
+
floatValue: isNaN(n) ? void 0 : n
|
|
737
|
+
};
|
|
738
|
+
}, L = function(e, t, n) {
|
|
739
|
+
(e.selectionStart !== 0 || e.selectionEnd !== e.value.length) && (It(e, t), I.current.setCaretTimeout = setTimeout(function() {
|
|
740
|
+
e.value === n && e.selectionStart !== t && It(e, t);
|
|
741
|
+
}, 0));
|
|
742
|
+
}, ae = function(e, t, n) {
|
|
743
|
+
return Kt(e, t, v(e), n);
|
|
744
|
+
}, R = function(e, t, n) {
|
|
745
|
+
var r = v(t), i = Gt(t, T, e, n, r, y, b);
|
|
746
|
+
return i = Kt(t, i, r), i;
|
|
747
|
+
}, oe = function(e) {
|
|
748
|
+
var t = e.formattedValue;
|
|
749
|
+
t === void 0 && (t = "");
|
|
750
|
+
var n = e.input, r = e.source, i = e.event, a = e.numAsString, o;
|
|
751
|
+
if (n) {
|
|
752
|
+
var s = e.inputValue || n.value, c = Bt(n);
|
|
753
|
+
n.value = t, o = R(s, t, c), o !== void 0 && L(n, o, t);
|
|
754
|
+
}
|
|
755
|
+
t !== T && te(ie(t, a), {
|
|
756
|
+
event: i,
|
|
757
|
+
source: r
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
E(function() {
|
|
761
|
+
var e = ee.current, t = e.formattedValue, n = e.numAsString;
|
|
762
|
+
(T !== t || D !== n) && te(ie(T, D), {
|
|
763
|
+
event: void 0,
|
|
764
|
+
source: yt.props
|
|
765
|
+
});
|
|
766
|
+
}, [T, D]);
|
|
767
|
+
var se = F.current ? Bt(F.current) : void 0;
|
|
768
|
+
(typeof window < "u" ? k : E)(function() {
|
|
769
|
+
var e = F.current;
|
|
770
|
+
if (T !== ee.current.formattedValue && e) {
|
|
771
|
+
var t = R(ee.current.formattedValue, T, se);
|
|
772
|
+
e.value = T, L(e, t, T);
|
|
773
|
+
}
|
|
774
|
+
}, [T]);
|
|
775
|
+
var ce = function(e, t, n) {
|
|
776
|
+
var r = t.target, i = A.current ? Rt(A.current, r.selectionEnd) : Lt(T, e), a = Object.assign(Object.assign({}, i), { lastValue: T }), o = s(e, a), c = re(o);
|
|
777
|
+
if (o = s(c, void 0), d && !d(ie(c, o))) {
|
|
778
|
+
var l = t.target, u = R(e, T, Bt(l));
|
|
779
|
+
return l.value = T, L(l, u, T), !1;
|
|
780
|
+
}
|
|
781
|
+
return oe({
|
|
782
|
+
formattedValue: c,
|
|
783
|
+
numAsString: o,
|
|
784
|
+
inputValue: e,
|
|
785
|
+
event: t,
|
|
786
|
+
source: n,
|
|
787
|
+
input: t.target
|
|
788
|
+
}), !0;
|
|
789
|
+
}, le = function(e, t) {
|
|
790
|
+
t === void 0 && (t = 0), A.current = {
|
|
791
|
+
selectionStart: e.selectionStart,
|
|
792
|
+
selectionEnd: e.selectionEnd + t
|
|
793
|
+
};
|
|
794
|
+
}, z = function(e) {
|
|
795
|
+
var t = e.target.value;
|
|
796
|
+
ce(t, e, yt.event) && f(e), A.current = void 0;
|
|
797
|
+
}, ue = function(e) {
|
|
798
|
+
var t = e.target, n = e.key, r = t.selectionStart, i = t.selectionEnd, a = t.value;
|
|
799
|
+
a === void 0 && (a = "");
|
|
800
|
+
var o;
|
|
801
|
+
n === "ArrowLeft" || n === "Backspace" ? o = Math.max(r - 1, 0) : n === "ArrowRight" ? o = Math.min(r + 1, a.length) : n === "Delete" && (o = r);
|
|
802
|
+
var s = 0;
|
|
803
|
+
n === "Delete" && r === i && (s = 1);
|
|
804
|
+
var c = n === "ArrowLeft" || n === "ArrowRight";
|
|
805
|
+
if (o === void 0 || r !== i && !c) p(e), le(t, s);
|
|
806
|
+
else {
|
|
807
|
+
var l = o;
|
|
808
|
+
c ? (l = ae(a, o, n === "ArrowLeft" ? "left" : "right"), l !== o && e.preventDefault()) : n === "Delete" && !y(a[o]) ? l = ae(a, o, "right") : n === "Backspace" && !y(a[o]) && (l = ae(a, o, "left")), l !== o && L(t, l, a), p(e), le(t, s);
|
|
809
|
+
}
|
|
810
|
+
}, de = function(e) {
|
|
811
|
+
var t = e.target, n = function() {
|
|
812
|
+
var e = t.selectionStart, n = t.selectionEnd, r = t.value;
|
|
813
|
+
if (r === void 0 && (r = ""), e === n) {
|
|
814
|
+
var i = ae(r, e);
|
|
815
|
+
i !== e && L(t, i, r);
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
n(), requestAnimationFrame(function() {
|
|
819
|
+
n();
|
|
820
|
+
}), m(e), le(t);
|
|
821
|
+
}, fe = function(e) {
|
|
822
|
+
e.persist && e.persist();
|
|
823
|
+
var t = e.target, n = e.currentTarget;
|
|
824
|
+
F.current = t, I.current.focusTimeout = setTimeout(function() {
|
|
825
|
+
var r = t.selectionStart, i = t.selectionEnd, a = t.value;
|
|
826
|
+
a === void 0 && (a = "");
|
|
827
|
+
var o = ae(a, r);
|
|
828
|
+
o !== r && (r !== 0 || i !== a.length) && L(t, o, a), h(Object.assign(Object.assign({}, e), { currentTarget: n }));
|
|
829
|
+
}, 0);
|
|
830
|
+
}, B = function(e) {
|
|
831
|
+
F.current = null, clearTimeout(I.current.focusTimeout), clearTimeout(I.current.setCaretTimeout), g(e);
|
|
832
|
+
}, pe = P && Vt() ? "numeric" : void 0, me = Object.assign({ inputMode: pe }, x, {
|
|
833
|
+
type: t,
|
|
834
|
+
value: T,
|
|
835
|
+
onChange: z,
|
|
836
|
+
onKeyDown: ue,
|
|
837
|
+
onMouseUp: de,
|
|
838
|
+
onFocus: fe,
|
|
839
|
+
onBlur: B
|
|
840
|
+
});
|
|
841
|
+
if (n === "text") return i ? S.createElement(S.Fragment, null, i(T, x) || null) : S.createElement("span", Object.assign({}, x, { ref: a }), T);
|
|
842
|
+
if (r) {
|
|
843
|
+
var V = r;
|
|
844
|
+
return S.createElement(V, Object.assign({}, me, { ref: a }));
|
|
845
|
+
}
|
|
846
|
+
return S.createElement("input", Object.assign({}, me, { ref: a }));
|
|
847
|
+
}
|
|
848
|
+
function Qt(e, t) {
|
|
849
|
+
var n = t.decimalScale, r = t.fixedDecimalScale, i = t.prefix;
|
|
850
|
+
i === void 0 && (i = "");
|
|
851
|
+
var a = t.suffix;
|
|
852
|
+
a === void 0 && (a = "");
|
|
853
|
+
var o = t.allowNegative, s = t.thousandsGroupStyle;
|
|
854
|
+
if (s === void 0 && (s = "thousand"), e === "" || e === "-") return e;
|
|
855
|
+
var c = $t(t), l = c.thousandSeparator, u = c.decimalSeparator, d = n !== 0 && e.indexOf(".") !== -1 || n && r, f = At(e, o), p = f.beforeDecimal, m = f.afterDecimal, h = f.addNegation;
|
|
856
|
+
return n !== void 0 && (m = Mt(m, n, !!r)), l && (p = Ot(p, l, s)), i && (p = i + p), a && (m += a), h && (p = "-" + p), e = p + (d && u || "") + m, e;
|
|
857
|
+
}
|
|
858
|
+
function $t(e) {
|
|
859
|
+
var t = e.decimalSeparator;
|
|
860
|
+
t === void 0 && (t = ".");
|
|
861
|
+
var n = e.thousandSeparator, r = e.allowedDecimalSeparators;
|
|
862
|
+
return n === !0 && (n = ","), r ||= [t, "."], {
|
|
863
|
+
decimalSeparator: t,
|
|
864
|
+
thousandSeparator: n,
|
|
865
|
+
allowedDecimalSeparators: r
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
function en(e, t) {
|
|
869
|
+
e === void 0 && (e = "");
|
|
870
|
+
var n = /* @__PURE__ */ RegExp("(-)"), r = /* @__PURE__ */ RegExp("(-)(.)*(-)"), i = n.test(e), a = r.test(e);
|
|
871
|
+
return e = e.replace(/-/g, ""), i && !a && t && (e = "-" + e), e;
|
|
872
|
+
}
|
|
873
|
+
function tn(e, t) {
|
|
874
|
+
return RegExp("(^-)|[0-9]|" + Et(e), t ? "g" : void 0);
|
|
875
|
+
}
|
|
876
|
+
function nn(e, t, n) {
|
|
877
|
+
return e === "" || !t?.match(/\d/) && !n?.match(/\d/) && typeof e == "string" && !isNaN(Number(e));
|
|
878
|
+
}
|
|
879
|
+
function rn(e, t, n) {
|
|
880
|
+
var r;
|
|
881
|
+
t === void 0 && (t = Ht(e));
|
|
882
|
+
var i = n.allowNegative, a = n.prefix;
|
|
883
|
+
a === void 0 && (a = "");
|
|
884
|
+
var o = n.suffix;
|
|
885
|
+
o === void 0 && (o = "");
|
|
886
|
+
var s = n.decimalScale, c = t.from, l = t.to, u = l.start, d = l.end, f = $t(n), p = f.allowedDecimalSeparators, m = f.decimalSeparator, h = e[d] === m;
|
|
887
|
+
if (St(e) && (e === a || e === o) && t.lastValue === "") return e;
|
|
888
|
+
if (d - u === 1 && p.indexOf(e[u]) !== -1) {
|
|
889
|
+
var g = s === 0 ? "" : m;
|
|
890
|
+
e = e.substring(0, u) + g + e.substring(u + 1, e.length);
|
|
891
|
+
}
|
|
892
|
+
var _ = function(e, t, n) {
|
|
893
|
+
var r = !1, i = !1;
|
|
894
|
+
a.startsWith("-") ? r = !1 : e.startsWith("--") ? (r = !1, i = !0) : o.startsWith("-") && e.length === o.length ? r = !1 : e[0] === "-" && (r = !0);
|
|
895
|
+
var s = +!!r;
|
|
896
|
+
return i && (s = 2), s && (e = e.substring(s), t -= s, n -= s), {
|
|
897
|
+
value: e,
|
|
898
|
+
start: t,
|
|
899
|
+
end: n,
|
|
900
|
+
hasNegation: r
|
|
901
|
+
};
|
|
902
|
+
}, v = _(e, u, d), y = v.hasNegation;
|
|
903
|
+
r = v, e = r.value, u = r.start, d = r.end;
|
|
904
|
+
var b = _(t.lastValue, c.start, c.end), x = b.start, S = b.end, C = b.value, w = e.substring(u, d);
|
|
905
|
+
e.length && C.length && (x > C.length - o.length || S < a.length) && !(w && o.startsWith(w)) && (e = C);
|
|
906
|
+
var T = 0;
|
|
907
|
+
e.startsWith(a) ? T += a.length : u < a.length && (T = u), e = e.substring(T), d -= T;
|
|
908
|
+
var E = e.length, D = e.length - o.length;
|
|
909
|
+
e.endsWith(o) ? E = D : (d > D || d > e.length - o.length) && (E = d), e = e.substring(0, E), e = en(y ? "-" + e : e, i), e = (e.match(tn(m, !0)) || []).join("");
|
|
910
|
+
var O = e.indexOf(m);
|
|
911
|
+
e = e.replace(new RegExp(Et(m), "g"), function(e, t) {
|
|
912
|
+
return t === O ? "." : "";
|
|
913
|
+
});
|
|
914
|
+
var k = At(e, i), A = k.beforeDecimal, ee = k.afterDecimal, j = k.addNegation;
|
|
915
|
+
return l.end - l.start < c.end - c.start && A === "" && h && !parseFloat(ee) && (e = j ? "-" : ""), e;
|
|
916
|
+
}
|
|
917
|
+
function an(e, t) {
|
|
918
|
+
var n = t.prefix;
|
|
919
|
+
n === void 0 && (n = "");
|
|
920
|
+
var r = t.suffix;
|
|
921
|
+
r === void 0 && (r = "");
|
|
922
|
+
var i = Array.from({ length: e.length + 1 }).map(function() {
|
|
923
|
+
return !0;
|
|
924
|
+
}), a = e[0] === "-";
|
|
925
|
+
i.fill(!1, 0, Math.min(n.length + +!!a, e.length));
|
|
926
|
+
var o = e.length;
|
|
927
|
+
return i.fill(!1, o - r.length + 1, o + 1), i;
|
|
928
|
+
}
|
|
929
|
+
function on(e) {
|
|
930
|
+
var t = $t(e), n = t.thousandSeparator, r = t.decimalSeparator, i = e.prefix;
|
|
931
|
+
i === void 0 && (i = "");
|
|
932
|
+
var a = e.allowNegative;
|
|
933
|
+
if (a === void 0 && (a = !0), n === r) throw Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: " + n + " (thousandSeparator = {true} is same as thousandSeparator = \",\")\n decimalSeparator: " + r + " (default value for decimalSeparator is .)\n ");
|
|
934
|
+
return i.startsWith("-") && a && (console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: " + i + "\n allowNegative: " + a + "\n "), a = !1), Object.assign(Object.assign({}, e), { allowNegative: a });
|
|
935
|
+
}
|
|
936
|
+
function sn(e) {
|
|
937
|
+
e = on(e), e.decimalSeparator, e.allowedDecimalSeparators, e.thousandsGroupStyle;
|
|
938
|
+
var t = e.suffix, n = e.allowNegative, r = e.allowLeadingZeros, i = e.onKeyDown;
|
|
939
|
+
i === void 0 && (i = bt);
|
|
940
|
+
var a = e.onBlur;
|
|
941
|
+
a === void 0 && (a = bt);
|
|
942
|
+
var o = e.thousandSeparator, s = e.decimalScale, c = e.fixedDecimalScale, l = e.prefix;
|
|
943
|
+
l === void 0 && (l = "");
|
|
944
|
+
var u = e.defaultValue, d = e.value, f = e.valueIsNumericString, p = e.onValueChange, m = vt(e, [
|
|
945
|
+
"decimalSeparator",
|
|
946
|
+
"allowedDecimalSeparators",
|
|
947
|
+
"thousandsGroupStyle",
|
|
948
|
+
"suffix",
|
|
949
|
+
"allowNegative",
|
|
950
|
+
"allowLeadingZeros",
|
|
951
|
+
"onKeyDown",
|
|
952
|
+
"onBlur",
|
|
953
|
+
"thousandSeparator",
|
|
954
|
+
"decimalScale",
|
|
955
|
+
"fixedDecimalScale",
|
|
956
|
+
"prefix",
|
|
957
|
+
"defaultValue",
|
|
958
|
+
"value",
|
|
959
|
+
"valueIsNumericString",
|
|
960
|
+
"onValueChange"
|
|
961
|
+
]), h = $t(e), g = h.decimalSeparator, _ = h.allowedDecimalSeparators, v = function(t) {
|
|
962
|
+
return Qt(t, e);
|
|
963
|
+
}, y = function(t, n) {
|
|
964
|
+
return rn(t, n, e);
|
|
965
|
+
}, b = Ct(d) ? u : d, x = f ?? nn(b, l, t);
|
|
966
|
+
Ct(d) ? Ct(u) || (x ||= typeof u == "number") : x ||= typeof d == "number";
|
|
967
|
+
var S = function(e) {
|
|
968
|
+
return Tt(e) ? e : (typeof e == "number" && (e = Pt(e)), x && typeof s == "number" ? Ft(e, s, !!c) : e);
|
|
969
|
+
}, C = Jt(S(d), S(u), !!x, v, y, p), w = C[0], T = w.numAsString, E = w.formattedValue, D = C[1];
|
|
970
|
+
return Object.assign(Object.assign({}, m), {
|
|
971
|
+
value: E,
|
|
972
|
+
valueIsNumericString: !1,
|
|
973
|
+
isValidInputCharacter: function(e) {
|
|
974
|
+
return e === g || St(e);
|
|
975
|
+
},
|
|
976
|
+
isCharacterSame: function(e) {
|
|
977
|
+
var t = e.currentValue, n = e.lastValue, r = e.formattedValue, i = e.currentValueIndex, a = e.formattedValueIndex, o = t[i], u = r[a], f = Lt(n, t).to, p = function(e) {
|
|
978
|
+
return y(e).indexOf(".") + l.length;
|
|
979
|
+
};
|
|
980
|
+
return d === 0 && c && s && t[f.start] === g && p(t) < i && p(r) > a ? !1 : i >= f.start && i < f.end && _ && _.includes(o) && u === g ? !0 : o === u;
|
|
981
|
+
},
|
|
982
|
+
onValueChange: D,
|
|
983
|
+
format: v,
|
|
984
|
+
removeFormatting: y,
|
|
985
|
+
getCaretBoundary: function(t) {
|
|
986
|
+
return an(t, e);
|
|
987
|
+
},
|
|
988
|
+
onKeyDown: function(e) {
|
|
989
|
+
var t = e.target, r = e.key, a = t.selectionStart, u = t.selectionEnd, d = t.value;
|
|
990
|
+
if (d === void 0 && (d = ""), (r === "Backspace" || r === "Delete") && u < l.length && d !== "-") e.preventDefault();
|
|
991
|
+
else if (a !== u) i(e);
|
|
992
|
+
else {
|
|
993
|
+
r === "Backspace" && d[0] === "-" && a === l.length + 1 && n && It(t, 1), s && c && (r === "Backspace" && d[a - 1] === g ? (It(t, a - 1), e.preventDefault()) : r === "Delete" && d[a] === g && e.preventDefault()), _?.includes(r) && d[a] === g && It(t, a + 1);
|
|
994
|
+
var f = o === !0 ? "," : o;
|
|
995
|
+
r === "Backspace" && d[a - 1] === f && It(t, a - 1), r === "Delete" && d[a] === f && It(t, a + 1), i(e);
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
onBlur: function(t) {
|
|
999
|
+
var n = T;
|
|
1000
|
+
n.match(/\d/g) || (n = ""), r || (n = jt(n)), c && s && (n = Ft(n, s, c)), n !== T && D({
|
|
1001
|
+
formattedValue: Qt(n, e),
|
|
1002
|
+
value: n,
|
|
1003
|
+
floatValue: parseFloat(n)
|
|
1004
|
+
}, {
|
|
1005
|
+
event: t,
|
|
1006
|
+
source: yt.event
|
|
1007
|
+
}), a(t);
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
function cn(e) {
|
|
1012
|
+
var t = sn(e);
|
|
1013
|
+
return S.createElement(Zt, Object.assign({}, t));
|
|
1014
|
+
}
|
|
1015
|
+
function ln(e, t) {
|
|
1016
|
+
var n = t.format, r = t.allowEmptyFormatting, i = t.mask, a = t.patternChar;
|
|
1017
|
+
if (a === void 0 && (a = "#"), e === "" && !r) return "";
|
|
1018
|
+
for (var o = 0, s = n.split(""), c = 0, l = n.length; c < l; c++) n[c] === a && (s[c] = e[o] || Ut(i, o), o += 1);
|
|
1019
|
+
return s.join("");
|
|
1020
|
+
}
|
|
1021
|
+
function un(e, t, n) {
|
|
1022
|
+
t === void 0 && (t = Ht(e));
|
|
1023
|
+
var r = n.format, i = n.patternChar;
|
|
1024
|
+
i === void 0 && (i = "#");
|
|
1025
|
+
var a = t.from, o = t.to, s = t.lastValue;
|
|
1026
|
+
s === void 0 && (s = "");
|
|
1027
|
+
var c = function(e) {
|
|
1028
|
+
return r[e] === i;
|
|
1029
|
+
}, l = function(e, t) {
|
|
1030
|
+
for (var n = "", r = 0; r < e.length; r++) c(t + r) && St(e[r]) && (n += e[r]);
|
|
1031
|
+
return n;
|
|
1032
|
+
}, u = function(e) {
|
|
1033
|
+
return e.replace(/[^0-9]/g, "");
|
|
1034
|
+
};
|
|
1035
|
+
if (!r.match(/\d/)) return u(e);
|
|
1036
|
+
if ((s === "" || a.end - a.start === s.length) && e.length === r.length) {
|
|
1037
|
+
for (var d = "", f = 0; f < e.length; f++) if (c(f)) St(e[f]) && (d += e[f]);
|
|
1038
|
+
else if (e[f] !== r[f]) return u(e);
|
|
1039
|
+
return d;
|
|
1040
|
+
}
|
|
1041
|
+
var p = s.substring(0, a.start), m = e.substring(o.start, o.end), h = s.substring(a.end);
|
|
1042
|
+
return "" + l(p, 0) + u(m) + l(h, a.end);
|
|
1043
|
+
}
|
|
1044
|
+
function dn(e, t) {
|
|
1045
|
+
var n = t.format, r = t.mask, i = t.patternChar;
|
|
1046
|
+
i === void 0 && (i = "#");
|
|
1047
|
+
var a = Array.from({ length: e.length + 1 }).map(function() {
|
|
1048
|
+
return !0;
|
|
1049
|
+
}), o = 0, s = -1, c = {};
|
|
1050
|
+
n.split("").forEach(function(t, n) {
|
|
1051
|
+
var a = void 0;
|
|
1052
|
+
t === i && (o++, a = Ut(r, o - 1), s === -1 && e[n] === a && (s = n)), c[n] = a;
|
|
1053
|
+
});
|
|
1054
|
+
for (var l = function(t) {
|
|
1055
|
+
return n[t] === i && e[t] !== c[t];
|
|
1056
|
+
}, u = 0, d = a.length; u < d; u++) a[u] = u === s || l(u) || l(u - 1);
|
|
1057
|
+
return a[n.indexOf(i)] = !0, a;
|
|
1058
|
+
}
|
|
1059
|
+
function fn(e) {
|
|
1060
|
+
var t = e.mask;
|
|
1061
|
+
if (t && (t === "string" ? t : t.toString()).match(/\d/g)) throw Error("Mask " + t + " should not contain numeric character;");
|
|
1062
|
+
}
|
|
1063
|
+
function pn(e, t) {
|
|
1064
|
+
return e === "" || !t?.match(/\d/) && typeof e == "string" && (!!e.match(/^\d+$/) || e === "");
|
|
1065
|
+
}
|
|
1066
|
+
function mn(e) {
|
|
1067
|
+
e.mask, e.allowEmptyFormatting;
|
|
1068
|
+
var t = e.format, n = e.inputMode;
|
|
1069
|
+
n === void 0 && (n = "numeric");
|
|
1070
|
+
var r = e.onKeyDown;
|
|
1071
|
+
r === void 0 && (r = bt);
|
|
1072
|
+
var i = e.patternChar;
|
|
1073
|
+
i === void 0 && (i = "#");
|
|
1074
|
+
var a = e.value, o = e.defaultValue, s = e.valueIsNumericString, c = vt(e, [
|
|
1075
|
+
"mask",
|
|
1076
|
+
"allowEmptyFormatting",
|
|
1077
|
+
"format",
|
|
1078
|
+
"inputMode",
|
|
1079
|
+
"onKeyDown",
|
|
1080
|
+
"patternChar",
|
|
1081
|
+
"value",
|
|
1082
|
+
"defaultValue",
|
|
1083
|
+
"valueIsNumericString"
|
|
1084
|
+
]);
|
|
1085
|
+
fn(e);
|
|
1086
|
+
var l = function(t) {
|
|
1087
|
+
return dn(t, e);
|
|
1088
|
+
}, u = function(e) {
|
|
1089
|
+
var n = e.key, a = e.target, o = a.selectionStart, s = a.selectionEnd, c = a.value;
|
|
1090
|
+
if (o !== s) r(e);
|
|
1091
|
+
else {
|
|
1092
|
+
var u = o;
|
|
1093
|
+
if (n === "Backspace" || n === "Delete") {
|
|
1094
|
+
var d = "right";
|
|
1095
|
+
if (n === "Backspace") {
|
|
1096
|
+
for (; u > 0 && t[u - 1] !== i;) u--;
|
|
1097
|
+
d = "left";
|
|
1098
|
+
} else {
|
|
1099
|
+
for (var f = t.length; u < f && t[u] !== i;) u++;
|
|
1100
|
+
d = "right";
|
|
1101
|
+
}
|
|
1102
|
+
u = Kt(c, u, l(c), d);
|
|
1103
|
+
} else t[u] !== i && n !== "ArrowLeft" && n !== "ArrowRight" && (u = Kt(c, u + 1, l(c), "right"));
|
|
1104
|
+
u !== o && It(a, u), r(e);
|
|
1105
|
+
}
|
|
1106
|
+
}, d = Ct(a) ? o : a, f = s ?? pn(d, t), p = Object.assign(Object.assign({}, e), { valueIsNumericString: f });
|
|
1107
|
+
return Object.assign(Object.assign({}, c), {
|
|
1108
|
+
value: a,
|
|
1109
|
+
defaultValue: o,
|
|
1110
|
+
valueIsNumericString: f,
|
|
1111
|
+
inputMode: n,
|
|
1112
|
+
format: function(e) {
|
|
1113
|
+
return ln(e, p);
|
|
1114
|
+
},
|
|
1115
|
+
removeFormatting: function(e, t) {
|
|
1116
|
+
return un(e, t, p);
|
|
1117
|
+
},
|
|
1118
|
+
getCaretBoundary: l,
|
|
1119
|
+
onKeyDown: u
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
function hn(e) {
|
|
1123
|
+
var t = mn(e);
|
|
1124
|
+
return S.createElement(Zt, Object.assign({}, t));
|
|
1125
|
+
}
|
|
1126
|
+
// src/components/controls/NumberField/numberfield.tsx
|
|
1127
|
+
var gn = S.forwardRef(function(e, t) {
|
|
1128
|
+
let { onChange: n, ...r } = e;
|
|
1129
|
+
return /* @__PURE__ */ U(cn, {
|
|
1130
|
+
...r,
|
|
1131
|
+
getInputRef: t,
|
|
1132
|
+
onValueChange: (t, r) => {
|
|
1133
|
+
r?.source === "event" && n({ target: {
|
|
1134
|
+
name: e.name,
|
|
1135
|
+
value: t.value
|
|
1136
|
+
} });
|
|
1137
|
+
},
|
|
1138
|
+
thousandSeparator: !0,
|
|
1139
|
+
valueIsNumericString: !0
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
function _n({ attributes: e = {}, rules: t = {}, onChange: r, submitTick: i, messages: o }) {
|
|
1143
|
+
let { MuiAttributes: s = {}, id: c = "" } = e, { sx: l, slotProps: u = {}, InputProps: d, inputProps: f, ...p } = s, [m, h] = b(() => e.value ?? "", [e.value]), [g, _] = S.useState(!1), [v, x] = S.useState(""), C = (e) => n(e, t, o, "Invalid");
|
|
1144
|
+
y(() => {
|
|
1145
|
+
if (i) {
|
|
1146
|
+
let e = C(m);
|
|
1147
|
+
_(!e.isValid), x(e.message);
|
|
1148
|
+
}
|
|
1149
|
+
}, [i]);
|
|
1150
|
+
let w = (e) => {
|
|
1151
|
+
let t = e.target.value;
|
|
1152
|
+
h(t);
|
|
1153
|
+
let n = C(t);
|
|
1154
|
+
_(!n.isValid), x(n.message), r && r({
|
|
1155
|
+
id: c,
|
|
1156
|
+
value: t
|
|
1157
|
+
});
|
|
1158
|
+
}, T = a(t);
|
|
1159
|
+
return /* @__PURE__ */ U(G, {
|
|
1160
|
+
fullWidth: !0,
|
|
1161
|
+
required: T,
|
|
1162
|
+
value: m,
|
|
1163
|
+
onChange: w,
|
|
1164
|
+
error: g,
|
|
1165
|
+
helperText: v,
|
|
1166
|
+
onBlur: () => {
|
|
1167
|
+
let e = C(m);
|
|
1168
|
+
_(!e.isValid), x(e.message);
|
|
1169
|
+
},
|
|
1170
|
+
...p,
|
|
1171
|
+
sx: X(Z, l),
|
|
1172
|
+
name: "numberformat",
|
|
1173
|
+
id: c,
|
|
1174
|
+
slotProps: {
|
|
1175
|
+
...u,
|
|
1176
|
+
input: {
|
|
1177
|
+
inputComponent: gn,
|
|
1178
|
+
...u.input || {},
|
|
1179
|
+
...d || {}
|
|
1180
|
+
},
|
|
1181
|
+
htmlInput: {
|
|
1182
|
+
...u.htmlInput || {},
|
|
1183
|
+
...f || {}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
// src/components/controls/Select/select.tsx
|
|
1189
|
+
var vn = /* @__PURE__ */ U(K, { fontSize: "small" }), yn = /* @__PURE__ */ U(Ce, { fontSize: "small" }), bn = (e = [], t = "", n = !1, r = ",") => {
|
|
1190
|
+
try {
|
|
1191
|
+
let i = Array.isArray(e) ? e : [];
|
|
1192
|
+
if (n) {
|
|
1193
|
+
let e = [];
|
|
1194
|
+
if (Array.isArray(t)) e = t;
|
|
1195
|
+
else if (typeof t == "string" && t.trim() !== "") {
|
|
1196
|
+
let n = r;
|
|
1197
|
+
t.includes(",") ? n = "," : t.includes(";") ? n = ";" : t.includes(":") && (n = ":"), e = t.split(n).map((e) => e.trim());
|
|
1198
|
+
}
|
|
1199
|
+
let n = new Set(e);
|
|
1200
|
+
return i.filter(({ value: e }) => n.has(e));
|
|
1201
|
+
}
|
|
1202
|
+
if (Array.isArray(t)) {
|
|
1203
|
+
let e = t[0];
|
|
1204
|
+
return i.find(({ value: t }) => t === e);
|
|
1205
|
+
}
|
|
1206
|
+
return i.find(({ value: e }) => e === t);
|
|
1207
|
+
} catch (e) {
|
|
1208
|
+
return console.error("getValue error:", e), n ? [] : null;
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
function xn({ attributes: t = {}, rules: n = {}, onChange: r, submitTick: i, messages: o }) {
|
|
1212
|
+
let { MuiAttributes: s = {}, options: c = [], MuiBoxAttributes: l = {}, id: d = "", InputProps: f = {} } = t, { sx: p, slotProps: m = {}, ...h } = l, g = s.multiple ? [] : null, [v, x] = b(() => t?.value ? bn(c, t?.value, s.multiple, t?.separator) ?? g : g, [t?.value, c]), [C, w] = S.useState(!1), [E, D] = S.useState(""), O = (t) => e(n, !t || Array.isArray(t) && t.length === 0, o);
|
|
1213
|
+
y(() => {
|
|
1214
|
+
if (i) {
|
|
1215
|
+
let e = O(v);
|
|
1216
|
+
w(!e.isValid), D(e.message);
|
|
1217
|
+
}
|
|
1218
|
+
}, [i]);
|
|
1219
|
+
let k = () => s.multiple ? {
|
|
1220
|
+
...s,
|
|
1221
|
+
renderOption: (e, t = {}, { selected: n }) => /* @__PURE__ */ W("li", {
|
|
1222
|
+
...e,
|
|
1223
|
+
children: [/* @__PURE__ */ U(xe, {
|
|
1224
|
+
icon: vn,
|
|
1225
|
+
checkedIcon: yn,
|
|
1226
|
+
style: { marginRight: 8 },
|
|
1227
|
+
checked: n,
|
|
1228
|
+
sx: u(t.color || "")
|
|
1229
|
+
}), t.title || t.label || t.value]
|
|
1230
|
+
})
|
|
1231
|
+
} : s, A = T((e) => e?.value || e?.title || e?.label, []), ee = T((e, n) => {
|
|
1232
|
+
x(n);
|
|
1233
|
+
let i = O(n);
|
|
1234
|
+
w(!i.isValid), D(i.message);
|
|
1235
|
+
let a = t?.separator ?? ";";
|
|
1236
|
+
if (n && r) {
|
|
1237
|
+
let e = s.multiple ? n.map(A) : A(n), t = s.multiple ? e.join(a) : e;
|
|
1238
|
+
r({
|
|
1239
|
+
id: d,
|
|
1240
|
+
value: t,
|
|
1241
|
+
option: n
|
|
1242
|
+
});
|
|
1243
|
+
} else r && r({
|
|
1244
|
+
id: d,
|
|
1245
|
+
value: "",
|
|
1246
|
+
option: n
|
|
1247
|
+
});
|
|
1248
|
+
}, [
|
|
1249
|
+
d,
|
|
1250
|
+
r,
|
|
1251
|
+
t?.separator,
|
|
1252
|
+
s.multiple,
|
|
1253
|
+
A,
|
|
1254
|
+
n.validation
|
|
1255
|
+
]), j = a(n);
|
|
1256
|
+
return /* @__PURE__ */ U(Se, {
|
|
1257
|
+
disablePortal: !1,
|
|
1258
|
+
...k(),
|
|
1259
|
+
options: c,
|
|
1260
|
+
value: v,
|
|
1261
|
+
onChange: ee,
|
|
1262
|
+
onBlur: () => {
|
|
1263
|
+
let e = O(v);
|
|
1264
|
+
w(!e.isValid), D(e.message);
|
|
1265
|
+
},
|
|
1266
|
+
slotProps: {
|
|
1267
|
+
...s.slotProps || {},
|
|
1268
|
+
popper: {
|
|
1269
|
+
modifiers: [{
|
|
1270
|
+
name: "preventOverflow",
|
|
1271
|
+
options: { boundary: "window" }
|
|
1272
|
+
}],
|
|
1273
|
+
...s.slotProps?.popper || {}
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
renderInput: (e) => {
|
|
1277
|
+
let t = _(f), n = {
|
|
1278
|
+
...e.slotProps.input,
|
|
1279
|
+
...t,
|
|
1280
|
+
startAdornment: /* @__PURE__ */ W(ve, { children: [t?.startAdornment, e.slotProps.input.startAdornment] }),
|
|
1281
|
+
endAdornment: /* @__PURE__ */ W(ve, { children: [t?.endAdornment, e.slotProps.input.endAdornment] })
|
|
1282
|
+
};
|
|
1283
|
+
return /* @__PURE__ */ U(G, {
|
|
1284
|
+
...e,
|
|
1285
|
+
...h,
|
|
1286
|
+
id: d,
|
|
1287
|
+
sx: X(Z, p),
|
|
1288
|
+
required: j,
|
|
1289
|
+
error: C,
|
|
1290
|
+
helperText: E,
|
|
1291
|
+
slotProps: {
|
|
1292
|
+
...m,
|
|
1293
|
+
...e.slotProps,
|
|
1294
|
+
inputLabel: {
|
|
1295
|
+
...e.slotProps?.inputLabel || {},
|
|
1296
|
+
...m.inputLabel || {}
|
|
1297
|
+
},
|
|
1298
|
+
htmlInput: {
|
|
1299
|
+
...m.htmlInput || {},
|
|
1300
|
+
...e.slotProps?.htmlInput || {}
|
|
1301
|
+
},
|
|
1302
|
+
input: {
|
|
1303
|
+
...m.input || {},
|
|
1304
|
+
...n,
|
|
1305
|
+
autoComplete: "new-password"
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
// src/components/controls/Autocomplete/autocomplete.tsx
|
|
1313
|
+
function Sn({ attributes: t = {}, rules: n = {}, onChange: r, messages: i }) {
|
|
1314
|
+
let { MuiAttributes: o = {}, id: s = "", options: c = [], label: l = "Combo Box" } = t, [u, d] = b(() => t.value ?? null, [t.value], () => t.value || null), [f, p] = M(!1), [m, h] = M(""), g = (t) => e(n, !t, i), _ = (e, t) => {
|
|
1315
|
+
d(t);
|
|
1316
|
+
let n = g(t);
|
|
1317
|
+
p(!n.isValid), h(n.message), r && r({
|
|
1318
|
+
id: s,
|
|
1319
|
+
value: t
|
|
1320
|
+
});
|
|
1321
|
+
}, v = () => {
|
|
1322
|
+
let e = g(u);
|
|
1323
|
+
p(!e.isValid), h(e.message);
|
|
1324
|
+
}, y = a(n);
|
|
1325
|
+
return /* @__PURE__ */ U(Se, {
|
|
1326
|
+
disablePortal: !0,
|
|
1327
|
+
id: s,
|
|
1328
|
+
options: c,
|
|
1329
|
+
value: u,
|
|
1330
|
+
onChange: _,
|
|
1331
|
+
fullWidth: !0,
|
|
1332
|
+
renderInput: (e) => /* @__PURE__ */ U(G, {
|
|
1333
|
+
...e,
|
|
1334
|
+
sx: Z,
|
|
1335
|
+
label: l,
|
|
1336
|
+
required: y,
|
|
1337
|
+
error: f,
|
|
1338
|
+
helperText: m,
|
|
1339
|
+
onBlur: v
|
|
1340
|
+
}),
|
|
1341
|
+
...o
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
// src/components/controls/CheckBox/toggleInput.tsx
|
|
1345
|
+
function Cn({ attributes: t = {}, rules: n = {}, onChange: r, submitTick: i, messages: o }, s) {
|
|
1346
|
+
let { id: c = "" } = t, [l, u] = b(() => !!t.value, [t.value], s), [d, f] = S.useState(!1), [p, m] = S.useState(""), h = a(n), g = (t) => {
|
|
1347
|
+
let r = e(n, !t, o);
|
|
1348
|
+
f(!r.isValid), m(r.message);
|
|
1349
|
+
};
|
|
1350
|
+
return y(() => {
|
|
1351
|
+
i && g(l);
|
|
1352
|
+
}, [i]), {
|
|
1353
|
+
checked: l,
|
|
1354
|
+
error: d,
|
|
1355
|
+
helperText: p,
|
|
1356
|
+
isMandatory: h,
|
|
1357
|
+
handleChange: (e) => {
|
|
1358
|
+
let t = e.target.checked;
|
|
1359
|
+
u(t), g(t), r && r({
|
|
1360
|
+
id: c,
|
|
1361
|
+
value: t
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
function wn({ labelProps: e = {}, isMandatory: t, error: n, helperText: r, control: i }) {
|
|
1367
|
+
let { label: a, sx: o, ...s } = e, c = t ? /* @__PURE__ */ W("span", { children: [a, /* @__PURE__ */ U("span", {
|
|
1368
|
+
"aria-hidden": "true",
|
|
1369
|
+
style: {
|
|
1370
|
+
color: "#d32f2f",
|
|
1371
|
+
marginLeft: 2
|
|
1372
|
+
},
|
|
1373
|
+
children: "*"
|
|
1374
|
+
})] }) : a;
|
|
1375
|
+
return /* @__PURE__ */ W(q, {
|
|
1376
|
+
required: t,
|
|
1377
|
+
error: n,
|
|
1378
|
+
component: "fieldset",
|
|
1379
|
+
children: [/* @__PURE__ */ U(we, {
|
|
1380
|
+
...s,
|
|
1381
|
+
label: c,
|
|
1382
|
+
sx: X(pt, o),
|
|
1383
|
+
control: i
|
|
1384
|
+
}), r && /* @__PURE__ */ U(Te, { children: r })]
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
// src/components/controls/CheckBox/checkbox.tsx
|
|
1388
|
+
function Tn(e) {
|
|
1389
|
+
let { MuiAttributes: t = {}, MuiFCLAttributes: n = {}, id: r = "" } = e.attributes || {}, { checked: i, error: a, helperText: o, isMandatory: s, handleChange: c } = Cn(e, () => t.defaultChecked || !!e.attributes?.value || !1), { checked: l, defaultChecked: u, ...d } = t;
|
|
1390
|
+
return /* @__PURE__ */ U(wn, {
|
|
1391
|
+
labelProps: n,
|
|
1392
|
+
isMandatory: s,
|
|
1393
|
+
error: a,
|
|
1394
|
+
helperText: o,
|
|
1395
|
+
control: /* @__PURE__ */ U(xe, {
|
|
1396
|
+
id: r,
|
|
1397
|
+
...d,
|
|
1398
|
+
checked: i,
|
|
1399
|
+
onChange: c,
|
|
1400
|
+
required: s
|
|
1401
|
+
})
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
// src/components/controls/Radio/radio.tsx
|
|
1405
|
+
function En({ attributes: t = {}, rules: n = {}, onChange: r, submitTick: i, messages: o }) {
|
|
1406
|
+
let { MuiAttributes: s = {}, MuiFCLAttributes: c = {}, MuiRGAttributes: l = {}, id: u = "", MuiFLAttributes: d = {}, MuiFCLabels: f = [], MuiFLabel: p = "", MuiFLabelIcon: m = {} } = t, [h, g] = b(() => t.value ?? "", [t.value], () => t.value || s.defaultValue || ""), [_, v] = S.useState(!1), [x, C] = S.useState(""), w = a(n), T = D(), E = l.name || u || `radio-group-${T}`, O = (t) => e(n, !t, o);
|
|
1407
|
+
y(() => {
|
|
1408
|
+
if (i) {
|
|
1409
|
+
let e = O(h);
|
|
1410
|
+
v(!e.isValid), C(e.message);
|
|
1411
|
+
}
|
|
1412
|
+
}, [i]);
|
|
1413
|
+
let k = (e) => {
|
|
1414
|
+
let t = e.target.value;
|
|
1415
|
+
g(t);
|
|
1416
|
+
let n = O(t);
|
|
1417
|
+
v(!n.isValid), C(n.message), r && r({
|
|
1418
|
+
id: u,
|
|
1419
|
+
value: t
|
|
1420
|
+
});
|
|
1421
|
+
}, ee = A(() => m && m.icon ? /* @__PURE__ */ W(J, {
|
|
1422
|
+
sx: {
|
|
1423
|
+
display: "flex",
|
|
1424
|
+
width: "100%"
|
|
1425
|
+
},
|
|
1426
|
+
children: [m && m.icon && /* @__PURE__ */ U(R, {
|
|
1427
|
+
...m.MuiFLabelIconAttributes,
|
|
1428
|
+
children: m.icon
|
|
1429
|
+
}, m.icon), /* @__PURE__ */ U(Oe, {
|
|
1430
|
+
...d,
|
|
1431
|
+
required: w,
|
|
1432
|
+
error: _,
|
|
1433
|
+
id: "radio-buttons-group-label",
|
|
1434
|
+
children: p
|
|
1435
|
+
})]
|
|
1436
|
+
}) : /* @__PURE__ */ U(Oe, {
|
|
1437
|
+
...d,
|
|
1438
|
+
required: w,
|
|
1439
|
+
error: _,
|
|
1440
|
+
id: "radio-buttons-group-label",
|
|
1441
|
+
children: p
|
|
1442
|
+
}), [
|
|
1443
|
+
w,
|
|
1444
|
+
_,
|
|
1445
|
+
p,
|
|
1446
|
+
m,
|
|
1447
|
+
d
|
|
1448
|
+
]);
|
|
1449
|
+
return /* @__PURE__ */ W(q, {
|
|
1450
|
+
id: u,
|
|
1451
|
+
required: w,
|
|
1452
|
+
error: _,
|
|
1453
|
+
component: "fieldset",
|
|
1454
|
+
children: [
|
|
1455
|
+
p && ee,
|
|
1456
|
+
/* @__PURE__ */ U(De, {
|
|
1457
|
+
"aria-labelledby": "radio-buttons-group-label",
|
|
1458
|
+
...l,
|
|
1459
|
+
name: E,
|
|
1460
|
+
value: h,
|
|
1461
|
+
onChange: k,
|
|
1462
|
+
children: f.map((e) => {
|
|
1463
|
+
let t = typeof e != "string", n = t ? e.label : e, r = t ? e.value : e, i = t ? e.color : void 0, a = t ? e.sx : void 0, { sx: o, ...l } = c, { sx: u, ...d } = s;
|
|
1464
|
+
return /* @__PURE__ */ U(we, {
|
|
1465
|
+
...l,
|
|
1466
|
+
value: r,
|
|
1467
|
+
control: /* @__PURE__ */ U(Ee, {
|
|
1468
|
+
...d,
|
|
1469
|
+
sx: X(i ? {
|
|
1470
|
+
color: i,
|
|
1471
|
+
"&.Mui-checked": { color: i }
|
|
1472
|
+
} : void 0, u)
|
|
1473
|
+
}),
|
|
1474
|
+
label: n,
|
|
1475
|
+
sx: X(pt, [
|
|
1476
|
+
i ? { "& .MuiFormControlLabel-label": { color: i } } : null,
|
|
1477
|
+
a,
|
|
1478
|
+
o
|
|
1479
|
+
].filter(Boolean))
|
|
1480
|
+
}, r);
|
|
1481
|
+
})
|
|
1482
|
+
}),
|
|
1483
|
+
x && /* @__PURE__ */ U(Te, { children: x })
|
|
1484
|
+
]
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
// src/components/controls/Switch/switch.tsx
|
|
1488
|
+
var Dn = he(({ color: e, ...t }) => /* @__PURE__ */ U(ke, { ...t }))(({ theme: e, color: t }) => ({
|
|
1489
|
+
"& .MuiSwitch-switchBase.Mui-checked": {
|
|
1490
|
+
color: t || "green",
|
|
1491
|
+
"&:hover": { backgroundColor: H(t || "green", e.palette.action.hoverOpacity) }
|
|
1492
|
+
},
|
|
1493
|
+
"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track": { backgroundColor: t || "green" }
|
|
1494
|
+
}));
|
|
1495
|
+
function On(e) {
|
|
1496
|
+
let { MuiAttributes: t = {}, MuiFCLAttributes: n = {}, color: r = "", id: i = "" } = e.attributes || {}, { checked: a, error: o, helperText: s, isMandatory: c, handleChange: l } = Cn(e, () => t.defaultValue || !!e.attributes?.value || !1), u = r ? Dn : ke, { defaultChecked: d, sx: f, ...p } = t, m = r ? { color: r } : { color: "primary" };
|
|
1497
|
+
return /* @__PURE__ */ U(wn, {
|
|
1498
|
+
labelProps: n,
|
|
1499
|
+
isMandatory: c,
|
|
1500
|
+
error: o,
|
|
1501
|
+
helperText: s,
|
|
1502
|
+
control: /* @__PURE__ */ U(u, {
|
|
1503
|
+
id: i,
|
|
1504
|
+
checked: a,
|
|
1505
|
+
onChange: l,
|
|
1506
|
+
required: c,
|
|
1507
|
+
...p,
|
|
1508
|
+
...m,
|
|
1509
|
+
sx: X(mt, f)
|
|
1510
|
+
})
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
// src/components/controls/Button/button.tsx
|
|
1514
|
+
var kn = {
|
|
1515
|
+
borderRadius: "10px",
|
|
1516
|
+
textTransform: "none",
|
|
1517
|
+
fontWeight: 600,
|
|
1518
|
+
boxShadow: "none",
|
|
1519
|
+
transition: "transform .18s, box-shadow .18s",
|
|
1520
|
+
"&:hover": {
|
|
1521
|
+
transform: "translateY(-1px)",
|
|
1522
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
function An({ attributes: e = {}, onChange: t }) {
|
|
1526
|
+
let { MuiAttributes: n = {}, id: r = "", text: i = "Button", action: a = "button", icon: o } = e, { sx: s, ...c } = n, l = () => {
|
|
1527
|
+
t && t({
|
|
1528
|
+
id: r,
|
|
1529
|
+
value: "click",
|
|
1530
|
+
option: a
|
|
1531
|
+
});
|
|
1532
|
+
};
|
|
1533
|
+
return /* @__PURE__ */ U(Ae, {
|
|
1534
|
+
variant: "contained",
|
|
1535
|
+
...c,
|
|
1536
|
+
type: a,
|
|
1537
|
+
onClick: l,
|
|
1538
|
+
startIcon: o ? /* @__PURE__ */ U(R, { children: o }) : c.startIcon,
|
|
1539
|
+
sx: X(kn, s),
|
|
1540
|
+
children: i
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
// src/components/controls/Divider/divider.tsx
|
|
1544
|
+
function jn({ attributes: e = {} }) {
|
|
1545
|
+
let { MuiAttributes: t = {} } = e, { sx: n, ...r } = t;
|
|
1546
|
+
return /* @__PURE__ */ U(je, {
|
|
1547
|
+
...r,
|
|
1548
|
+
sx: X({
|
|
1549
|
+
borderColor: "divider",
|
|
1550
|
+
opacity: .9
|
|
1551
|
+
}, n)
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
// src/components/controls/Computed/computed.tsx
|
|
1555
|
+
var Mn = /* @__PURE__ */ t(i());
|
|
1556
|
+
function Nn({ attributes: e = {} }) {
|
|
1557
|
+
let { MuiAttributes: t = {}, format: n = "", prefix: r = "", suffix: i = "", value: a } = e, { sx: o, ...s } = t, c = a ?? "", l = n && c !== "" && Number.isFinite(Number(c)) ? (0, Mn.default)(c).format(n) : String(c);
|
|
1558
|
+
return /* @__PURE__ */ U(G, {
|
|
1559
|
+
fullWidth: !0,
|
|
1560
|
+
variant: "outlined",
|
|
1561
|
+
...(() => {
|
|
1562
|
+
let { InputProps: e, slotProps: t, ...n } = s;
|
|
1563
|
+
return n;
|
|
1564
|
+
})(),
|
|
1565
|
+
value: l === "" ? "" : `${r}${l}${i}`,
|
|
1566
|
+
"aria-readonly": !0,
|
|
1567
|
+
sx: X(Z, o),
|
|
1568
|
+
slotProps: {
|
|
1569
|
+
...s.slotProps || {},
|
|
1570
|
+
input: {
|
|
1571
|
+
...s.slotProps?.input || {},
|
|
1572
|
+
...s.InputProps || {},
|
|
1573
|
+
readOnly: !0
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
// src/components/controls/Alert/alert.tsx
|
|
1579
|
+
function Pn({ attributes: e = {} }) {
|
|
1580
|
+
let { severity: t = "info", title: n = "", text: r = "", message: i = "", variant: a = "standard", MuiAttributes: o = {} } = e, s = r || i, { sx: c, ...l } = o, u = {
|
|
1581
|
+
borderRadius: "12px",
|
|
1582
|
+
alignItems: "center",
|
|
1583
|
+
"& .MuiAlert-message": { fontWeight: 500 }
|
|
1584
|
+
};
|
|
1585
|
+
return /* @__PURE__ */ W(Me, {
|
|
1586
|
+
severity: t,
|
|
1587
|
+
variant: a,
|
|
1588
|
+
...l,
|
|
1589
|
+
sx: X(u, c),
|
|
1590
|
+
children: [n && /* @__PURE__ */ U(Ne, { children: n }), s]
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
Fe.extend(Ie), Fe.extend(Le), Fe.extend(Re);
|
|
1594
|
+
var Fn = Fe;
|
|
1595
|
+
// src/components/controls/DateTime/datetime.tsx
|
|
1596
|
+
function In(e, t) {
|
|
1597
|
+
function n({ attributes: t = {}, rules: n = {}, onChange: r }) {
|
|
1598
|
+
let { MuiAttributes: i = {}, name: o = e, id: s = "" } = t, { slotProps: c = {}, ...l } = i, { textField: u = {}, ...d } = c, f = ge().components?.MuiTextField?.defaultProps || {}, [m, h] = b(() => t?.value ? Fn(t?.value) : x, [t?.value], () => t?.value ? Fn(t?.value) : null), g = a(n), _ = p(o);
|
|
1599
|
+
return /* @__PURE__ */ U(be, {
|
|
1600
|
+
dateAdapter: Pe,
|
|
1601
|
+
children: /* @__PURE__ */ U(_, {
|
|
1602
|
+
value: m,
|
|
1603
|
+
onChange: (e) => {
|
|
1604
|
+
h(e), r && r({
|
|
1605
|
+
id: s,
|
|
1606
|
+
value: e
|
|
1607
|
+
});
|
|
1608
|
+
},
|
|
1609
|
+
slotProps: {
|
|
1610
|
+
...d,
|
|
1611
|
+
textField: {
|
|
1612
|
+
required: g,
|
|
1613
|
+
fullWidth: !0,
|
|
1614
|
+
...f.size ? { size: f.size } : {},
|
|
1615
|
+
...f.variant ? { variant: f.variant } : {},
|
|
1616
|
+
sx: Z,
|
|
1617
|
+
...u
|
|
1618
|
+
}
|
|
1619
|
+
},
|
|
1620
|
+
...l
|
|
1621
|
+
})
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
return n.displayName = t, n;
|
|
1625
|
+
}
|
|
1626
|
+
var Ln = In("DatePicker", "DateTime"), Rn = In("DateTimePicker", "DateTimePicker"), zn = In("TimePicker", "TimePicker");
|
|
1627
|
+
// src/components/controls/DateRangePicker/daterangepicker.tsx
|
|
1628
|
+
function Bn(e) {
|
|
1629
|
+
if (!e) return {
|
|
1630
|
+
start: null,
|
|
1631
|
+
end: null
|
|
1632
|
+
};
|
|
1633
|
+
let t, n;
|
|
1634
|
+
return typeof e == "string" ? [t, n] = e.split("~") : Array.isArray(e) ? [t, n] = e : typeof e == "object" && (t = e.start, n = e.end), {
|
|
1635
|
+
start: t ? Fn(t) : null,
|
|
1636
|
+
end: n ? Fn(n) : null
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
function Vn({ attributes: e = {}, rules: t = {}, onChange: n }) {
|
|
1640
|
+
let { MuiAttributes: r = {}, id: i = "", format: o = "MM/DD/YYYY", startLabel: s = "Start", endLabel: c = "End" } = e, l = ge().components?.MuiTextField?.defaultProps || {}, u = {
|
|
1641
|
+
...l.size ? { size: l.size } : {},
|
|
1642
|
+
...l.variant ? { variant: l.variant } : {}
|
|
1643
|
+
}, [d, f] = b(() => Bn(e.value), [e.value]), p = a(t), m = !!d.start && !!d.end && d.start.isValid() && d.end.isValid() && d.end.isBefore(d.start), h = (e) => {
|
|
1644
|
+
if (!n) return;
|
|
1645
|
+
let t = e.start && e.start.isValid() ? e.start.format(o) : null, r = e.end && e.end.isValid() ? e.end.format(o) : null;
|
|
1646
|
+
n({
|
|
1647
|
+
id: i,
|
|
1648
|
+
value: {
|
|
1649
|
+
start: t,
|
|
1650
|
+
end: r
|
|
1651
|
+
},
|
|
1652
|
+
option: o
|
|
1653
|
+
});
|
|
1654
|
+
}, g = (e) => {
|
|
1655
|
+
let t = {
|
|
1656
|
+
...d,
|
|
1657
|
+
start: e
|
|
1658
|
+
};
|
|
1659
|
+
f(t), h(t);
|
|
1660
|
+
}, _ = (e) => {
|
|
1661
|
+
let t = {
|
|
1662
|
+
...d,
|
|
1663
|
+
end: e
|
|
1664
|
+
};
|
|
1665
|
+
f(t), h(t);
|
|
1666
|
+
};
|
|
1667
|
+
return /* @__PURE__ */ U(be, {
|
|
1668
|
+
dateAdapter: Pe,
|
|
1669
|
+
children: /* @__PURE__ */ W(ze, {
|
|
1670
|
+
direction: "row",
|
|
1671
|
+
spacing: 2,
|
|
1672
|
+
children: [/* @__PURE__ */ U(ye, {
|
|
1673
|
+
label: s,
|
|
1674
|
+
format: o,
|
|
1675
|
+
value: d.start,
|
|
1676
|
+
onChange: g,
|
|
1677
|
+
slotProps: { textField: {
|
|
1678
|
+
required: p,
|
|
1679
|
+
fullWidth: !0,
|
|
1680
|
+
...u,
|
|
1681
|
+
sx: Z
|
|
1682
|
+
} },
|
|
1683
|
+
...r
|
|
1684
|
+
}), /* @__PURE__ */ U(ye, {
|
|
1685
|
+
label: c,
|
|
1686
|
+
format: o,
|
|
1687
|
+
value: d.end,
|
|
1688
|
+
onChange: _,
|
|
1689
|
+
slotProps: { textField: {
|
|
1690
|
+
required: p,
|
|
1691
|
+
fullWidth: !0,
|
|
1692
|
+
...u,
|
|
1693
|
+
error: m,
|
|
1694
|
+
helperText: m ? "End date must be on or after the start date" : void 0,
|
|
1695
|
+
sx: Z
|
|
1696
|
+
} },
|
|
1697
|
+
...r
|
|
1698
|
+
})]
|
|
1699
|
+
})
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
// src/components/controls/Chip/chip.tsx
|
|
1703
|
+
function Hn({ attributes: e = {} }) {
|
|
1704
|
+
let { MuiAttributes: t = {}, label: n = "Chip" } = e, { sx: r, ...i } = t;
|
|
1705
|
+
return /* @__PURE__ */ U(Be, {
|
|
1706
|
+
label: n,
|
|
1707
|
+
...i,
|
|
1708
|
+
sx: X(ht, r)
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
// src/components/controls/ChipSelect/chipselect.tsx
|
|
1712
|
+
var Un = [
|
|
1713
|
+
"default",
|
|
1714
|
+
"primary",
|
|
1715
|
+
"secondary",
|
|
1716
|
+
"error",
|
|
1717
|
+
"info",
|
|
1718
|
+
"success",
|
|
1719
|
+
"warning"
|
|
1720
|
+
], Wn = (e = []) => (Array.isArray(e) ? e : []).map((e) => typeof e == "string" ? {
|
|
1721
|
+
label: e,
|
|
1722
|
+
value: e
|
|
1723
|
+
} : {
|
|
1724
|
+
label: e?.label ?? String(e?.value ?? ""),
|
|
1725
|
+
value: e?.value ?? e?.label,
|
|
1726
|
+
icon: e?.icon,
|
|
1727
|
+
color: e?.color,
|
|
1728
|
+
disabled: e?.disabled
|
|
1729
|
+
}), Gn = (e, t, n) => {
|
|
1730
|
+
if (t) {
|
|
1731
|
+
if (Array.isArray(e)) return e;
|
|
1732
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
1733
|
+
let t = n;
|
|
1734
|
+
return e.includes(n) ? t = n : e.includes(";") ? t = ";" : e.includes(",") && (t = ","), e.split(t).map((e) => e.trim()).filter((e) => e !== "");
|
|
1735
|
+
}
|
|
1736
|
+
return e == null || e === "" ? [] : [e];
|
|
1737
|
+
}
|
|
1738
|
+
return Array.isArray(e) ? e.length ? e[0] : "" : e ?? "";
|
|
1739
|
+
};
|
|
1740
|
+
function Kn({ attributes: t = {}, rules: n = {}, onChange: r, submitTick: i, messages: o }) {
|
|
1741
|
+
let { id: s = "", options: c = [], multiple: l = !1, label: u = "", separator: d = ";", color: f = "primary", size: p = "medium", allowDeselect: m = !0, MuiAttributes: h = {}, MuiStackAttributes: g = {} } = t, _ = S.useMemo(() => Wn(c), [c]), [v, C] = b((e) => {
|
|
1742
|
+
let n = Gn(t.value, l, d);
|
|
1743
|
+
return JSON.stringify(e) === JSON.stringify(n) ? x : n;
|
|
1744
|
+
}, [
|
|
1745
|
+
t.value,
|
|
1746
|
+
l,
|
|
1747
|
+
d
|
|
1748
|
+
], () => Gn(t.value, l, d)), [w, T] = S.useState(!1), [E, D] = S.useState(""), O = a(n), k = (t) => e(n, l ? !Array.isArray(t) || t.length === 0 : t === "" || t == null, o);
|
|
1749
|
+
y(() => {
|
|
1750
|
+
if (i) {
|
|
1751
|
+
let e = k(v);
|
|
1752
|
+
T(!e.isValid), D(e.message);
|
|
1753
|
+
}
|
|
1754
|
+
}, [i]);
|
|
1755
|
+
let A = (e) => {
|
|
1756
|
+
let t = k(e);
|
|
1757
|
+
if (T(!t.isValid), D(t.message), typeof r == "function") {
|
|
1758
|
+
if (l) {
|
|
1759
|
+
let t = _.filter((t) => e.includes(t.value));
|
|
1760
|
+
r({
|
|
1761
|
+
id: s,
|
|
1762
|
+
value: e,
|
|
1763
|
+
option: t
|
|
1764
|
+
});
|
|
1765
|
+
} else {
|
|
1766
|
+
let t = _.find((t) => t.value === e) ?? null;
|
|
1767
|
+
r({
|
|
1768
|
+
id: s,
|
|
1769
|
+
value: e,
|
|
1770
|
+
option: t
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
}, ee = (e) => l ? Array.isArray(v) && v.includes(e) : v === e, j = (e) => {
|
|
1775
|
+
if (e.disabled) return;
|
|
1776
|
+
let t;
|
|
1777
|
+
if (l) {
|
|
1778
|
+
let n = Array.isArray(v) ? v : [];
|
|
1779
|
+
t = n.includes(e.value) ? n.filter((t) => t !== e.value) : [...n, e.value];
|
|
1780
|
+
} else t = v === e.value && m ? "" : e.value;
|
|
1781
|
+
C(t), A(t);
|
|
1782
|
+
}, M = (e) => {
|
|
1783
|
+
let t = e.color ?? f;
|
|
1784
|
+
return Un.includes(t) ? t : "default";
|
|
1785
|
+
}, te = (e) => {
|
|
1786
|
+
let t = e.color ?? f;
|
|
1787
|
+
return Un.includes(t) ? void 0 : t;
|
|
1788
|
+
};
|
|
1789
|
+
return /* @__PURE__ */ W(q, {
|
|
1790
|
+
id: s,
|
|
1791
|
+
required: O,
|
|
1792
|
+
error: w,
|
|
1793
|
+
component: "fieldset",
|
|
1794
|
+
variant: "standard",
|
|
1795
|
+
fullWidth: !0,
|
|
1796
|
+
children: [
|
|
1797
|
+
u && /* @__PURE__ */ U(Oe, {
|
|
1798
|
+
component: "legend",
|
|
1799
|
+
required: O,
|
|
1800
|
+
error: w,
|
|
1801
|
+
sx: {
|
|
1802
|
+
mb: 1,
|
|
1803
|
+
fontWeight: 600,
|
|
1804
|
+
fontSize: "0.9rem"
|
|
1805
|
+
},
|
|
1806
|
+
children: u
|
|
1807
|
+
}),
|
|
1808
|
+
/* @__PURE__ */ W(ze, {
|
|
1809
|
+
direction: "row",
|
|
1810
|
+
useFlexGap: !0,
|
|
1811
|
+
spacing: 1,
|
|
1812
|
+
role: l ? "group" : "radiogroup",
|
|
1813
|
+
"aria-label": u || s || "chip-select",
|
|
1814
|
+
...g,
|
|
1815
|
+
sx: [{ flexWrap: "wrap" }, ...Array.isArray(g.sx) ? g.sx : [g.sx]],
|
|
1816
|
+
children: [_.map((e) => {
|
|
1817
|
+
let t = ee(e.value), n = te(e), r = e.icon ? /* @__PURE__ */ U(Ve, {
|
|
1818
|
+
fontSize: "small",
|
|
1819
|
+
children: e.icon
|
|
1820
|
+
}) : t ? /* @__PURE__ */ U(He, { fontSize: "small" }) : void 0;
|
|
1821
|
+
return /* @__PURE__ */ U(Be, {
|
|
1822
|
+
size: p,
|
|
1823
|
+
...h,
|
|
1824
|
+
label: e.label,
|
|
1825
|
+
clickable: !e.disabled,
|
|
1826
|
+
disabled: e.disabled,
|
|
1827
|
+
role: l ? "checkbox" : "radio",
|
|
1828
|
+
"aria-checked": t,
|
|
1829
|
+
"aria-pressed": t,
|
|
1830
|
+
icon: r,
|
|
1831
|
+
variant: t ? "filled" : "outlined",
|
|
1832
|
+
color: t ? M(e) : "default",
|
|
1833
|
+
onClick: () => j(e),
|
|
1834
|
+
sx: {
|
|
1835
|
+
borderRadius: "999px",
|
|
1836
|
+
px: .75,
|
|
1837
|
+
fontWeight: 600,
|
|
1838
|
+
letterSpacing: "0.01em",
|
|
1839
|
+
borderWidth: t ? 0 : 1.5,
|
|
1840
|
+
cursor: e.disabled ? "not-allowed" : "pointer",
|
|
1841
|
+
transition: "transform .18s cubic-bezier(.4,0,.2,1), box-shadow .18s cubic-bezier(.4,0,.2,1), background-color .18s",
|
|
1842
|
+
...t && n ? {
|
|
1843
|
+
backgroundColor: n,
|
|
1844
|
+
color: "#fff",
|
|
1845
|
+
"& .MuiChip-icon": { color: "#fff" }
|
|
1846
|
+
} : {},
|
|
1847
|
+
...t ? { boxShadow: "0 4px 12px rgba(0,0,0,0.14)" } : { backgroundColor: "background.paper" },
|
|
1848
|
+
"&:hover": e.disabled ? {} : {
|
|
1849
|
+
transform: "translateY(-2px)",
|
|
1850
|
+
boxShadow: t ? "0 6px 18px rgba(0,0,0,0.20)" : "0 2px 10px rgba(0,0,0,0.10)",
|
|
1851
|
+
...t && n ? { backgroundColor: n } : {}
|
|
1852
|
+
},
|
|
1853
|
+
"&:active": { transform: "translateY(0)" },
|
|
1854
|
+
...h?.sx || {}
|
|
1855
|
+
}
|
|
1856
|
+
}, String(e.value));
|
|
1857
|
+
}), _.length === 0 && /* @__PURE__ */ U(J, {
|
|
1858
|
+
sx: {
|
|
1859
|
+
color: "text.disabled",
|
|
1860
|
+
fontSize: "0.85rem",
|
|
1861
|
+
fontStyle: "italic"
|
|
1862
|
+
},
|
|
1863
|
+
children: "No options configured"
|
|
1864
|
+
})]
|
|
1865
|
+
}),
|
|
1866
|
+
E && /* @__PURE__ */ U(Te, { children: E })
|
|
1867
|
+
]
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
// src/components/controls/Slider/slider.tsx
|
|
1871
|
+
var qn = { "& .MuiSlider-thumb": {
|
|
1872
|
+
transition: "box-shadow .2s",
|
|
1873
|
+
"&:hover, &.Mui-focusVisible": { boxShadow: "0 0 0 8px rgba(99,102,241,0.16)" }
|
|
1874
|
+
} };
|
|
1875
|
+
function Jn({ attributes: e = {}, onChange: t }) {
|
|
1876
|
+
let { id: n = "", label: r, min: i = 0, max: a = 100, step: o = 1, marks: s, valueLabelDisplay: c = "auto", MuiAttributes: l = {} } = e, { sx: u, ...d } = l, [f, p] = b(() => e.value === void 0 ? x : e.value, [e.value], () => e.value ?? i);
|
|
1877
|
+
return /* @__PURE__ */ W(q, {
|
|
1878
|
+
component: "fieldset",
|
|
1879
|
+
fullWidth: !0,
|
|
1880
|
+
children: [r && /* @__PURE__ */ U(Oe, {
|
|
1881
|
+
component: "legend",
|
|
1882
|
+
children: r
|
|
1883
|
+
}), /* @__PURE__ */ U(Ue, {
|
|
1884
|
+
value: f,
|
|
1885
|
+
min: i,
|
|
1886
|
+
max: a,
|
|
1887
|
+
step: o,
|
|
1888
|
+
marks: s,
|
|
1889
|
+
valueLabelDisplay: c,
|
|
1890
|
+
onChange: (e, r) => {
|
|
1891
|
+
p(r), t?.({
|
|
1892
|
+
id: n,
|
|
1893
|
+
value: r
|
|
1894
|
+
});
|
|
1895
|
+
},
|
|
1896
|
+
...d,
|
|
1897
|
+
sx: X(qn, u)
|
|
1898
|
+
})]
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
// src/components/controls/Rating/rating.tsx
|
|
1902
|
+
var Yn = {
|
|
1903
|
+
fontSize: "2rem",
|
|
1904
|
+
"& .MuiRating-iconFilled": { color: "primary.main" },
|
|
1905
|
+
"& .MuiRating-iconHover": { color: "primary.dark" }
|
|
1906
|
+
};
|
|
1907
|
+
function Xn({ attributes: e = {}, rules: t = {}, onChange: n }) {
|
|
1908
|
+
let { id: r = "", label: i, MuiAttributes: o = {} } = e, { max: s = 5, precision: c, size: l = "large", sx: u, ...d } = o, [f, p] = b(() => Number(e.value) || 0, [e.value]), [m, h] = S.useState(!1), g = a(t);
|
|
1909
|
+
return /* @__PURE__ */ W(q, {
|
|
1910
|
+
required: g,
|
|
1911
|
+
error: m,
|
|
1912
|
+
component: "fieldset",
|
|
1913
|
+
children: [
|
|
1914
|
+
i && /* @__PURE__ */ U(Oe, {
|
|
1915
|
+
component: "legend",
|
|
1916
|
+
children: i
|
|
1917
|
+
}),
|
|
1918
|
+
/* @__PURE__ */ U(We, {
|
|
1919
|
+
name: r || "rating",
|
|
1920
|
+
value: f,
|
|
1921
|
+
max: s,
|
|
1922
|
+
precision: c,
|
|
1923
|
+
size: l,
|
|
1924
|
+
onChange: (e, t) => {
|
|
1925
|
+
let i = t ?? 0;
|
|
1926
|
+
p(i), g && h(i <= 0), n?.({
|
|
1927
|
+
id: r,
|
|
1928
|
+
value: i
|
|
1929
|
+
});
|
|
1930
|
+
},
|
|
1931
|
+
...d,
|
|
1932
|
+
sx: X(Yn, u)
|
|
1933
|
+
}),
|
|
1934
|
+
m && /* @__PURE__ */ U(Te, { children: "Required" })
|
|
1935
|
+
]
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
// src/components/controls/ToggleButtons/togglebuttons.tsx
|
|
1939
|
+
var Zn = (e) => (e || []).map((e) => typeof e == "object" && e ? {
|
|
1940
|
+
value: e.value,
|
|
1941
|
+
label: e.label ?? String(e.value),
|
|
1942
|
+
icon: e.icon
|
|
1943
|
+
} : {
|
|
1944
|
+
value: e,
|
|
1945
|
+
label: String(e)
|
|
1946
|
+
}), Qn = {
|
|
1947
|
+
"& .MuiToggleButton-root": {
|
|
1948
|
+
borderRadius: "10px !important",
|
|
1949
|
+
textTransform: "none",
|
|
1950
|
+
fontWeight: 600,
|
|
1951
|
+
transition: "all .18s",
|
|
1952
|
+
border: "1px solid",
|
|
1953
|
+
px: 2
|
|
1954
|
+
},
|
|
1955
|
+
gap: 1
|
|
1956
|
+
};
|
|
1957
|
+
function $n({ attributes: e = {}, rules: t = {}, onChange: n }) {
|
|
1958
|
+
let { MuiAttributes: r = {}, id: i = "", multiple: o = !1, label: s = "", size: c = "medium", color: l = "primary" } = e, { sx: u, ...d } = r, f = A(() => Zn(e.options || []), [e.options]), [p, m] = b(() => o ? Array.isArray(e.value) ? e.value : [] : e.value ?? null, [e.value]), [h, g] = M(!1), _ = a(t), v = o ? !Array.isArray(p) || p.length === 0 : p == null || p === "", y = _ && h && v, x = y ? t?.validation?.find((e) => e.rule === "mandatory" || e.rule === "mandatoryselect")?.message || "Required" : "";
|
|
1959
|
+
return /* @__PURE__ */ W(q, {
|
|
1960
|
+
required: _,
|
|
1961
|
+
error: y,
|
|
1962
|
+
component: "fieldset",
|
|
1963
|
+
children: [
|
|
1964
|
+
s && /* @__PURE__ */ U(Oe, {
|
|
1965
|
+
required: _,
|
|
1966
|
+
error: y,
|
|
1967
|
+
sx: {
|
|
1968
|
+
mb: .75,
|
|
1969
|
+
fontWeight: 600
|
|
1970
|
+
},
|
|
1971
|
+
children: s
|
|
1972
|
+
}),
|
|
1973
|
+
/* @__PURE__ */ U(Ke, {
|
|
1974
|
+
value: p,
|
|
1975
|
+
exclusive: !o,
|
|
1976
|
+
onChange: (e, t) => {
|
|
1977
|
+
m(t), g(!0);
|
|
1978
|
+
let r = o ? f.filter((e) => (t || []).includes(e.value)) : f.find((e) => e.value === t) ?? null;
|
|
1979
|
+
n?.({
|
|
1980
|
+
id: i,
|
|
1981
|
+
value: t,
|
|
1982
|
+
option: r
|
|
1983
|
+
});
|
|
1984
|
+
},
|
|
1985
|
+
size: c,
|
|
1986
|
+
color: l,
|
|
1987
|
+
sx: X(Qn, u),
|
|
1988
|
+
...d,
|
|
1989
|
+
children: f.map((e) => /* @__PURE__ */ W(Ge, {
|
|
1990
|
+
value: e.value,
|
|
1991
|
+
children: [e.icon && /* @__PURE__ */ U(Ve, {
|
|
1992
|
+
fontSize: "small",
|
|
1993
|
+
sx: { mr: e.label ? .75 : 0 },
|
|
1994
|
+
children: e.icon
|
|
1995
|
+
}), e.label]
|
|
1996
|
+
}, String(e.value)))
|
|
1997
|
+
}),
|
|
1998
|
+
x && /* @__PURE__ */ U(Te, { children: x })
|
|
1999
|
+
]
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
// src/components/controls/PasswordField/passwordfield.tsx
|
|
2003
|
+
var er = (e) => {
|
|
2004
|
+
let t = 0;
|
|
2005
|
+
return e.length >= 8 && (t += 25), /[0-9]/.test(e) && (t += 25), /[A-Z]/.test(e) && (t += 25), /[^A-Za-z0-9]/.test(e) && (t += 25), t;
|
|
2006
|
+
}, tr = (e) => e <= 25 ? "error" : e <= 50 ? "warning" : e <= 75 ? "info" : "success";
|
|
2007
|
+
function nr({ attributes: e = {}, rules: t = {}, onChange: r, submitTick: i, messages: o }) {
|
|
2008
|
+
let { MuiAttributes: s = {}, id: c = "", showStrength: l = !1 } = e, [u, d] = b(() => e.value === void 0 ? "" : e.value, [e.value]), [f, p] = S.useState(s.helperText || ""), [m, h] = S.useState(!1), [g, _] = S.useState(!1), v = a(t), x = (e) => n(e, t, o);
|
|
2009
|
+
y(() => {
|
|
2010
|
+
if (i) {
|
|
2011
|
+
let e = x(u);
|
|
2012
|
+
h(!e.isValid), p(e.message);
|
|
2013
|
+
}
|
|
2014
|
+
}, [i]);
|
|
2015
|
+
let C = (e) => {
|
|
2016
|
+
let t = e.target.value, n = x(t);
|
|
2017
|
+
d(t), p(n.message), h(!n.isValid);
|
|
2018
|
+
}, w = (e) => {
|
|
2019
|
+
let t = e.target.value, n = x(t);
|
|
2020
|
+
p(n.message), h(!n.isValid), typeof r == "function" && r({
|
|
2021
|
+
id: c,
|
|
2022
|
+
value: t
|
|
2023
|
+
});
|
|
2024
|
+
}, { sx: T, ...E } = s, D = er(u || "");
|
|
2025
|
+
return /* @__PURE__ */ W(J, {
|
|
2026
|
+
sx: { width: "100%" },
|
|
2027
|
+
children: [/* @__PURE__ */ U(G, {
|
|
2028
|
+
fullWidth: !0,
|
|
2029
|
+
...E,
|
|
2030
|
+
id: c,
|
|
2031
|
+
type: g ? "text" : "password",
|
|
2032
|
+
sx: X(Z, T),
|
|
2033
|
+
required: v,
|
|
2034
|
+
value: u,
|
|
2035
|
+
error: m,
|
|
2036
|
+
helperText: f,
|
|
2037
|
+
onChange: C,
|
|
2038
|
+
onBlur: w,
|
|
2039
|
+
slotProps: { input: { endAdornment: /* @__PURE__ */ U(qe, {
|
|
2040
|
+
position: "end",
|
|
2041
|
+
children: /* @__PURE__ */ U(Je, {
|
|
2042
|
+
"aria-label": g ? "Hide password" : "Show password",
|
|
2043
|
+
onClick: () => _((e) => !e),
|
|
2044
|
+
edge: "end",
|
|
2045
|
+
children: U(g ? Ze : Xe, {})
|
|
2046
|
+
})
|
|
2047
|
+
}) } }
|
|
2048
|
+
}), l ? /* @__PURE__ */ U(Ye, {
|
|
2049
|
+
variant: "determinate",
|
|
2050
|
+
value: D,
|
|
2051
|
+
color: tr(D),
|
|
2052
|
+
sx: {
|
|
2053
|
+
mt: 1,
|
|
2054
|
+
height: 6,
|
|
2055
|
+
borderRadius: 3
|
|
2056
|
+
}
|
|
2057
|
+
}) : null]
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
// src/components/controls/OtpField/otpfield.tsx
|
|
2061
|
+
var rr = (e, t) => {
|
|
2062
|
+
let n = (e || "").slice(0, t).split("");
|
|
2063
|
+
return Array.from({ length: t }, (e, t) => n[t] || "");
|
|
2064
|
+
};
|
|
2065
|
+
function ir({ attributes: e = {}, rules: t = {}, onChange: n }) {
|
|
2066
|
+
let { MuiAttributes: r = {}, id: i = "", label: o = "" } = e, s = e.length || 6, [c, l] = b(() => rr(e.value || "", s), [e.value, s]), u = S.useRef([]), d = a(t), f = (e) => {
|
|
2067
|
+
l(e), typeof n == "function" && n({
|
|
2068
|
+
id: i,
|
|
2069
|
+
value: e.join("")
|
|
2070
|
+
});
|
|
2071
|
+
}, p = (e) => {
|
|
2072
|
+
let t = u.current[e];
|
|
2073
|
+
t && t.focus();
|
|
2074
|
+
}, m = (e) => (t) => {
|
|
2075
|
+
let n = t.target.value, r = n ? n.slice(-1) : "", i = [...c];
|
|
2076
|
+
i[e] = r, f(i), r && e < s - 1 && p(e + 1);
|
|
2077
|
+
}, h = (e) => (t) => {
|
|
2078
|
+
if (t.key === "Backspace" && !c[e] && e > 0) {
|
|
2079
|
+
t.preventDefault();
|
|
2080
|
+
let n = [...c];
|
|
2081
|
+
n[e - 1] = "", f(n), p(e - 1);
|
|
2082
|
+
} else t.key === "ArrowLeft" && e > 0 ? p(e - 1) : t.key === "ArrowRight" && e < s - 1 && p(e + 1);
|
|
2083
|
+
}, g = (e) => (t) => {
|
|
2084
|
+
t.preventDefault();
|
|
2085
|
+
let n = t.clipboardData.getData("text").trim();
|
|
2086
|
+
if (!n) return;
|
|
2087
|
+
let r = [...c];
|
|
2088
|
+
for (let t = 0; t < n.length && e + t < s; t += 1) r[e + t] = n[t];
|
|
2089
|
+
f(r);
|
|
2090
|
+
let i = Math.min(e + n.length, s - 1);
|
|
2091
|
+
p(i);
|
|
2092
|
+
}, { sx: _, ...v } = r, y = X(((e) => ({
|
|
2093
|
+
width: 48,
|
|
2094
|
+
transition: `box-shadow .2s ${Y}`,
|
|
2095
|
+
"& input": {
|
|
2096
|
+
textAlign: "center",
|
|
2097
|
+
fontSize: "1.25rem",
|
|
2098
|
+
fontWeight: 700
|
|
2099
|
+
},
|
|
2100
|
+
"& .MuiOutlinedInput-root": {
|
|
2101
|
+
borderRadius: "10px",
|
|
2102
|
+
transition: `box-shadow .2s ${Y}`,
|
|
2103
|
+
"&.Mui-focused": { boxShadow: `0 0 0 3px ${H(e.palette.primary.main, .16)}` }
|
|
2104
|
+
}
|
|
2105
|
+
})), _);
|
|
2106
|
+
return /* @__PURE__ */ W(q, {
|
|
2107
|
+
component: "fieldset",
|
|
2108
|
+
required: d,
|
|
2109
|
+
children: [
|
|
2110
|
+
o ? /* @__PURE__ */ U(Oe, {
|
|
2111
|
+
component: "legend",
|
|
2112
|
+
children: o
|
|
2113
|
+
}) : null,
|
|
2114
|
+
/* @__PURE__ */ U(J, {
|
|
2115
|
+
sx: {
|
|
2116
|
+
display: "flex",
|
|
2117
|
+
flexDirection: "row",
|
|
2118
|
+
gap: 1,
|
|
2119
|
+
mt: +!!o
|
|
2120
|
+
},
|
|
2121
|
+
children: c.map((e, t) => /* @__PURE__ */ U(G, {
|
|
2122
|
+
...v,
|
|
2123
|
+
size: "small",
|
|
2124
|
+
value: e,
|
|
2125
|
+
inputRef: (e) => {
|
|
2126
|
+
u.current[t] = e;
|
|
2127
|
+
},
|
|
2128
|
+
onChange: m(t),
|
|
2129
|
+
onKeyDown: h(t),
|
|
2130
|
+
onPaste: g(t),
|
|
2131
|
+
slotProps: { htmlInput: {
|
|
2132
|
+
maxLength: 1,
|
|
2133
|
+
inputMode: "text",
|
|
2134
|
+
"aria-label": `${o || "Code"} digit ${t + 1}`
|
|
2135
|
+
} },
|
|
2136
|
+
sx: y
|
|
2137
|
+
}, t))
|
|
2138
|
+
}),
|
|
2139
|
+
d ? /* @__PURE__ */ U(Te, { children: r.helperText || "Required" }) : null
|
|
2140
|
+
]
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2143
|
+
// src/components/controls/PhoneField/phonefield.tsx
|
|
2144
|
+
function ar({ attributes: e = {}, rules: t = {}, onChange: n }) {
|
|
2145
|
+
let { id: r = "", format: i = "+1 (###) ###-####", mask: o = "_", label: s, MuiAttributes: c = {} } = e, { sx: l, ...u } = c, [d, f] = b(() => e.value || "", [e.value]), p = a(t);
|
|
2146
|
+
return /* @__PURE__ */ U(hn, {
|
|
2147
|
+
customInput: G,
|
|
2148
|
+
format: i,
|
|
2149
|
+
mask: o,
|
|
2150
|
+
value: d,
|
|
2151
|
+
onValueChange: (e) => {
|
|
2152
|
+
f(e.value), n?.({
|
|
2153
|
+
id: r,
|
|
2154
|
+
value: e.value,
|
|
2155
|
+
option: e.formattedValue
|
|
2156
|
+
});
|
|
2157
|
+
},
|
|
2158
|
+
fullWidth: !0,
|
|
2159
|
+
required: p,
|
|
2160
|
+
label: s,
|
|
2161
|
+
id: r,
|
|
2162
|
+
name: "phoneformat",
|
|
2163
|
+
...u,
|
|
2164
|
+
sx: X(Z, l)
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
// src/components/controls/CurrencyField/currencyfield.tsx
|
|
2168
|
+
function or({ attributes: e = {}, rules: t = {}, onChange: n }) {
|
|
2169
|
+
let { id: r = "", prefix: i = "$", thousandSeparator: o = ",", decimalScale: s = 2, fixedDecimalScale: c = !0, label: l, MuiAttributes: u = {} } = e, { sx: d, ...f } = u, [p, m] = b(() => e.value ?? "", [e.value]), h = a(t);
|
|
2170
|
+
return /* @__PURE__ */ U(cn, {
|
|
2171
|
+
customInput: G,
|
|
2172
|
+
prefix: i,
|
|
2173
|
+
thousandSeparator: o,
|
|
2174
|
+
decimalScale: s,
|
|
2175
|
+
fixedDecimalScale: c,
|
|
2176
|
+
valueIsNumericString: !0,
|
|
2177
|
+
value: p,
|
|
2178
|
+
onValueChange: (e) => {
|
|
2179
|
+
m(e.value), n?.({
|
|
2180
|
+
id: r,
|
|
2181
|
+
value: e.value,
|
|
2182
|
+
option: e.floatValue
|
|
2183
|
+
});
|
|
2184
|
+
},
|
|
2185
|
+
fullWidth: !0,
|
|
2186
|
+
required: h,
|
|
2187
|
+
label: l,
|
|
2188
|
+
id: r,
|
|
2189
|
+
name: "currencyformat",
|
|
2190
|
+
...f,
|
|
2191
|
+
sx: X(Z, d)
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
// src/components/controls/Hyperlink/hyperlink.tsx
|
|
2195
|
+
function sr({ attributes: e = {}, rules: t = {} }) {
|
|
2196
|
+
let { label: n = "", value: r = "", MuiAttributes: i = {}, url: o = "", target: s = "_blank", displayText: c = "" } = e, l = a(t), u = o || r || "#", d = c || n || u, { sx: f, ...p } = i.link || {};
|
|
2197
|
+
return /* @__PURE__ */ W(N, {
|
|
2198
|
+
sx: { width: "100%" },
|
|
2199
|
+
...i.container,
|
|
2200
|
+
children: [n && c && /* @__PURE__ */ W(V, {
|
|
2201
|
+
variant: "subtitle2",
|
|
2202
|
+
gutterBottom: !0,
|
|
2203
|
+
sx: { display: "flex" },
|
|
2204
|
+
...i.displayText,
|
|
2205
|
+
children: [n, l && /* @__PURE__ */ U(N, {
|
|
2206
|
+
component: "span",
|
|
2207
|
+
sx: {
|
|
2208
|
+
color: "error.main",
|
|
2209
|
+
ml: .5
|
|
2210
|
+
},
|
|
2211
|
+
children: "*"
|
|
2212
|
+
})]
|
|
2213
|
+
}), /* @__PURE__ */ U(se, {
|
|
2214
|
+
href: u,
|
|
2215
|
+
target: s,
|
|
2216
|
+
rel: s === "_blank" ? "noopener noreferrer" : void 0,
|
|
2217
|
+
...p,
|
|
2218
|
+
sx: X({
|
|
2219
|
+
fontWeight: 600,
|
|
2220
|
+
textUnderlineOffset: "3px",
|
|
2221
|
+
transition: "color .18s ease",
|
|
2222
|
+
"&:hover": { textDecoration: "underline" }
|
|
2223
|
+
}, f),
|
|
2224
|
+
children: d
|
|
2225
|
+
})]
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
// src/components/controls/index.ts
|
|
2229
|
+
var cr = w(() => import("./datatable-lZIwHx6a.mjs")), lr = w(() => import("./bar-LVtZP6Ui.mjs")), ur = w(() => import("./line-cK6taoCA.mjs")), dr = w(() => import("./pie-DFO89j-z.mjs")), fr = w(() => import("./mixChart-CSq7pQqJ.mjs")), pr = w(() => import("./tagsinput-CXmsu8K9.mjs")), mr = w(() => import("./fileupload-BLH0wrc2.mjs")), hr = w(() => import("./keyvaluefield-C-a0MGDM.mjs")), gr = w(() => import("./numberstepper-c0raw-fV.mjs")), _r = w(() => import("./matrixfield-DQHet7LH.mjs")), vr = w(() => import("./consentfield-D3eHFCZf.mjs")), yr = w(() => import("./colorpicker-TDpxW59g.mjs")), br = w(() => import("./markdowneditor-C3l0_zuX.mjs")), xr = w(() => import("./addressfield-BYisUY6y.mjs")), Sr = w(() => import("./cascadeselect-s-LY4P0l.mjs")), Cr = w(() => import("./formwizard-I6M99opg.mjs")), wr = w(() => import("./summaryfield-BN-NhzA6.mjs")), Tr = w(() => import("./geofield-CcbP9EtG.mjs")), Er = w(() => import("./richtexteditor-aF2uky8O.mjs")), Dr = w(() => import("./npsscale-BgU-fVZ4.mjs")), Or = w(() => import("./editabletable-BEnZM9qt.mjs")), kr = w(() => import("./intlphone-Bj5nEUMa.mjs")), Ar = w(() => import("./asyncautocomplete-D4oCW2B0.mjs")), jr = w(() => import("./list-CIFEhaTq.mjs")), Mr = w(() => import("./multitextbox-Bsr8mHo5.mjs")), Nr = w(() => import("./lineitemlist-bmk7fEf9.mjs")), Pr = w(() => import("./formrepeater-BvW1lZ2k.mjs")), Fr = w(() => import("./collection-DGq2rxDx.mjs")), Ir = w(() => import("./signature-HiL8FJ6C.mjs")), Lr = w(() => import("./group-BCGjUNL2.mjs")), Rr = w(() => import("./accordion-Cqu-4mCj.mjs")), zr = w(() => import("./tabs-DvIbQ1qg.mjs")), Br = {
|
|
2230
|
+
Typography: ft,
|
|
2231
|
+
TextField: _t,
|
|
2232
|
+
Table: cr,
|
|
2233
|
+
DateTime: Ln,
|
|
2234
|
+
DateTimePicker: Rn,
|
|
2235
|
+
TimePicker: zn,
|
|
2236
|
+
Select: xn,
|
|
2237
|
+
CheckBox: Tn,
|
|
2238
|
+
Switch: On,
|
|
2239
|
+
Radio: En,
|
|
2240
|
+
Stepper: w(() => import("./stepper-C8VaX9xu.mjs")),
|
|
2241
|
+
Bar: lr,
|
|
2242
|
+
Line: ur,
|
|
2243
|
+
Pie: dr,
|
|
2244
|
+
MixChart: fr,
|
|
2245
|
+
Divider: jn,
|
|
2246
|
+
Chip: Hn,
|
|
2247
|
+
ChipSelect: Kn,
|
|
2248
|
+
Button: An,
|
|
2249
|
+
DateRangePicker: Vn,
|
|
2250
|
+
Rating: Xn,
|
|
2251
|
+
Slider: Jn,
|
|
2252
|
+
TagsInput: pr,
|
|
2253
|
+
ToggleButtons: $n,
|
|
2254
|
+
PasswordField: nr,
|
|
2255
|
+
OtpField: ir,
|
|
2256
|
+
PhoneField: ar,
|
|
2257
|
+
CurrencyField: or,
|
|
2258
|
+
FileUpload: mr,
|
|
2259
|
+
Alert: Pn,
|
|
2260
|
+
Computed: Nn,
|
|
2261
|
+
KeyValueField: hr,
|
|
2262
|
+
NumberStepper: gr,
|
|
2263
|
+
MatrixField: _r,
|
|
2264
|
+
ConsentField: vr,
|
|
2265
|
+
ColorPicker: yr,
|
|
2266
|
+
MarkdownEditor: br,
|
|
2267
|
+
AddressField: xr,
|
|
2268
|
+
CascadeSelect: Sr,
|
|
2269
|
+
FormWizard: Cr,
|
|
2270
|
+
SummaryField: wr,
|
|
2271
|
+
GeoField: Tr,
|
|
2272
|
+
RichTextEditor: Er,
|
|
2273
|
+
NpsScale: Dr,
|
|
2274
|
+
EditableTable: Or,
|
|
2275
|
+
IntlPhone: kr,
|
|
2276
|
+
AsyncAutocomplete: Ar,
|
|
2277
|
+
List: jr,
|
|
2278
|
+
NumberField: _n,
|
|
2279
|
+
MultiTextbox: Mr,
|
|
2280
|
+
LineItemList: Nr,
|
|
2281
|
+
FormRepeater: Pr,
|
|
2282
|
+
Collection: Fr,
|
|
2283
|
+
Signature: Ir,
|
|
2284
|
+
Group: Lr,
|
|
2285
|
+
Accordion: Rr,
|
|
2286
|
+
Tabs: zr,
|
|
2287
|
+
AutoComplete: Sn,
|
|
2288
|
+
ImgList: w(() => import("./imagelist-CNe1Dp_M.mjs")),
|
|
2289
|
+
Hyperlink: sr,
|
|
2290
|
+
LocationField: w(() => import("./locationfield-SPonkbMU.mjs"))
|
|
2291
|
+
}, Vr = /* @__PURE__ */ new Map();
|
|
2292
|
+
function Hr(e, t) {
|
|
2293
|
+
e && t && Vr.set(e, t);
|
|
2294
|
+
}
|
|
2295
|
+
function Ur(e) {
|
|
2296
|
+
Object.entries(e || {}).forEach(([e, t]) => Hr(e, t));
|
|
2297
|
+
}
|
|
2298
|
+
function Wr(e) {
|
|
2299
|
+
Vr.delete(e);
|
|
2300
|
+
}
|
|
2301
|
+
function Gr(e) {
|
|
2302
|
+
return e ? Vr.get(e) : void 0;
|
|
2303
|
+
}
|
|
2304
|
+
function Kr(e) {
|
|
2305
|
+
return !!e && Vr.has(e);
|
|
2306
|
+
}
|
|
2307
|
+
function qr() {
|
|
2308
|
+
return Array.from(Vr.keys());
|
|
2309
|
+
}
|
|
2310
|
+
// src/components/DynamicComponent.tsx
|
|
2311
|
+
var Jr = class extends S.Component {
|
|
2312
|
+
constructor(e) {
|
|
2313
|
+
super(e), this.state = { failed: !1 };
|
|
2314
|
+
}
|
|
2315
|
+
static getDerivedStateFromError() {
|
|
2316
|
+
return { failed: !0 };
|
|
2317
|
+
}
|
|
2318
|
+
render() {
|
|
2319
|
+
return this.state.failed ? /* @__PURE__ */ W("div", {
|
|
2320
|
+
style: {
|
|
2321
|
+
padding: "8px 12px",
|
|
2322
|
+
fontSize: 13,
|
|
2323
|
+
color: "#b45309",
|
|
2324
|
+
background: "#fffbeb",
|
|
2325
|
+
border: "1px solid #fde68a",
|
|
2326
|
+
borderRadius: 8
|
|
2327
|
+
},
|
|
2328
|
+
children: [
|
|
2329
|
+
"This field couldn’t be displayed. If it’s a chart or data grid, install its optional peer (",
|
|
2330
|
+
/* @__PURE__ */ U("code", { children: "@mui/x-charts" }),
|
|
2331
|
+
" / ",
|
|
2332
|
+
/* @__PURE__ */ U("code", { children: "@mui/x-data-grid" }),
|
|
2333
|
+
")."
|
|
2334
|
+
]
|
|
2335
|
+
}) : this.props.children;
|
|
2336
|
+
}
|
|
2337
|
+
}, Yr = () => /* @__PURE__ */ U("div", {
|
|
2338
|
+
style: { minHeight: 40 },
|
|
2339
|
+
"aria-busy": "true"
|
|
2340
|
+
});
|
|
2341
|
+
function Xr(e) {
|
|
2342
|
+
let { map: t, type: n } = e, r = Gr(n), i = t ? Br[t] : void 0, a = r || i;
|
|
2343
|
+
return a ? /* @__PURE__ */ U(Jr, { children: /* @__PURE__ */ U(C, {
|
|
2344
|
+
fallback: /* @__PURE__ */ U(Yr, {}),
|
|
2345
|
+
children: /* @__PURE__ */ U(a, { ...e })
|
|
2346
|
+
}) }) : /* @__PURE__ */ U("div", {});
|
|
2347
|
+
}
|
|
2348
|
+
// src/util/rules.ts
|
|
2349
|
+
var Zr = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0, Q = (e) => {
|
|
2350
|
+
let t = typeof e == "number" ? e : parseFloat(String(e));
|
|
2351
|
+
return Number.isFinite(t) ? t : NaN;
|
|
2352
|
+
}, Qr = (e, t) => {
|
|
2353
|
+
if (e === t) return !0;
|
|
2354
|
+
let n = (e) => e == null || typeof e != "object" && typeof e != "function";
|
|
2355
|
+
return n(e) && n(t) && String(e) === String(t);
|
|
2356
|
+
}, $r = (e, t, n) => {
|
|
2357
|
+
switch (t) {
|
|
2358
|
+
case "eq": return Qr(e, n);
|
|
2359
|
+
case "neq": return !Qr(e, n);
|
|
2360
|
+
case "gt": return Q(e) > Q(n);
|
|
2361
|
+
case "gte": return Q(e) >= Q(n);
|
|
2362
|
+
case "lt": return Q(e) < Q(n);
|
|
2363
|
+
case "lte": return Q(e) <= Q(n);
|
|
2364
|
+
case "in": return Array.isArray(n) && n.map(String).includes(String(e));
|
|
2365
|
+
case "nin": return !(Array.isArray(n) && n.map(String).includes(String(e)));
|
|
2366
|
+
case "contains": return Array.isArray(e) ? e.map(String).includes(String(n)) : String(e ?? "").includes(String(n));
|
|
2367
|
+
case "startsWith": return String(e ?? "").startsWith(String(n));
|
|
2368
|
+
case "endsWith": return String(e ?? "").endsWith(String(n));
|
|
2369
|
+
case "empty": return Zr(e);
|
|
2370
|
+
case "notEmpty": return !Zr(e);
|
|
2371
|
+
case "truthy": return !!e && !Zr(e);
|
|
2372
|
+
case "falsy": return !e || Zr(e);
|
|
2373
|
+
default: return !1;
|
|
2374
|
+
}
|
|
2375
|
+
}, ei = (e) => !!e && (Array.isArray(e.all) || Array.isArray(e.any) || Array.isArray(e.none));
|
|
2376
|
+
function ti(e, t) {
|
|
2377
|
+
if (!e) return !0;
|
|
2378
|
+
if (ei(e)) {
|
|
2379
|
+
let { all: n, any: r, none: i } = e, a = !n || n.every((e) => ti(e, t)), o = !r || r.some((e) => ti(e, t)), s = !i || !i.some((e) => ti(e, t));
|
|
2380
|
+
return a && o && s;
|
|
2381
|
+
}
|
|
2382
|
+
let n = e;
|
|
2383
|
+
if (!n.field) return !0;
|
|
2384
|
+
let r = t[n.field];
|
|
2385
|
+
return $r(r, n.op ?? (n.value === void 0 ? "truthy" : "eq"), n.value);
|
|
2386
|
+
}
|
|
2387
|
+
var ni = {
|
|
2388
|
+
SUM: (e) => e.reduce((e, t) => e + t, 0),
|
|
2389
|
+
AVG: (e) => e.length ? e.reduce((e, t) => e + t, 0) / e.length : 0,
|
|
2390
|
+
MIN: (e) => e.length ? Math.min(...e) : 0,
|
|
2391
|
+
MAX: (e) => e.length ? Math.max(...e) : 0,
|
|
2392
|
+
ROUND: (e) => {
|
|
2393
|
+
let [t, n = 0] = e, r = 10 ** n;
|
|
2394
|
+
return Math.round((t || 0) * r) / r;
|
|
2395
|
+
},
|
|
2396
|
+
ABS: (e) => Math.abs(e[0] || 0),
|
|
2397
|
+
FLOOR: (e) => Math.floor(e[0] || 0),
|
|
2398
|
+
CEIL: (e) => Math.ceil(e[0] || 0)
|
|
2399
|
+
}, ri = (e) => {
|
|
2400
|
+
let t = [], n = 0;
|
|
2401
|
+
for (; n < e.length;) {
|
|
2402
|
+
let r = e[n];
|
|
2403
|
+
if (r === " " || r === " " || r === "\n") n += 1;
|
|
2404
|
+
else if (r >= "0" && r <= "9") {
|
|
2405
|
+
let r = "";
|
|
2406
|
+
for (; n < e.length && /[0-9.]/.test(e[n]);) r += e[n], n += 1;
|
|
2407
|
+
t.push({
|
|
2408
|
+
t: "num",
|
|
2409
|
+
v: r
|
|
2410
|
+
});
|
|
2411
|
+
} else if (/[A-Za-z_]/.test(r)) {
|
|
2412
|
+
let r = "";
|
|
2413
|
+
for (; n < e.length && /[A-Za-z0-9_.]/.test(e[n]);) r += e[n], n += 1;
|
|
2414
|
+
t.push({
|
|
2415
|
+
t: "id",
|
|
2416
|
+
v: r
|
|
2417
|
+
});
|
|
2418
|
+
} else if ("+-*/%".includes(r)) t.push({
|
|
2419
|
+
t: "op",
|
|
2420
|
+
v: r
|
|
2421
|
+
}), n += 1;
|
|
2422
|
+
else if (r === "(") t.push({
|
|
2423
|
+
t: "lp",
|
|
2424
|
+
v: r
|
|
2425
|
+
}), n += 1;
|
|
2426
|
+
else if (r === ")") t.push({
|
|
2427
|
+
t: "rp",
|
|
2428
|
+
v: r
|
|
2429
|
+
}), n += 1;
|
|
2430
|
+
else if (r === ",") t.push({
|
|
2431
|
+
t: "comma",
|
|
2432
|
+
v: r
|
|
2433
|
+
}), n += 1;
|
|
2434
|
+
else throw Error(`Unexpected character '${r}' in formula`);
|
|
2435
|
+
}
|
|
2436
|
+
return t;
|
|
2437
|
+
};
|
|
2438
|
+
function ii(e, t) {
|
|
2439
|
+
if (typeof e != "string" || e.trim() === "") return "";
|
|
2440
|
+
let n;
|
|
2441
|
+
try {
|
|
2442
|
+
n = ri(e);
|
|
2443
|
+
} catch {
|
|
2444
|
+
return "";
|
|
2445
|
+
}
|
|
2446
|
+
let r = 0, i = () => n[r], a = () => n[r++], o = (e) => {
|
|
2447
|
+
let n = t[e], r = Q(n);
|
|
2448
|
+
return Number.isFinite(r) ? r : 0;
|
|
2449
|
+
};
|
|
2450
|
+
function s() {
|
|
2451
|
+
let e = c();
|
|
2452
|
+
for (; i() && i().t === "op" && (i().v === "+" || i().v === "-");) {
|
|
2453
|
+
let t = a().v, n = c();
|
|
2454
|
+
e = t === "+" ? e + n : e - n;
|
|
2455
|
+
}
|
|
2456
|
+
return e;
|
|
2457
|
+
}
|
|
2458
|
+
function c() {
|
|
2459
|
+
let e = l();
|
|
2460
|
+
for (; i() && i().t === "op" && "*/%".includes(i().v);) {
|
|
2461
|
+
let t = a().v, n = l();
|
|
2462
|
+
t === "*" ? e *= n : e = t === "/" ? n === 0 ? 0 : e / n : n === 0 ? 0 : e % n;
|
|
2463
|
+
}
|
|
2464
|
+
return e;
|
|
2465
|
+
}
|
|
2466
|
+
function l() {
|
|
2467
|
+
let e = i();
|
|
2468
|
+
return e && e.t === "op" && e.v === "-" ? (a(), -l()) : e && e.t === "op" && e.v === "+" ? (a(), l()) : u();
|
|
2469
|
+
}
|
|
2470
|
+
function u() {
|
|
2471
|
+
let e = a();
|
|
2472
|
+
if (!e) throw Error("Unexpected end of formula");
|
|
2473
|
+
if (e.t === "num") return parseFloat(e.v);
|
|
2474
|
+
if (e.t === "lp") {
|
|
2475
|
+
let e = s();
|
|
2476
|
+
if (!i() || i().t !== "rp") throw Error("Missing )");
|
|
2477
|
+
return a(), e;
|
|
2478
|
+
}
|
|
2479
|
+
if (e.t === "id") {
|
|
2480
|
+
if (i() && i().t === "lp") {
|
|
2481
|
+
a();
|
|
2482
|
+
let t = [];
|
|
2483
|
+
if (i() && i().t !== "rp") for (t.push(s()); i() && i().t === "comma";) a(), t.push(s());
|
|
2484
|
+
if (!i() || i().t !== "rp") throw Error("Missing ) in call");
|
|
2485
|
+
a();
|
|
2486
|
+
let n = ni[e.v.toUpperCase()];
|
|
2487
|
+
if (!n) throw Error(`Unknown function ${e.v}`);
|
|
2488
|
+
return n(t);
|
|
2489
|
+
}
|
|
2490
|
+
return o(e.v);
|
|
2491
|
+
}
|
|
2492
|
+
throw Error(`Unexpected token ${e.v}`);
|
|
2493
|
+
}
|
|
2494
|
+
try {
|
|
2495
|
+
let e = s();
|
|
2496
|
+
return r === n.length && Number.isFinite(e) ? e : "";
|
|
2497
|
+
} catch {
|
|
2498
|
+
return "";
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
var ai = {
|
|
2502
|
+
equalsField: (e, t) => e === t,
|
|
2503
|
+
notEqualsField: (e, t) => e !== t,
|
|
2504
|
+
gtField: (e, t) => Q(e) > Q(t),
|
|
2505
|
+
gteField: (e, t) => Q(e) >= Q(t),
|
|
2506
|
+
ltField: (e, t) => Q(e) < Q(t),
|
|
2507
|
+
lteField: (e, t) => Q(e) <= Q(t)
|
|
2508
|
+
}, oi = /* @__PURE__ */ new Set([
|
|
2509
|
+
"typography",
|
|
2510
|
+
"divider",
|
|
2511
|
+
"alert",
|
|
2512
|
+
"image",
|
|
2513
|
+
"imagelist",
|
|
2514
|
+
"hyperlink",
|
|
2515
|
+
"button",
|
|
2516
|
+
"summary"
|
|
2517
|
+
]), si = (e, t = 2) => !e || t === 1 ? e : /(s|x|z|ch|sh)$/i.test(e) ? `${e}es` : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`, ci = (e) => e.itemLabel || e.title || "Item", li = (e) => e.title || si(ci(e)), ui = (e) => Array.isArray(e) ? e.filter((e) => e && typeof e == "object") : [], di = (e) => e?.id || e?.props?.id, fi = (e = [], t) => {
|
|
2518
|
+
for (let n of e) {
|
|
2519
|
+
if (di(n) === t) return n;
|
|
2520
|
+
if (Array.isArray(n?.subforms)) for (let e of n.subforms) {
|
|
2521
|
+
let n = fi(e.data || [], t);
|
|
2522
|
+
if (n) return n;
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}, pi = (e, t) => {
|
|
2526
|
+
let n = e.find((e) => (e && typeof e == "object" ? e.value : e) === t);
|
|
2527
|
+
return String(n == null ? t : typeof n == "object" ? n.label ?? n.title ?? n.value : n);
|
|
2528
|
+
}, mi = (e) => e && typeof e == "object" && typeof e.toDate == "function" && typeof e.isValid == "function", hi = {
|
|
2529
|
+
datetime: {
|
|
2530
|
+
month: "short",
|
|
2531
|
+
day: "numeric",
|
|
2532
|
+
year: "numeric"
|
|
2533
|
+
},
|
|
2534
|
+
datetimepicker: {
|
|
2535
|
+
month: "short",
|
|
2536
|
+
day: "numeric",
|
|
2537
|
+
year: "numeric",
|
|
2538
|
+
hour: "numeric",
|
|
2539
|
+
minute: "2-digit"
|
|
2540
|
+
},
|
|
2541
|
+
timepicker: {
|
|
2542
|
+
hour: "numeric",
|
|
2543
|
+
minute: "2-digit"
|
|
2544
|
+
}
|
|
2545
|
+
}, gi = (e) => {
|
|
2546
|
+
if (mi(e)) return e.isValid() ? e.toDate() : null;
|
|
2547
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
2548
|
+
if (typeof e == "string") {
|
|
2549
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
2550
|
+
if (t) return new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
|
|
2551
|
+
let n = Date.parse(e);
|
|
2552
|
+
return Number.isNaN(n) ? null : new Date(n);
|
|
2553
|
+
}
|
|
2554
|
+
return null;
|
|
2555
|
+
}, _i = (e) => {
|
|
2556
|
+
let t = e?.props || {};
|
|
2557
|
+
return String(t.MuiAttributes?.label || t.MuiBoxAttributes?.label || t.MuiFCLAttributes?.label || t.MuiFLabel || t.label || "");
|
|
2558
|
+
}, vi = (e, t) => {
|
|
2559
|
+
if (t == null || t === "") return "";
|
|
2560
|
+
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
2561
|
+
let n = hi[e?.type || ""];
|
|
2562
|
+
if (n || mi(t) || t instanceof Date) {
|
|
2563
|
+
let e = gi(t);
|
|
2564
|
+
if (e) return e.toLocaleString(void 0, n || hi.datetime);
|
|
2565
|
+
if (typeof t != "string") return "";
|
|
2566
|
+
}
|
|
2567
|
+
let r = e?.props || {}, i = e?.type === "radio" ? r.MuiFCLabels : r.options;
|
|
2568
|
+
if (Array.isArray(i) && i.length) {
|
|
2569
|
+
let e = Array.isArray(t) ? t : [t], n = r.separator ?? ";";
|
|
2570
|
+
return !Array.isArray(t) && typeof t == "string" && r.MuiAttributes?.multiple && (e = t.split(n)), e.filter((e) => e !== "" && e != null).map((e) => pi(i, e)).join(", ");
|
|
2571
|
+
}
|
|
2572
|
+
return Array.isArray(t) ? t.map((e) => e && typeof e == "object" ? "" : String(e)).filter(Boolean).join(", ") : typeof t == "object" ? Object.values(t).filter((e) => e !== "" && e != null && typeof e != "object").join(", ") : String(t);
|
|
2573
|
+
}, yi = (e) => e.replace(/\(\s*\)|\[\s*\]/g, "").replace(/\s+/g, " ").replace(/([,·|•])(\s*[,·|•])+/g, "$1").replace(/^[\s,·|•]+|[\s,·|•]+$/g, "").replace(/\s+([,])/g, "$1").trim(), bi = (e, t, n = []) => {
|
|
2574
|
+
if (e == null || !t) return "";
|
|
2575
|
+
if (typeof e == "function") try {
|
|
2576
|
+
return String(e(t) ?? "");
|
|
2577
|
+
} catch {
|
|
2578
|
+
return "";
|
|
2579
|
+
}
|
|
2580
|
+
let r = (e) => vi(fi(n, e), t[e]);
|
|
2581
|
+
return Array.isArray(e) ? e.map((e) => r(e)).filter(Boolean).join(" · ") : e.includes("{") ? yi(e.replace(/\{([^}]+)\}/g, (e, t) => r(t.trim()))) : r(e);
|
|
2582
|
+
}, xi = (e = []) => e.flatMap((e) => [...!oi.has(e?.type || "") && di(e) ? [e] : [], ...Array.isArray(e?.subforms) ? e.subforms.flatMap((e) => xi(e.data || [])) : []]), Si = (e) => !e || typeof e == "function" ? [] : Array.isArray(e) ? e : e.includes("{") ? Array.from(e.matchAll(/\{([^}]+)\}/g), (e) => e[1].trim()) : [e], Ci = {
|
|
2583
|
+
textfield: "notes",
|
|
2584
|
+
multitextbox: "notes",
|
|
2585
|
+
markdown: "notes",
|
|
2586
|
+
richtext: "notes",
|
|
2587
|
+
numberfield: "tag",
|
|
2588
|
+
numberstepper: "tag",
|
|
2589
|
+
currency: "payments",
|
|
2590
|
+
computed: "functions",
|
|
2591
|
+
select: "list_alt",
|
|
2592
|
+
autocomplete: "list_alt",
|
|
2593
|
+
asyncautocomplete: "list_alt",
|
|
2594
|
+
cascadeselect: "list_alt",
|
|
2595
|
+
radio: "radio_button_checked",
|
|
2596
|
+
chipselect: "sell",
|
|
2597
|
+
togglebuttons: "tune",
|
|
2598
|
+
tagsinput: "sell",
|
|
2599
|
+
checkbox: "check_circle",
|
|
2600
|
+
switch: "toggle_on",
|
|
2601
|
+
consent: "verified",
|
|
2602
|
+
datetime: "event",
|
|
2603
|
+
datetimepicker: "event",
|
|
2604
|
+
daterangepicker: "date_range",
|
|
2605
|
+
timepicker: "schedule",
|
|
2606
|
+
phone: "call",
|
|
2607
|
+
intlphone: "call",
|
|
2608
|
+
password: "lock",
|
|
2609
|
+
otp: "pin",
|
|
2610
|
+
address: "place",
|
|
2611
|
+
geo: "place",
|
|
2612
|
+
locationfield: "place",
|
|
2613
|
+
rating: "star",
|
|
2614
|
+
slider: "tune",
|
|
2615
|
+
nps: "speed",
|
|
2616
|
+
colorpicker: "palette",
|
|
2617
|
+
fileupload: "attach_file",
|
|
2618
|
+
signature: "draw"
|
|
2619
|
+
}, wi = (e) => Ci[e?.type || ""] || "label", Ti = (e, t, n) => {
|
|
2620
|
+
let r = t.fields || [], i = t.display || {}, a = i.title ? bi(i.title, e, r) : bi(Ei(t)[0], e, r), o = i.subtitle ? bi(i.subtitle, e, r) : "", s = Di(t).map((t) => ({
|
|
2621
|
+
...t,
|
|
2622
|
+
value: vi(fi(r, t.id), e[t.id])
|
|
2623
|
+
})).filter((e) => e.value);
|
|
2624
|
+
return {
|
|
2625
|
+
title: a || `${ci(t)} ${n + 1}`,
|
|
2626
|
+
rawTitle: a,
|
|
2627
|
+
subtitle: o,
|
|
2628
|
+
details: s
|
|
2629
|
+
};
|
|
2630
|
+
}, Ei = (e) => {
|
|
2631
|
+
let t = e.display || {};
|
|
2632
|
+
if (t.title) return Si(t.title);
|
|
2633
|
+
let n = xi(e.fields || [])[0];
|
|
2634
|
+
return n ? [di(n)] : [];
|
|
2635
|
+
}, Di = (e) => {
|
|
2636
|
+
let t = e.fields || [], n = e.display || {}, r = (e, t, n = {}) => ({
|
|
2637
|
+
id: t,
|
|
2638
|
+
label: n.label || _i(e) || t,
|
|
2639
|
+
icon: n.icon || wi(e),
|
|
2640
|
+
...n.span ? { span: n.span } : {}
|
|
2641
|
+
});
|
|
2642
|
+
if (n.details === !1) return [];
|
|
2643
|
+
if (Array.isArray(n.details)) return n.details.map((e) => typeof e == "string" ? { field: e } : e).filter((e) => e && e.field).map((e) => r(fi(t, e.field), e.field, e));
|
|
2644
|
+
let i = /* @__PURE__ */ new Set([...Ei(e), ...Si(n.subtitle)]), a = typeof n.badge == "string" ? n.badge : n.badge?.field;
|
|
2645
|
+
return a && i.add(a), xi(t).filter((e) => !i.has(di(e))).map((e) => r(e, di(e)));
|
|
2646
|
+
}, Oi = (e, t) => {
|
|
2647
|
+
let n = (t.collections || []).map((t) => {
|
|
2648
|
+
let n = ui(e?.[t.id]).length;
|
|
2649
|
+
return n ? `${n} ${si(ci(t), n).toLowerCase()}` : "";
|
|
2650
|
+
}).filter(Boolean);
|
|
2651
|
+
return n.length <= 1 ? n.join("") : `${n.slice(0, -1).join(", ")} and ${n[n.length - 1]}`;
|
|
2652
|
+
}, ki = (e, t, n = {}, r = []) => {
|
|
2653
|
+
let i = ui(e), a = [], o = ci(t).toLowerCase(), s = Math.max(Number(t.min) || 0, +!!n.required);
|
|
2654
|
+
if (i.length < s) {
|
|
2655
|
+
let e = n.required && i.length === 0 && n.requiredMessage ? n.requiredMessage : t.minMessage || `Add at least ${s} ${si(o, s)}`;
|
|
2656
|
+
a.push({
|
|
2657
|
+
path: r,
|
|
2658
|
+
message: e
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2661
|
+
return t.max != null && i.length > Number(t.max) && a.push({
|
|
2662
|
+
path: r,
|
|
2663
|
+
message: t.maxMessage || `No more than ${t.max} ${si(o, Number(t.max))} allowed`
|
|
2664
|
+
}), i.forEach((e, n) => {
|
|
2665
|
+
(t.collections || []).forEach((t) => {
|
|
2666
|
+
a.push(...ki(e[t.id], t, {}, [
|
|
2667
|
+
...r,
|
|
2668
|
+
n,
|
|
2669
|
+
t.id
|
|
2670
|
+
]));
|
|
2671
|
+
});
|
|
2672
|
+
}), a;
|
|
2673
|
+
}, Ai = (e, t, n = "") => {
|
|
2674
|
+
let r = [];
|
|
2675
|
+
return ui(e).forEach((e, i) => {
|
|
2676
|
+
let a = `${n}${ci(t)} ${i + 1}`, { title: o, subtitle: s, details: c } = Ti(e, t, i), l = [[o, s].filter(Boolean).join(" — "), ...c.map((e) => `${e.label}: ${e.value}`)];
|
|
2677
|
+
r.push({
|
|
2678
|
+
label: a,
|
|
2679
|
+
value: l.join("\n")
|
|
2680
|
+
}), (t.collections || []).forEach((t) => {
|
|
2681
|
+
r.push(...Ai(e[t.id], t, `${a} › `));
|
|
2682
|
+
});
|
|
2683
|
+
}), r;
|
|
2684
|
+
}, ji = { MUI: { map: dt } }, $ = {}, Mi = (e, t) => ti(e, t), Ni = (e) => e ? $[e] : $, Pi = (e) => {
|
|
2685
|
+
let t = Object.keys($);
|
|
2686
|
+
e ? delete $[e] : t.forEach((e) => delete $[e]);
|
|
2687
|
+
}, Fi = (e) => ({
|
|
2688
|
+
getValues: () => ({ ...$[e] || {} }),
|
|
2689
|
+
clear: () => Pi(e)
|
|
2690
|
+
}), Ii = (e, t) => !e?.visibleWhen || Mi(e.visibleWhen, t), Li = /* @__PURE__ */ new Set([
|
|
2691
|
+
"typography",
|
|
2692
|
+
"divider",
|
|
2693
|
+
"alert",
|
|
2694
|
+
"image",
|
|
2695
|
+
"imagelist",
|
|
2696
|
+
"hyperlink",
|
|
2697
|
+
"button",
|
|
2698
|
+
"summary"
|
|
2699
|
+
]), Ri = (e, t) => {
|
|
2700
|
+
if (!e || typeof e != "object") return e;
|
|
2701
|
+
let n = { ...e };
|
|
2702
|
+
typeof n.text == "string" && (n.text = t(n.text)), typeof n.label == "string" && (n.label = t(n.label)), typeof n.MuiFLabel == "string" && (n.MuiFLabel = t(n.MuiFLabel)), [
|
|
2703
|
+
"MuiAttributes",
|
|
2704
|
+
"MuiBoxAttributes",
|
|
2705
|
+
"MuiFCLAttributes"
|
|
2706
|
+
].forEach((e) => {
|
|
2707
|
+
if (n[e] && typeof n[e] == "object") {
|
|
2708
|
+
let r = { ...n[e] };
|
|
2709
|
+
typeof r.label == "string" && (r.label = t(r.label)), typeof r.placeholder == "string" && (r.placeholder = t(r.placeholder)), typeof r.helperText == "string" && (r.helperText = t(r.helperText)), n[e] = r;
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
let r = (e) => e.map((e) => e && typeof e == "object" && typeof e.label == "string" ? {
|
|
2713
|
+
...e,
|
|
2714
|
+
label: t(e.label)
|
|
2715
|
+
} : e);
|
|
2716
|
+
return Array.isArray(n.options) && (n.options = r(n.options)), Array.isArray(n.MuiFCLabels) && (n.MuiFCLabels = r(n.MuiFCLabels)), n;
|
|
2717
|
+
}, zi = (e) => {
|
|
2718
|
+
let t = e?.props || {};
|
|
2719
|
+
return t.MuiAttributes?.label || t.MuiBoxAttributes?.label || t.MuiFLabel || t.label || t.MuiFCLAttributes?.label || e?.id || t.id || "";
|
|
2720
|
+
}, Bi = (e, t) => {
|
|
2721
|
+
let n = (e || []).find((e) => (typeof e == "string" ? e : e?.value) === t);
|
|
2722
|
+
return n ? typeof n == "string" ? n : n.label ?? n.title ?? n.value : String(t);
|
|
2723
|
+
}, Vi = (e, t, n) => {
|
|
2724
|
+
if (t == null || t === "") return "";
|
|
2725
|
+
let r = e?.type, i = e?.props || {}, a = i.options;
|
|
2726
|
+
if (e?.optionsMap && e?.dependsOn && (a = e.optionsMap[n[e.dependsOn]] || []), r === "radio" && (a = i.MuiFCLabels), Array.isArray(a) && a.length) return Array.isArray(t) ? t.map((e) => Bi(a, e)).join(", ") : typeof t == "string" && /[;,]/.test(t) ? t.split(/[;,]/).map((e) => Bi(a, e.trim())).filter(Boolean).join(", ") : Bi(a, t);
|
|
2727
|
+
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
2728
|
+
if (Array.isArray(t)) return t.filter((e) => e !== "" && e != null).join(", ");
|
|
2729
|
+
if (typeof t == "object") try {
|
|
2730
|
+
let e = Object.values(t).filter((e) => e !== "" && e != null);
|
|
2731
|
+
return e.length ? e.join(", ") : JSON.stringify(t);
|
|
2732
|
+
} catch {
|
|
2733
|
+
return String(t);
|
|
2734
|
+
}
|
|
2735
|
+
return String(t);
|
|
2736
|
+
}, Hi = (e, t) => {
|
|
2737
|
+
let n = [], r = (e) => {
|
|
2738
|
+
(e || []).forEach((e) => {
|
|
2739
|
+
if (Li.has(e?.type) || e?.visibleWhen && !Mi(e.visibleWhen, t)) return;
|
|
2740
|
+
let i = e?.id || e?.props?.id;
|
|
2741
|
+
if (e?.type === "collection") {
|
|
2742
|
+
i && n.push(...Ai(t[i], {
|
|
2743
|
+
...e.props || {},
|
|
2744
|
+
id: i
|
|
2745
|
+
}));
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
let a = i ? Vi(e, t[i], t) : "";
|
|
2749
|
+
if (a !== "" && n.push({
|
|
2750
|
+
label: zi(e),
|
|
2751
|
+
value: a
|
|
2752
|
+
}), Array.isArray(e?.subforms)) {
|
|
2753
|
+
let n = i ? t[i] : void 0;
|
|
2754
|
+
e.subforms.forEach((e) => {
|
|
2755
|
+
(Array.isArray(n) ? n.includes(e.conditionValue) : e.conditionValue === n) && r(e.data || []);
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
});
|
|
2759
|
+
};
|
|
2760
|
+
return r(e), n;
|
|
2761
|
+
}, Ui = (e) => String(e).replace(/[&<>"']/g, (e) => ({
|
|
2762
|
+
"&": "&",
|
|
2763
|
+
"<": "<",
|
|
2764
|
+
">": ">",
|
|
2765
|
+
"\"": """,
|
|
2766
|
+
"'": "'"
|
|
2767
|
+
})[e]), Wi = (e, t) => {
|
|
2768
|
+
if (typeof document > "u") return;
|
|
2769
|
+
let n = e.length ? e.map((e) => `<div class="row"><div class="lbl">${Ui(e.label)}</div><div class="val">${Ui(e.value)}</div></div>`).join("") : "<p class=\"empty\">No values entered.</p>", r = `<!doctype html><html><head><meta charset="utf-8"><title>${Ui(t || "Form")}</title>
|
|
2770
|
+
<style>
|
|
2771
|
+
*{box-sizing:border-box} body{font-family:-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#0f172a;margin:32px}
|
|
2772
|
+
h1{font-size:18px;margin:0 0 16px} .row{display:grid;grid-template-columns:34% 1fr;gap:16px;padding:9px 0;border-bottom:1px solid #e2e8f0}
|
|
2773
|
+
.lbl{color:#64748b;font-weight:500;font-size:13px} .val{color:#0f172a;font-weight:600;font-size:13px;white-space:pre-wrap;word-break:break-word}
|
|
2774
|
+
.empty{color:#64748b} @media print{body{margin:12mm}}
|
|
2775
|
+
</style></head><body>${t ? `<h1>${Ui(t)}</h1>` : ""}${n}</body></html>`, i = document.createElement("iframe");
|
|
2776
|
+
i.setAttribute("aria-hidden", "true"), i.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;", document.body.appendChild(i);
|
|
2777
|
+
let a = () => {
|
|
2778
|
+
setTimeout(() => {
|
|
2779
|
+
try {
|
|
2780
|
+
document.body.removeChild(i);
|
|
2781
|
+
} catch {}
|
|
2782
|
+
}, 500);
|
|
2783
|
+
}, o = i.contentWindow?.document;
|
|
2784
|
+
o ? (o.open(), o.write(r), o.close(), i.contentWindow ? setTimeout(() => {
|
|
2785
|
+
try {
|
|
2786
|
+
i.contentWindow?.focus(), i.contentWindow?.print();
|
|
2787
|
+
} catch {}
|
|
2788
|
+
a();
|
|
2789
|
+
}, 50) : a()) : a();
|
|
2790
|
+
}, Gi = async (e, t = {}) => {
|
|
2791
|
+
let n, r;
|
|
2792
|
+
try {
|
|
2793
|
+
let e = await import("pdfmake/build/pdfmake"), t = await import("pdfmake/build/vfs_fonts");
|
|
2794
|
+
n = e?.default || e, r = t?.pdfMake?.vfs || t?.vfs || t?.default?.pdfMake?.vfs || t?.default?.vfs || t?.default;
|
|
2795
|
+
} catch {
|
|
2796
|
+
throw Error("exportPdf() needs the optional \"pdfmake\" package. Install it with: npm i pdfmake");
|
|
2797
|
+
}
|
|
2798
|
+
if (!n?.createPdf) throw Error("exportPdf() needs the optional \"pdfmake\" package. Install it with: npm i pdfmake");
|
|
2799
|
+
r && (n.vfs = r);
|
|
2800
|
+
let i = {
|
|
2801
|
+
content: [...t.title ? [{
|
|
2802
|
+
text: t.title,
|
|
2803
|
+
fontSize: 15,
|
|
2804
|
+
bold: !0,
|
|
2805
|
+
color: "#0f172a",
|
|
2806
|
+
margin: [
|
|
2807
|
+
0,
|
|
2808
|
+
0,
|
|
2809
|
+
0,
|
|
2810
|
+
12
|
|
2811
|
+
]
|
|
2812
|
+
}] : [], e.length ? {
|
|
2813
|
+
table: {
|
|
2814
|
+
headerRows: 0,
|
|
2815
|
+
widths: ["34%", "*"],
|
|
2816
|
+
body: e.map((e) => [{
|
|
2817
|
+
text: e.label,
|
|
2818
|
+
color: "#64748b",
|
|
2819
|
+
margin: [
|
|
2820
|
+
0,
|
|
2821
|
+
3,
|
|
2822
|
+
0,
|
|
2823
|
+
3
|
|
2824
|
+
]
|
|
2825
|
+
}, {
|
|
2826
|
+
text: e.value,
|
|
2827
|
+
color: "#0f172a",
|
|
2828
|
+
bold: !0,
|
|
2829
|
+
margin: [
|
|
2830
|
+
0,
|
|
2831
|
+
3,
|
|
2832
|
+
0,
|
|
2833
|
+
3
|
|
2834
|
+
]
|
|
2835
|
+
}])
|
|
2836
|
+
},
|
|
2837
|
+
layout: {
|
|
2838
|
+
hLineWidth: (e, t) => e === 0 || e === t.table.body.length ? 0 : .5,
|
|
2839
|
+
vLineWidth: () => 0,
|
|
2840
|
+
hLineColor: () => "#e2e8f0",
|
|
2841
|
+
paddingLeft: () => 0,
|
|
2842
|
+
paddingRight: () => 8
|
|
2843
|
+
}
|
|
2844
|
+
} : {
|
|
2845
|
+
text: "No values entered.",
|
|
2846
|
+
color: "#64748b"
|
|
2847
|
+
}],
|
|
2848
|
+
defaultStyle: { fontSize: 10 },
|
|
2849
|
+
pageMargins: [
|
|
2850
|
+
40,
|
|
2851
|
+
40,
|
|
2852
|
+
40,
|
|
2853
|
+
40
|
|
2854
|
+
]
|
|
2855
|
+
}, a = t.filename || `${(t.title || "form").replace(/\s+/g, "-").toLowerCase()}.pdf`;
|
|
2856
|
+
n.createPdf(i).download(a);
|
|
2857
|
+
}, Ki = (e, t, n = "This field is required") => {
|
|
2858
|
+
let r = [...e?.rules?.validation || []], i = r.some((e) => s.includes(e.rule));
|
|
2859
|
+
return e?.requiredWhen && !i && Mi(e.requiredWhen, t) && r.push({
|
|
2860
|
+
rule: "mandatory",
|
|
2861
|
+
message: e.requiredMessage || n
|
|
2862
|
+
}), r;
|
|
2863
|
+
}, qi = (e, t, n, i, a) => {
|
|
2864
|
+
let o = $[t] || {}, c = new Set((e || []).filter((e) => !Ii(e, o)).map((e) => e?.id || e?.props?.id).filter(Boolean)), l = (e || []).reduce((e, t) => {
|
|
2865
|
+
if (!Ii(t, o)) return e;
|
|
2866
|
+
let i = Ki(t, o, n);
|
|
2867
|
+
if (i.length === 0) return e;
|
|
2868
|
+
let a = t?.id || t?.props?.id;
|
|
2869
|
+
if (!a) return e;
|
|
2870
|
+
let c = o[a], l = c == null ? "" : c.toString(), u = i.some((e) => s.includes(e.rule));
|
|
2871
|
+
return i.forEach((t) => {
|
|
2872
|
+
let n = ai[t.rule];
|
|
2873
|
+
if (n) {
|
|
2874
|
+
if (!l && !u) return;
|
|
2875
|
+
let r = o[t.field ?? t.value], i = r == null ? "" : r.toString();
|
|
2876
|
+
n(l, i) || e.push({
|
|
2877
|
+
...t,
|
|
2878
|
+
id: a
|
|
2879
|
+
});
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
let i = r[t.rule];
|
|
2883
|
+
if (typeof i != "function") return;
|
|
2884
|
+
let c = s.includes(t.rule);
|
|
2885
|
+
(l || c) && (l && i(l, t.value) || e.push({
|
|
2886
|
+
...t,
|
|
2887
|
+
id: a
|
|
2888
|
+
}));
|
|
2889
|
+
}), e;
|
|
2890
|
+
}, []);
|
|
2891
|
+
if ((e || []).forEach((e) => {
|
|
2892
|
+
if (e?.type !== "collection" || !Ii(e, o)) return;
|
|
2893
|
+
let t = e?.id || e?.props?.id;
|
|
2894
|
+
if (!t || l.some((e) => e.id === t)) return;
|
|
2895
|
+
let n = ki(o[t], {
|
|
2896
|
+
...e.props || {},
|
|
2897
|
+
id: t
|
|
2898
|
+
});
|
|
2899
|
+
n.length && l.push({
|
|
2900
|
+
id: t,
|
|
2901
|
+
rule: "collection",
|
|
2902
|
+
message: n[0].message,
|
|
2903
|
+
issues: n
|
|
2904
|
+
});
|
|
2905
|
+
}), i) {
|
|
2906
|
+
let e = [];
|
|
2907
|
+
try {
|
|
2908
|
+
e = i(o) || [];
|
|
2909
|
+
} catch {
|
|
2910
|
+
e = [];
|
|
2911
|
+
}
|
|
2912
|
+
e.forEach((e) => {
|
|
2913
|
+
e && e.id && !c.has(e.id) && l.push({
|
|
2914
|
+
id: e.id,
|
|
2915
|
+
rule: e.rule || "schema",
|
|
2916
|
+
message: e.message
|
|
2917
|
+
});
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
return a && Object.entries(a).forEach(([e, t]) => {
|
|
2921
|
+
e && !c.has(e) && t && (t.status === "invalid" ? l.push({
|
|
2922
|
+
id: e,
|
|
2923
|
+
rule: "async",
|
|
2924
|
+
message: t.message || "Invalid"
|
|
2925
|
+
}) : t.status === "pending" && l.push({
|
|
2926
|
+
id: e,
|
|
2927
|
+
rule: "async-pending",
|
|
2928
|
+
message: "Still validating…"
|
|
2929
|
+
}));
|
|
2930
|
+
}), l;
|
|
2931
|
+
}, Ji = [
|
|
2932
|
+
"primary",
|
|
2933
|
+
"secondary",
|
|
2934
|
+
"success",
|
|
2935
|
+
"error",
|
|
2936
|
+
"warning",
|
|
2937
|
+
"info",
|
|
2938
|
+
"inherit"
|
|
2939
|
+
], Yi = {
|
|
2940
|
+
required: "This field is required",
|
|
2941
|
+
errorSummary: "{n} field(s) need attention"
|
|
2942
|
+
}, Xi = (e) => {
|
|
2943
|
+
try {
|
|
2944
|
+
return typeof window > "u" ? null : e === "session" ? window.sessionStorage : window.localStorage;
|
|
2945
|
+
} catch {
|
|
2946
|
+
return null;
|
|
2947
|
+
}
|
|
2948
|
+
}, Zi = {}, Qi = /* @__PURE__ */ new Set([
|
|
2949
|
+
"tabs",
|
|
2950
|
+
"group",
|
|
2951
|
+
"accordion",
|
|
2952
|
+
"stepper"
|
|
2953
|
+
]), $i = /* @__PURE__ */ new Set(["summary"]), ea = /* @__PURE__ */ new WeakMap(), ta = /* @__PURE__ */ new WeakMap(), na = 0, ra = (e) => {
|
|
2954
|
+
let t = ea.get(e);
|
|
2955
|
+
if (t === void 0) {
|
|
2956
|
+
try {
|
|
2957
|
+
t = JSON.stringify(e, (e, t) => typeof t == "function" ? (ta.has(t) || ta.set(t, ++na), `ƒ${ta.get(t)}`) : t);
|
|
2958
|
+
} catch {
|
|
2959
|
+
t = `!${++na}`;
|
|
2960
|
+
}
|
|
2961
|
+
ea.set(e, t);
|
|
2962
|
+
}
|
|
2963
|
+
return t;
|
|
2964
|
+
}, ia = S.memo(function(e) {
|
|
2965
|
+
let { field: t, index: n, guid: r, value: i, msg: o, t: s } = e, { type: c = "", style: l = {}, className: u = "", visible: d = !1, rules: f = {}, subforms: p = [] } = t, m = t.props || {}, h = t.layout || {}, g = t?.id || m?.id, _ = ji.MUI.map[c] || {}, { options: v = {} } = _, y = g ? {
|
|
2966
|
+
...m,
|
|
2967
|
+
id: g
|
|
2968
|
+
} : m;
|
|
2969
|
+
g && i !== void 0 && (y = {
|
|
2970
|
+
...y,
|
|
2971
|
+
value: i
|
|
2972
|
+
}), e.disabled && (y = {
|
|
2973
|
+
...y,
|
|
2974
|
+
MuiAttributes: {
|
|
2975
|
+
...y.MuiAttributes || {},
|
|
2976
|
+
disabled: !0
|
|
2977
|
+
},
|
|
2978
|
+
MuiBoxAttributes: {
|
|
2979
|
+
...y.MuiBoxAttributes || {},
|
|
2980
|
+
disabled: !0
|
|
2981
|
+
},
|
|
2982
|
+
MuiFCLAttributes: {
|
|
2983
|
+
...y.MuiFCLAttributes || {},
|
|
2984
|
+
disabled: !0
|
|
2985
|
+
}
|
|
2986
|
+
}), t.optionsMap && t.dependsOn && (y = {
|
|
2987
|
+
...y,
|
|
2988
|
+
options: t.optionsMap[e.depValue] || []
|
|
2989
|
+
});
|
|
2990
|
+
let b = f;
|
|
2991
|
+
e.required && !a(f) && (b = {
|
|
2992
|
+
...f,
|
|
2993
|
+
validation: [...f.validation || [], {
|
|
2994
|
+
rule: "mandatory",
|
|
2995
|
+
message: t.requiredMessage || o.required
|
|
2996
|
+
}]
|
|
2997
|
+
}), e.translateOn && (y = Ri(y, s), b?.validation && (b = {
|
|
2998
|
+
...b,
|
|
2999
|
+
validation: b.validation.map((e) => e?.message ? {
|
|
3000
|
+
...e,
|
|
3001
|
+
message: s(e.message)
|
|
3002
|
+
} : e)
|
|
3003
|
+
}));
|
|
3004
|
+
let x = p.find((e) => Array.isArray(i) ? i.includes(e.conditionValue) : e.conditionValue === i);
|
|
3005
|
+
return /* @__PURE__ */ W(ae, {
|
|
3006
|
+
style: {
|
|
3007
|
+
...l,
|
|
3008
|
+
cursor: e.clickable ? "pointer" : "default",
|
|
3009
|
+
position: "relative",
|
|
3010
|
+
transition: "background-color 0.2s, box-shadow 0.2s",
|
|
3011
|
+
borderRadius: 4
|
|
3012
|
+
},
|
|
3013
|
+
...h,
|
|
3014
|
+
className: `${u} ${d ? "show" : "hidden"}`,
|
|
3015
|
+
onDoubleClick: (n) => {
|
|
3016
|
+
e.onFieldDoubleClick && (n.stopPropagation(), e.onFieldDoubleClick(t));
|
|
3017
|
+
},
|
|
3018
|
+
onContextMenu: (n) => {
|
|
3019
|
+
e.onFieldContextMenu && (n.preventDefault(), n.stopPropagation(), e.onFieldContextMenu(n, t));
|
|
3020
|
+
},
|
|
3021
|
+
children: [
|
|
3022
|
+
/* @__PURE__ */ U(Xr, {
|
|
3023
|
+
type: c,
|
|
3024
|
+
map: _.map,
|
|
3025
|
+
option: v.type || "",
|
|
3026
|
+
control: t,
|
|
3027
|
+
attributes: y,
|
|
3028
|
+
rules: b,
|
|
3029
|
+
onChange: e.onUpdate,
|
|
3030
|
+
onStepUpdate: e.onStepUpdate,
|
|
3031
|
+
currentStep: e.activeStep,
|
|
3032
|
+
patch: e.patch,
|
|
3033
|
+
submitTick: e.submitTick,
|
|
3034
|
+
messages: o
|
|
3035
|
+
}, `dynamic-comp-${g || n}-${e.formVersion}`),
|
|
3036
|
+
e.asyncEntry && /* @__PURE__ */ W(N, {
|
|
3037
|
+
sx: {
|
|
3038
|
+
display: "flex",
|
|
3039
|
+
alignItems: "center",
|
|
3040
|
+
gap: .5,
|
|
3041
|
+
mt: .5,
|
|
3042
|
+
ml: .25
|
|
3043
|
+
},
|
|
3044
|
+
children: [
|
|
3045
|
+
e.asyncEntry.status === "pending" && /* @__PURE__ */ W(ve, { children: [/* @__PURE__ */ U(F, {
|
|
3046
|
+
size: 13,
|
|
3047
|
+
thickness: 5
|
|
3048
|
+
}), /* @__PURE__ */ U(V, {
|
|
3049
|
+
variant: "caption",
|
|
3050
|
+
sx: { color: "text.secondary" },
|
|
3051
|
+
children: "Checking…"
|
|
3052
|
+
})] }),
|
|
3053
|
+
e.asyncEntry.status === "valid" && /* @__PURE__ */ W(V, {
|
|
3054
|
+
variant: "caption",
|
|
3055
|
+
sx: {
|
|
3056
|
+
color: "success.main",
|
|
3057
|
+
display: "flex",
|
|
3058
|
+
alignItems: "center",
|
|
3059
|
+
gap: .25
|
|
3060
|
+
},
|
|
3061
|
+
children: [/* @__PURE__ */ U(R, {
|
|
3062
|
+
sx: { fontSize: 15 },
|
|
3063
|
+
children: "check_circle"
|
|
3064
|
+
}), "Available"]
|
|
3065
|
+
}),
|
|
3066
|
+
e.asyncEntry.status === "invalid" && /* @__PURE__ */ W(V, {
|
|
3067
|
+
variant: "caption",
|
|
3068
|
+
sx: {
|
|
3069
|
+
color: "error.main",
|
|
3070
|
+
display: "flex",
|
|
3071
|
+
alignItems: "center",
|
|
3072
|
+
gap: .25
|
|
3073
|
+
},
|
|
3074
|
+
children: [/* @__PURE__ */ U(R, {
|
|
3075
|
+
sx: { fontSize: 15 },
|
|
3076
|
+
children: "error"
|
|
3077
|
+
}), e.asyncEntry.message]
|
|
3078
|
+
})
|
|
3079
|
+
]
|
|
3080
|
+
}),
|
|
3081
|
+
x && x.data && /* @__PURE__ */ U(N, {
|
|
3082
|
+
sx: {
|
|
3083
|
+
mt: 2,
|
|
3084
|
+
pl: 2,
|
|
3085
|
+
borderLeft: "2px solid",
|
|
3086
|
+
borderColor: "divider",
|
|
3087
|
+
width: "100%"
|
|
3088
|
+
},
|
|
3089
|
+
children: /* @__PURE__ */ U(aa, {
|
|
3090
|
+
guid: `${r}-subform-${g}-${String(x.conditionValue)}`,
|
|
3091
|
+
data: x.data,
|
|
3092
|
+
patch: e.patch,
|
|
3093
|
+
onChange: e.onUpdate,
|
|
3094
|
+
MuiGridAttributes: { spacing: 1 }
|
|
3095
|
+
}, `${r}-subform-${g}-${String(x.conditionValue)}`)
|
|
3096
|
+
})
|
|
3097
|
+
]
|
|
3098
|
+
});
|
|
3099
|
+
}, (e, t) => {
|
|
3100
|
+
if (e.alwaysRender || t.alwaysRender) return !1;
|
|
3101
|
+
for (let n of Object.keys(t)) if (n !== "field" && !Object.is(e[n], t[n])) return !1;
|
|
3102
|
+
return e.field === t.field || ra(e.field) === ra(t.field);
|
|
3103
|
+
});
|
|
3104
|
+
function aa({ data: e = [], patch: t = Zi, guid: n, formRef: r, onSubmit: i, onChange: a, onStepChange: o, MuiGridAttributes: s = { spacing: 2 }, activeStep: c = 0, onFieldClick: l, onFieldDoubleClick: u, onFieldContextMenu: p, persistOnUnmount: g = !1, autoSave: _ = !1, autoSaveKey: v, autoSaveStorage: y = "local", apiRef: x, messages: C, validationSummary: w = !1, resolver: D, asyncValidators: k, readOnly: te = !1, reviewMode: ne = !1, warnOnUnsavedChanges: I = !1, submitLabel: re, submitButton: ie, stickySubmit: L = !1, cancelLabel: oe, onCancel: se, translate: ce }) {
|
|
3105
|
+
let le = v || `dynamic-mui:${n}`, z = T((e) => ce && typeof e == "string" ? ce(e) : e, [ce]), ue = {
|
|
3106
|
+
...Yi,
|
|
3107
|
+
...C || {}
|
|
3108
|
+
}, de = A(() => ({
|
|
3109
|
+
required: z(ue.required),
|
|
3110
|
+
errorSummary: z(ue.errorSummary)
|
|
3111
|
+
}), [
|
|
3112
|
+
z,
|
|
3113
|
+
ue.required,
|
|
3114
|
+
ue.errorSummary
|
|
3115
|
+
]), fe = A(() => {
|
|
3116
|
+
try {
|
|
3117
|
+
return JSON.stringify(t);
|
|
3118
|
+
} catch {
|
|
3119
|
+
return String(t);
|
|
3120
|
+
}
|
|
3121
|
+
}, [t]), [B, pe] = b(() => ({ ...t }), [fe], () => t), [, me] = ee((e) => e + 1, 0), [he, ge] = M(0), [_e, G] = M([]), [ye, be] = M(!1), [xe, Se] = M(0), K = j(null), Ce = j(!0), we = j(!1), [q, Te] = M({}), Ee = j({}), J = j({});
|
|
3122
|
+
E(() => () => {
|
|
3123
|
+
Ce.current = !1, Object.values(Ee.current).forEach((e) => clearTimeout(e)), Ee.current = {};
|
|
3124
|
+
}, []);
|
|
3125
|
+
let De = T((e, t) => {
|
|
3126
|
+
let r = k?.[e];
|
|
3127
|
+
if (!r || !e) return;
|
|
3128
|
+
clearTimeout(Ee.current[e]), Te((t) => ({
|
|
3129
|
+
...t,
|
|
3130
|
+
[e]: { status: "pending" }
|
|
3131
|
+
}));
|
|
3132
|
+
let i = (J.current[e] || 0) + 1;
|
|
3133
|
+
J.current[e] = i, Ee.current[e] = setTimeout(() => {
|
|
3134
|
+
Promise.resolve(r(t, $[n] || {})).then((t) => {
|
|
3135
|
+
Ce.current && J.current[e] === i && Te((n) => ({
|
|
3136
|
+
...n,
|
|
3137
|
+
[e]: t ? {
|
|
3138
|
+
status: "invalid",
|
|
3139
|
+
message: String(t)
|
|
3140
|
+
} : { status: "valid" }
|
|
3141
|
+
}));
|
|
3142
|
+
}).catch(() => {
|
|
3143
|
+
Ce.current && J.current[e] === i && Te((t) => {
|
|
3144
|
+
let n = { ...t };
|
|
3145
|
+
return delete n[e], n;
|
|
3146
|
+
});
|
|
3147
|
+
});
|
|
3148
|
+
}, 450);
|
|
3149
|
+
}, [k, n]), Oe = j(null);
|
|
3150
|
+
A(() => {
|
|
3151
|
+
let t;
|
|
3152
|
+
try {
|
|
3153
|
+
t = JSON.stringify(B);
|
|
3154
|
+
} catch {
|
|
3155
|
+
t = String(B);
|
|
3156
|
+
}
|
|
3157
|
+
t = `${n}::${t}`;
|
|
3158
|
+
let r = Oe.current !== t;
|
|
3159
|
+
Oe.current = t, f(e, r ? B : {}, n, $);
|
|
3160
|
+
}, [
|
|
3161
|
+
B,
|
|
3162
|
+
e,
|
|
3163
|
+
n
|
|
3164
|
+
]);
|
|
3165
|
+
let ke = A(() => h(m >= 9 ? e.map((e) => e && e.props ? {
|
|
3166
|
+
...e,
|
|
3167
|
+
props: d(e.props)
|
|
3168
|
+
} : e) : e), [e]);
|
|
3169
|
+
E(() => {
|
|
3170
|
+
(0, lt.default)($[n]) && ($[n] = { ...t });
|
|
3171
|
+
}, [n, t]), E(() => {
|
|
3172
|
+
K.current === null && (K.current = { ...$[n] || {} });
|
|
3173
|
+
}, []), E(() => {
|
|
3174
|
+
if (!I || typeof window > "u") return;
|
|
3175
|
+
let e = (e) => {
|
|
3176
|
+
let t = K.current;
|
|
3177
|
+
t && !(0, ut.default)($[n] || {}, t) && (e.preventDefault(), e.returnValue = "");
|
|
3178
|
+
};
|
|
3179
|
+
return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
|
|
3180
|
+
}, [I, n]), E(() => {
|
|
3181
|
+
if (!g) return () => {
|
|
3182
|
+
delete $[n];
|
|
3183
|
+
};
|
|
3184
|
+
}, [n, g]), E(() => {
|
|
3185
|
+
if (!_) return;
|
|
3186
|
+
let e = Xi(y);
|
|
3187
|
+
if (e) try {
|
|
3188
|
+
let t = e.getItem(le);
|
|
3189
|
+
if (t) {
|
|
3190
|
+
let e = JSON.parse(t);
|
|
3191
|
+
$[n] = {
|
|
3192
|
+
...$[n],
|
|
3193
|
+
...e
|
|
3194
|
+
}, pe((t) => ({
|
|
3195
|
+
...t,
|
|
3196
|
+
...e
|
|
3197
|
+
})), K.current = { ...$[n] || {} };
|
|
3198
|
+
}
|
|
3199
|
+
} catch {}
|
|
3200
|
+
}, [
|
|
3201
|
+
_,
|
|
3202
|
+
le,
|
|
3203
|
+
y,
|
|
3204
|
+
n
|
|
3205
|
+
]);
|
|
3206
|
+
let Ae = T(() => {
|
|
3207
|
+
if (!_) return;
|
|
3208
|
+
let e = Xi(y);
|
|
3209
|
+
if (e) try {
|
|
3210
|
+
e.setItem(le, JSON.stringify($[n] || {}));
|
|
3211
|
+
} catch {}
|
|
3212
|
+
}, [
|
|
3213
|
+
_,
|
|
3214
|
+
y,
|
|
3215
|
+
le,
|
|
3216
|
+
n
|
|
3217
|
+
]), je = T(({ id: t, value: r, option: i }) => {
|
|
3218
|
+
$[n] || ($[n] = {}), $[n][t] = r;
|
|
3219
|
+
let o = $[n];
|
|
3220
|
+
e.forEach((e) => {
|
|
3221
|
+
let t = e?.id || e?.props?.id;
|
|
3222
|
+
if (t && e.visibleWhen && !Mi(e.visibleWhen, o) && delete o[t], Array.isArray(e.subforms) && e.subforms.length) {
|
|
3223
|
+
let n = t ? o[t] : void 0, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
3224
|
+
e.subforms.forEach((e) => {
|
|
3225
|
+
let t = Array.isArray(n) ? n.includes(e.conditionValue) : e.conditionValue === n;
|
|
3226
|
+
(e.data || []).forEach((e) => {
|
|
3227
|
+
let n = e?.id || e?.props?.id;
|
|
3228
|
+
n && (t ? r : i).add(n);
|
|
3229
|
+
});
|
|
3230
|
+
}), i.forEach((e) => {
|
|
3231
|
+
r.has(e) || delete o[e];
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
if (t && e.optionsMap && e.dependsOn) {
|
|
3235
|
+
let n = (e.optionsMap[o[e.dependsOn]] || []).map((e) => typeof e == "string" ? e : e?.value), r = o[t];
|
|
3236
|
+
r != null && r !== "" && !n.includes(r) && delete o[t];
|
|
3237
|
+
}
|
|
3238
|
+
}), e.forEach((e) => {
|
|
3239
|
+
let t = e?.id || e?.props?.id;
|
|
3240
|
+
t && e.formula && (o[t] = ii(e.formula, o));
|
|
3241
|
+
}), me(), Ae(), k?.[t] && De(t, r), typeof a == "function" && a({
|
|
3242
|
+
id: t,
|
|
3243
|
+
value: r,
|
|
3244
|
+
option: i
|
|
3245
|
+
});
|
|
3246
|
+
}, [
|
|
3247
|
+
n,
|
|
3248
|
+
a,
|
|
3249
|
+
Ae,
|
|
3250
|
+
e,
|
|
3251
|
+
k,
|
|
3252
|
+
De
|
|
3253
|
+
]), Me = T((e) => {
|
|
3254
|
+
let t = e?.[0]?.id;
|
|
3255
|
+
if (!t || typeof document > "u") return;
|
|
3256
|
+
let r = document.getElementById(t) || document.querySelector(`[name="${t}"]`) || document.getElementById(`${n}-${t}`);
|
|
3257
|
+
r && (r.scrollIntoView?.({
|
|
3258
|
+
behavior: "smooth",
|
|
3259
|
+
block: "center"
|
|
3260
|
+
}), r.focus?.());
|
|
3261
|
+
}, [n]), Ne = T(() => {
|
|
3262
|
+
let t = (qi(e, n, de.required, D, q) || []).map((e) => ce && e?.message ? {
|
|
3263
|
+
...e,
|
|
3264
|
+
message: z(e.message)
|
|
3265
|
+
} : e);
|
|
3266
|
+
return G(t), ge((e) => e + 1), t;
|
|
3267
|
+
}, [
|
|
3268
|
+
e,
|
|
3269
|
+
n,
|
|
3270
|
+
de.required,
|
|
3271
|
+
D,
|
|
3272
|
+
q
|
|
3273
|
+
]), Pe = T((e, t, n) => {
|
|
3274
|
+
if (we.current) return;
|
|
3275
|
+
let r = (qi(t, n, de.required, D, q) || []).map((e) => ce && e?.message ? {
|
|
3276
|
+
...e,
|
|
3277
|
+
message: z(e.message)
|
|
3278
|
+
} : e);
|
|
3279
|
+
if (G(r), ge((e) => e + 1), r.length && Me(r), typeof e == "function") {
|
|
3280
|
+
let i = e($, r, t, n);
|
|
3281
|
+
i && typeof i.then == "function" && (we.current = !0, be(!0), Promise.resolve(i).finally(() => {
|
|
3282
|
+
we.current = !1, Ce.current && be(!1);
|
|
3283
|
+
}));
|
|
3284
|
+
}
|
|
3285
|
+
}, [
|
|
3286
|
+
Me,
|
|
3287
|
+
de.required,
|
|
3288
|
+
D,
|
|
3289
|
+
q
|
|
3290
|
+
]);
|
|
3291
|
+
O(x, () => ({
|
|
3292
|
+
getValues: () => ({ ...$[n] || {} }),
|
|
3293
|
+
getErrors: () => Ne(),
|
|
3294
|
+
validate: () => Ne().length === 0,
|
|
3295
|
+
setValues: (e) => {
|
|
3296
|
+
$[n] = {
|
|
3297
|
+
...$[n] || {},
|
|
3298
|
+
...e || {}
|
|
3299
|
+
}, pe((t) => ({
|
|
3300
|
+
...t,
|
|
3301
|
+
...e || {}
|
|
3302
|
+
}));
|
|
3303
|
+
},
|
|
3304
|
+
reset: () => {
|
|
3305
|
+
delete $[n], pe({}), G([]), Se((e) => e + 1), me();
|
|
3306
|
+
},
|
|
3307
|
+
submit: () => Pe(i, e, n),
|
|
3308
|
+
getInitialValues: () => ({ ...K.current || {} }),
|
|
3309
|
+
isDirty: () => !(0, ut.default)($[n] || {}, K.current || {}),
|
|
3310
|
+
resetToInitial: () => {
|
|
3311
|
+
$[n] = { ...K.current || {} }, pe({ ...K.current || {} }), G([]), Se((e) => e + 1), me();
|
|
3312
|
+
},
|
|
3313
|
+
markPristine: () => {
|
|
3314
|
+
K.current = { ...$[n] || {} };
|
|
3315
|
+
},
|
|
3316
|
+
print: (t) => Wi(Hi(e, $[n] || {}), t?.title),
|
|
3317
|
+
exportPdf: (t) => Gi(Hi(e, $[n] || {}), t)
|
|
3318
|
+
}), [
|
|
3319
|
+
x,
|
|
3320
|
+
n,
|
|
3321
|
+
Ne,
|
|
3322
|
+
Pe,
|
|
3323
|
+
i,
|
|
3324
|
+
e
|
|
3325
|
+
]);
|
|
3326
|
+
let Fe = j({
|
|
3327
|
+
onUpdate: je,
|
|
3328
|
+
onStepChange: o,
|
|
3329
|
+
onFieldDoubleClick: u,
|
|
3330
|
+
onFieldContextMenu: p
|
|
3331
|
+
});
|
|
3332
|
+
Fe.current = {
|
|
3333
|
+
onUpdate: je,
|
|
3334
|
+
onStepChange: o,
|
|
3335
|
+
onFieldDoubleClick: u,
|
|
3336
|
+
onFieldContextMenu: p
|
|
3337
|
+
};
|
|
3338
|
+
let Ie = T((e) => Fe.current.onUpdate(e), []), Le = T((e, t, n) => {
|
|
3339
|
+
let r = Fe.current.onStepChange;
|
|
3340
|
+
typeof r == "function" && r(e, t, n);
|
|
3341
|
+
}, []), Re = T((e) => Fe.current.onFieldDoubleClick?.(e), []), ze = T((e, t) => Fe.current.onFieldContextMenu?.(e, t), []), Be = (e, r) => {
|
|
3342
|
+
let i = e?.type || "", a = e?.id || e?.props?.id, o = $[n] || {};
|
|
3343
|
+
if (e.visibleWhen && !Mi(e.visibleWhen, o)) return a && $[n] && $[n][a] !== void 0 && delete $[n][a], null;
|
|
3344
|
+
let s = a ? o[a] : void 0;
|
|
3345
|
+
return e.formula && a && (s = ii(e.formula, o), $[n] && ($[n][a] = s)), /* @__PURE__ */ U(ia, {
|
|
3346
|
+
field: e,
|
|
3347
|
+
index: r,
|
|
3348
|
+
guid: n,
|
|
3349
|
+
value: s,
|
|
3350
|
+
disabled: !!(te || e.disabledWhen && Mi(e.disabledWhen, o)),
|
|
3351
|
+
required: !!(e.requiredWhen && Mi(e.requiredWhen, o)),
|
|
3352
|
+
depValue: e.dependsOn ? o[e.dependsOn] : void 0,
|
|
3353
|
+
patch: Qi.has(i) || e.subforms?.length ? t : void 0,
|
|
3354
|
+
asyncEntry: a ? q[a] : void 0,
|
|
3355
|
+
submitTick: he,
|
|
3356
|
+
formVersion: xe,
|
|
3357
|
+
activeStep: c,
|
|
3358
|
+
msg: de,
|
|
3359
|
+
t: z,
|
|
3360
|
+
translateOn: !!ce,
|
|
3361
|
+
onUpdate: Ie,
|
|
3362
|
+
onStepUpdate: Le,
|
|
3363
|
+
clickable: !!l,
|
|
3364
|
+
onFieldDoubleClick: u ? Re : void 0,
|
|
3365
|
+
onFieldContextMenu: p ? ze : void 0,
|
|
3366
|
+
alwaysRender: $i.has(i) || Kr(i)
|
|
3367
|
+
}, a || `layout-comp-${r}`);
|
|
3368
|
+
}, Ve = _e.length ? de.errorSummary.replace("{n}", String(_e.length)) : "";
|
|
3369
|
+
if (ne) {
|
|
3370
|
+
let t = Hi(e, $[n] || {});
|
|
3371
|
+
return /* @__PURE__ */ U(N, {
|
|
3372
|
+
className: "dmui-review",
|
|
3373
|
+
sx: { width: "100%" },
|
|
3374
|
+
children: t.length === 0 ? /* @__PURE__ */ U(V, {
|
|
3375
|
+
variant: "body2",
|
|
3376
|
+
sx: { color: "text.secondary" },
|
|
3377
|
+
children: "No values entered."
|
|
3378
|
+
}) : t.map((e, n) => /* @__PURE__ */ W(N, {
|
|
3379
|
+
sx: {
|
|
3380
|
+
display: "grid",
|
|
3381
|
+
gridTemplateColumns: {
|
|
3382
|
+
xs: "1fr",
|
|
3383
|
+
sm: "minmax(0, 34%) 1fr"
|
|
3384
|
+
},
|
|
3385
|
+
gap: {
|
|
3386
|
+
xs: .25,
|
|
3387
|
+
sm: 2
|
|
3388
|
+
},
|
|
3389
|
+
py: 1.1,
|
|
3390
|
+
borderBottom: n < t.length - 1 ? "1px solid" : "none",
|
|
3391
|
+
borderColor: "divider"
|
|
3392
|
+
},
|
|
3393
|
+
children: [/* @__PURE__ */ U(V, {
|
|
3394
|
+
variant: "body2",
|
|
3395
|
+
sx: {
|
|
3396
|
+
color: "text.secondary",
|
|
3397
|
+
fontWeight: 500
|
|
3398
|
+
},
|
|
3399
|
+
children: z(e.label)
|
|
3400
|
+
}), /* @__PURE__ */ U(V, {
|
|
3401
|
+
variant: "body2",
|
|
3402
|
+
sx: {
|
|
3403
|
+
color: "text.primary",
|
|
3404
|
+
fontWeight: 600,
|
|
3405
|
+
wordBreak: "break-word",
|
|
3406
|
+
whiteSpace: "pre-wrap"
|
|
3407
|
+
},
|
|
3408
|
+
children: z(e.value)
|
|
3409
|
+
})]
|
|
3410
|
+
}, `review-${n}`))
|
|
3411
|
+
});
|
|
3412
|
+
}
|
|
3413
|
+
return /* @__PURE__ */ W(ve, { children: [
|
|
3414
|
+
/* @__PURE__ */ U(N, {
|
|
3415
|
+
"aria-live": "polite",
|
|
3416
|
+
sx: {
|
|
3417
|
+
position: "absolute",
|
|
3418
|
+
width: "1px",
|
|
3419
|
+
height: "1px",
|
|
3420
|
+
p: 0,
|
|
3421
|
+
m: "-1px",
|
|
3422
|
+
overflow: "hidden",
|
|
3423
|
+
clip: "rect(0 0 0 0)",
|
|
3424
|
+
whiteSpace: "nowrap",
|
|
3425
|
+
border: 0
|
|
3426
|
+
},
|
|
3427
|
+
children: Ve
|
|
3428
|
+
}),
|
|
3429
|
+
w && _e.length > 0 && /* @__PURE__ */ U(N, {
|
|
3430
|
+
role: "alert",
|
|
3431
|
+
sx: {
|
|
3432
|
+
mb: 2,
|
|
3433
|
+
p: 1.5,
|
|
3434
|
+
borderRadius: 1.5,
|
|
3435
|
+
bgcolor: "error.light",
|
|
3436
|
+
color: "error.contrastText",
|
|
3437
|
+
border: "1px solid",
|
|
3438
|
+
borderColor: "error.main",
|
|
3439
|
+
fontSize: "0.875rem",
|
|
3440
|
+
fontWeight: 500
|
|
3441
|
+
},
|
|
3442
|
+
children: Ve
|
|
3443
|
+
}),
|
|
3444
|
+
/* @__PURE__ */ U(ae, {
|
|
3445
|
+
container: !0,
|
|
3446
|
+
...s,
|
|
3447
|
+
children: ke.wrows.map((e, t) => /* @__PURE__ */ U(S.Fragment, { children: e.map(Be) }, `row-${t}`))
|
|
3448
|
+
}, `layout-grid-${n}`),
|
|
3449
|
+
ke.worows.length > 0 && /* @__PURE__ */ U(ae, {
|
|
3450
|
+
container: !0,
|
|
3451
|
+
...s,
|
|
3452
|
+
children: ke.worows.map((e, t) => Be(e, t))
|
|
3453
|
+
}, `layout-grid-worows-${n}`),
|
|
3454
|
+
(() => {
|
|
3455
|
+
let t = ie || (re ? { label: re } : null);
|
|
3456
|
+
if (!t || te) return null;
|
|
3457
|
+
let r = ye || !!t.loading, a = t.color, o = !!a && Ji.includes(a), s = o ? a : "primary", c = z(r ? t.loadingLabel || t.label || "Submitting…" : t.label || "Submit");
|
|
3458
|
+
return /* @__PURE__ */ W(N, {
|
|
3459
|
+
sx: (e) => {
|
|
3460
|
+
let n = t.gradient?.[0] || (o && a !== "inherit" ? e.palette[a].main : void 0) || (a && !o ? a : e.palette.primary.main), r = t.gradient ? {
|
|
3461
|
+
background: `linear-gradient(135deg, ${t.gradient[0]}, ${t.gradient[1]})`,
|
|
3462
|
+
color: "#fff",
|
|
3463
|
+
"&:hover": {
|
|
3464
|
+
background: `linear-gradient(135deg, ${t.gradient[0]}, ${t.gradient[1]})`,
|
|
3465
|
+
filter: "brightness(1.06)"
|
|
3466
|
+
}
|
|
3467
|
+
} : a && !o ? {
|
|
3468
|
+
bgcolor: a,
|
|
3469
|
+
color: "#fff",
|
|
3470
|
+
"&:hover": {
|
|
3471
|
+
bgcolor: a,
|
|
3472
|
+
filter: "brightness(1.06)"
|
|
3473
|
+
}
|
|
3474
|
+
} : {};
|
|
3475
|
+
return {
|
|
3476
|
+
display: "flex",
|
|
3477
|
+
justifyContent: "flex-end",
|
|
3478
|
+
alignItems: "center",
|
|
3479
|
+
gap: 1.25,
|
|
3480
|
+
...L ? {
|
|
3481
|
+
position: "sticky",
|
|
3482
|
+
bottom: 0,
|
|
3483
|
+
zIndex: 3,
|
|
3484
|
+
py: 1.5,
|
|
3485
|
+
px: 2,
|
|
3486
|
+
mt: 2,
|
|
3487
|
+
bgcolor: H(e.palette.background.paper, .82),
|
|
3488
|
+
backdropFilter: "blur(10px)",
|
|
3489
|
+
WebkitBackdropFilter: "blur(10px)",
|
|
3490
|
+
borderTop: `1px solid ${e.palette.divider}`,
|
|
3491
|
+
boxShadow: `0 -10px 26px -18px ${H(e.palette.common.black, .5)}`
|
|
3492
|
+
} : {
|
|
3493
|
+
pt: 1,
|
|
3494
|
+
mt: 2.5
|
|
3495
|
+
},
|
|
3496
|
+
"& .dmui-submit": {
|
|
3497
|
+
textTransform: "none",
|
|
3498
|
+
fontWeight: 700,
|
|
3499
|
+
borderRadius: 2.5,
|
|
3500
|
+
px: 3,
|
|
3501
|
+
py: .9,
|
|
3502
|
+
letterSpacing: "0.01em",
|
|
3503
|
+
...(t.variant ?? "contained") === "contained" ? { boxShadow: `0 8px 18px -8px ${H(n, .6)}` } : {},
|
|
3504
|
+
transition: "transform .16s ease, box-shadow .16s ease, filter .16s ease",
|
|
3505
|
+
"&:hover": {
|
|
3506
|
+
transform: "translateY(-1px)",
|
|
3507
|
+
...(t.variant ?? "contained") === "contained" ? { boxShadow: `0 12px 24px -8px ${H(n, .72)}` } : {}
|
|
3508
|
+
},
|
|
3509
|
+
"&:active": { transform: "translateY(0)" },
|
|
3510
|
+
...(t.variant ?? "contained") === "contained" ? r : {}
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3513
|
+
},
|
|
3514
|
+
children: [
|
|
3515
|
+
_e.length > 0 && /* @__PURE__ */ W(V, {
|
|
3516
|
+
variant: "caption",
|
|
3517
|
+
sx: {
|
|
3518
|
+
mr: "auto",
|
|
3519
|
+
display: "flex",
|
|
3520
|
+
alignItems: "center",
|
|
3521
|
+
gap: .5,
|
|
3522
|
+
color: "error.main",
|
|
3523
|
+
fontWeight: 600
|
|
3524
|
+
},
|
|
3525
|
+
children: [/* @__PURE__ */ U(R, {
|
|
3526
|
+
fontSize: "small",
|
|
3527
|
+
children: "error_outline"
|
|
3528
|
+
}), de.errorSummary.replace("{n}", String(_e.length))]
|
|
3529
|
+
}),
|
|
3530
|
+
oe && /* @__PURE__ */ U(P, {
|
|
3531
|
+
variant: "outlined",
|
|
3532
|
+
disabled: r,
|
|
3533
|
+
onClick: () => se?.(),
|
|
3534
|
+
sx: {
|
|
3535
|
+
textTransform: "none",
|
|
3536
|
+
fontWeight: 600,
|
|
3537
|
+
borderRadius: 2.5,
|
|
3538
|
+
px: 2.5,
|
|
3539
|
+
py: .9,
|
|
3540
|
+
borderColor: "divider",
|
|
3541
|
+
color: "text.secondary",
|
|
3542
|
+
"&:hover": {
|
|
3543
|
+
borderColor: "text.disabled",
|
|
3544
|
+
bgcolor: "action.hover"
|
|
3545
|
+
}
|
|
3546
|
+
},
|
|
3547
|
+
children: z(oe)
|
|
3548
|
+
}),
|
|
3549
|
+
/* @__PURE__ */ U(P, {
|
|
3550
|
+
className: "dmui-submit",
|
|
3551
|
+
variant: t.variant || "contained",
|
|
3552
|
+
color: s,
|
|
3553
|
+
disableElevation: !0,
|
|
3554
|
+
fullWidth: t.fullWidth,
|
|
3555
|
+
disabled: r,
|
|
3556
|
+
startIcon: r ? /* @__PURE__ */ U(F, {
|
|
3557
|
+
size: 18,
|
|
3558
|
+
color: "inherit"
|
|
3559
|
+
}) : t.icon ? /* @__PURE__ */ U(R, { children: t.icon }) : void 0,
|
|
3560
|
+
endIcon: !r && t.endIcon ? /* @__PURE__ */ U(R, { children: t.endIcon }) : void 0,
|
|
3561
|
+
onClick: () => Pe(i, e, n),
|
|
3562
|
+
sx: t.sx,
|
|
3563
|
+
children: c
|
|
3564
|
+
})
|
|
3565
|
+
]
|
|
3566
|
+
});
|
|
3567
|
+
})(),
|
|
3568
|
+
/* @__PURE__ */ U("button", {
|
|
3569
|
+
"aria-label": "button",
|
|
3570
|
+
type: "button",
|
|
3571
|
+
ref: r || null,
|
|
3572
|
+
onClick: () => Pe(i, e, n),
|
|
3573
|
+
style: { display: "none" }
|
|
3574
|
+
})
|
|
3575
|
+
] });
|
|
3576
|
+
}
|
|
3577
|
+
// src/ai/mapping.ts
|
|
3578
|
+
var oa = (e) => String(e || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "field", sa = {
|
|
3579
|
+
text: { type: "textfield" },
|
|
3580
|
+
string: { type: "textfield" },
|
|
3581
|
+
textarea: { type: "multitextbox" },
|
|
3582
|
+
longtext: { type: "multitextbox" },
|
|
3583
|
+
email: {
|
|
3584
|
+
type: "textfield",
|
|
3585
|
+
rule: "email",
|
|
3586
|
+
inputType: "email"
|
|
3587
|
+
},
|
|
3588
|
+
number: { type: "numberfield" },
|
|
3589
|
+
integer: { type: "numberfield" },
|
|
3590
|
+
tel: { type: "phone" },
|
|
3591
|
+
phone: { type: "phone" },
|
|
3592
|
+
money: { type: "currency" },
|
|
3593
|
+
currency: { type: "currency" },
|
|
3594
|
+
date: { type: "datetime" },
|
|
3595
|
+
datetime: { type: "datetime" },
|
|
3596
|
+
time: { type: "timepicker" },
|
|
3597
|
+
daterange: { type: "daterangepicker" },
|
|
3598
|
+
dropdown: { type: "select" },
|
|
3599
|
+
select: { type: "select" },
|
|
3600
|
+
multiselect: {
|
|
3601
|
+
type: "select",
|
|
3602
|
+
multiple: !0
|
|
3603
|
+
},
|
|
3604
|
+
radio: { type: "radio" },
|
|
3605
|
+
checkbox: { type: "checkbox" },
|
|
3606
|
+
boolean: { type: "switch" },
|
|
3607
|
+
toggle: { type: "switch" },
|
|
3608
|
+
chips: { type: "chipselect" },
|
|
3609
|
+
tags: { type: "tagsinput" },
|
|
3610
|
+
segmented: { type: "togglebuttons" },
|
|
3611
|
+
rating: { type: "rating" },
|
|
3612
|
+
slider: { type: "slider" },
|
|
3613
|
+
file: { type: "fileupload" },
|
|
3614
|
+
upload: { type: "fileupload" },
|
|
3615
|
+
signature: { type: "signature" },
|
|
3616
|
+
address: { type: "address" },
|
|
3617
|
+
password: { type: "password" },
|
|
3618
|
+
otp: { type: "otp" },
|
|
3619
|
+
color: { type: "colorpicker" },
|
|
3620
|
+
markdown: { type: "markdown" },
|
|
3621
|
+
computed: { type: "computed" },
|
|
3622
|
+
geo: { type: "geo" },
|
|
3623
|
+
location: { type: "locationfield" }
|
|
3624
|
+
}, ca = /* @__PURE__ */ new Set([
|
|
3625
|
+
"select",
|
|
3626
|
+
"chipselect",
|
|
3627
|
+
"togglebuttons",
|
|
3628
|
+
"cascadeselect"
|
|
3629
|
+
]), la = /* @__PURE__ */ new Set([
|
|
3630
|
+
"select",
|
|
3631
|
+
"chipselect",
|
|
3632
|
+
"togglebuttons",
|
|
3633
|
+
"radio",
|
|
3634
|
+
"tagsinput"
|
|
3635
|
+
]), ua = (e) => e === "half" ? 6 : e === "third" ? 4 : 12;
|
|
3636
|
+
function da(e) {
|
|
3637
|
+
return Array.isArray(e) ? e.map((e, t) => {
|
|
3638
|
+
let n = sa[e.type] || { type: e.type || "textfield" }, r = n.type, i = oa(e.id || e.label || `field_${t + 1}`), a = ua(e.width), o = {
|
|
3639
|
+
label: e.label,
|
|
3640
|
+
fullWidth: !0
|
|
3641
|
+
};
|
|
3642
|
+
e.placeholder && (o.placeholder = e.placeholder), e.helperText && (o.helperText = e.helperText), n.inputType && (o.type = n.inputType);
|
|
3643
|
+
let s = !!(e.multiple || n.multiple);
|
|
3644
|
+
s && r === "select" && (o.multiple = !0);
|
|
3645
|
+
let c = {
|
|
3646
|
+
id: i,
|
|
3647
|
+
MuiAttributes: o
|
|
3648
|
+
};
|
|
3649
|
+
e.options && e.options.length && (ca.has(r) ? c.options = e.options.map((e) => ({
|
|
3650
|
+
value: oa(e),
|
|
3651
|
+
label: e
|
|
3652
|
+
})) : r === "radio" && (c.MuiFCLabels = e.options, c.MuiFLabel = e.label)), (r === "chipselect" || r === "togglebuttons") && (c.label = e.label, s && (c.multiple = !0)), r === "computed" && e.formula && (c.formula = e.formula);
|
|
3653
|
+
let l = [];
|
|
3654
|
+
if (e.required) {
|
|
3655
|
+
let t = la.has(r) ? "mandatoryselect" : "mandatory";
|
|
3656
|
+
l.push({
|
|
3657
|
+
rule: t,
|
|
3658
|
+
message: `${e.label || "This field"} is required`
|
|
3659
|
+
});
|
|
3660
|
+
}
|
|
3661
|
+
n.rule && l.push({
|
|
3662
|
+
rule: n.rule,
|
|
3663
|
+
message: `Enter a valid ${e.label || n.rule}`
|
|
3664
|
+
});
|
|
3665
|
+
let u = {
|
|
3666
|
+
type: r,
|
|
3667
|
+
props: c,
|
|
3668
|
+
layout: {
|
|
3669
|
+
row: t + 1,
|
|
3670
|
+
xs: 12,
|
|
3671
|
+
sm: a
|
|
3672
|
+
}
|
|
3673
|
+
};
|
|
3674
|
+
return l.length && (u.rules = { validation: l }), e.formula && (u.formula = e.formula), e.visibleWhen && e.visibleWhen.field && (u.visibleWhen = e.visibleWhen), u;
|
|
3675
|
+
}) : [];
|
|
3676
|
+
}
|
|
3677
|
+
function fa(e) {
|
|
3678
|
+
if (!Array.isArray(e)) return [];
|
|
3679
|
+
let t = [];
|
|
3680
|
+
return e.forEach((e) => {
|
|
3681
|
+
let n = e.props || {}, r = n.MuiAttributes || {}, i = e.id || n.id;
|
|
3682
|
+
if (!i) return;
|
|
3683
|
+
let a;
|
|
3684
|
+
Array.isArray(n.options) && n.options.length ? a = n.options.map((e) => typeof e == "string" ? e : String(e?.value ?? e?.label ?? "")) : Array.isArray(n.MuiFCLabels) && (a = n.MuiFCLabels.map((e) => typeof e == "string" ? e : String(e?.value ?? e?.label ?? ""))), t.push({
|
|
3685
|
+
id: i,
|
|
3686
|
+
label: r.label || n.label || n.MuiFLabel,
|
|
3687
|
+
type: e.type,
|
|
3688
|
+
options: a && a.length ? a : void 0,
|
|
3689
|
+
format: n.format || r.format
|
|
3690
|
+
});
|
|
3691
|
+
}), t;
|
|
3692
|
+
}
|
|
3693
|
+
function pa(e) {
|
|
3694
|
+
return Array.isArray(e) ? e.map((e, t) => {
|
|
3695
|
+
let n = e.props || {}, r = n.MuiAttributes || {}, i = e.id || n.id || `field_${t + 1}`, a = r.label || n.label || n.MuiFLabel || i, o;
|
|
3696
|
+
Array.isArray(n.options) ? o = n.options.map((e) => typeof e == "string" ? e : e.label ?? e.value) : Array.isArray(n.MuiFCLabels) && (o = n.MuiFCLabels.map((e) => typeof e == "string" ? e : e.label ?? e.value));
|
|
3697
|
+
let s = (e.rules?.validation || []).some((e) => e.rule === "mandatory" || e.rule === "mandatoryselect"), c = e.layout?.sm ?? e.layout?.size?.sm, l = c === 6 ? "half" : c === 4 ? "third" : "full", u = {
|
|
3698
|
+
type: e.type || "textfield",
|
|
3699
|
+
id: i,
|
|
3700
|
+
label: a,
|
|
3701
|
+
required: s,
|
|
3702
|
+
width: l
|
|
3703
|
+
};
|
|
3704
|
+
return o && (u.options = o), r.placeholder && (u.placeholder = r.placeholder), r.helperText && (u.helperText = r.helperText), (e.formula || n.formula) && (u.formula = e.formula || n.formula), (n.multiple || r.multiple) && (u.multiple = !0), e.visibleWhen && (u.visibleWhen = e.visibleWhen), u;
|
|
3705
|
+
}) : [];
|
|
3706
|
+
}
|
|
3707
|
+
// src/ai/client.ts
|
|
3708
|
+
var ma = "gpt-4o-mini", ha = /* @__PURE__ */ "textfield.textarea.email.number.phone.currency.password.date.time.daterange.select.radio.checkbox.switch.chipselect.togglebuttons.tags.rating.slider.file.signature.address.color.markdown.otp.computed.geo".split("."), ga = "Each field: {\n \"type\": one of the allowed types,\n \"id\": snake_case string,\n \"label\": string,\n \"required\": boolean (optional),\n \"placeholder\": string (optional),\n \"helperText\": string (optional),\n \"options\": string[] (only for select/radio/chipselect/togglebuttons),\n \"multiple\": boolean (optional),\n \"width\": \"full\" | \"half\" | \"third\" (optional),\n \"formula\": string like \"qty * price\" (only for computed),\n \"visibleWhen\": { \"field\": id, \"op\": \"eq\", \"value\": any } (optional)\n}", _a = (e) => {
|
|
3709
|
+
if (e && typeof e == "object") return e;
|
|
3710
|
+
if (typeof e != "string") return {};
|
|
3711
|
+
try {
|
|
3712
|
+
return JSON.parse(e);
|
|
3713
|
+
} catch {
|
|
3714
|
+
let t = e.match(/\{[\s\S]*\}|\[[\s\S]*\]/);
|
|
3715
|
+
if (t) try {
|
|
3716
|
+
return JSON.parse(t[0]);
|
|
3717
|
+
} catch {}
|
|
3718
|
+
return {};
|
|
3719
|
+
}
|
|
3720
|
+
};
|
|
3721
|
+
function va(e) {
|
|
3722
|
+
if (!e?.endpoint) throw Error("createAIClient: `endpoint` is required. Point it at YOUR backend proxy that holds the OpenAI key — never embed the key in client code.");
|
|
3723
|
+
let t = e.fetchImpl || (typeof fetch < "u" ? fetch : void 0);
|
|
3724
|
+
if (!t) throw Error("createAIClient: no fetch implementation available.");
|
|
3725
|
+
async function n(n) {
|
|
3726
|
+
let r = {
|
|
3727
|
+
model: n.model || e.model || ma,
|
|
3728
|
+
messages: n.messages,
|
|
3729
|
+
temperature: n.temperature ?? .2
|
|
3730
|
+
};
|
|
3731
|
+
n.json && (r.response_format = { type: "json_object" });
|
|
3732
|
+
let i = await t(e.endpoint, {
|
|
3733
|
+
method: "POST",
|
|
3734
|
+
headers: {
|
|
3735
|
+
"Content-Type": "application/json",
|
|
3736
|
+
...e.headers || {}
|
|
3737
|
+
},
|
|
3738
|
+
body: JSON.stringify(r)
|
|
3739
|
+
});
|
|
3740
|
+
if (!i.ok) throw Error(`AI request failed: ${i.status} ${i.statusText}`);
|
|
3741
|
+
let a;
|
|
3742
|
+
try {
|
|
3743
|
+
a = await i.json();
|
|
3744
|
+
} catch {
|
|
3745
|
+
throw Error("AI proxy returned a non-JSON response. Check that your relay endpoint forwards the provider JSON.");
|
|
3746
|
+
}
|
|
3747
|
+
let o = a?.choices?.[0]?.message?.content ?? a?.content ?? a?.result ?? a;
|
|
3748
|
+
return n.json ? _a(o) : typeof o == "string" ? o : String(o ?? "");
|
|
3749
|
+
}
|
|
3750
|
+
async function r(e, t) {
|
|
3751
|
+
let r = await n({
|
|
3752
|
+
json: !0,
|
|
3753
|
+
messages: [{
|
|
3754
|
+
role: "system",
|
|
3755
|
+
content: `You are a form designer. Given a request, output ONLY JSON of the form { "fields": SimpleField[] }. Allowed "type" values: ${(t?.allowedTypes || ha).join(", ")}. ` + ga + " Choose sensible types, ids, labels, required flags and widths. Group related short fields with width \"half\". Do not include markdown or commentary."
|
|
3756
|
+
}, {
|
|
3757
|
+
role: "user",
|
|
3758
|
+
content: e
|
|
3759
|
+
}]
|
|
3760
|
+
});
|
|
3761
|
+
return da(r?.fields || r);
|
|
3762
|
+
}
|
|
3763
|
+
async function i(e, t) {
|
|
3764
|
+
let r = pa(e), i = await n({
|
|
3765
|
+
json: !0,
|
|
3766
|
+
messages: [{
|
|
3767
|
+
role: "system",
|
|
3768
|
+
content: "You edit form schemas. You are given the current fields as JSON and an instruction. Return ONLY JSON { \"fields\": SimpleField[] } for the FULL updated form (not a diff). Preserve unrelated fields and their ids. " + ga
|
|
3769
|
+
}, {
|
|
3770
|
+
role: "user",
|
|
3771
|
+
content: `Current fields:\n${JSON.stringify(r)}\n\nInstruction: ${t}`
|
|
3772
|
+
}]
|
|
3773
|
+
});
|
|
3774
|
+
return da(i?.fields || i);
|
|
3775
|
+
}
|
|
3776
|
+
async function a(e) {
|
|
3777
|
+
let t = pa(e), r = await n({
|
|
3778
|
+
json: !0,
|
|
3779
|
+
messages: [{
|
|
3780
|
+
role: "system",
|
|
3781
|
+
content: "You are a form UX and data-quality reviewer. Review the given fields and return ONLY JSON { \"issues\": Issue[], \"improved\": SimpleField[] }. Issue = { field?: id, kind: \"label\"|\"validation\"|\"logic\"|\"type\"|\"accessibility\"|\"other\", severity: \"info\"|\"suggestion\"|\"warning\", message: string }. \"improved\" is the full form with your fixes applied. " + ga
|
|
3782
|
+
}, {
|
|
3783
|
+
role: "user",
|
|
3784
|
+
content: `Fields:\n${JSON.stringify(t)}`
|
|
3785
|
+
}]
|
|
3786
|
+
});
|
|
3787
|
+
return {
|
|
3788
|
+
issues: Array.isArray(r?.issues) ? r.issues : [],
|
|
3789
|
+
improved: r?.improved ? da(r.improved) : void 0
|
|
3790
|
+
};
|
|
3791
|
+
}
|
|
3792
|
+
async function o(e, t) {
|
|
3793
|
+
let r = await n({
|
|
3794
|
+
json: !0,
|
|
3795
|
+
messages: [{
|
|
3796
|
+
role: "system",
|
|
3797
|
+
content: "Extract structured data from the user text to fill a form. Return ONLY JSON { \"values\": { <fieldId>: value } }. Only include fields you are confident about; omit unknowns. For fields that list `options`, return EXACTLY one of those option values (an array of them when the field is multi-select). For fields with a `format`, format the value accordingly. Otherwise use plain strings/numbers/booleans."
|
|
3798
|
+
}, {
|
|
3799
|
+
role: "user",
|
|
3800
|
+
content: `Fields:\n${JSON.stringify(t)}\n\nText:\n${e}`
|
|
3801
|
+
}]
|
|
3802
|
+
});
|
|
3803
|
+
return r?.values && typeof r.values == "object" ? r.values : r || {};
|
|
3804
|
+
}
|
|
3805
|
+
let s = (e) => (Array.isArray(e) ? e : [e]).filter(Boolean).map((e) => ({
|
|
3806
|
+
type: "image_url",
|
|
3807
|
+
image_url: { url: e }
|
|
3808
|
+
}));
|
|
3809
|
+
async function c(e, t, r) {
|
|
3810
|
+
let i = await n({
|
|
3811
|
+
json: !0,
|
|
3812
|
+
messages: [{
|
|
3813
|
+
role: "system",
|
|
3814
|
+
content: `You digitize documents into forms. Look at the image(s) and output ONLY JSON { "fields": SimpleField[] } that reproduces the form/fields shown. Allowed "type" values: ${(r?.allowedTypes || ha).join(", ")}. ` + ga
|
|
3815
|
+
}, {
|
|
3816
|
+
role: "user",
|
|
3817
|
+
content: [{
|
|
3818
|
+
type: "text",
|
|
3819
|
+
text: t || "Recreate this form as fields."
|
|
3820
|
+
}, ...s(e)]
|
|
3821
|
+
}]
|
|
3822
|
+
});
|
|
3823
|
+
return da(i?.fields || i);
|
|
3824
|
+
}
|
|
3825
|
+
async function l(e, t) {
|
|
3826
|
+
let r = await n({
|
|
3827
|
+
json: !0,
|
|
3828
|
+
messages: [{
|
|
3829
|
+
role: "system",
|
|
3830
|
+
content: "Extract structured data from the document image(s) to fill a form. Return ONLY JSON { \"values\": { <fieldId>: value } }. Only include fields you are confident about; omit unknowns. For fields that list `options`, return EXACTLY one of those option values; honor any `format` given."
|
|
3831
|
+
}, {
|
|
3832
|
+
role: "user",
|
|
3833
|
+
content: [{
|
|
3834
|
+
type: "text",
|
|
3835
|
+
text: `Fields:\n${JSON.stringify(t)}`
|
|
3836
|
+
}, ...s(e)]
|
|
3837
|
+
}]
|
|
3838
|
+
});
|
|
3839
|
+
return r?.values && typeof r.values == "object" ? r.values : r || {};
|
|
3840
|
+
}
|
|
3841
|
+
async function u(e, t, r) {
|
|
3842
|
+
return n({
|
|
3843
|
+
temperature: .4,
|
|
3844
|
+
messages: [{
|
|
3845
|
+
role: "system",
|
|
3846
|
+
content: `${{
|
|
3847
|
+
improve: "Improve the clarity and flow of the text while preserving meaning.",
|
|
3848
|
+
summarize: "Summarize the text concisely.",
|
|
3849
|
+
expand: "Expand the text with more helpful detail.",
|
|
3850
|
+
shorten: "Make the text shorter and tighter.",
|
|
3851
|
+
"fix-grammar": "Fix spelling and grammar. Keep the wording otherwise unchanged.",
|
|
3852
|
+
professional: "Rewrite the text in a professional, polished tone.",
|
|
3853
|
+
translate: `Translate the text into ${r || "English"}.`
|
|
3854
|
+
}[t]} Return ONLY the resulting text, no preamble.`
|
|
3855
|
+
}, {
|
|
3856
|
+
role: "user",
|
|
3857
|
+
content: e
|
|
3858
|
+
}]
|
|
3859
|
+
});
|
|
3860
|
+
}
|
|
3861
|
+
return {
|
|
3862
|
+
chat: n,
|
|
3863
|
+
generateForm: r,
|
|
3864
|
+
editForm: i,
|
|
3865
|
+
reviewForm: a,
|
|
3866
|
+
extractToFields: o,
|
|
3867
|
+
assistText: u,
|
|
3868
|
+
generateFormFromImage: c,
|
|
3869
|
+
extractFromImage: l
|
|
3870
|
+
};
|
|
3871
|
+
}
|
|
3872
|
+
// src/ai/react/AIFormGenerator.tsx
|
|
3873
|
+
function ya({ client: e, current: t, onGenerate: n, placeholder: r, label: i }) {
|
|
3874
|
+
let [a, o] = M(""), [s, c] = M(!1), [l, u] = M(null), d = Array.isArray(t) && t.length > 0, f = d ? "Apply edit" : "Generate form";
|
|
3875
|
+
return /* @__PURE__ */ U(N, {
|
|
3876
|
+
sx: {
|
|
3877
|
+
p: 2.5,
|
|
3878
|
+
borderRadius: 3,
|
|
3879
|
+
border: "1px solid",
|
|
3880
|
+
borderColor: "divider",
|
|
3881
|
+
bgcolor: "background.paper",
|
|
3882
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.06)"
|
|
3883
|
+
},
|
|
3884
|
+
children: /* @__PURE__ */ W(B, {
|
|
3885
|
+
spacing: 2,
|
|
3886
|
+
children: [
|
|
3887
|
+
/* @__PURE__ */ U(pe, {
|
|
3888
|
+
label: i ?? "Describe your form",
|
|
3889
|
+
placeholder: r ?? (d ? "e.g. Add a phone number field and make email required" : "e.g. A contact form with name, email and message"),
|
|
3890
|
+
value: a,
|
|
3891
|
+
onChange: (e) => o(e.target.value),
|
|
3892
|
+
multiline: !0,
|
|
3893
|
+
minRows: 3,
|
|
3894
|
+
fullWidth: !0,
|
|
3895
|
+
disabled: s,
|
|
3896
|
+
slotProps: { input: { sx: { borderRadius: 2 } } }
|
|
3897
|
+
}),
|
|
3898
|
+
l && /* @__PURE__ */ U(te, {
|
|
3899
|
+
severity: "error",
|
|
3900
|
+
onClose: () => u(null),
|
|
3901
|
+
sx: { borderRadius: 2 },
|
|
3902
|
+
children: l
|
|
3903
|
+
}),
|
|
3904
|
+
/* @__PURE__ */ U(N, {
|
|
3905
|
+
sx: {
|
|
3906
|
+
display: "flex",
|
|
3907
|
+
justifyContent: "flex-end"
|
|
3908
|
+
},
|
|
3909
|
+
children: /* @__PURE__ */ U(P, {
|
|
3910
|
+
variant: "contained",
|
|
3911
|
+
onClick: async () => {
|
|
3912
|
+
let r = a.trim();
|
|
3913
|
+
if (r && !s) {
|
|
3914
|
+
c(!0), u(null);
|
|
3915
|
+
try {
|
|
3916
|
+
n(d ? await e.editForm(t, r) : await e.generateForm(r));
|
|
3917
|
+
} catch (e) {
|
|
3918
|
+
u(e instanceof Error ? e.message : String(e));
|
|
3919
|
+
} finally {
|
|
3920
|
+
c(!1);
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
},
|
|
3924
|
+
disabled: s || !a.trim(),
|
|
3925
|
+
startIcon: s ? /* @__PURE__ */ U(F, {
|
|
3926
|
+
size: 18,
|
|
3927
|
+
color: "inherit"
|
|
3928
|
+
}) : void 0,
|
|
3929
|
+
sx: {
|
|
3930
|
+
borderRadius: 2,
|
|
3931
|
+
textTransform: "none",
|
|
3932
|
+
px: 3,
|
|
3933
|
+
py: 1,
|
|
3934
|
+
fontWeight: 600
|
|
3935
|
+
},
|
|
3936
|
+
children: f
|
|
3937
|
+
})
|
|
3938
|
+
})
|
|
3939
|
+
]
|
|
3940
|
+
})
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
// src/ai/react/AIFill.tsx
|
|
3944
|
+
var ba = ({ client: e, schema: t, fields: n, onFill: r, placeholder: i = "Paste any text here (an email, a note, an address…) and let AI fill the form.", label: a = "Paste text to autofill" }) => {
|
|
3945
|
+
let [o, s] = M(""), [c, l] = M(!1), [u, d] = M(null), f = n ?? (t ? fa(t) : []);
|
|
3946
|
+
return /* @__PURE__ */ W(N, {
|
|
3947
|
+
sx: {
|
|
3948
|
+
display: "flex",
|
|
3949
|
+
flexDirection: "column",
|
|
3950
|
+
gap: 1.5
|
|
3951
|
+
},
|
|
3952
|
+
children: [
|
|
3953
|
+
/* @__PURE__ */ U(pe, {
|
|
3954
|
+
value: o,
|
|
3955
|
+
onChange: (e) => s(e.target.value),
|
|
3956
|
+
label: a,
|
|
3957
|
+
placeholder: i,
|
|
3958
|
+
multiline: !0,
|
|
3959
|
+
minRows: 4,
|
|
3960
|
+
fullWidth: !0,
|
|
3961
|
+
disabled: c,
|
|
3962
|
+
sx: { "& .MuiOutlinedInput-root": { borderRadius: 2 } },
|
|
3963
|
+
slotProps: { htmlInput: { "aria-label": a } }
|
|
3964
|
+
}),
|
|
3965
|
+
u && /* @__PURE__ */ U(te, {
|
|
3966
|
+
severity: "error",
|
|
3967
|
+
onClose: () => d(null),
|
|
3968
|
+
children: u
|
|
3969
|
+
}),
|
|
3970
|
+
/* @__PURE__ */ U(B, {
|
|
3971
|
+
direction: "row",
|
|
3972
|
+
sx: { justifyContent: "flex-end" },
|
|
3973
|
+
children: /* @__PURE__ */ U(P, {
|
|
3974
|
+
variant: "contained",
|
|
3975
|
+
onClick: async () => {
|
|
3976
|
+
l(!0), d(null);
|
|
3977
|
+
try {
|
|
3978
|
+
r(await e.extractToFields(o, f) ?? {});
|
|
3979
|
+
} catch (e) {
|
|
3980
|
+
d(e?.message || "Failed to extract values from the text.");
|
|
3981
|
+
} finally {
|
|
3982
|
+
l(!1);
|
|
3983
|
+
}
|
|
3984
|
+
},
|
|
3985
|
+
disabled: c,
|
|
3986
|
+
startIcon: c ? /* @__PURE__ */ U(F, {
|
|
3987
|
+
size: 18,
|
|
3988
|
+
color: "inherit"
|
|
3989
|
+
}) : /* @__PURE__ */ U(Qe, {}),
|
|
3990
|
+
sx: {
|
|
3991
|
+
borderRadius: 2,
|
|
3992
|
+
textTransform: "none",
|
|
3993
|
+
fontWeight: 600,
|
|
3994
|
+
px: 2.5
|
|
3995
|
+
},
|
|
3996
|
+
children: c ? "Autofilling…" : "Autofill from text"
|
|
3997
|
+
})
|
|
3998
|
+
})
|
|
3999
|
+
]
|
|
4000
|
+
});
|
|
4001
|
+
};
|
|
4002
|
+
// src/ai/react/AITextAssist.tsx
|
|
4003
|
+
function xa(e) {
|
|
4004
|
+
let [t, n] = M(!1), [r, i] = M(null);
|
|
4005
|
+
return {
|
|
4006
|
+
run: T(async (t, r, a) => {
|
|
4007
|
+
n(!0), i(null);
|
|
4008
|
+
try {
|
|
4009
|
+
return await e.assistText(t, r, a);
|
|
4010
|
+
} catch (e) {
|
|
4011
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
4012
|
+
throw i(t), e;
|
|
4013
|
+
} finally {
|
|
4014
|
+
n(!1);
|
|
4015
|
+
}
|
|
4016
|
+
}, [e]),
|
|
4017
|
+
loading: t,
|
|
4018
|
+
error: r
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
var Sa = {
|
|
4022
|
+
improve: {
|
|
4023
|
+
label: "Improve writing",
|
|
4024
|
+
icon: /* @__PURE__ */ U($e, { fontSize: "small" })
|
|
4025
|
+
},
|
|
4026
|
+
summarize: {
|
|
4027
|
+
label: "Summarize",
|
|
4028
|
+
icon: /* @__PURE__ */ U(tt, { fontSize: "small" })
|
|
4029
|
+
},
|
|
4030
|
+
expand: {
|
|
4031
|
+
label: "Expand",
|
|
4032
|
+
icon: /* @__PURE__ */ U(nt, { fontSize: "small" })
|
|
4033
|
+
},
|
|
4034
|
+
shorten: {
|
|
4035
|
+
label: "Make shorter",
|
|
4036
|
+
icon: /* @__PURE__ */ U(et, { fontSize: "small" })
|
|
4037
|
+
},
|
|
4038
|
+
"fix-grammar": {
|
|
4039
|
+
label: "Fix spelling & grammar",
|
|
4040
|
+
icon: /* @__PURE__ */ U(rt, { fontSize: "small" })
|
|
4041
|
+
},
|
|
4042
|
+
professional: {
|
|
4043
|
+
label: "Make professional",
|
|
4044
|
+
icon: /* @__PURE__ */ U(it, { fontSize: "small" })
|
|
4045
|
+
},
|
|
4046
|
+
translate: {
|
|
4047
|
+
label: "Translate",
|
|
4048
|
+
icon: /* @__PURE__ */ U(at, { fontSize: "small" })
|
|
4049
|
+
}
|
|
4050
|
+
}, Ca = [
|
|
4051
|
+
"improve",
|
|
4052
|
+
"summarize",
|
|
4053
|
+
"expand",
|
|
4054
|
+
"shorten",
|
|
4055
|
+
"fix-grammar",
|
|
4056
|
+
"professional",
|
|
4057
|
+
"translate"
|
|
4058
|
+
];
|
|
4059
|
+
function wa({ client: e, text: t, actions: n = Ca, onResult: r, targetLanguage: i, size: a = "medium" }) {
|
|
4060
|
+
let { run: o, loading: s } = xa(e), [c, l] = M(null), u = !!c, d = (e) => {
|
|
4061
|
+
l(e.currentTarget);
|
|
4062
|
+
}, f = () => {
|
|
4063
|
+
l(null);
|
|
4064
|
+
}, p = async (e) => {
|
|
4065
|
+
l(null);
|
|
4066
|
+
try {
|
|
4067
|
+
r(await o(t, e, i));
|
|
4068
|
+
} catch {}
|
|
4069
|
+
};
|
|
4070
|
+
return /* @__PURE__ */ W(ve, { children: [/* @__PURE__ */ U(me, {
|
|
4071
|
+
title: "AI assist",
|
|
4072
|
+
children: /* @__PURE__ */ U("span", { children: /* @__PURE__ */ U(oe, {
|
|
4073
|
+
"aria-label": "AI assist",
|
|
4074
|
+
"aria-haspopup": "menu",
|
|
4075
|
+
"aria-expanded": u ? "true" : void 0,
|
|
4076
|
+
onClick: d,
|
|
4077
|
+
disabled: s,
|
|
4078
|
+
size: a,
|
|
4079
|
+
sx: {
|
|
4080
|
+
color: "primary.main",
|
|
4081
|
+
borderRadius: 2,
|
|
4082
|
+
transition: "background-color 120ms ease",
|
|
4083
|
+
"&:hover": { bgcolor: "action.hover" }
|
|
4084
|
+
},
|
|
4085
|
+
children: s ? /* @__PURE__ */ U(F, {
|
|
4086
|
+
size: a === "small" ? 16 : 20,
|
|
4087
|
+
color: "inherit"
|
|
4088
|
+
}) : /* @__PURE__ */ U(Qe, { fontSize: a === "small" ? "small" : "medium" })
|
|
4089
|
+
}) })
|
|
4090
|
+
}), /* @__PURE__ */ U(de, {
|
|
4091
|
+
anchorEl: c,
|
|
4092
|
+
open: u,
|
|
4093
|
+
onClose: f,
|
|
4094
|
+
anchorOrigin: {
|
|
4095
|
+
vertical: "bottom",
|
|
4096
|
+
horizontal: "left"
|
|
4097
|
+
},
|
|
4098
|
+
transformOrigin: {
|
|
4099
|
+
vertical: "top",
|
|
4100
|
+
horizontal: "left"
|
|
4101
|
+
},
|
|
4102
|
+
slotProps: { paper: {
|
|
4103
|
+
elevation: 3,
|
|
4104
|
+
sx: {
|
|
4105
|
+
mt: .5,
|
|
4106
|
+
minWidth: 220,
|
|
4107
|
+
borderRadius: 2,
|
|
4108
|
+
border: "1px solid",
|
|
4109
|
+
borderColor: "divider",
|
|
4110
|
+
overflow: "hidden"
|
|
4111
|
+
}
|
|
4112
|
+
} },
|
|
4113
|
+
children: n.map((e) => {
|
|
4114
|
+
let t = Sa[e];
|
|
4115
|
+
return /* @__PURE__ */ W(fe, {
|
|
4116
|
+
onClick: () => p(e),
|
|
4117
|
+
sx: {
|
|
4118
|
+
py: 1,
|
|
4119
|
+
px: 1.5,
|
|
4120
|
+
gap: .5
|
|
4121
|
+
},
|
|
4122
|
+
children: [/* @__PURE__ */ U(z, {
|
|
4123
|
+
sx: {
|
|
4124
|
+
color: "primary.main",
|
|
4125
|
+
minWidth: 32
|
|
4126
|
+
},
|
|
4127
|
+
children: t?.icon ?? /* @__PURE__ */ U($e, { fontSize: "small" })
|
|
4128
|
+
}), /* @__PURE__ */ U(ue, {
|
|
4129
|
+
primary: t?.label ?? e,
|
|
4130
|
+
slotProps: { primary: { sx: {
|
|
4131
|
+
fontSize: 14,
|
|
4132
|
+
fontWeight: 500
|
|
4133
|
+
} } }
|
|
4134
|
+
})]
|
|
4135
|
+
}, e);
|
|
4136
|
+
})
|
|
4137
|
+
})] });
|
|
4138
|
+
}
|
|
4139
|
+
// src/ai/react/AISchemaReview.tsx
|
|
4140
|
+
var Ta = {
|
|
4141
|
+
warning: "warning",
|
|
4142
|
+
suggestion: "info",
|
|
4143
|
+
info: "default"
|
|
4144
|
+
};
|
|
4145
|
+
function Ea({ client: e, schema: t, onApply: n, buttonLabel: r }) {
|
|
4146
|
+
let [i, a] = M(!1), [o, s] = M(null), [c, l] = M(null), u = async () => {
|
|
4147
|
+
if (!i) {
|
|
4148
|
+
a(!0), s(null);
|
|
4149
|
+
try {
|
|
4150
|
+
let n = await e.reviewForm(t);
|
|
4151
|
+
l(n);
|
|
4152
|
+
} catch (e) {
|
|
4153
|
+
s(e instanceof Error ? e.message : String(e));
|
|
4154
|
+
} finally {
|
|
4155
|
+
a(!1);
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
}, d = !!c?.improved && !!n;
|
|
4159
|
+
return /* @__PURE__ */ U(N, {
|
|
4160
|
+
sx: {
|
|
4161
|
+
p: 2.5,
|
|
4162
|
+
borderRadius: 3,
|
|
4163
|
+
border: "1px solid",
|
|
4164
|
+
borderColor: "divider",
|
|
4165
|
+
bgcolor: "background.paper",
|
|
4166
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.06)"
|
|
4167
|
+
},
|
|
4168
|
+
children: /* @__PURE__ */ W(B, {
|
|
4169
|
+
spacing: 2,
|
|
4170
|
+
children: [
|
|
4171
|
+
/* @__PURE__ */ U(N, {
|
|
4172
|
+
sx: {
|
|
4173
|
+
display: "flex",
|
|
4174
|
+
justifyContent: "flex-end",
|
|
4175
|
+
gap: 1.5
|
|
4176
|
+
},
|
|
4177
|
+
children: /* @__PURE__ */ U(P, {
|
|
4178
|
+
variant: "contained",
|
|
4179
|
+
onClick: u,
|
|
4180
|
+
disabled: i,
|
|
4181
|
+
startIcon: i ? /* @__PURE__ */ U(F, {
|
|
4182
|
+
size: 18,
|
|
4183
|
+
color: "inherit"
|
|
4184
|
+
}) : void 0,
|
|
4185
|
+
sx: {
|
|
4186
|
+
borderRadius: 2,
|
|
4187
|
+
textTransform: "none",
|
|
4188
|
+
px: 3,
|
|
4189
|
+
py: 1,
|
|
4190
|
+
fontWeight: 600
|
|
4191
|
+
},
|
|
4192
|
+
children: r ?? "Review with AI"
|
|
4193
|
+
})
|
|
4194
|
+
}),
|
|
4195
|
+
o && /* @__PURE__ */ U(te, {
|
|
4196
|
+
severity: "error",
|
|
4197
|
+
onClose: () => s(null),
|
|
4198
|
+
sx: { borderRadius: 2 },
|
|
4199
|
+
children: o
|
|
4200
|
+
}),
|
|
4201
|
+
c && c.issues.length === 0 && /* @__PURE__ */ U(te, {
|
|
4202
|
+
severity: "success",
|
|
4203
|
+
sx: { borderRadius: 2 },
|
|
4204
|
+
children: "No issues found"
|
|
4205
|
+
}),
|
|
4206
|
+
c && c.issues.length > 0 && /* @__PURE__ */ U(ce, {
|
|
4207
|
+
disablePadding: !0,
|
|
4208
|
+
sx: {
|
|
4209
|
+
display: "flex",
|
|
4210
|
+
flexDirection: "column",
|
|
4211
|
+
gap: 1
|
|
4212
|
+
},
|
|
4213
|
+
children: c.issues.map((e, t) => /* @__PURE__ */ U(le, {
|
|
4214
|
+
alignItems: "flex-start",
|
|
4215
|
+
sx: {
|
|
4216
|
+
p: 1.5,
|
|
4217
|
+
borderRadius: 2,
|
|
4218
|
+
border: "1px solid",
|
|
4219
|
+
borderColor: "divider",
|
|
4220
|
+
bgcolor: "action.hover"
|
|
4221
|
+
},
|
|
4222
|
+
children: /* @__PURE__ */ W(B, {
|
|
4223
|
+
spacing: .75,
|
|
4224
|
+
sx: { width: "100%" },
|
|
4225
|
+
children: [/* @__PURE__ */ W(N, {
|
|
4226
|
+
sx: {
|
|
4227
|
+
display: "flex",
|
|
4228
|
+
alignItems: "center",
|
|
4229
|
+
flexWrap: "wrap",
|
|
4230
|
+
gap: .75
|
|
4231
|
+
},
|
|
4232
|
+
children: [
|
|
4233
|
+
/* @__PURE__ */ U(ne, {
|
|
4234
|
+
size: "small",
|
|
4235
|
+
label: e.severity,
|
|
4236
|
+
color: Ta[e.severity],
|
|
4237
|
+
sx: {
|
|
4238
|
+
textTransform: "capitalize",
|
|
4239
|
+
fontWeight: 600
|
|
4240
|
+
}
|
|
4241
|
+
}),
|
|
4242
|
+
/* @__PURE__ */ U(ne, {
|
|
4243
|
+
size: "small",
|
|
4244
|
+
variant: "outlined",
|
|
4245
|
+
label: e.kind,
|
|
4246
|
+
sx: { textTransform: "capitalize" }
|
|
4247
|
+
}),
|
|
4248
|
+
e.field && /* @__PURE__ */ U(V, {
|
|
4249
|
+
variant: "caption",
|
|
4250
|
+
sx: {
|
|
4251
|
+
fontFamily: "monospace",
|
|
4252
|
+
color: "text.secondary"
|
|
4253
|
+
},
|
|
4254
|
+
children: e.field
|
|
4255
|
+
})
|
|
4256
|
+
]
|
|
4257
|
+
}), /* @__PURE__ */ U(V, {
|
|
4258
|
+
variant: "body2",
|
|
4259
|
+
children: e.message
|
|
4260
|
+
})]
|
|
4261
|
+
})
|
|
4262
|
+
}, t))
|
|
4263
|
+
}),
|
|
4264
|
+
d && /* @__PURE__ */ U(N, {
|
|
4265
|
+
sx: {
|
|
4266
|
+
display: "flex",
|
|
4267
|
+
justifyContent: "flex-end"
|
|
4268
|
+
},
|
|
4269
|
+
children: /* @__PURE__ */ U(P, {
|
|
4270
|
+
variant: "outlined",
|
|
4271
|
+
onClick: () => n(c.improved),
|
|
4272
|
+
sx: {
|
|
4273
|
+
borderRadius: 2,
|
|
4274
|
+
textTransform: "none",
|
|
4275
|
+
px: 3,
|
|
4276
|
+
py: 1,
|
|
4277
|
+
fontWeight: 600
|
|
4278
|
+
},
|
|
4279
|
+
children: "Apply improvements"
|
|
4280
|
+
})
|
|
4281
|
+
})
|
|
4282
|
+
]
|
|
4283
|
+
})
|
|
4284
|
+
});
|
|
4285
|
+
}
|
|
4286
|
+
// src/ai/react/AIVisionImport.tsx
|
|
4287
|
+
var Da = (e) => new Promise((t, n) => {
|
|
4288
|
+
let r = new FileReader();
|
|
4289
|
+
r.onload = () => t(String(r.result || "")), r.onerror = () => n(r.error), r.readAsDataURL(e);
|
|
4290
|
+
}), Oa = (e, t) => t || (e || []).map((e) => ({
|
|
4291
|
+
id: e.id || e.props?.id,
|
|
4292
|
+
label: e.props?.MuiAttributes?.label,
|
|
4293
|
+
type: e.type
|
|
4294
|
+
})).filter((e) => !!e.id);
|
|
4295
|
+
function ka({ client: e, mode: t = "generate", schema: n, fields: r, onGenerate: i, onFill: a, label: o, accept: s = "image/*" }) {
|
|
4296
|
+
let c = S.useRef(null), [l, u] = S.useState(""), [d, f] = S.useState(""), [p, m] = S.useState(!1), [h, g] = S.useState(null), _ = async (e) => {
|
|
4297
|
+
let t = e.target.files?.[0];
|
|
4298
|
+
if (t) {
|
|
4299
|
+
g(null);
|
|
4300
|
+
try {
|
|
4301
|
+
u(await Da(t)), f(t.name);
|
|
4302
|
+
} catch {
|
|
4303
|
+
g("Could not read the file.");
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
}, v = async () => {
|
|
4307
|
+
if (l) {
|
|
4308
|
+
m(!0), g(null);
|
|
4309
|
+
try {
|
|
4310
|
+
if (t === "fill") {
|
|
4311
|
+
let t = await e.extractFromImage(l, Oa(n, r));
|
|
4312
|
+
a?.(t || {});
|
|
4313
|
+
} else {
|
|
4314
|
+
let t = await e.generateFormFromImage(l);
|
|
4315
|
+
i?.(t || []);
|
|
4316
|
+
}
|
|
4317
|
+
} catch (e) {
|
|
4318
|
+
g(e?.message || "AI request failed.");
|
|
4319
|
+
} finally {
|
|
4320
|
+
m(!1);
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
}, y = o || (t === "fill" ? "Read document into form" : "Build form from image");
|
|
4324
|
+
return /* @__PURE__ */ U(J, {
|
|
4325
|
+
sx: {
|
|
4326
|
+
p: 2,
|
|
4327
|
+
border: "1px solid",
|
|
4328
|
+
borderColor: "divider",
|
|
4329
|
+
borderRadius: 2.5,
|
|
4330
|
+
bgcolor: "background.paper"
|
|
4331
|
+
},
|
|
4332
|
+
children: /* @__PURE__ */ W(ze, {
|
|
4333
|
+
spacing: 1.5,
|
|
4334
|
+
children: [
|
|
4335
|
+
/* @__PURE__ */ U("input", {
|
|
4336
|
+
ref: c,
|
|
4337
|
+
type: "file",
|
|
4338
|
+
accept: s,
|
|
4339
|
+
onChange: _,
|
|
4340
|
+
style: { display: "none" },
|
|
4341
|
+
"aria-label": "vision-file"
|
|
4342
|
+
}),
|
|
4343
|
+
/* @__PURE__ */ U(Ae, {
|
|
4344
|
+
variant: "outlined",
|
|
4345
|
+
startIcon: /* @__PURE__ */ U(st, {}),
|
|
4346
|
+
onClick: () => c.current?.click(),
|
|
4347
|
+
sx: {
|
|
4348
|
+
borderRadius: 2,
|
|
4349
|
+
textTransform: "none"
|
|
4350
|
+
},
|
|
4351
|
+
children: d || "Choose image / document"
|
|
4352
|
+
}),
|
|
4353
|
+
l && s.includes("image") ? /* @__PURE__ */ U(J, {
|
|
4354
|
+
component: "img",
|
|
4355
|
+
src: l,
|
|
4356
|
+
alt: "preview",
|
|
4357
|
+
sx: {
|
|
4358
|
+
maxHeight: 160,
|
|
4359
|
+
maxWidth: "100%",
|
|
4360
|
+
borderRadius: 1.5,
|
|
4361
|
+
objectFit: "contain",
|
|
4362
|
+
border: "1px solid",
|
|
4363
|
+
borderColor: "divider"
|
|
4364
|
+
}
|
|
4365
|
+
}) : null,
|
|
4366
|
+
/* @__PURE__ */ U(Ae, {
|
|
4367
|
+
variant: "contained",
|
|
4368
|
+
onClick: v,
|
|
4369
|
+
disabled: !l || p,
|
|
4370
|
+
startIcon: p ? /* @__PURE__ */ U(ot, {
|
|
4371
|
+
size: 16,
|
|
4372
|
+
color: "inherit"
|
|
4373
|
+
}) : /* @__PURE__ */ U(Qe, {}),
|
|
4374
|
+
sx: {
|
|
4375
|
+
borderRadius: 2,
|
|
4376
|
+
textTransform: "none",
|
|
4377
|
+
fontWeight: 600,
|
|
4378
|
+
alignSelf: "flex-start"
|
|
4379
|
+
},
|
|
4380
|
+
children: y
|
|
4381
|
+
}),
|
|
4382
|
+
h ? /* @__PURE__ */ U(Me, {
|
|
4383
|
+
severity: "error",
|
|
4384
|
+
children: h
|
|
4385
|
+
}) : null,
|
|
4386
|
+
/* @__PURE__ */ U(_e, {
|
|
4387
|
+
variant: "caption",
|
|
4388
|
+
sx: { color: "text.secondary" },
|
|
4389
|
+
children: "Image is sent to your AI proxy for one-time processing."
|
|
4390
|
+
})
|
|
4391
|
+
]
|
|
4392
|
+
})
|
|
4393
|
+
});
|
|
4394
|
+
}
|
|
4395
|
+
// src/ai/react/AIForm.tsx
|
|
4396
|
+
function Aa({ client: e, data: t, guid: n, patch: r, onSubmit: i, onChange: a, onSchemaChange: o, enableFill: s = !0, enableReview: c = !0, enableGenerate: l = !1, formRef: u, formProps: d }) {
|
|
4397
|
+
let [f, p] = S.useState(t), [m, h] = S.useState(r || {}), [g, _] = S.useState(null);
|
|
4398
|
+
S.useEffect(() => {
|
|
4399
|
+
p(t);
|
|
4400
|
+
}, [t]), S.useEffect(() => {
|
|
4401
|
+
r && h((e) => ({
|
|
4402
|
+
...e,
|
|
4403
|
+
...r
|
|
4404
|
+
}));
|
|
4405
|
+
}, [r]);
|
|
4406
|
+
let v = (e) => {
|
|
4407
|
+
e && e.length && (p(e), o?.(e), _(null));
|
|
4408
|
+
}, y = (e) => {
|
|
4409
|
+
h((t) => ({
|
|
4410
|
+
...t,
|
|
4411
|
+
...e || {}
|
|
4412
|
+
})), _(null);
|
|
4413
|
+
}, b = () => _(null);
|
|
4414
|
+
return /* @__PURE__ */ W(N, { children: [
|
|
4415
|
+
/* @__PURE__ */ W(B, {
|
|
4416
|
+
direction: "row",
|
|
4417
|
+
spacing: 1,
|
|
4418
|
+
sx: {
|
|
4419
|
+
mb: 1.5,
|
|
4420
|
+
flexWrap: "wrap"
|
|
4421
|
+
},
|
|
4422
|
+
children: [
|
|
4423
|
+
l && /* @__PURE__ */ U(P, {
|
|
4424
|
+
size: "small",
|
|
4425
|
+
variant: "outlined",
|
|
4426
|
+
startIcon: /* @__PURE__ */ U(R, { children: "auto_awesome" }),
|
|
4427
|
+
onClick: () => _("generate"),
|
|
4428
|
+
sx: {
|
|
4429
|
+
borderRadius: 2,
|
|
4430
|
+
textTransform: "none"
|
|
4431
|
+
},
|
|
4432
|
+
children: f.length ? "Edit with AI" : "Generate with AI"
|
|
4433
|
+
}),
|
|
4434
|
+
s && !!f.length && /* @__PURE__ */ U(P, {
|
|
4435
|
+
size: "small",
|
|
4436
|
+
variant: "outlined",
|
|
4437
|
+
color: "secondary",
|
|
4438
|
+
startIcon: /* @__PURE__ */ U(R, { children: "auto_fix_high" }),
|
|
4439
|
+
onClick: () => _("fill"),
|
|
4440
|
+
sx: {
|
|
4441
|
+
borderRadius: 2,
|
|
4442
|
+
textTransform: "none"
|
|
4443
|
+
},
|
|
4444
|
+
children: "AI Fill"
|
|
4445
|
+
}),
|
|
4446
|
+
c && !!f.length && /* @__PURE__ */ U(P, {
|
|
4447
|
+
size: "small",
|
|
4448
|
+
variant: "outlined",
|
|
4449
|
+
startIcon: /* @__PURE__ */ U(R, { children: "fact_check" }),
|
|
4450
|
+
onClick: () => _("review"),
|
|
4451
|
+
sx: {
|
|
4452
|
+
borderRadius: 2,
|
|
4453
|
+
textTransform: "none"
|
|
4454
|
+
},
|
|
4455
|
+
children: "Review"
|
|
4456
|
+
})
|
|
4457
|
+
]
|
|
4458
|
+
}),
|
|
4459
|
+
/* @__PURE__ */ U(aa, {
|
|
4460
|
+
...d,
|
|
4461
|
+
guid: n,
|
|
4462
|
+
data: f,
|
|
4463
|
+
patch: m,
|
|
4464
|
+
onSubmit: i,
|
|
4465
|
+
onChange: a,
|
|
4466
|
+
formRef: u
|
|
4467
|
+
}),
|
|
4468
|
+
/* @__PURE__ */ W(I, {
|
|
4469
|
+
open: g === "generate",
|
|
4470
|
+
onClose: b,
|
|
4471
|
+
maxWidth: "sm",
|
|
4472
|
+
fullWidth: !0,
|
|
4473
|
+
children: [
|
|
4474
|
+
/* @__PURE__ */ U(L, { children: f.length ? "Edit form with AI" : "Generate form with AI" }),
|
|
4475
|
+
/* @__PURE__ */ U(ie, {
|
|
4476
|
+
dividers: !0,
|
|
4477
|
+
children: /* @__PURE__ */ U(ya, {
|
|
4478
|
+
client: e,
|
|
4479
|
+
current: f.length ? f : void 0,
|
|
4480
|
+
onGenerate: v
|
|
4481
|
+
})
|
|
4482
|
+
}),
|
|
4483
|
+
/* @__PURE__ */ U(re, { children: /* @__PURE__ */ U(P, {
|
|
4484
|
+
onClick: b,
|
|
4485
|
+
children: "Close"
|
|
4486
|
+
}) })
|
|
4487
|
+
]
|
|
4488
|
+
}),
|
|
4489
|
+
/* @__PURE__ */ W(I, {
|
|
4490
|
+
open: g === "fill",
|
|
4491
|
+
onClose: b,
|
|
4492
|
+
maxWidth: "sm",
|
|
4493
|
+
fullWidth: !0,
|
|
4494
|
+
children: [
|
|
4495
|
+
/* @__PURE__ */ U(L, { children: "AI Fill — paste text to populate the form" }),
|
|
4496
|
+
/* @__PURE__ */ U(ie, {
|
|
4497
|
+
dividers: !0,
|
|
4498
|
+
children: /* @__PURE__ */ U(ba, {
|
|
4499
|
+
client: e,
|
|
4500
|
+
schema: f,
|
|
4501
|
+
onFill: y
|
|
4502
|
+
})
|
|
4503
|
+
}),
|
|
4504
|
+
/* @__PURE__ */ U(re, { children: /* @__PURE__ */ U(P, {
|
|
4505
|
+
onClick: b,
|
|
4506
|
+
children: "Close"
|
|
4507
|
+
}) })
|
|
4508
|
+
]
|
|
4509
|
+
}),
|
|
4510
|
+
/* @__PURE__ */ W(I, {
|
|
4511
|
+
open: g === "review",
|
|
4512
|
+
onClose: b,
|
|
4513
|
+
maxWidth: "sm",
|
|
4514
|
+
fullWidth: !0,
|
|
4515
|
+
children: [
|
|
4516
|
+
/* @__PURE__ */ U(L, { children: "AI Review" }),
|
|
4517
|
+
/* @__PURE__ */ U(ie, {
|
|
4518
|
+
dividers: !0,
|
|
4519
|
+
children: /* @__PURE__ */ U(Ea, {
|
|
4520
|
+
client: e,
|
|
4521
|
+
schema: f,
|
|
4522
|
+
onApply: v
|
|
4523
|
+
})
|
|
4524
|
+
}),
|
|
4525
|
+
/* @__PURE__ */ U(re, { children: /* @__PURE__ */ U(P, {
|
|
4526
|
+
onClick: b,
|
|
4527
|
+
children: "Close"
|
|
4528
|
+
}) })
|
|
4529
|
+
]
|
|
4530
|
+
})
|
|
4531
|
+
] });
|
|
4532
|
+
}
|
|
4533
|
+
export { Xr as A, X as B, ci as C, ai as D, ui as E, qr as F, dt as G, pt as H, Wr as I, ct as K, Br as L, Kr as M, Hr as N, ii as O, Ur as P, hn as R, vi as S, li as T, Z as U, ht as V, gt as W, Oi as _, xa as a, _i as b, va as c, oa as d, Pi as f, ki as g, Fi as h, wa as i, Gr as j, ti as k, pa as l, aa as m, ka as n, ba as o, Ni as p, Ea as r, ya as s, Aa as t, da as u, Ti as v, si as w, fi as x, Di as y, Y as z };
|