@m4l/components 3.1.7 → 3.1.8
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/index.js +183 -340
- package/node_modules-CQtkw0uG.js +7350 -0
- package/package.json +1 -1
- package/vendor-AfIOyqRr.js +24636 -0
- package/components/AccountPopover/index-Dm2-k-Mv.js +0 -334
- package/components/AppBar/index-i0rhG3J1.js +0 -93
- package/components/BaseModule/index-CiNNlxzS.js +0 -30
- package/components/CommonActions/components/ActionCancel/index-CIdpDXkr.js +0 -12
- package/components/CommonActions/components/ActionFormCancel/index-CpyASN3q.js +0 -56
- package/components/CommonActions/components/ActionFormIntro/index-7KKtcUra.js +0 -33
- package/components/CommonActions/components/ActionIntro/index-CqqDZZcG.js +0 -25
- package/components/CommonActions/components/Actions/index-CuG1pnXW.js +0 -70
- package/components/DataGrid/constants-8L7QgBKi.js +0 -10
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index-CveSCbq_.js +0 -26
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index-CHqvieM2.js +0 -22
- package/components/DataGrid/formatters/ColumnDateFormatter/index-CKg8CJ6A.js +0 -19
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index-DE6bwaKP.js +0 -23
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index-BslXGK-A.js +0 -14
- package/components/DataGrid/formatters/ColumnPointsFormatter/index-BXGW2CsK.js +0 -10
- package/components/DataGrid/formatters/ColumnPriceFormatter/index-O11tBykn.js +0 -10
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index-BaCawLr1.js +0 -36
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index-Cq7a-jnE.js +0 -10
- package/components/DataGrid/formatters/index-CrZXPa0e.js +0 -13
- package/components/DataGrid/index-BZ-lbmuU.js +0 -908
- package/components/DataGrid/subcomponents/Actions/index-CHvPZ4Ru.js +0 -549
- package/components/DataGrid/subcomponents/editors/TextEditor/index-BIFm8akr.js +0 -80
- package/components/DragResizeWindow/index-D2jLYExo.js +0 -505
- package/components/DynamicFilter/constants-ByqmFATV.js +0 -31
- package/components/DynamicFilter/dictionary-PrbXU3VZ.js +0 -51
- package/components/DynamicFilter/index-DZiJc9h7.js +0 -116
- package/components/DynamicFilter/slots/SlotsEnum-cawFeNzx.js +0 -34
- package/components/DynamicFilter/slots/dynamicFilterSlots-DHxelhXP.js +0 -151
- package/components/DynamicFilter/slots/index-l0sNRNKZ.js +0 -1
- package/components/DynamicFilter/store/index-BT-eWVnJ.js +0 -254
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/index-B32bAzi-.js +0 -60
- package/components/DynamicFilter/subcomponents/AppliedFilters/index-Bha19drV.js +0 -26
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/index-BmvzoHit.js +0 -40
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index-BcO3SlP5.js +0 -129
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index-BCJhpNS8.js +0 -171
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index-DCNhz68u.js +0 -153
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index-BdypjM1Y.js +0 -146
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index-D-NFIVnK.js +0 -114
- package/components/DynamicFilter/subcomponents/FieldTypes/index-BwQHJqk9.js +0 -38
- package/components/DynamicFilter/subcomponents/FilterActions/index-B9UWmk07.js +0 -88
- package/components/DynamicFilter/subcomponents/InputFilter/index-CfGb1TfV.js +0 -188
- package/components/DynamicFilter/subcomponents/PopoverFilter/index-DkfRGrlO.js +0 -158
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/index-DSegwAm2.js +0 -63
- package/components/FieldLabel/index-CI57EizR.js +0 -54
- package/components/GridLayout/index-C4HyxNYX.js +0 -1044
- package/components/GridLayout/subcomponents/Griditem/index-C7jT4s8t.js +0 -395
- package/components/GridLayout/subcomponents/Responsive/index-BKcU2OnF.js +0 -348
- package/components/GridLayout/subcomponents/SizeProvider/index-1aJ-e_54.js +0 -71
- package/components/HelperText/index-Crn_XIPF.js +0 -50
- package/components/Icon/index-C89MAkeH.js +0 -176
- package/components/Image/index-COp8vP0X.js +0 -175
- package/components/LanguagePopover/index-BA2Igs9L.js +0 -179
- package/components/LinearProgressIndeterminate/index-BwI756Mb.js +0 -55
- package/components/Loadable/index-BMbi9ISF.js +0 -9
- package/components/LoadingError/index-Cf0oGUrL.js +0 -89
- package/components/MFIsolationApp/index-V4R55hNU.js +0 -169
- package/components/MFLoader/index-BI8vQZSH.js +0 -299
- package/components/ModalDialog/index-CEVQBQ7W.js +0 -77
- package/components/NavLink/index-D1S_vtFO.js +0 -55
- package/components/NoItemSelected/index-B9oM26AX.js +0 -54
- package/components/ObjectLogs/index-CiXOJpS4.js +0 -233
- package/components/PDFViewer/index-GVN2rfd6.js +0 -51
- package/components/Page/index-DZMkYmr4.js +0 -117
- package/components/PaperForm/index-DwgAfjci.js +0 -59
- package/components/Period/index-2pJG3VmY.js +0 -238
- package/components/PrintingSystem/index-B2qcnfw0.js +0 -187
- package/components/PrintingSystem/subcomponents/BodyNode/index-Cv2aoy8S.js +0 -49
- package/components/PrintingSystem/subcomponents/ChartNode/index-BmJm8v_C.js +0 -105
- package/components/PrintingSystem/subcomponents/DividerNode/index-MpFhE-H0.js +0 -20
- package/components/PrintingSystem/subcomponents/FooterNode/index-ZEcWdMSM.js +0 -49
- package/components/PrintingSystem/subcomponents/GridNode/index-SsKax2xu.js +0 -74
- package/components/PrintingSystem/subcomponents/HeaderNode/index-Cs8TOOBL.js +0 -49
- package/components/PrintingSystem/subcomponents/PaperNode/index-DBb25Ecg.js +0 -30
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index-CTVn7J9Q.js +0 -47
- package/components/PrintingSystem/subcomponents/SectionNode/index-iYPM3EaS.js +0 -49
- package/components/PrintingSystem/subcomponents/TextBoxNode/index-DGjXCFKJ.js +0 -24
- package/components/PropertyValue/index-Bh-Jnrte.js +0 -264
- package/components/Resizeable/index-DdP1xfE9.js +0 -20
- package/components/ScrollBar/index-f2URPPE2.js +0 -35
- package/components/ScrollToTop/index-TxORk5dB.js +0 -12
- package/components/SideBar/index-PUBBe0yH.js +0 -758
- package/components/SplitLayout/index-Bu1hcO6G.js +0 -89
- package/components/ToastContainer/index-DK1d8NNd.js +0 -191
- package/components/WrapperComponent/index-BHV-CsDU.js +0 -14
- package/components/animate/LoadingScreen/index-CkVLOrMz.js +0 -70
- package/components/animate/MotionContainer/index-eartnWyO.js +0 -34
- package/components/animate/MotionLazyContainer/index-Be8osTiG.js +0 -9
- package/components/animate/PropagateLoader/index-Bkq8V2SN.js +0 -23
- package/components/animate/features-BbnE33u3.js +0 -5
- package/components/animate/index-BsWiJfzp.js +0 -89
- package/components/animate/variants/bounce-DanQqHAX.js +0 -101
- package/components/animate/variants/container-Dmpr6tg5.js +0 -22
- package/components/animate/variants/fade-CAOJNn06.js +0 -65
- package/components/animate/variants/index-l0sNRNKZ.js +0 -1
- package/components/animate/variants/transition-B9W5SWTa.js +0 -20
- package/components/areas/components/AreasAdmin/index-OxQU3P8Y.js +0 -699
- package/components/areas/components/AreasViewer/index-DQ0aPioP.js +0 -805
- package/components/areas/components/index-l0sNRNKZ.js +0 -1
- package/components/areas/constants-rqODZNZe.js +0 -6
- package/components/areas/contexts/AreasContext/index-BqRlA7JA.js +0 -1110
- package/components/areas/contexts/DynamicMFParmsContext/index-22c6E7vK.js +0 -36
- package/components/areas/contexts/WindowToolsMFContext/index-DkE30fhm.js +0 -12
- package/components/areas/contexts/index-l0sNRNKZ.js +0 -1
- package/components/areas/dictionary-YUsP9beq.js +0 -36
- package/components/areas/hooks/index-l0sNRNKZ.js +0 -1
- package/components/areas/hooks/useAreas/index-BSbwbJLS.js +0 -11
- package/components/areas/hooks/useDynamicMFParameters/index-DhbcZPs9.js +0 -12
- package/components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle-BzPD-miW.js +0 -31
- package/components/areas/hooks/useWindowToolsMF/index-BECQfhbC.js +0 -10
- package/components/areas/icons-CwFr-alN.js +0 -24
- package/components/areas/index-B_Odny9h.js +0 -22
- package/components/commercial/AppBarCommercial/index-CHq3P3GY.js +0 -28
- package/components/commercial/SectionCommercial/index-BeABGtdr.js +0 -56
- package/components/commercial/TopBar/index-F1repmti.js +0 -232
- package/components/commercial/index-CxDzs6Ax.js +0 -81
- package/components/formatters/BooleanFormatter/index-DktIidqW.js +0 -44
- package/components/formatters/DateFormatter/index-CGcRZ8BA.js +0 -43
- package/components/formatters/PointsFormatter/index-C7sR8iqk.js +0 -25
- package/components/formatters/PriceFormatter/index-CsvRawmc.js +0 -35
- package/components/formatters/UncertaintyFormatter/index-B9ESVEVp.js +0 -29
- package/components/formatters/index-pnJhDYKe.js +0 -109
- package/components/hook-form/HelperError/index-BVnmUazV.js +0 -19
- package/components/hook-form/RHFAutocomplete/index-BtPL16HR.js +0 -657
- package/components/hook-form/RHFAutocompleteAsync/index-BfzjLHG8.js +0 -226
- package/components/hook-form/RHFCheckbox/index-Vyttu8Vx.js +0 -132
- package/components/hook-form/RHFColorPicker/index-Cxxb5Wa_.js +0 -191
- package/components/hook-form/RHFDateTime/index-CW1Slb-f.js +0 -190
- package/components/hook-form/RHFMultiCheckbox/index-BARudV1A.js +0 -34
- package/components/hook-form/RHFPeriod/index-r-HeIOoZ.js +0 -98
- package/components/hook-form/RHFRadioGroup/index-CTD-0zKo.js +0 -52
- package/components/hook-form/RHFSelect/index-LdwRuFz-.js +0 -29
- package/components/hook-form/RHFTextField/index-B6ufruSB.js +0 -337
- package/components/hook-form/RHFUpload/index-CDPbm8NR.js +0 -253
- package/components/maps/components/GpsTools/index-5MXlhIEt.js +0 -1948
- package/components/maps/components/Map/index-2Lx5ARXa.js +0 -2546
- package/components/maps/index-Ci-7-FHg.js +0 -7
- package/components/modal/WindowBase-Gd27v5FU.js +0 -44
- package/components/modal/WindowConfirm-u6vAMFo7.js +0 -73
- package/components/modal/index-CydPIpKZ.js +0 -65
- package/components/mui_extended/Accordion/index-DMLYJL7o.js +0 -124
- package/components/mui_extended/Avatar/index-ClBa-6eF.js +0 -64
- package/components/mui_extended/Badge/index-zI-F_Qkq.js +0 -29
- package/components/mui_extended/BoxIcon/index-BUTJ2tKw.js +0 -22
- package/components/mui_extended/Breadcrumbs/index-DTS7rOZH.js +0 -86
- package/components/mui_extended/Button/index-CGfZbaea.js +0 -222
- package/components/mui_extended/CheckBox-BXUrbonB.js +0 -76
- package/components/mui_extended/CircularProgress/index-Bnnti_G6.js +0 -8
- package/components/mui_extended/IconButton/classes/constants-ChY2jKkp.js +0 -4
- package/components/mui_extended/IconButton/classes/index-BxjJGAqZ.js +0 -45
- package/components/mui_extended/IconButton/index-CusYFjie.js +0 -97
- package/components/mui_extended/IconButton/styledIconButton-fAsbGoFS.js +0 -7
- package/components/mui_extended/LinearProgress/index-CGgW8jq2.js +0 -9
- package/components/mui_extended/LinkWithRoute/index-BC2miUjR.js +0 -15
- package/components/mui_extended/MenuActions/MenuActions-C6CjSU6C.js +0 -149
- package/components/mui_extended/MenuActions/constants-BwsU9chA.js +0 -10
- package/components/mui_extended/MenuActions/dictionary-Dj_07puT.js +0 -11
- package/components/mui_extended/MenuActions/slots/MenuActionsEnum-Bu-L6eWU.js +0 -13
- package/components/mui_extended/MenuActions/slots/MenuActionsSlots-D65KZAKF.js +0 -46
- package/components/mui_extended/Pager/index-DCbxiTZA.js +0 -257
- package/components/mui_extended/Popover/index-DfrJAQkV.js +0 -153
- package/components/mui_extended/Stack/index-DzEeCYfp.js +0 -31
- package/components/mui_extended/Tab/index-Bu3dPidV.js +0 -129
- package/components/mui_extended/ToggleButton/index-C9cBkT1V.js +0 -18
- package/components/mui_extended/ToggleIconButton/index--0b3Td6C.js +0 -26
- package/components/mui_extended/Tooltip/index-B8QUytCK.js +0 -42
- package/components/mui_extended/Typography/index-Cf_4Zw8f.js +0 -54
- package/components/mui_extended/index-l0sNRNKZ.js +0 -1
- package/components/popups/PopupsProvider/index-DhSxmtfJ.js +0 -172
- package/components/popups/PopupsViewer/constants-DuyD7aCn.js +0 -4
- package/components/popups/PopupsViewer/icons-BUujqqbu.js +0 -7
- package/components/popups/PopupsViewer/index-BecevSns.js +0 -172
- package/components/popups/PopupsViewer/slots/index-B98CiRLa.js +0 -14
- package/components/popups/PopupsViewer/slots/popupsViewerSlots-BXH77nCF.js +0 -46
- package/components/popups/index-l0sNRNKZ.js +0 -1
- package/contexts/ModalContext/index-CPfNnfTL.js +0 -39
- package/contexts/RHFormContext/index-D_nK759o.js +0 -78
- package/hocs/withToggle/index-C1_DMZD3.js +0 -14
- package/hooks/useFormAddEdit/index-D9oSjUn1.js +0 -90
- package/hooks/useFormReadyForUpdate/index-B3HygFCM.js +0 -20
- package/hooks/useModal/index-BJSQOX3U.js +0 -10
- package/hooks/useSizeContainer/index-D4hDjM1P.js +0 -37
- package/hooks/useStateRef/index-C3P6ZK3m.js +0 -15
- package/hooks/useTab/index-B_GEQFOP.js +0 -12
- package/react-data-grid-BfYuZ6AK.js +0 -2606
- package/react-draggable-DsCPdgQP.js +0 -811
- package/react-json-view-bhqIAaNg.js +0 -2576
- package/react-resizable-eBbFl2dX.js +0 -618
- package/react-spinners-TpKN9lZg.js +0 -123
- package/react-splitter-layout-C-JTsNGs.js +0 -158
- package/styles/DynamicFilter-CJFsIegc.js +0 -319
- package/styles/MenuActions-lTi-ynPM.js +0 -42
- package/styles/index-DKj6m8SL.js +0 -1691
- package/test/constants_no_mock-CF-669v-.js +0 -4
- package/test/getNameDataTestId-BaBTWhBr.js +0 -10
- package/utils/index-DiMrtgIu.js +0 -502
- /package/components/GridLayout/subcomponents/{Griditem → GridItem}/index.d.ts +0 -0
- /package/components/GridLayout/subcomponents/{Griditem → GridItem}/types.d.ts +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { generateUtilityClasses, generateUtilityClass, useTheme, Tooltip as Tooltip$1 } from "@mui/material";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
5
|
-
const componentName = "M4LTooltip";
|
|
6
|
-
generateUtilityClasses(componentName, [
|
|
7
|
-
/* elements */
|
|
8
|
-
"root"
|
|
9
|
-
/* states or variants of elements */
|
|
10
|
-
]);
|
|
11
|
-
function getTooltipUtilityClass(slot) {
|
|
12
|
-
return generateUtilityClass(componentName, slot);
|
|
13
|
-
}
|
|
14
|
-
const tooltipUtilityClasses = () => {
|
|
15
|
-
const slots = {
|
|
16
|
-
root: ["root"]
|
|
17
|
-
};
|
|
18
|
-
const composedClasses = unstable_composeClasses(slots, getTooltipUtilityClass, {});
|
|
19
|
-
return {
|
|
20
|
-
...composedClasses
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const Tooltip = (props) => {
|
|
24
|
-
const { children, className, ...others } = props;
|
|
25
|
-
const classes = tooltipUtilityClasses();
|
|
26
|
-
const theme = useTheme();
|
|
27
|
-
const stylesoverrides = theme.components?.M4LTooltip?.styleOverrides;
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
-
Tooltip$1,
|
|
30
|
-
{
|
|
31
|
-
PopperProps: {
|
|
32
|
-
sx: { ...stylesoverrides },
|
|
33
|
-
className: clsx(classes.root, className)
|
|
34
|
-
},
|
|
35
|
-
...others,
|
|
36
|
-
children
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
41
|
-
Tooltip as T
|
|
42
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useModuleSkeleton } from "@m4l/core";
|
|
3
|
-
import { Skeleton, generateUtilityClasses, generateUtilityClass, Typography as Typography$1 } from "@mui/material";
|
|
4
|
-
import { aL as WarpperTypography } from "../../../styles/index-DKj6m8SL.js";
|
|
5
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
6
|
-
import clsx from "clsx";
|
|
7
|
-
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock-CF-669v-.js";
|
|
8
|
-
const SkeletonTypography = (props) => {
|
|
9
|
-
const { skeletonWidth, skeletongHeight } = props;
|
|
10
|
-
return /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: skeletonWidth, height: skeletongHeight });
|
|
11
|
-
};
|
|
12
|
-
generateUtilityClasses("M4LTypography", [
|
|
13
|
-
/* elements */
|
|
14
|
-
"root"
|
|
15
|
-
/* states or variants of elements */
|
|
16
|
-
]);
|
|
17
|
-
function getTypographyClassesUtilityClass(slot) {
|
|
18
|
-
return generateUtilityClass("M4LTypography", slot);
|
|
19
|
-
}
|
|
20
|
-
const useUtilityClasses = () => {
|
|
21
|
-
const slots = {
|
|
22
|
-
root: ["root"]
|
|
23
|
-
};
|
|
24
|
-
const composedClasses = unstable_composeClasses(slots, getTypographyClassesUtilityClass, {});
|
|
25
|
-
return {
|
|
26
|
-
...composedClasses
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const TYPOGRAPHY_PREFIX = "Typography";
|
|
30
|
-
const getNameDataTestId = (KEY) => {
|
|
31
|
-
return `${TYPOGRAPHY_PREFIX}-${KEY}`;
|
|
32
|
-
};
|
|
33
|
-
function Typography(props) {
|
|
34
|
-
const {
|
|
35
|
-
skeletonWidth = "100%",
|
|
36
|
-
skeletongHeight = "18px",
|
|
37
|
-
variant = "body",
|
|
38
|
-
className,
|
|
39
|
-
...other
|
|
40
|
-
} = props;
|
|
41
|
-
const isSkeleton = useModuleSkeleton();
|
|
42
|
-
const classes = useUtilityClasses();
|
|
43
|
-
return /* @__PURE__ */ jsx(
|
|
44
|
-
WarpperTypography,
|
|
45
|
-
{
|
|
46
|
-
className: clsx(classes.root, className),
|
|
47
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root") } : {},
|
|
48
|
-
children: !isSkeleton ? /* @__PURE__ */ jsx(Typography$1, { ...other, variant }) : /* @__PURE__ */ jsx(SkeletonTypography, { skeletonWidth, skeletongHeight })
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
Typography as T
|
|
54
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import React__default, { createContext, useRef, useEffect, useContext } from "react";
|
|
2
|
-
import { createStore, useStore } from "zustand";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { shallow } from "zustand/shallow";
|
|
5
|
-
import { useFirstRender } from "@m4l/graphics";
|
|
6
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
7
|
-
import { devtools } from "zustand/middleware";
|
|
8
|
-
import { immer } from "zustand/middleware/immer";
|
|
9
|
-
import { cloneDeep } from "lodash";
|
|
10
|
-
const createPopupsStore = (initProps) => {
|
|
11
|
-
const startProps = {
|
|
12
|
-
currentZindex: initProps.baseZindex,
|
|
13
|
-
popupsIds: [],
|
|
14
|
-
hashPopups: {},
|
|
15
|
-
getContainer: () => initProps.containerElement,
|
|
16
|
-
...initProps
|
|
17
|
-
};
|
|
18
|
-
return createStore(
|
|
19
|
-
devtools(
|
|
20
|
-
immer((set, get) => ({
|
|
21
|
-
...startProps,
|
|
22
|
-
popupsActions: {
|
|
23
|
-
init: (initialPopups) => {
|
|
24
|
-
set((state) => {
|
|
25
|
-
let maxZindex = state.baseZindex;
|
|
26
|
-
for (let index = 0; index < initialPopups.length; index++) {
|
|
27
|
-
state.hashPopups[initialPopups[index].popupId] = cloneDeep(initialPopups[index]);
|
|
28
|
-
state.popupsIds.push(initialPopups[index].popupId);
|
|
29
|
-
if (initialPopups[index].zIndex > maxZindex) {
|
|
30
|
-
maxZindex = initialPopups[index].zIndex;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
state.currentZindex = maxZindex + 1;
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
addPopup: (popupProps, options) => {
|
|
37
|
-
if (get().hashPopups[popupProps.popupId]) {
|
|
38
|
-
throw new Error(`Poupup with id ${popupProps.popupId} already exists`);
|
|
39
|
-
}
|
|
40
|
-
if (options?.closeOthers) {
|
|
41
|
-
set((state) => {
|
|
42
|
-
state.popupsIds.forEach((popupId) => {
|
|
43
|
-
state.hashPopups[popupId].status = "closing";
|
|
44
|
-
});
|
|
45
|
-
state.hashPopups[popupProps.popupId] = {
|
|
46
|
-
...popupProps,
|
|
47
|
-
status: "init",
|
|
48
|
-
zIndex: state.currentZindex
|
|
49
|
-
};
|
|
50
|
-
state.popupsIds.push(popupProps.popupId);
|
|
51
|
-
state.currentZindex = state.currentZindex + 1;
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
set((state) => {
|
|
55
|
-
state.hashPopups[popupProps.popupId] = {
|
|
56
|
-
...popupProps,
|
|
57
|
-
status: "init",
|
|
58
|
-
zIndex: state.currentZindex
|
|
59
|
-
};
|
|
60
|
-
state.popupsIds.push(popupProps.popupId);
|
|
61
|
-
state.currentZindex = state.currentZindex + 1;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
removePopup: (popupId) => {
|
|
66
|
-
if (!get().hashPopups[popupId]) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
set((state) => {
|
|
70
|
-
state.popupsIds.splice(state.popupsIds.indexOf(popupId), 1);
|
|
71
|
-
delete state.hashPopups[popupId];
|
|
72
|
-
if (state.popupsIds.length === 0) {
|
|
73
|
-
state.currentZindex = state.baseZindex;
|
|
74
|
-
} else {
|
|
75
|
-
state.currentZindex = state.currentZindex - 1;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
},
|
|
79
|
-
closePopup: (popupId) => {
|
|
80
|
-
if (!get().hashPopups[popupId]) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
set((state) => {
|
|
84
|
-
state.hashPopups[popupId].status = "closing";
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
updatePopup: (popupId, popupProps) => {
|
|
88
|
-
if (!get().hashPopups[popupId]) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
set((state) => {
|
|
92
|
-
state.hashPopups[popupId] = { ...state.hashPopups[popupId], ...popupProps };
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
showPopup: (popupId) => {
|
|
96
|
-
if (!get().hashPopups[popupId]) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
set((state) => {
|
|
100
|
-
state.hashPopups[popupId].status = "init";
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
hidePopup: (popupId) => {
|
|
104
|
-
if (!get().hashPopups[popupId]) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
set((state) => {
|
|
108
|
-
state.hashPopups[popupId].status = "hidden";
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
setPopupOnFront: (popupId) => {
|
|
112
|
-
if (!get().hashPopups[popupId]) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
set((state) => {
|
|
116
|
-
const maxIndex = state.popupsIds.reduce((max, _pId, cIndex) => {
|
|
117
|
-
return state.hashPopups[state.popupsIds[cIndex]].zIndex > max ? state.hashPopups[state.popupsIds[cIndex]].zIndex : max;
|
|
118
|
-
}, state.hashPopups[state.popupsIds[0]].zIndex);
|
|
119
|
-
if (state.hashPopups[popupId].zIndex !== maxIndex) {
|
|
120
|
-
state.hashPopups[popupId].zIndex = state.currentZindex;
|
|
121
|
-
state.currentZindex = state.currentZindex + 1;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
setHandlerGetLabel: (newHandler) => {
|
|
126
|
-
set((state) => {
|
|
127
|
-
state.getLabel = newHandler;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
})),
|
|
132
|
-
{ name: `Popups store: ${initProps.storeId}` }
|
|
133
|
-
)
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
const PopupsContext = createContext(null);
|
|
137
|
-
function PopupsProvider(props) {
|
|
138
|
-
const { children, initialPopups, baseZindex = 0, storeId, containerElement } = props;
|
|
139
|
-
const { getLabel } = useModuleDictionary();
|
|
140
|
-
const isFirstRender = useFirstRender([getLabel]);
|
|
141
|
-
const popupsStoreRef = useRef();
|
|
142
|
-
if (!popupsStoreRef.current) {
|
|
143
|
-
popupsStoreRef.current = createPopupsStore({
|
|
144
|
-
getLabel,
|
|
145
|
-
baseZindex,
|
|
146
|
-
storeId,
|
|
147
|
-
containerElement
|
|
148
|
-
});
|
|
149
|
-
popupsStoreRef.current?.getState().popupsActions.init(initialPopups || []);
|
|
150
|
-
}
|
|
151
|
-
const { setHandlerGetLabel } = useStore(
|
|
152
|
-
popupsStoreRef.current,
|
|
153
|
-
(state) => state.popupsActions,
|
|
154
|
-
shallow
|
|
155
|
-
);
|
|
156
|
-
useEffect(() => {
|
|
157
|
-
if (!isFirstRender) {
|
|
158
|
-
setHandlerGetLabel(getLabel);
|
|
159
|
-
}
|
|
160
|
-
}, [getLabel]);
|
|
161
|
-
return /* @__PURE__ */ jsx(PopupsContext.Provider, { value: popupsStoreRef.current, children: /* @__PURE__ */ jsx(React__default.Fragment, { children }) });
|
|
162
|
-
}
|
|
163
|
-
function usePopupsStore(selector, equalityFn) {
|
|
164
|
-
const context = useContext(PopupsContext);
|
|
165
|
-
if (!context) throw new Error("usePopupsStore context must be use inside PopupsContext");
|
|
166
|
-
return useStore(context, selector, equalityFn);
|
|
167
|
-
}
|
|
168
|
-
export {
|
|
169
|
-
PopupsProvider as P,
|
|
170
|
-
PopupsContext as a,
|
|
171
|
-
usePopupsStore as u
|
|
172
|
-
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
|
3
|
-
import { shallow } from "zustand/shallow";
|
|
4
|
-
import { forwardRef } from "react";
|
|
5
|
-
import { useEnvironment } from "@m4l/core";
|
|
6
|
-
import { u as usePopupsStore } from "../PopupsProvider/index-DhSxmtfJ.js";
|
|
7
|
-
import { P as POPUPS_ICONS } from "./icons-BUujqqbu.js";
|
|
8
|
-
import { P as PopupHeaderContainerStyled, a as PopupHeaderTitleStyled, b as PopupHeaderSubTitleStyled, c as PopupContentEditionInfoStyled, d as PopupDragWindowRootStyled, e as PopupContentRootStyled, f as PopupContentWrapperStyled, R as RootStyled } from "./slots/popupsViewerSlots-BXH77nCF.js";
|
|
9
|
-
import { d as draggableWindowClasses } from "../../DragResizeWindow/index-D2jLYExo.js";
|
|
10
|
-
import { I as Icon } from "../../Icon/index-C89MAkeH.js";
|
|
11
|
-
import { I as IconButton } from "../../mui_extended/IconButton/index-CusYFjie.js";
|
|
12
|
-
import { u as useSizeContainer } from "../../../hooks/useSizeContainer/index-D4hDjM1P.js";
|
|
13
|
-
const Header = (props) => {
|
|
14
|
-
const { popupId } = props;
|
|
15
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
16
|
-
const popup = usePopupsStore((state) => state.hashPopups[popupId], shallow);
|
|
17
|
-
const { status, subTitle, zIndex, variant } = popup || {};
|
|
18
|
-
const ownerState = {
|
|
19
|
-
status,
|
|
20
|
-
variant,
|
|
21
|
-
subTitle,
|
|
22
|
-
zIndex
|
|
23
|
-
};
|
|
24
|
-
const { closePopup } = usePopupsStore((state) => state.popupsActions, shallow);
|
|
25
|
-
const { iconUrl } = popup || {};
|
|
26
|
-
const onClose = () => {
|
|
27
|
-
closePopup(popupId);
|
|
28
|
-
};
|
|
29
|
-
if (!popup) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return /* @__PURE__ */ jsxs(
|
|
33
|
-
PopupHeaderContainerStyled,
|
|
34
|
-
{
|
|
35
|
-
ownerState,
|
|
36
|
-
className: draggableWindowClasses.draggableHandle,
|
|
37
|
-
children: [
|
|
38
|
-
/* @__PURE__ */ jsx(Icon, { src: iconUrl, size: "small" }),
|
|
39
|
-
/* @__PURE__ */ jsx(PopupHeaderTitleStyled, { ownerState: { ...popup }, children: popup.title }),
|
|
40
|
-
popup.subTitle && /* @__PURE__ */ jsx(PopupHeaderSubTitleStyled, { ownerState, children: popup.subTitle }),
|
|
41
|
-
/* @__PURE__ */ jsx(
|
|
42
|
-
IconButton,
|
|
43
|
-
{
|
|
44
|
-
className: draggableWindowClasses.draggableCancel,
|
|
45
|
-
onClick: onClose,
|
|
46
|
-
"aria-label": "click",
|
|
47
|
-
src: `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/${POPUPS_ICONS.CLOSE}`
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
const EditionInfo = (props) => {
|
|
55
|
-
const { editionInfo } = props;
|
|
56
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
57
|
-
return /* @__PURE__ */ jsxs(PopupContentEditionInfoStyled, { ownerState: { editionInfo }, children: [
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
Icon,
|
|
60
|
-
{
|
|
61
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/popup/assets/icons/${POPUPS_ICONS.EDITION_INFO}`,
|
|
62
|
-
size: "small"
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
/* @__PURE__ */ jsx("span", { children: editionInfo })
|
|
66
|
-
] });
|
|
67
|
-
};
|
|
68
|
-
const Popup = forwardRef((props, ref) => {
|
|
69
|
-
const { popupId, containerElement, containerSize, style } = props;
|
|
70
|
-
const popup = usePopupsStore((state) => state.hashPopups[popupId], shallow);
|
|
71
|
-
const { setPopupOnFront: setPopupOnTop } = usePopupsStore((state) => state.popupsActions, shallow);
|
|
72
|
-
const {
|
|
73
|
-
status,
|
|
74
|
-
subTitle,
|
|
75
|
-
editionInfo,
|
|
76
|
-
zIndex,
|
|
77
|
-
variant = "normal",
|
|
78
|
-
draggable = true,
|
|
79
|
-
resizable = true,
|
|
80
|
-
defaultPosition,
|
|
81
|
-
bounds,
|
|
82
|
-
onMouseDown,
|
|
83
|
-
...others
|
|
84
|
-
} = popup || {};
|
|
85
|
-
const ownerState = {
|
|
86
|
-
status,
|
|
87
|
-
variant,
|
|
88
|
-
subTitle,
|
|
89
|
-
editionInfo,
|
|
90
|
-
zIndex
|
|
91
|
-
};
|
|
92
|
-
const onMouseDownLocal = (e) => {
|
|
93
|
-
console.log("onMouseDownLocal", popupId);
|
|
94
|
-
setPopupOnTop(popupId);
|
|
95
|
-
if (onMouseDown) {
|
|
96
|
-
onMouseDown(e);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
if (!popup) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return /* @__PURE__ */ jsxs(
|
|
103
|
-
PopupDragWindowRootStyled,
|
|
104
|
-
{
|
|
105
|
-
ownerState,
|
|
106
|
-
ref,
|
|
107
|
-
hidden: popup.status === "hidden",
|
|
108
|
-
onMouseDown: onMouseDownLocal,
|
|
109
|
-
containerElement,
|
|
110
|
-
containerSize,
|
|
111
|
-
bounds,
|
|
112
|
-
draggable,
|
|
113
|
-
resizeable: resizable,
|
|
114
|
-
defaultPosition,
|
|
115
|
-
style: { ...style, zIndex },
|
|
116
|
-
...others,
|
|
117
|
-
children: [
|
|
118
|
-
/* @__PURE__ */ jsx(Header, { popupId: popup.popupId }),
|
|
119
|
-
/* @__PURE__ */ jsxs(PopupContentRootStyled, { ownerState, children: [
|
|
120
|
-
popup.editionInfo && /* @__PURE__ */ jsx(EditionInfo, { editionInfo: popup.editionInfo }),
|
|
121
|
-
/* @__PURE__ */ jsx(PopupContentWrapperStyled, { ownerState, children: popup.functionComponent && popup.functionComponent({ ...popup.componentProps }) })
|
|
122
|
-
] })
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
const PopupsViewer = () => {
|
|
128
|
-
const popupsIds = usePopupsStore(
|
|
129
|
-
(state) => state.popupsIds.filter((pId) => state.hashPopups[pId].status !== "closing"),
|
|
130
|
-
shallow
|
|
131
|
-
);
|
|
132
|
-
const baseZindex = usePopupsStore((state) => state.baseZindex, shallow);
|
|
133
|
-
const containerElement = usePopupsStore((state) => state.getContainer, shallow)();
|
|
134
|
-
const { removePopup } = usePopupsStore((state) => state.popupsActions, shallow);
|
|
135
|
-
const containerSize = useSizeContainer(containerElement);
|
|
136
|
-
if (!containerElement || !containerSize) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
return /* @__PURE__ */ jsx(RootStyled, { ownerState: { baseZindex }, children: /* @__PURE__ */ jsx(TransitionGroup, { children: popupsIds.map((id) => {
|
|
140
|
-
return /* @__PURE__ */ jsx(
|
|
141
|
-
CSSTransition,
|
|
142
|
-
{
|
|
143
|
-
timeout: { appear: 0, enter: 1300, exit: 0 },
|
|
144
|
-
unmountOnExit: true,
|
|
145
|
-
onExited: () => {
|
|
146
|
-
removePopup(id);
|
|
147
|
-
},
|
|
148
|
-
classNames: {
|
|
149
|
-
// appear: 'fade-appear', // Clases para la animación de aparición
|
|
150
|
-
// appearActive: 'fade-appear-active',
|
|
151
|
-
enter: "fade-enter",
|
|
152
|
-
// Clases para la animación de entrada
|
|
153
|
-
enterActive: "fade-enter-active",
|
|
154
|
-
enterDone: "fade-enter-done"
|
|
155
|
-
},
|
|
156
|
-
children: /* @__PURE__ */ jsx(
|
|
157
|
-
Popup,
|
|
158
|
-
{
|
|
159
|
-
popupId: id,
|
|
160
|
-
containerElement,
|
|
161
|
-
containerSize
|
|
162
|
-
},
|
|
163
|
-
id
|
|
164
|
-
)
|
|
165
|
-
},
|
|
166
|
-
id
|
|
167
|
-
);
|
|
168
|
-
}) }) });
|
|
169
|
-
};
|
|
170
|
-
export {
|
|
171
|
-
PopupsViewer as P
|
|
172
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var PopupViewerSlots = /* @__PURE__ */ ((PopupViewerSlots2) => {
|
|
2
|
-
PopupViewerSlots2["root"] = "root";
|
|
3
|
-
PopupViewerSlots2["popupDragWindowRoot"] = "popupDragWindowRoot";
|
|
4
|
-
PopupViewerSlots2["pDWHeaderContainer"] = "pDWHeaderContainer";
|
|
5
|
-
PopupViewerSlots2["pDWHeaderTitle"] = "pDWHeaderTitle";
|
|
6
|
-
PopupViewerSlots2["pDWHeaderSubTitle"] = "pDWHeaderSubTitle";
|
|
7
|
-
PopupViewerSlots2["pDWContentRoot"] = "pDWContentRoot";
|
|
8
|
-
PopupViewerSlots2["pDWContentEditionInfo"] = "pDWContentEditionInfo";
|
|
9
|
-
PopupViewerSlots2["pDWContentWrapper"] = "pDWContentWrapper";
|
|
10
|
-
return PopupViewerSlots2;
|
|
11
|
-
})(PopupViewerSlots || {});
|
|
12
|
-
export {
|
|
13
|
-
PopupViewerSlots as P
|
|
14
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { styled } from "@mui/material/styles";
|
|
2
|
-
import { P as POPUPS_VIEWER_KEY_COMPONENT } from "../constants-DuyD7aCn.js";
|
|
3
|
-
import { aM as popupsViewerStyles } from "../../../../styles/index-DKj6m8SL.js";
|
|
4
|
-
import { P as PopupViewerSlots } from "./index-B98CiRLa.js";
|
|
5
|
-
import { D as DragResizeWindow } from "../../../DragResizeWindow/index-D2jLYExo.js";
|
|
6
|
-
const RootStyled = styled("div", { name: POPUPS_VIEWER_KEY_COMPONENT, slot: PopupViewerSlots.root })(
|
|
7
|
-
popupsViewerStyles?.root
|
|
8
|
-
);
|
|
9
|
-
const PopupDragWindowRootStyled = styled(DragResizeWindow, {
|
|
10
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
11
|
-
slot: PopupViewerSlots.popupDragWindowRoot
|
|
12
|
-
})(popupsViewerStyles?.popupDragWindowRoot);
|
|
13
|
-
const PopupHeaderContainerStyled = styled("div", {
|
|
14
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
15
|
-
slot: PopupViewerSlots.pDWHeaderContainer
|
|
16
|
-
})(popupsViewerStyles?.pDWHeaderContainer);
|
|
17
|
-
const PopupHeaderTitleStyled = styled("span", {
|
|
18
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
19
|
-
slot: PopupViewerSlots.pDWHeaderTitle
|
|
20
|
-
})(popupsViewerStyles?.pDWHeaderTitle);
|
|
21
|
-
const PopupHeaderSubTitleStyled = styled("span", {
|
|
22
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
23
|
-
slot: PopupViewerSlots.pDWHeaderSubTitle
|
|
24
|
-
})(popupsViewerStyles?.pDWHeaderSubTitle);
|
|
25
|
-
const PopupContentEditionInfoStyled = styled("div", {
|
|
26
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
27
|
-
slot: PopupViewerSlots.pDWContentEditionInfo
|
|
28
|
-
})(popupsViewerStyles?.pDWContentEditionInfo);
|
|
29
|
-
const PopupContentRootStyled = styled("div", {
|
|
30
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
31
|
-
slot: PopupViewerSlots.pDWContentRoot
|
|
32
|
-
})(popupsViewerStyles?.pDWContentRoot);
|
|
33
|
-
const PopupContentWrapperStyled = styled("div", {
|
|
34
|
-
name: POPUPS_VIEWER_KEY_COMPONENT,
|
|
35
|
-
slot: PopupViewerSlots.pDWContentWrapper
|
|
36
|
-
})(popupsViewerStyles?.pDWContentWrapper);
|
|
37
|
-
export {
|
|
38
|
-
PopupHeaderContainerStyled as P,
|
|
39
|
-
RootStyled as R,
|
|
40
|
-
PopupHeaderTitleStyled as a,
|
|
41
|
-
PopupHeaderSubTitleStyled as b,
|
|
42
|
-
PopupContentEditionInfoStyled as c,
|
|
43
|
-
PopupDragWindowRootStyled as d,
|
|
44
|
-
PopupContentRootStyled as e,
|
|
45
|
-
PopupContentWrapperStyled as f
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useState } from "react";
|
|
3
|
-
import { M as ModalDialog } from "../../components/ModalDialog/index-CEVQBQ7W.js";
|
|
4
|
-
const ModalContext = createContext(null);
|
|
5
|
-
function ModalProvider({ children }) {
|
|
6
|
-
const [modalOptions, setModalOptions] = useState({
|
|
7
|
-
open: false,
|
|
8
|
-
fullScreen: false
|
|
9
|
-
});
|
|
10
|
-
const openModal = (modalOpenProps) => {
|
|
11
|
-
setModalOptions({
|
|
12
|
-
open: true,
|
|
13
|
-
initialWidth: 300,
|
|
14
|
-
initialHeigth: 350,
|
|
15
|
-
...modalOpenProps
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
const closeModal = () => {
|
|
19
|
-
setModalOptions((last) => ({ ...last, open: false }));
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
ModalContext.Provider,
|
|
23
|
-
{
|
|
24
|
-
value: {
|
|
25
|
-
...modalOptions,
|
|
26
|
-
openModal,
|
|
27
|
-
closeModal
|
|
28
|
-
},
|
|
29
|
-
children: [
|
|
30
|
-
children,
|
|
31
|
-
/* @__PURE__ */ jsx(ModalDialog, {})
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
ModalProvider as M,
|
|
38
|
-
ModalContext as a
|
|
39
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import { useForm, FormProvider } from "react-hook-form";
|
|
5
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
6
|
-
import { aN as FormProviderRoot } from "../../styles/index-DKj6m8SL.js";
|
|
7
|
-
import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
|
|
8
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
9
|
-
const componentName = "M4LRHFormProvider";
|
|
10
|
-
generateUtilityClasses(
|
|
11
|
-
componentName,
|
|
12
|
-
[
|
|
13
|
-
/* elements */
|
|
14
|
-
"root"
|
|
15
|
-
/* states or variants of elements */
|
|
16
|
-
]
|
|
17
|
-
);
|
|
18
|
-
function getRHFormProviderUtilityClass(slot) {
|
|
19
|
-
return generateUtilityClass(componentName, slot);
|
|
20
|
-
}
|
|
21
|
-
const RHFormProviderUtilityClasses = () => {
|
|
22
|
-
const slots = {
|
|
23
|
-
root: ["root"],
|
|
24
|
-
property: ["property"],
|
|
25
|
-
value: ["value"],
|
|
26
|
-
skeletonProperty: ["skeletonProperty"]
|
|
27
|
-
};
|
|
28
|
-
const composedClasses = unstable_composeClasses(slots, getRHFormProviderUtilityClass, {});
|
|
29
|
-
return {
|
|
30
|
-
...composedClasses
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const classes = RHFormProviderUtilityClasses();
|
|
34
|
-
function RHFormProvider(props) {
|
|
35
|
-
const { children, onSubmit, values, validationSchema, statusLoad = "ready", className } = props;
|
|
36
|
-
const methods = useForm({
|
|
37
|
-
resolver: yupResolver(validationSchema),
|
|
38
|
-
defaultValues: values
|
|
39
|
-
});
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (statusLoad === "reload_values_provider") {
|
|
42
|
-
const keys = Object.keys(values);
|
|
43
|
-
keys.forEach((key) => {
|
|
44
|
-
methods.setValue(key, values[key], {
|
|
45
|
-
shouldValidate: false,
|
|
46
|
-
shouldDirty: false,
|
|
47
|
-
shouldTouch: false
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
methods.clearErrors();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}, [methods, statusLoad, values]);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (statusLoad === "ready") {
|
|
56
|
-
methods.setValue("statusLoad", "ready", {
|
|
57
|
-
shouldValidate: false,
|
|
58
|
-
shouldDirty: false,
|
|
59
|
-
shouldTouch: false
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, [statusLoad]);
|
|
63
|
-
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(
|
|
64
|
-
FormProviderRoot,
|
|
65
|
-
{
|
|
66
|
-
className: clsx(classes.root, className),
|
|
67
|
-
onSubmit: methods.handleSubmit(onSubmit),
|
|
68
|
-
children
|
|
69
|
-
}
|
|
70
|
-
) });
|
|
71
|
-
}
|
|
72
|
-
function getFormComponentsDictionary() {
|
|
73
|
-
return ["form_provider"];
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
RHFormProvider as R,
|
|
77
|
-
getFormComponentsDictionary as g
|
|
78
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
function withToggle(Component) {
|
|
4
|
-
return (props) => {
|
|
5
|
-
const { isToggled: propIsToggled, onToggle: propOnToggle, ...rest } = props;
|
|
6
|
-
const [internalIsToggled, setInternalIsToggled] = useState(props.defaultIsPressed || false);
|
|
7
|
-
const isToggled = propIsToggled !== void 0 ? propIsToggled : internalIsToggled;
|
|
8
|
-
const onToggle = propOnToggle !== void 0 ? propOnToggle : () => setInternalIsToggled((prev) => !prev);
|
|
9
|
-
return /* @__PURE__ */ jsx(Component, { ...rest, onToggle, isToggled });
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
withToggle as w
|
|
14
|
-
};
|