@m4l/components 0.2.35 → 0.2.36
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/@types/export.d.ts +274 -441
- package/@types/types.d.ts +25 -0
- package/assets/Logo/index.109a182d.js +38 -0
- package/components/AccountPopover/classes/types.d.ts +1 -1
- package/components/AccountPopover/index.a9dc9f92.js +332 -0
- package/components/AccountPopover/style.d.ts +2 -0
- package/components/AccountPopover/subcomponents/MyAvatar/types.d.ts +6 -6
- package/components/AccountPopover/subcomponents/PopOver/types.d.ts +8 -8
- package/components/AccountPopover/types.d.ts +3 -3
- package/components/AppBar/classes/types.d.ts +1 -1
- package/components/AppBar/index.7dee7427.js +93 -0
- package/components/AppBar/styles.d.ts +2 -0
- package/components/AppBar/tests/utils.d.ts +1 -1
- package/components/AppBar/types.d.ts +9 -9
- package/components/CommonActions/classes/types.d.ts +1 -1
- package/components/CommonActions/components/ActionCancel/{index.416cbf9b.js → index.46f636e9.js} +5 -13
- package/components/CommonActions/components/ActionFormCancel/{index.78267f7c.js → index.2b0bd50d.js} +30 -35
- package/components/CommonActions/components/ActionFormIntro/{index.dcb4d280.js → index.4f212c39.js} +19 -26
- package/components/CommonActions/components/ActionIntro/{index.094290fd.js → index.7406bd47.js} +16 -17
- package/components/CommonActions/components/Actions/{index.fa7ab18c.js → index.273645af.js} +30 -26
- package/components/CommonActions/components/Actions/index.d.ts +2 -1
- package/components/CommonActions/components/Actions/styles.d.ts +2 -0
- package/components/CommonActions/components/Actions/types.d.ts +2 -2
- package/components/CommonActions/tests/utils.d.ts +1 -1
- package/components/DataGrid/assets/icons/datagrid.svg +4 -4
- package/components/DataGrid/classes/types.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnBooleanFormatter/{index.cd6e553a.js → index.cee6b676.js} +11 -12
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/{index.0c439ac3.js → index.708f3fb5.js} +4 -12
- package/components/DataGrid/formatters/ColumnDateFormatter/{index.704db1ca.js → index.e00d0cf2.js} +4 -12
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.c064bb07.js +23 -0
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/{index.925387d2.js → index.880e743b.js} +4 -9
- package/components/DataGrid/formatters/ColumnPointsFormatter/{index.4335c26b.js → index.226cc583.js} +2 -5
- package/components/DataGrid/formatters/ColumnPriceFormatter/{index.d717405e.js → index.bf9d9e60.js} +2 -5
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/{index.0b23ba88.js → index.4045b2f2.js} +13 -17
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/{index.aeea65aa.js → index.a87302d1.js} +2 -5
- package/components/DataGrid/{index.abe0f9b9.js → index.304437ee.js} +257 -319
- package/components/DataGrid/styles.d.ts +2 -0
- package/components/DataGrid/subcomponents/Actions/index.f14590d2.js +595 -0
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.d.ts +8 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.d.ts +2 -0
- package/components/DataGrid/subcomponents/editors/TextEditor/{index.eac1749c.js → index.3f0d9e28.js} +26 -25
- package/components/DataGrid/subcomponents/editors/TextEditor/index.d.ts +6 -0
- package/components/DragResizeWindow/DragResizeWindow.d.ts +3 -3
- package/components/DragResizeWindow/classes/types.d.ts +1 -1
- package/components/DragResizeWindow/index.a9f25040.js +480 -0
- package/components/DragResizeWindow/styled.d.ts +2 -0
- package/components/DragResizeWindow/types.d.ts +4 -5
- package/components/DragResizeWindow/utils.d.ts +1 -1
- package/components/DynamicFilter/DynamicFilter.d.ts +1 -7
- package/components/DynamicFilter/constants.d.ts +3 -11
- package/components/DynamicFilter/dictionary.d.ts +1 -2
- package/components/DynamicFilter/dynamicFilterSlots.d.ts +112 -0
- package/components/DynamicFilter/helpers/formatToInitialFilters.d.ts +7 -0
- package/components/DynamicFilter/helpers/formatToRowFilter.d.ts +7 -0
- package/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.d.ts +11 -0
- package/components/DynamicFilter/index.48d809e2.js +2086 -0
- package/components/DynamicFilter/index.d.ts +1 -2
- package/components/DynamicFilter/store/DynamicFilterContext.d.ts +16 -0
- package/components/DynamicFilter/{contexts/DynamicFilterContext/store.d.ts → store/DynamicFilterStore.d.ts} +28 -60
- package/components/DynamicFilter/store/useDynamicFilterStore.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/AppliedFilterChip.d.ts +3 -0
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/index.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/useAppliedFilterChip.d.ts +10 -0
- package/components/DynamicFilter/subcomponents/AppliedFilters/AppliedFilters.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/AppliedFilters/index.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/AppliedFilters/useAppliedFilters.d.ts +5 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/index.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/useDynamicFilterBase.d.ts +4 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.d.ts +14 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/DataTypeComponent.d.ts +7 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.d.ts +14 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.d.ts +21 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.d.ts +14 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.d.ts +21 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.d.ts +14 -0
- package/components/DynamicFilter/subcomponents/FieldTypes/fieldFactory.d.ts +7 -0
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActions.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActionsSkeleton.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/FilterActions/index.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.d.ts +18 -0
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilterSkeleton.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/InputFilter/index.d.ts +1 -7
- package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.d.ts +40 -0
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/PopoverFilter/index.d.ts +1 -14
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +24 -0
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.d.ts +7 -0
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/index.d.ts +1 -11
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/usePopoverMenuFields.d.ts +9 -0
- package/components/DynamicFilter/types.d.ts +101 -30
- package/components/FieldLabel/classes/types.d.ts +1 -1
- package/components/FieldLabel/index.2622ee40.js +54 -0
- package/components/FieldLabel/styles.d.ts +2 -0
- package/components/GridLayout/{index.65470f01.js → index.b9c47a4c.js} +516 -468
- package/components/GridLayout/styles.d.ts +2 -0
- package/components/GridLayout/subcomponents/Griditem/index.69bc14e5.js +397 -0
- package/components/GridLayout/subcomponents/Responsive/{index.5b3e0521.js → index.094c1d09.js} +50 -31
- package/components/GridLayout/subcomponents/SizeProvider/{index.0328ad0a.js → index.e1d2df80.js} +34 -31
- package/components/HelperText/{index.7d2afdb3.js → index.81c5d349.js} +12 -21
- package/components/HelperText/styles.d.ts +2 -0
- package/components/Icon/{index.ad330e78.js → index.ee7b85c9.js} +67 -59
- package/components/Icon/styles.d.ts +4 -0
- package/components/Image/{index.b799c514.js → index.8cc036b1.js} +40 -75
- package/components/Image/styles.d.ts +2 -0
- package/components/Image/tests/utils.d.ts +1 -1
- package/components/Image/utils/getRatioValues.d.ts +1 -1
- package/components/LanguagePopover/index.72f316fc.js +187 -0
- package/components/LanguagePopover/styles.d.ts +6 -0
- package/components/LanguagePopover/tests/utils.d.ts +1 -1
- package/components/LinearProgressIndeterminate/classes/types.d.ts +1 -1
- package/components/LinearProgressIndeterminate/{index.c46da124.js → index.2ecd571e.js} +31 -19
- package/components/LinearProgressIndeterminate/styles.d.ts +2 -0
- package/components/Loadable/{index.e994fc3e.js → index.97fe63f9.js} +3 -8
- package/components/LoadingError/classes/types.d.ts +1 -1
- package/components/LoadingError/{index.ee29dd48.js → index.7aaba1cf.js} +30 -47
- package/components/LoadingError/styles.d.ts +2 -0
- package/components/LoadingError/types.d.ts +1 -1
- package/components/MFLoader/classes/types.d.ts +1 -1
- package/components/MFLoader/{index.3a37407c.js → index.40c419c0.js} +53 -69
- package/components/MFLoader/styles.d.ts +2 -0
- package/components/MFLoader/types.d.ts +4 -4
- package/components/ModalDialog/index.42349189.js +77 -0
- package/components/NavLink/{index.b75c91e1.js → index.9e847eb5.js} +21 -25
- package/components/NavLink/styles.d.ts +2 -0
- package/components/NavLink/tests/utils.d.ts +1 -1
- package/components/NavLink/types.d.ts +2 -2
- package/components/NoItemSelected/classes/types.d.ts +1 -1
- package/components/NoItemSelected/{index.3a479c64.js → index.5a8160fd.js} +17 -43
- package/components/NoItemSelected/styles.d.ts +5 -0
- package/components/ObjectLogs/index.6955149e.js +253 -0
- package/components/ObjectLogs/styles.d.ts +4 -0
- package/components/PDFViewer/classes/types.d.ts +1 -1
- package/components/PDFViewer/{index.88c6ff6a.js → index.47bb0928.js} +7 -18
- package/components/PDFViewer/styles.d.ts +2 -0
- package/components/Page/index.c1d4a319.js +114 -0
- package/components/PaperForm/classes/types.d.ts +1 -1
- package/components/PaperForm/{index.d08b43f6.js → index.9f6fd02d.js} +20 -63
- package/components/PaperForm/styles.d.ts +7 -0
- package/components/PaperForm/types.d.ts +1 -2
- package/components/Period/classes/types.d.ts +1 -1
- package/components/Period/{index.3f89d8a4.js → index.c6d1a95a.js} +108 -125
- package/components/Period/styles.d.ts +7 -0
- package/components/PrintingSystem/classes/types.d.ts +1 -1
- package/components/PrintingSystem/{index.27f1f209.js → index.f51a00f8.js} +45 -57
- package/components/PrintingSystem/styles.d.ts +2 -0
- package/components/PrintingSystem/subcomponents/BodyNode/index.6792c353.js +49 -0
- package/components/PrintingSystem/subcomponents/BodyNode/types.d.ts +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.990e164c.js → index.eec6b4cd.js} +28 -32
- package/components/PrintingSystem/subcomponents/ChartNode/types.d.ts +1 -2
- package/components/PrintingSystem/subcomponents/DividerNode/index.e58467c9.js +20 -0
- package/components/PrintingSystem/subcomponents/DividerNode/types.d.ts +2 -3
- package/components/PrintingSystem/subcomponents/FooterNode/index.920b75c9.js +49 -0
- package/components/PrintingSystem/subcomponents/FooterNode/types.d.ts +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/index.6c1ad53c.js +70 -0
- package/components/PrintingSystem/subcomponents/GridNode/types.d.ts +2 -2
- package/components/PrintingSystem/subcomponents/HeaderNode/index.e8b151ad.js +49 -0
- package/components/PrintingSystem/subcomponents/HeaderNode/types.d.ts +1 -1
- package/components/PrintingSystem/subcomponents/ImageNode/types.d.ts +2 -3
- package/components/PrintingSystem/subcomponents/Pager/types.d.ts +2 -2
- package/components/PrintingSystem/subcomponents/PaperNode/index.bf199422.js +30 -0
- package/components/PrintingSystem/subcomponents/PaperNode/types.d.ts +2 -2
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index.44d436b9.js +47 -0
- package/components/PrintingSystem/subcomponents/PropertyValueNode/types.d.ts +2 -2
- package/components/PrintingSystem/subcomponents/QRImageNode/types.d.ts +2 -3
- package/components/PrintingSystem/subcomponents/SectionNode/index.879cf13d.js +49 -0
- package/components/PrintingSystem/subcomponents/SectionNode/types.d.ts +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/index.eb6af0ca.js +24 -0
- package/components/PrintingSystem/subcomponents/TextBoxNode/types.d.ts +2 -3
- package/components/PrintingSystem/utils/FactoryRender/types.d.ts +1 -1
- package/components/PrintingSystem/utils/PageRender/types.d.ts +1 -1
- package/components/PropertyValue/classes/types.d.ts +1 -1
- package/components/PropertyValue/index.5e59580c.js +264 -0
- package/components/PropertyValue/styles.d.ts +2 -0
- package/components/Resizeable/{index.cb5aad75.js → index.5e8e48b1.js} +16 -23
- package/components/ResizeableWindow/styles.d.ts +5 -0
- package/components/ScrollBar/classes/types.d.ts +1 -1
- package/components/ScrollBar/{index.7dfc2f29.js → index.4b965665.js} +31 -51
- package/components/ScrollBar/styles.d.ts +9 -0
- package/components/SideBar/context/sideBarContext/index.d.ts +4 -4
- package/components/SideBar/index.5d1f4a23.js +851 -0
- package/components/SideBar/styles.d.ts +20 -0
- package/components/SideBar/subcomponents/ContentDesktop/subcomponents/CollapseButton/styles.d.ts +3 -0
- package/components/SideBar/subcomponents/ContentGroups/styles.d.ts +4 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/styles.d.ts +2 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/ArrowIcon/styles.d.ts +2 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/styles.d.ts +9 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/type.d.ts +2 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/styles.d.ts +2 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/subcomponents/NavItemSubContent/styles.d.ts +22 -0
- package/components/SideBar/subcomponents/ContentMobile/styles.d.ts +3 -0
- package/components/SideBar/subcomponents/ContentMobile/subcomponents/types.d.ts +4 -4
- package/components/SideBar/tests/constants.d.ts +1 -1
- package/components/SideBar/tests/utils.d.ts +1 -1
- package/components/SideBar/types.d.ts +2 -2
- package/components/SplitLayout/SplitLayout.d.ts +1 -1
- package/components/SplitLayout/classes/types.d.ts +1 -1
- package/components/SplitLayout/{index.7302ceb3.js → index.15756f0f.js} +40 -29
- package/components/SplitLayout/styles.d.ts +4 -0
- package/components/SplitLayout/tests/utils.d.ts +1 -1
- package/components/ToastContainer/ToastContainer.d.ts +1 -1
- package/components/ToastContainer/classes/types.d.ts +1 -1
- package/components/ToastContainer/{index.4d44ce53.js → index.dbd78941.js} +14 -30
- package/components/ToastContainer/styles.d.ts +2 -0
- package/components/ToastContainer/subcomponents/ToastMessage/index.d.ts +1 -1
- package/components/ToastContainer/subcomponents/ToastMessage/types.d.ts +1 -1
- package/components/ToastContainer/types.d.ts +1 -1
- package/components/WrapperComponent/index.57964195.js +14 -0
- package/components/animate/AnimatedScroll/styles.d.ts +6 -0
- package/components/animate/AnimatedScroll/types.d.ts +3 -3
- package/components/animate/LoadingScreen/{index.1d0c4307.js → index.1a83615a.js} +25 -39
- package/components/animate/LoadingScreen/styles.d.ts +7 -0
- package/components/animate/MotionContainer/index.3032bd8f.js +34 -0
- package/components/animate/MotionContainer/index.d.ts +9 -9
- package/components/animate/MotionLazyContainer/index.d.ts +2 -2
- package/components/animate/MotionLazyContainer/{index.572dd012.js → index.d2902a6c.js} +3 -9
- package/components/animate/PropagateLoader/{index.7fab43c8.js → index.76d7ea70.js} +4 -12
- package/components/animate/PropagateLoader/syles.d.ts +2 -0
- package/components/animate/{index.5d4575bc.js → index.87296638.js} +35 -56
- package/components/areas/components/AreasAdmin/index.f239c717.js +733 -0
- package/components/areas/components/AreasAdmin/styles.d.ts +5 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/styles.d.ts +4 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/subcomponents/ChipActionsMobile/types.d.ts +1 -1
- package/components/areas/components/AreasAdmin/subcomponents/PanelWindowPopUp/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/index.61e0538b.js +1071 -0
- package/components/areas/components/AreasViewer/styles.d.ts +2 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/subcomponents/ResizeHandle/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/styles.d.ts +2 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowModal/styles.d.ts +3 -0
- package/components/areas/contexts/AreasContext/{index.c5a3b322.js → index.19c7b906.js} +32 -77
- package/components/areas/contexts/DynamicMFParmsContext/{index.1607c78e.js → index.3d9ad0ad.js} +3 -9
- package/components/areas/contexts/DynamicMFParmsContext/types.d.ts +2 -2
- package/components/areas/contexts/WindowToolsMFContext/{index.8f3e2a04.js → index.992ae7a3.js} +3 -11
- package/components/areas/contexts/WindowToolsMFContext/types.d.ts +29 -29
- package/components/areas/hooks/useAreas/{index.caa92660.js → index.cedd30ee.js} +1 -1
- package/components/areas/hooks/useDynamicMFParameters/{index.e52c5392.js → index.9e09e1e3.js} +2 -4
- package/components/areas/hooks/useWindowToolsMF/{index.b7afaf88.js → index.2fbae9dc.js} +1 -1
- package/components/areas/types.d.ts +17 -17
- package/components/commercial/AppBarCommercial/classes/types.d.ts +1 -1
- package/components/commercial/AppBarCommercial/{index.9cf586a2.js → index.9f654f8e.js} +10 -12
- package/components/commercial/AppBarCommercial/styles.d.ts +2 -0
- package/components/commercial/AppBarCommercial/types.d.ts +1 -1
- package/components/commercial/HamburgerMenu/classes/type.d.ts +1 -1
- package/components/commercial/HamburgerMenu/styles.d.ts +13 -0
- package/components/commercial/HamburgerMenu/test/utils.d.ts +1 -1
- package/components/commercial/HamburgerMenu/types.d.ts +1 -1
- package/components/commercial/SectionCommercial/classes/types.d.ts +1 -1
- package/components/commercial/SectionCommercial/{index.4dbfc0a7.js → index.3df4685b.js} +28 -19
- package/components/commercial/SectionCommercial/styles.d.ts +11 -0
- package/components/commercial/SectionCommercial/types.d.ts +3 -4
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.d.ts +1 -1
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/subcomponents/ArrowIcon/styles.d.ts +2 -0
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/types.d.ts +1 -1
- package/components/commercial/TopBar/context/index.d.ts +1 -1
- package/components/commercial/TopBar/context/type.d.ts +2 -2
- package/components/commercial/TopBar/index.7aeb6ec0.js +234 -0
- package/components/commercial/TopBar/style.d.ts +2 -0
- package/components/commercial/TopBar/type.d.ts +2 -2
- package/components/commercial/TopBar/utils/isActive/index.d.ts +1 -1
- package/components/commercial/{index.89ad149c.js → index.b90488db.js} +40 -38
- package/components/formatters/BooleanFormatter/{index.9ccf9298.js → index.0c2d8e35.js} +20 -30
- package/components/formatters/DateFormatter/{index.578a9f53.js → index.2ef6f261.js} +5 -14
- package/components/formatters/FormatterRoot/styles.d.ts +2 -0
- package/components/formatters/FormatterRoot/types.d.ts +1 -1
- package/components/formatters/PointsFormatter/{index.8a4fa393.js → index.d8a4ee54.js} +4 -11
- package/components/formatters/PriceFormatter/{index.83cbe7be.js → index.97f75b4b.js} +5 -13
- package/components/formatters/UncertaintyFormatter/{index.08e1b79f.js → index.c3ffdebc.js} +8 -13
- package/components/formatters/{index.03471e3f.js → index.b816c6b6.js} +11 -34
- package/components/hook-form/HelperError/index.c8b046b7.js +19 -0
- package/components/hook-form/RHFAutocomplete/index.ea2ac2b1.js +408 -0
- package/components/hook-form/RHFAutocomplete/styles.d.ts +2 -0
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/styles.d.ts +2 -0
- package/components/hook-form/RHFAutocompleteAsync/{index.bc278965.js → index.98dcf0de.js} +47 -45
- package/components/hook-form/RHFAutocompleteAsync/styles.d.ts +5 -0
- package/components/hook-form/RHFAutocompleteAsync/tests/utils.d.ts +1 -1
- package/components/hook-form/RHFCheckbox/index.c32278fa.js +142 -0
- package/components/hook-form/RHFCheckbox/styles.d.ts +15 -0
- package/components/hook-form/RHFCheckbox/test/utils.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/classes/types.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/index.8c939bfd.js +191 -0
- package/components/hook-form/RHFColorPicker/styles.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/types.d.ts +2 -3
- package/components/hook-form/RHFColorPicker/types.d.ts +7 -7
- package/components/hook-form/RHFDateTime/classes/types.d.ts +1 -1
- package/components/hook-form/RHFDateTime/index.ac27deab.js +190 -0
- package/components/hook-form/RHFDateTime/styles.d.ts +2 -0
- package/components/hook-form/RHFDateTime/types.d.ts +1 -1
- package/components/hook-form/RHFMultiCheckbox/index.437e6ba3.js +34 -0
- package/components/hook-form/RHFPeriod/classes/types.d.ts +1 -1
- package/components/hook-form/RHFPeriod/index.70cfc422.js +104 -0
- package/components/hook-form/RHFPeriod/styles.d.ts +2 -0
- package/components/hook-form/RHFRadioGroup/index.11c0add8.js +35 -0
- package/components/hook-form/RHFRadioGroup/types.d.ts +1 -1
- package/components/hook-form/RHFSelect/index.c6c60ecc.js +29 -0
- package/components/hook-form/RHFTextField/index.fa97889a.js +325 -0
- package/components/hook-form/RHFTextField/styles.d.ts +3 -0
- package/components/hook-form/RHFTextField/subcomponents/Skeleton/styles.d.ts +3 -0
- package/components/hook-form/RHFTextField/tests/utils.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/styles.d.ts +2 -0
- package/components/hook-form/RHFTextFieldPassword/tests/utils.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/types.d.ts +1 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/classes/types.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/styles.d.ts +2 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/styles.d.ts +2 -0
- package/components/hook-form/RHFUpload/index.c5e5c61c.js +258 -0
- package/components/maps/components/GpsTools/constants.d.ts +1 -1
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/types.d.ts +3 -3
- package/components/maps/components/GpsTools/{index.d93188ad.js → index.4ea69dd1.js} +748 -767
- package/components/maps/components/GpsTools/styles.d.ts +2 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/styles.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/types.d.ts +2 -2
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/types.d.ts +1 -1
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/types.d.ts +2 -2
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useColumns.d.ts +1 -1
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/styles.d.ts +11 -0
- package/components/maps/components/GpsTools/types.d.ts +1 -1
- package/components/maps/components/Map/contexts/MapContext/helper.d.ts +1 -1
- package/components/maps/components/Map/contexts/MapContext/index.d.ts +1 -1
- package/components/maps/components/Map/contexts/MapContext/types.d.ts +6 -6
- package/components/maps/components/Map/external/googleMutant/index.d.ts +94 -94
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/index.d.ts +1 -1
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/FeatureDivIconLabel/types.d.ts +1 -1
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/MarkerIconLabel/types.d.ts +2 -2
- package/components/maps/components/Map/featureRenders/MarkerFeatureRender/index.d.ts +1 -1
- package/components/maps/components/Map/hooks/useAutoFocus/types.d.ts +2 -2
- package/components/maps/components/Map/{index.accb1f77.js → index.62b7d09b.js} +731 -770
- package/components/maps/components/Map/index.d.ts +1 -1
- package/components/maps/components/Map/styled.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/bing.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/google.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/osm.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/helpers.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/types.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/types.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/types.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/types.d.ts +2 -2
- package/components/maps/components/Map/types.d.ts +2 -2
- package/components/maps/{index.34ab6a68.js → index.13bb982c.js} +1 -1
- package/components/maps/index.d.ts +2 -2
- package/components/maps/leaflet-geoman.d.ts +1476 -1633
- package/components/modal/WindowBase.2414cd02.js +44 -0
- package/components/modal/WindowConfirm/types.d.ts +4 -4
- package/components/modal/WindowConfirm.48140481.js +66 -0
- package/components/modal/classes/types.d.ts +1 -1
- package/components/modal/{index.61389369.js → index.81eb6def.js} +7 -1
- package/components/mui_extended/Accordion/classes/types.d.ts +1 -1
- package/components/mui_extended/Accordion/index.d08a0361.js +142 -0
- package/components/mui_extended/Accordion/styles.d.ts +4 -0
- package/components/mui_extended/Avatar/classes/types.d.ts +1 -1
- package/components/mui_extended/Avatar/{index.75e6ed57.js → index.fb9ad158.js} +26 -34
- package/components/mui_extended/Avatar/styles.d.ts +2 -0
- package/components/mui_extended/Avatar/tests/utils.d.ts +1 -1
- package/components/mui_extended/Badge/Badge.d.ts +1 -1
- package/components/mui_extended/Badge/classes/types.d.ts +1 -1
- package/components/mui_extended/Badge/{index.09f5aee5.js → index.2a3aef2c.js} +10 -16
- package/components/mui_extended/Badge/styles.d.ts +2 -0
- package/components/mui_extended/Badge/types.d.ts +1 -1
- package/components/mui_extended/BoxIcon/index.d61e7ac5.js +22 -0
- package/components/mui_extended/Breadcrumbs/index.4a44883c.js +87 -0
- package/components/mui_extended/Button/classes/types.d.ts +2 -2
- package/components/mui_extended/Button/{index.c3084916.js → index.5395d101.js} +71 -79
- package/components/mui_extended/Button/styles.d.ts +13 -0
- package/components/mui_extended/CheckBox/classes/types.d.ts +1 -1
- package/components/mui_extended/CheckBox/styles.d.ts +2 -0
- package/components/mui_extended/CheckBox/subcomponents/Skeleton/types.d.ts +1 -1
- package/components/mui_extended/CheckBox/types.d.ts +2 -2
- package/components/mui_extended/{CheckBox.2a3b86c5.js → CheckBox.256169f0.js} +23 -33
- package/components/mui_extended/CircularProgress/{index.ad569afd.js → index.967e70b7.js} +2 -4
- package/components/mui_extended/IconButton/{index.f8a3021b.js → index.b0ee4965.js} +42 -48
- package/components/mui_extended/IconButton/styles.d.ts +2 -0
- package/components/mui_extended/ImageButton/styles.d.ts +2 -0
- package/components/mui_extended/ImageButton/tests/utils.d.ts +1 -1
- package/components/mui_extended/LinearProgress/{index.c92b9ba9.js → index.4092bb69.js} +3 -7
- package/components/mui_extended/LinkWithRoute/index.288c51f3.js +15 -0
- package/components/mui_extended/LoadingButton/styles.d.ts +2 -0
- package/components/mui_extended/LoadingButton/tests/utils.d.ts +1 -1
- package/components/mui_extended/MenuActions/classes/types.d.ts +1 -1
- package/components/mui_extended/MenuActions/{index.90f53670.js → index.d92ed0d6.js} +68 -68
- package/components/mui_extended/MenuActions/styles.d.ts +30 -0
- package/components/mui_extended/Pager/classes/types.d.ts +1 -1
- package/components/mui_extended/Pager/{index.ea2a4f3e.js → index.1ba2d52b.js} +114 -112
- package/components/mui_extended/Pager/styles.d.ts +2 -0
- package/components/mui_extended/Pager/subcomponents/CustomTablePagination/types.d.ts +2 -2
- package/components/mui_extended/Pager/subcomponents/PagerActions/types.d.ts +1 -1
- package/components/mui_extended/Popover/index.4e7340b4.js +142 -0
- package/components/mui_extended/Popover/styles.d.ts +1 -0
- package/components/mui_extended/Popover/subcomponts/ArrowIcon/index.d.ts +3 -0
- package/components/mui_extended/Stack/Stack.d.ts +1 -1
- package/components/mui_extended/Stack/classes/types.d.ts +1 -1
- package/components/mui_extended/Stack/{index.0e53197c.js → index.fe363ca5.js} +3 -11
- package/components/mui_extended/Stack/styles.d.ts +11 -0
- package/components/mui_extended/Stack/types.d.ts +1 -1
- package/components/mui_extended/Tab/classes/types.d.ts +1 -1
- package/components/mui_extended/Tab/{index.9214d9cc.js → index.c5ad86e2.js} +41 -63
- package/components/mui_extended/Tab/styles.d.ts +3 -0
- package/components/mui_extended/TabContent/TabContent.d.ts +1 -1
- package/components/mui_extended/TabContent/classes/types.d.ts +1 -1
- package/components/mui_extended/TabContent/styles.d.ts +2 -0
- package/components/mui_extended/TabContent/types.d.ts +1 -1
- package/components/mui_extended/Tabs/classes/types.d.ts +1 -1
- package/components/mui_extended/Tabs/styles.d.ts +59 -0
- package/components/mui_extended/ToggleButton/ToggleButton.d.ts +1 -1
- package/components/mui_extended/ToggleButton/index.7fbc8614.js +18 -0
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.d.ts +1 -1
- package/components/mui_extended/ToggleIconButton/{index.d9dbf650.js → index.0cd347b4.js} +13 -8
- package/components/mui_extended/ToggleIconButton/types.d.ts +2 -2
- package/components/mui_extended/Tooltip/classes/types.d.ts +1 -1
- package/components/mui_extended/Tooltip/{index.24a2bc3f.js → index.49bb5ee1.js} +12 -15
- package/components/mui_extended/Tooltip/types.d.ts +3 -3
- package/components/mui_extended/Typography/{index.379dd374.js → index.a1e774a2.js} +12 -26
- package/components/mui_extended/Typography/styles.d.ts +2 -0
- package/components/mui_extended/Typography/tests/utils.d.ts +1 -1
- package/components/popups/PopupsProvider/{index.d7409f48.js → index.8fb6232a.js} +12 -26
- package/components/popups/PopupsViewer/index.813854e4.js +171 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +4 -4
- package/components/popups/components/PopupsViewer/classes/types.d.ts +1 -1
- package/components/popups/components/PopupsViewer/styled.d.ts +2 -0
- package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +1 -1
- package/contexts/ModalContext/{index.2368bb19.js → index.45c275cd.js} +18 -19
- package/contexts/RHFormContext/classes/types.d.ts +1 -1
- package/contexts/RHFormContext/{index.7b2a8723.js → index.bf3a2812.js} +14 -20
- package/contexts/RHFormContext/styles.d.ts +2 -0
- package/hocs/index.d.ts +1 -0
- package/hocs/withToggle/{index.50aec5e4.js → index.548aeace.js} +3 -11
- package/hooks/useFormAddEdit/{index.000ce60b.js → index.9b27ca02.js} +37 -41
- package/hooks/useFormFocus/index.d.ts +2 -2
- package/hooks/useFormFocus/types.d.ts +1 -1
- package/hooks/useModal/{index.f73d7e42.js → index.30674bb7.js} +1 -1
- package/hooks/useSizeContainer/{index.62b4e0c4.js → index.3c48670c.js} +1 -1
- package/hooks/useTab/{index.976d5e1e.js → index.f7973779.js} +1 -1
- package/index.d.ts +2 -1
- package/index.js +136 -136
- package/package.json +11 -1
- package/{react-draggable.e4725f3a.js → react-draggable.79b4c69a.js} +1 -1
- package/{react-resizable.c07d63fb.js → react-resizable.af1f31c1.js} +2 -2
- package/styles/DynamicFilter.styles.d.ts +2 -0
- package/test/getNameDataTestId.0faeade8.js +10 -0
- package/test/getNameDataTestId.d.ts +10 -0
- package/utils/containerQuery.d.ts +2 -0
- package/utils/{index.6469f148.js → index.0718eeac.js} +4 -0
- package/utils/index.d.ts +1 -1
- package/vite-env.d.ts +4 -4
- package/assets/Logo/index.228dcb5a.js +0 -93
- package/components/AccountPopover/index.39efc8f0.js +0 -302
- package/components/AppBar/index.c8850b99.js +0 -109
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.867b8745.js +0 -26
- package/components/DataGrid/subcomponents/Actions/index.4f2071ee.js +0 -663
- package/components/DragResizeWindow/index.13ef022e.js +0 -489
- package/components/DynamicFilter/classes/index.d.ts +0 -5
- package/components/DynamicFilter/classes/types.d.ts +0 -35
- package/components/DynamicFilter/contexts/DynamicFilterContext/helpers.d.ts +0 -23
- package/components/DynamicFilter/contexts/DynamicFilterContext/index.d.ts +0 -18
- package/components/DynamicFilter/contexts/DynamicFilterContext/types.d.ts +0 -5
- package/components/DynamicFilter/hooks/useDynamicFilter.d.ts +0 -2
- package/components/DynamicFilter/index.c52a8e96.js +0 -1954
- package/components/DynamicFilter/subcomponents/ApplyedFilters/index.d.ts +0 -6
- package/components/DynamicFilter/subcomponents/ApplyedFilters/subcomponents/ApplyedFilter/index.d.ts +0 -2
- package/components/DynamicFilter/subcomponents/ClearFilters/index.d.ts +0 -1
- package/components/DynamicFilter/subcomponents/FilterButton/index.d.ts +0 -11
- package/components/DynamicFilter/subcomponents/InnerForHooks/index.d.ts +0 -5
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/types.d.ts +0 -6
- package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/helpers.d.ts +0 -39
- package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/index.d.ts +0 -5
- package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/helpers.d.ts +0 -42
- package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/helpers.d.ts +0 -36
- package/components/DynamicFilter/subcomponents/fieldstypes/SelectFilter/helpers.d.ts +0 -51
- package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/helpers.d.ts +0 -39
- package/components/DynamicFilter/subcomponents/fieldstypes/factory.d.ts +0 -82
- package/components/DynamicFilter/subcomponents/fieldstypes/validations.d.ts +0 -32
- package/components/DynamicFilter/tests/contants.d.ts +0 -5
- package/components/FieldLabel/index.0412576c.js +0 -82
- package/components/GridLayout/subcomponents/Griditem/index.30016fc1.js +0 -366
- package/components/LanguagePopover/index.93c48ec5.js +0 -196
- package/components/ModalDialog/index.78c9650a.js +0 -92
- package/components/ObjectLogs/index.1d85a021.js +0 -293
- package/components/Page/index.5d34dc4d.js +0 -127
- package/components/PrintingSystem/subcomponents/BodyNode/index.319a3bb9.js +0 -48
- package/components/PrintingSystem/subcomponents/DividerNode/index.e504dbd2.js +0 -19
- package/components/PrintingSystem/subcomponents/FooterNode/index.9a19a7cb.js +0 -48
- package/components/PrintingSystem/subcomponents/GridNode/index.8d14e1b6.js +0 -71
- package/components/PrintingSystem/subcomponents/HeaderNode/index.89e4eaab.js +0 -48
- package/components/PrintingSystem/subcomponents/PaperNode/index.dd4ca449.js +0 -46
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index.048d7ebf.js +0 -41
- package/components/PrintingSystem/subcomponents/SectionNode/index.83f1efea.js +0 -48
- package/components/PrintingSystem/subcomponents/TextBoxNode/index.5427cb75.js +0 -28
- package/components/PropertyValue/index.15c61a4b.js +0 -209
- package/components/SideBar/index.b0359a2b.js +0 -916
- package/components/SplitLayout/index.d.ts +0 -2
- package/components/WrapperComponent/index.5e872594.js +0 -18
- package/components/animate/MotionContainer/index.8d9f9d80.js +0 -33
- package/components/areas/components/AreasAdmin/index.820a00ab.js +0 -737
- package/components/areas/components/AreasViewer/index.6d7194e2.js +0 -1086
- package/components/commercial/TopBar/index.93a7d26a.js +0 -275
- package/components/hook-form/HelperError/index.66bbcac3.js +0 -30
- package/components/hook-form/RHFAutocomplete/index.1f2afb6b.js +0 -429
- package/components/hook-form/RHFCheckbox/index.eca64469.js +0 -143
- package/components/hook-form/RHFColorPicker/index.dc13d5a3.js +0 -204
- package/components/hook-form/RHFDateTime/index.e554b068.js +0 -203
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +0 -34
- package/components/hook-form/RHFPeriod/index.e4e4530f.js +0 -112
- package/components/hook-form/RHFRadioGroup/index.1ddb3d93.js +0 -45
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +0 -36
- package/components/hook-form/RHFTextField/index.1bfa601f.js +0 -358
- package/components/hook-form/RHFUpload/index.6e98b291.js +0 -242
- package/components/modal/WindowBase.fd86f575.js +0 -74
- package/components/modal/WindowConfirm.ee6de236.js +0 -105
- package/components/mui_extended/Accordion/index.7dcdfd3a.js +0 -126
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +0 -22
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +0 -94
- package/components/mui_extended/LinkWithRoute/index.16436ab8.js +0 -30
- package/components/mui_extended/Popover/index.d85de73b.js +0 -179
- package/components/mui_extended/ToggleButton/index.191711f3.js +0 -19
- package/components/popups/PopupsViewer/index.1500ce72.js +0 -186
- package/test/getNameDataTestId.14875ec7.js +0 -6
- /package/components/DynamicFilter/subcomponents/{fieldstypes → FieldTypes}/DateTimeFilter/index.d.ts +0 -0
- /package/components/DynamicFilter/subcomponents/{fieldstypes → FieldTypes}/NumberFilter/index.d.ts +0 -0
- /package/components/DynamicFilter/subcomponents/{fieldstypes → FieldTypes}/SelectFilter/index.d.ts +0 -0
- /package/components/DynamicFilter/subcomponents/{fieldstypes → FieldTypes}/StringFilter/index.d.ts +0 -0
|
@@ -1,1954 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo, useEffect, createContext, useRef, createElement, useState, useCallback } from "react";
|
|
2
|
-
import { useModuleDictionary, useEnvironment, useModuleSkeleton, useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
3
|
-
import { useStore, createStore } from "zustand";
|
|
4
|
-
import { generateUtilityClasses, styled, alpha, Skeleton, MenuItem } from "@mui/material";
|
|
5
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
6
|
-
import { g as getComponentUtilityClass, i as isValidDate } from "../../utils/index.6469f148.js";
|
|
7
|
-
import { devtools } from "zustand/middleware";
|
|
8
|
-
import { immer } from "zustand/middleware/immer";
|
|
9
|
-
import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
|
|
10
|
-
import { g as getCommonActionsDictionary, A as Actions } from "../CommonActions/components/Actions/index.fa7ab18c.js";
|
|
11
|
-
import { g as getRHFAutocompleteComponentsDictionary, R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.1f2afb6b.js";
|
|
12
|
-
import { g as getNameDataTestId } from "../../test/getNameDataTestId.14875ec7.js";
|
|
13
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
14
|
-
import { useFormContext, useWatch } from "react-hook-form";
|
|
15
|
-
import { shallow } from "zustand/shallow";
|
|
16
|
-
import { R as RHFDateTime } from "../hook-form/RHFDateTime/index.e554b068.js";
|
|
17
|
-
import { R as RHFTextField } from "../hook-form/RHFTextField/index.1bfa601f.js";
|
|
18
|
-
import * as Yup from "yup";
|
|
19
|
-
import { R as RHFAutocompleteAsync } from "../hook-form/RHFAutocompleteAsync/index.bc278965.js";
|
|
20
|
-
import { useResponsiveDesktop, useFirstRender, useFormatter } from "@m4l/graphics";
|
|
21
|
-
import { S as ScrollBar } from "../ScrollBar/index.7dfc2f29.js";
|
|
22
|
-
import clsx from "clsx";
|
|
23
|
-
import { I as IconButton } from "../mui_extended/IconButton/index.f8a3021b.js";
|
|
24
|
-
import { L as LabelMemuItem } from "../mui_extended/MenuActions/index.90f53670.js";
|
|
25
|
-
import { P as Popover } from "../mui_extended/Popover/index.d85de73b.js";
|
|
26
|
-
import { I as Icon } from "../Icon/index.ad330e78.js";
|
|
27
|
-
import { useTheme } from "@mui/material/styles";
|
|
28
|
-
import { R as RHFormProvider } from "../../contexts/RHFormContext/index.7b2a8723.js";
|
|
29
|
-
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.416cbf9b.js";
|
|
30
|
-
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.094290fd.js";
|
|
31
|
-
import { T as Typography } from "../mui_extended/Typography/index.379dd374.js";
|
|
32
|
-
const COMPONENT_PREFIX = "M4LDynamicFilter";
|
|
33
|
-
const COMPONENT_CLASS_NAME = "M4LDynamicFilter";
|
|
34
|
-
const ASSETS_URL = "frontend/components/dynamic_filter/assets/icons";
|
|
35
|
-
const ASSETS = {
|
|
36
|
-
refresh: "restart.svg",
|
|
37
|
-
search: "search.svg"
|
|
38
|
-
};
|
|
39
|
-
const ALL_FIELDS = {
|
|
40
|
-
name: "all",
|
|
41
|
-
dictionaryId: "dynamic_filter.all_fields",
|
|
42
|
-
urlIcon: "",
|
|
43
|
-
type: "string",
|
|
44
|
-
multiple: true,
|
|
45
|
-
presence: "optional"
|
|
46
|
-
};
|
|
47
|
-
const STRING_OPERATORS = ["c", "nc"];
|
|
48
|
-
const NUMBER_OPERATORS = ["b", "e", "ne", "gt", "gte", "lt", "lte"];
|
|
49
|
-
const BOOLEAN_OPERATORS = ["e", "ne"];
|
|
50
|
-
const SELECT_OPERATORS = ["in", "nin"];
|
|
51
|
-
const DATE_TIME_OPERATORS = [
|
|
52
|
-
"b",
|
|
53
|
-
"e",
|
|
54
|
-
"ne",
|
|
55
|
-
"gt",
|
|
56
|
-
"gte",
|
|
57
|
-
"lt",
|
|
58
|
-
"lte"
|
|
59
|
-
];
|
|
60
|
-
const dynamicFilterClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
|
|
61
|
-
"root",
|
|
62
|
-
"filterButton",
|
|
63
|
-
"containerFistRow",
|
|
64
|
-
"containerInputFilter",
|
|
65
|
-
"wrapperApplyedFilters",
|
|
66
|
-
"containerApplyedFilters",
|
|
67
|
-
"containerClearFilter",
|
|
68
|
-
"clearFiltersButton",
|
|
69
|
-
"applyedFilter",
|
|
70
|
-
"popoverMenuFields",
|
|
71
|
-
"popoverMenuFieldsPaper",
|
|
72
|
-
"popoverMenuFieldsItem",
|
|
73
|
-
"popoverFilter",
|
|
74
|
-
"popoverFilterPaper",
|
|
75
|
-
"popoverFilterHeader",
|
|
76
|
-
"popoverHeaderTitle",
|
|
77
|
-
"containerBooleanFilter",
|
|
78
|
-
"containerDateTimeFilter",
|
|
79
|
-
"containerNumberFilter",
|
|
80
|
-
"containerStringFilter",
|
|
81
|
-
"containerSelectFilter",
|
|
82
|
-
"classespopoverLabelMemuItem",
|
|
83
|
-
"popoverContainerFields",
|
|
84
|
-
"classesFilterButton",
|
|
85
|
-
"inputFilter",
|
|
86
|
-
"isSkeleton",
|
|
87
|
-
"isMobile",
|
|
88
|
-
"inEdition",
|
|
89
|
-
"isDirty",
|
|
90
|
-
"isInvalid",
|
|
91
|
-
"noSetted",
|
|
92
|
-
"isEmpty"
|
|
93
|
-
]);
|
|
94
|
-
const useUtilityClasses = (ownerState) => {
|
|
95
|
-
const slots = {
|
|
96
|
-
root: ["root", ownerState.inEdition && "inEdition", ownerState.isDirty && "isDirty", !ownerState.isValid && "isInvalid", ownerState.isMobile && "isMobile", ownerState.isSkeleton && "isSkeleton", ownerState.isEmpty && "isEmpty"],
|
|
97
|
-
filterButton: ["filterButton"],
|
|
98
|
-
containerFistRow: ["containerFistRow"],
|
|
99
|
-
containerInputFilter: ["containerInputFilter"],
|
|
100
|
-
classesFilterButton: ["classesFilterButton"],
|
|
101
|
-
wrapperApplyedFilters: ["wrapperApplyedFilters"],
|
|
102
|
-
containerApplyedFilters: ["containerApplyedFilters"],
|
|
103
|
-
containerClearFilter: ["containerClearFilter"],
|
|
104
|
-
applyedFilter: ["applyedFilter"],
|
|
105
|
-
clearFiltersButton: ["clearFiltersButton"],
|
|
106
|
-
popoverContainerFields: ["popoverContainerFields"],
|
|
107
|
-
popoverMenuFields: ["popoverMenuFields"],
|
|
108
|
-
popoverMenuFieldsPaper: ["popoverMenuFieldsPaper"],
|
|
109
|
-
popoverMenuFieldsItem: ["popoverMenuFieldsItem"],
|
|
110
|
-
popoverFilter: ["popoverFilter"],
|
|
111
|
-
classespopoverLabelMemuItem: ["classespopoverLabelMemuItem"],
|
|
112
|
-
popoverFilterPaper: ["popoverFilterPaper"],
|
|
113
|
-
popoverFilterHeader: ["popoverFilterHeader"],
|
|
114
|
-
popoverHeaderTitle: ["popoverHeaderTitle"],
|
|
115
|
-
containerBooleanFilter: ["containerBooleanFilter"],
|
|
116
|
-
containerDateTimeFilter: ["containerDateTimeFilter"],
|
|
117
|
-
containerNumberFilter: ["containerNumberFilter"],
|
|
118
|
-
containerStringFilter: ["containerStringFilter"],
|
|
119
|
-
containerSelectFilter: ["containerSelectFilter"],
|
|
120
|
-
inputFilter: ["inputFilter"]
|
|
121
|
-
};
|
|
122
|
-
return unstable_composeClasses(slots, getComponentUtilityClass(COMPONENT_CLASS_NAME), {});
|
|
123
|
-
};
|
|
124
|
-
function useDynamicFilter(selector, equalityFn) {
|
|
125
|
-
const store = useContext(DynamicFilterContext);
|
|
126
|
-
if (!store)
|
|
127
|
-
throw new Error("useDynamicFilterStore context must be use inside DynamicFilterContext");
|
|
128
|
-
return useStore(store, selector, equalityFn);
|
|
129
|
-
}
|
|
130
|
-
const DYNAMICFILTER_DICTIONARY_ID = "dynamic_filter";
|
|
131
|
-
function getDynamicFilterComponentsDictionary() {
|
|
132
|
-
return [DYNAMICFILTER_DICTIONARY_ID].concat(
|
|
133
|
-
getCommonActionsDictionary().concat(getRHFAutocompleteComponentsDictionary())
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
const DICCTIONARY = {
|
|
137
|
-
input_placeholder: "input_placeholder",
|
|
138
|
-
operand_true: "operand_true",
|
|
139
|
-
operand_false: "operand_false",
|
|
140
|
-
filter_tooltip_refresh: "filter_tooltip_refresh",
|
|
141
|
-
filter_tooltip_dirty: "filter_tooltip_dirty",
|
|
142
|
-
filter_tooltip_invalid: "filter_tooltip_invalid",
|
|
143
|
-
operator_b: "operator_b",
|
|
144
|
-
operator_e: "operator_e",
|
|
145
|
-
operator_ne: "operator_ne",
|
|
146
|
-
operator_gt: "operator_gt",
|
|
147
|
-
operator_gte: "operator_gte",
|
|
148
|
-
operator_lt: "operator_lt",
|
|
149
|
-
operator_lte: "operator_lte",
|
|
150
|
-
operator_c: "operator_c",
|
|
151
|
-
operator_nc: "operator_nc",
|
|
152
|
-
operator_in: "operator_in",
|
|
153
|
-
operator_nin: "operator_nin",
|
|
154
|
-
label_boolean_operator: "label_boolean_operator",
|
|
155
|
-
label_boolean_operand1: "label_boolean_operand1",
|
|
156
|
-
label_operator_date_time: "label_operator_date_time",
|
|
157
|
-
label_operand1_date_time: "label_operand1_date_time",
|
|
158
|
-
label_operand2_date_time: "label_operand2_date_time",
|
|
159
|
-
label_operator_number: "label_operator_number",
|
|
160
|
-
label_operand1_number: "label_operand1_number",
|
|
161
|
-
label_operand2_number: "label_operand2_number",
|
|
162
|
-
label_operator_string: "label_operator_string",
|
|
163
|
-
label_operand1_string: "label_operand1_string",
|
|
164
|
-
operator_required: "operator_required",
|
|
165
|
-
error_invalid_date: "error_invalid_date",
|
|
166
|
-
error_less_than_start: "error_less_than_start",
|
|
167
|
-
label_select_operator: "label_select_operator",
|
|
168
|
-
label_select_operands_array: "label_select_operands_array",
|
|
169
|
-
error_operand_required: "error_operand_required"
|
|
170
|
-
};
|
|
171
|
-
const getDynamicFilterDictionary = (key) => {
|
|
172
|
-
return `${DYNAMICFILTER_DICTIONARY_ID}.${key}`;
|
|
173
|
-
};
|
|
174
|
-
function BooleanFilter() {
|
|
175
|
-
const classesContainerBooleanFilter = useDynamicFilter((state) => state.classes.containerBooleanFilter);
|
|
176
|
-
const dataTestId = useDynamicFilter((state) => state.classes.containerBooleanFilter);
|
|
177
|
-
const {
|
|
178
|
-
getLabel
|
|
179
|
-
} = useModuleDictionary();
|
|
180
|
-
const operators = useMemo(() => BOOLEAN_OPERATORS.map((o) => ({
|
|
181
|
-
id: o,
|
|
182
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
183
|
-
})), [getLabel]);
|
|
184
|
-
const optionsYesNo = useMemo(() => [{
|
|
185
|
-
value: true,
|
|
186
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_true))
|
|
187
|
-
}, {
|
|
188
|
-
value: false,
|
|
189
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_false))
|
|
190
|
-
}], [getLabel]);
|
|
191
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
192
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
193
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerBooleanFilter", dataTestId)
|
|
194
|
-
} : {},
|
|
195
|
-
className: classesContainerBooleanFilter,
|
|
196
|
-
children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
197
|
-
name: "formValueOperator",
|
|
198
|
-
autoComplete: "off",
|
|
199
|
-
options: operators,
|
|
200
|
-
getOptionLabel: (option) => option.label,
|
|
201
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
202
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operator))
|
|
203
|
-
}), /* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
204
|
-
name: "formValueOperand1",
|
|
205
|
-
autoComplete: "off",
|
|
206
|
-
options: optionsYesNo,
|
|
207
|
-
getOptionLabel: (option) => option.label,
|
|
208
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
209
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operand1))
|
|
210
|
-
})]
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
function DateTimeFilter() {
|
|
214
|
-
const classesContainerDateTimeFilter = useDynamicFilter((state) => state.classes.containerDateTimeFilter, shallow);
|
|
215
|
-
const {
|
|
216
|
-
getLabel
|
|
217
|
-
} = useModuleDictionary();
|
|
218
|
-
const {
|
|
219
|
-
control
|
|
220
|
-
} = useFormContext();
|
|
221
|
-
const operator = useWatch({
|
|
222
|
-
control,
|
|
223
|
-
name: "formValueOperator"
|
|
224
|
-
});
|
|
225
|
-
const operators = useMemo(() => DATE_TIME_OPERATORS.map((o) => ({
|
|
226
|
-
id: o,
|
|
227
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
228
|
-
})), [getLabel]);
|
|
229
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
230
|
-
className: classesContainerDateTimeFilter,
|
|
231
|
-
children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
232
|
-
name: "formValueOperator",
|
|
233
|
-
autoComplete: "off",
|
|
234
|
-
options: operators,
|
|
235
|
-
getOptionLabel: (option) => option.label,
|
|
236
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
237
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_date_time))
|
|
238
|
-
}), /* @__PURE__ */ jsx(RHFDateTime, {
|
|
239
|
-
name: "formValueOperand1",
|
|
240
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_date_time))
|
|
241
|
-
}), operator && operator.id === "b" && /* @__PURE__ */ jsx(RHFDateTime, {
|
|
242
|
-
name: "formValueOperand2",
|
|
243
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_date_time))
|
|
244
|
-
})]
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
function NumberFilter() {
|
|
248
|
-
const classesContainerNumberFilter = useDynamicFilter((state) => state.classes.containerNumberFilter);
|
|
249
|
-
const {
|
|
250
|
-
getLabel
|
|
251
|
-
} = useModuleDictionary();
|
|
252
|
-
const {
|
|
253
|
-
control
|
|
254
|
-
} = useFormContext();
|
|
255
|
-
const operator = useWatch({
|
|
256
|
-
control,
|
|
257
|
-
name: "formValueOperator"
|
|
258
|
-
});
|
|
259
|
-
const operators = useMemo(() => NUMBER_OPERATORS.map((o) => ({
|
|
260
|
-
id: o,
|
|
261
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
262
|
-
})), [getLabel]);
|
|
263
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
264
|
-
className: classesContainerNumberFilter,
|
|
265
|
-
children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
266
|
-
name: "formValueOperator",
|
|
267
|
-
autoComplete: "off",
|
|
268
|
-
options: operators,
|
|
269
|
-
getOptionLabel: (option) => option.label,
|
|
270
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
271
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_number))
|
|
272
|
-
}), /* @__PURE__ */ jsx(RHFTextField, {
|
|
273
|
-
name: "formValueOperand1",
|
|
274
|
-
type: "number",
|
|
275
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_number))
|
|
276
|
-
}), operator && operator.id === "b" && /* @__PURE__ */ jsx(RHFTextField, {
|
|
277
|
-
name: "formValueOperand2",
|
|
278
|
-
type: "number",
|
|
279
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_number))
|
|
280
|
-
})]
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
function StringFilter() {
|
|
284
|
-
const classesContainerStringFilter = useDynamicFilter((state) => state.classes.containerStringFilter);
|
|
285
|
-
const {
|
|
286
|
-
getLabel
|
|
287
|
-
} = useModuleDictionary();
|
|
288
|
-
const operators = useMemo(() => STRING_OPERATORS.map((o) => ({
|
|
289
|
-
id: o,
|
|
290
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
291
|
-
})), [getLabel]);
|
|
292
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
293
|
-
className: classesContainerStringFilter,
|
|
294
|
-
children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
295
|
-
name: "formValueOperator",
|
|
296
|
-
autoComplete: "off",
|
|
297
|
-
options: operators,
|
|
298
|
-
getOptionLabel: (option) => option.label,
|
|
299
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
300
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_string))
|
|
301
|
-
}), /* @__PURE__ */ jsx(RHFTextField, {
|
|
302
|
-
name: "formValueOperand1",
|
|
303
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_string))
|
|
304
|
-
})]
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
const getDefaultBooleanFilter = (field, fixed) => {
|
|
308
|
-
const dfop1 = field.defaultOperand1;
|
|
309
|
-
const defaultFilter = {
|
|
310
|
-
id: 0,
|
|
311
|
-
fieldType: "boolean",
|
|
312
|
-
field,
|
|
313
|
-
fixed,
|
|
314
|
-
isSetted: true,
|
|
315
|
-
operator: "e",
|
|
316
|
-
operand1: true
|
|
317
|
-
};
|
|
318
|
-
if (dfop1 !== void 0 && typeof dfop1 === "boolean") {
|
|
319
|
-
defaultFilter.operand1 = dfop1;
|
|
320
|
-
}
|
|
321
|
-
return defaultFilter;
|
|
322
|
-
};
|
|
323
|
-
const getBooleanLabels = (filter, getLabel) => {
|
|
324
|
-
const labelOperands = filter.operand1 ? getLabel(getDynamicFilterDictionary("operand_true")) : getLabel(getDynamicFilterDictionary("operand_false"));
|
|
325
|
-
const ret = {
|
|
326
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
327
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
328
|
-
labelOperands
|
|
329
|
-
};
|
|
330
|
-
return ret;
|
|
331
|
-
};
|
|
332
|
-
const getBooleanSchema = (getLabel) => Yup.object({
|
|
333
|
-
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
334
|
-
formValueOperand1: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`))
|
|
335
|
-
});
|
|
336
|
-
const getBooleanFormValue = (field, getLabel, filterValueBoolean) => {
|
|
337
|
-
const filterValue = filterValueBoolean ? filterValueBoolean : void 0;
|
|
338
|
-
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "e";
|
|
339
|
-
const formValueOperand1 = filterValue ? {
|
|
340
|
-
value: filterValue.operand1,
|
|
341
|
-
label: getLabel(getDynamicFilterDictionary(`operand_${filterValue.operand1}`))
|
|
342
|
-
} : null;
|
|
343
|
-
const ret = {
|
|
344
|
-
fieldType: "boolean",
|
|
345
|
-
formValueOperator: {
|
|
346
|
-
id: operator,
|
|
347
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
348
|
-
},
|
|
349
|
-
formValueOperand1
|
|
350
|
-
};
|
|
351
|
-
return ret;
|
|
352
|
-
};
|
|
353
|
-
const getFilterFromBooleanFormValue = (formFilterValue) => {
|
|
354
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
355
|
-
const opeand1 = formFilterValue.formValueOperand1?.value || false;
|
|
356
|
-
return {
|
|
357
|
-
fieldType: "boolean",
|
|
358
|
-
operator,
|
|
359
|
-
operand1: opeand1
|
|
360
|
-
};
|
|
361
|
-
};
|
|
362
|
-
const getDefaultStringFilter = (field, fixed) => {
|
|
363
|
-
const dfop1 = field.defaultOperand1;
|
|
364
|
-
const defaultFilter = {
|
|
365
|
-
id: 0,
|
|
366
|
-
fieldType: "string",
|
|
367
|
-
field,
|
|
368
|
-
fixed,
|
|
369
|
-
isSetted: false,
|
|
370
|
-
operator: "c",
|
|
371
|
-
operand1: ""
|
|
372
|
-
};
|
|
373
|
-
if (dfop1 !== void 0 && typeof dfop1 === "string") {
|
|
374
|
-
defaultFilter.operand1 = dfop1;
|
|
375
|
-
}
|
|
376
|
-
return defaultFilter;
|
|
377
|
-
};
|
|
378
|
-
const getStringLabels = (filter, getLabel) => {
|
|
379
|
-
const labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
380
|
-
return {
|
|
381
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
382
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
383
|
-
labelOperands
|
|
384
|
-
};
|
|
385
|
-
};
|
|
386
|
-
const getStringSchema = (getLabel) => Yup.object({
|
|
387
|
-
formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
|
|
388
|
-
formValueOperand1: Yup.string().required(
|
|
389
|
-
getLabel(getDynamicFilterDictionary(DICCTIONARY.error_operand_required))
|
|
390
|
-
)
|
|
391
|
-
});
|
|
392
|
-
const getStringFormValue = (field, getLabel, filterValue) => {
|
|
393
|
-
const filterValueString = filterValue;
|
|
394
|
-
const operator = filterValueString ? filterValueString.operator : field.defaultOperator ?? "c";
|
|
395
|
-
const formValueOperand1 = filterValueString ? filterValueString.operand1 : "";
|
|
396
|
-
return {
|
|
397
|
-
fieldType: "string",
|
|
398
|
-
formValueOperator: {
|
|
399
|
-
id: operator,
|
|
400
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
401
|
-
},
|
|
402
|
-
formValueOperand1
|
|
403
|
-
};
|
|
404
|
-
};
|
|
405
|
-
const getFilterFromStringFormValue = (formFilterValue) => {
|
|
406
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
407
|
-
const operand1 = formFilterValue.formValueOperand1;
|
|
408
|
-
return {
|
|
409
|
-
fieldType: "string",
|
|
410
|
-
operator,
|
|
411
|
-
operand1
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
const getDefaultDateTimeFilter = (field, fixed) => {
|
|
415
|
-
const defaultStartDate = new Date();
|
|
416
|
-
const defaultEndDate = new Date();
|
|
417
|
-
defaultStartDate.setHours(0, 0, 0, 0);
|
|
418
|
-
defaultEndDate.setHours(23, 59, 59, 999);
|
|
419
|
-
const dfop1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
420
|
-
const dfop2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
421
|
-
const defaultFilter = {
|
|
422
|
-
id: 0,
|
|
423
|
-
fieldType: "datetime",
|
|
424
|
-
field,
|
|
425
|
-
fixed,
|
|
426
|
-
isSetted: true,
|
|
427
|
-
operator: "b",
|
|
428
|
-
operand1: dfop1,
|
|
429
|
-
operand2: dfop2
|
|
430
|
-
};
|
|
431
|
-
return defaultFilter;
|
|
432
|
-
};
|
|
433
|
-
const getDateLabels = (filter, getLabel, formatters) => {
|
|
434
|
-
const { dateFormatter } = formatters;
|
|
435
|
-
let labelOperands;
|
|
436
|
-
if (filter.operator === "b") {
|
|
437
|
-
labelOperands = filter.operand1 && filter.operand2 ? `${dateFormatter.formatDate(
|
|
438
|
-
filter.operand1,
|
|
439
|
-
dateFormatter.datetimeFormat
|
|
440
|
-
)} - ${dateFormatter.formatDate(
|
|
441
|
-
filter.operand2,
|
|
442
|
-
dateFormatter.datetimeFormat
|
|
443
|
-
)}` : "";
|
|
444
|
-
} else {
|
|
445
|
-
labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
|
|
446
|
-
}
|
|
447
|
-
return {
|
|
448
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
449
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
450
|
-
labelOperands
|
|
451
|
-
};
|
|
452
|
-
};
|
|
453
|
-
const getDateTimeSchema = (getLabel) => Yup.object({
|
|
454
|
-
formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
|
|
455
|
-
formValueOperand1: Yup.date().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))),
|
|
456
|
-
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
457
|
-
is: "b",
|
|
458
|
-
then: Yup.date().typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).min(
|
|
459
|
-
Yup.ref("formValueOperand1"),
|
|
460
|
-
getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))
|
|
461
|
-
)
|
|
462
|
-
})
|
|
463
|
-
});
|
|
464
|
-
const getDateTimeFormValue = (field, getLabel, filterValueDateTime) => {
|
|
465
|
-
const filterValue = filterValueDateTime;
|
|
466
|
-
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "b";
|
|
467
|
-
const defaultStartDate = new Date();
|
|
468
|
-
const defaultEndDate = new Date();
|
|
469
|
-
const dfop1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
470
|
-
const dfop2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
471
|
-
const formValueOperand1 = filterValue ? filterValue.operand1 : dfop1;
|
|
472
|
-
const formValueOperand2 = filterValue && filterValue.operator === "b" ? filterValue.operand2 : dfop2;
|
|
473
|
-
return {
|
|
474
|
-
fieldType: "datetime",
|
|
475
|
-
formValueOperator: {
|
|
476
|
-
id: operator,
|
|
477
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
478
|
-
},
|
|
479
|
-
formValueOperand1,
|
|
480
|
-
formValueOperand2
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
const getFilterFromDateTimeFormValue = (formFilterValue) => {
|
|
484
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
485
|
-
const operand1 = formFilterValue.formValueOperand1;
|
|
486
|
-
if (operator === "b") {
|
|
487
|
-
const operand2 = formFilterValue.formValueOperand2;
|
|
488
|
-
return {
|
|
489
|
-
fieldType: "datetime",
|
|
490
|
-
operator,
|
|
491
|
-
operand1,
|
|
492
|
-
operand2
|
|
493
|
-
};
|
|
494
|
-
} else {
|
|
495
|
-
return {
|
|
496
|
-
fieldType: "datetime",
|
|
497
|
-
operator,
|
|
498
|
-
operand1
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
const getDefaultNumberFilter = (fieldNumber, fixed) => {
|
|
503
|
-
const field = fieldNumber;
|
|
504
|
-
const dOperator = field.defaultOperator ?? "e";
|
|
505
|
-
const dfop1 = field.defaultOperand1 ?? null;
|
|
506
|
-
const dfop2 = field.defaultOperand2 ?? null;
|
|
507
|
-
const defaultFilter = {
|
|
508
|
-
id: 0,
|
|
509
|
-
fieldType: "number",
|
|
510
|
-
field,
|
|
511
|
-
fixed,
|
|
512
|
-
isSetted: false,
|
|
513
|
-
operator: dOperator,
|
|
514
|
-
operand1: dfop1,
|
|
515
|
-
operand2: dfop2
|
|
516
|
-
};
|
|
517
|
-
return defaultFilter;
|
|
518
|
-
};
|
|
519
|
-
const getNumberLabels = (filter, getLabel) => {
|
|
520
|
-
let labelOperands;
|
|
521
|
-
if (filter.operator === "b") {
|
|
522
|
-
labelOperands = filter.operand1 && filter.operand2 ? `${filter.operand1} - ${filter.operand2}` : "";
|
|
523
|
-
} else {
|
|
524
|
-
labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
525
|
-
}
|
|
526
|
-
return {
|
|
527
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
528
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
529
|
-
labelOperands
|
|
530
|
-
};
|
|
531
|
-
};
|
|
532
|
-
const getNumberSchema = (getLabel) => Yup.object({
|
|
533
|
-
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
534
|
-
formValueOperand1: Yup.number().typeError(
|
|
535
|
-
getLabel(`dynamic_filter.error_operand_mustbe_number`)
|
|
536
|
-
),
|
|
537
|
-
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
538
|
-
is: "b",
|
|
539
|
-
then: Yup.number().typeError(getLabel(`dynamic_filter.error_operand_mustbe_number`)).min(
|
|
540
|
-
Yup.ref("formValueOperand1"),
|
|
541
|
-
getLabel(`dynamic_filter.error_less_than_start`)
|
|
542
|
-
)
|
|
543
|
-
})
|
|
544
|
-
});
|
|
545
|
-
const getNumberFormValue = (field, getLabel, filterValue) => {
|
|
546
|
-
const filterValueNumber = filterValue;
|
|
547
|
-
const operator = filterValueNumber ? filterValueNumber.operator : field.defaultOperator ?? "e";
|
|
548
|
-
const formValueOperand1 = filterValueNumber ? filterValueNumber.operand1 : null;
|
|
549
|
-
const formValueOperand2 = filterValueNumber && filterValueNumber?.operator === "b" ? filterValueNumber.operand2 : null;
|
|
550
|
-
return {
|
|
551
|
-
fieldType: "number",
|
|
552
|
-
formValueOperator: {
|
|
553
|
-
id: operator,
|
|
554
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
555
|
-
},
|
|
556
|
-
formValueOperand1,
|
|
557
|
-
formValueOperand2
|
|
558
|
-
};
|
|
559
|
-
};
|
|
560
|
-
const getFilterFromNumberFormValue = (formFilterValue) => {
|
|
561
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
562
|
-
const operand1 = formFilterValue.formValueOperand1 ? formFilterValue.formValueOperand1 : 0;
|
|
563
|
-
if (operator === "b") {
|
|
564
|
-
const operand2 = formFilterValue.formValueOperand2 ? formFilterValue.formValueOperand2 : 0;
|
|
565
|
-
return {
|
|
566
|
-
fieldType: "number",
|
|
567
|
-
operator,
|
|
568
|
-
operand1,
|
|
569
|
-
operand2
|
|
570
|
-
};
|
|
571
|
-
} else {
|
|
572
|
-
return {
|
|
573
|
-
fieldType: "number",
|
|
574
|
-
operator,
|
|
575
|
-
operand1
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
function filterValidOperandsArraySelect(operandsArray, field) {
|
|
580
|
-
const operandsArrayFormatted = Array.isArray(operandsArray) ? operandsArray : [operandsArray];
|
|
581
|
-
const getOptionId = field?.selectOptions?.getOptionId;
|
|
582
|
-
const getOptionLabel = field?.selectOptions?.getOptionLabel;
|
|
583
|
-
return operandsArrayFormatted?.filter((operand) => {
|
|
584
|
-
return typeof operand === "object" && getOptionId?.(operand) && getOptionLabel?.(operand);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
const getDefaultSelectFilter = (field, fixed) => {
|
|
588
|
-
const defaultOperand = field.defaultOperandsArray;
|
|
589
|
-
const defaultFilter = {
|
|
590
|
-
id: 0,
|
|
591
|
-
fieldType: "select",
|
|
592
|
-
field,
|
|
593
|
-
fixed,
|
|
594
|
-
isSetted: true,
|
|
595
|
-
operator: "in",
|
|
596
|
-
operandsArray: []
|
|
597
|
-
};
|
|
598
|
-
if (defaultOperand !== void 0 && Array.isArray(defaultOperand)) {
|
|
599
|
-
const validOperandsArray = filterValidOperandsArraySelect(defaultOperand, field);
|
|
600
|
-
defaultFilter.operandsArray = validOperandsArray || [];
|
|
601
|
-
}
|
|
602
|
-
return defaultFilter;
|
|
603
|
-
};
|
|
604
|
-
const getSelectLabels = (filter, getLabel, formatters, field) => {
|
|
605
|
-
const operandsArray = filter.operandsArray;
|
|
606
|
-
const labelOperands = operandsArray?.reduce?.((label, operand) => {
|
|
607
|
-
const textLabel = field.selectOptions?.getOptionLabel?.(operand) || "";
|
|
608
|
-
return label ? `${label} | ${textLabel}` : textLabel;
|
|
609
|
-
}, "")?.toString() || "";
|
|
610
|
-
return {
|
|
611
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
612
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
613
|
-
labelOperands
|
|
614
|
-
};
|
|
615
|
-
};
|
|
616
|
-
const getSelectSchema = (getLabel) => Yup.object({
|
|
617
|
-
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
618
|
-
formValueOperandsArray: Yup.lazy((value) => {
|
|
619
|
-
return Array.isArray(value) ? Yup.array().min(1, getLabel(`dynamic_filter.error_operand_required`)).of(Yup.object().nullable()).required(getLabel(`dynamic_filter.error_operand_required`)) : Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`));
|
|
620
|
-
})
|
|
621
|
-
});
|
|
622
|
-
const getSelectFormValue = (field, getLabel, filterValueSelect) => {
|
|
623
|
-
const filterValue = filterValueSelect ? filterValueSelect : void 0;
|
|
624
|
-
const isMultiple = field?.selectOptions?.multiple ?? false;
|
|
625
|
-
const formValueOperandsArray = isMultiple ? filterValueSelect?.operandsArray : filterValueSelect?.operandsArray?.[0] || filterValueSelect?.operandsArray;
|
|
626
|
-
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "in";
|
|
627
|
-
return {
|
|
628
|
-
fieldType: "select",
|
|
629
|
-
formValueOperator: {
|
|
630
|
-
id: operator,
|
|
631
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
632
|
-
},
|
|
633
|
-
formValueOperandsArray
|
|
634
|
-
};
|
|
635
|
-
};
|
|
636
|
-
const getFilterFromSelectFormValue = (formFilterValue) => {
|
|
637
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
638
|
-
const operandsArray = Array.isArray(formFilterValue.formValueOperandsArray) ? formFilterValue.formValueOperandsArray : [formFilterValue.formValueOperandsArray];
|
|
639
|
-
return {
|
|
640
|
-
fieldType: "select",
|
|
641
|
-
operator,
|
|
642
|
-
operandsArray
|
|
643
|
-
};
|
|
644
|
-
};
|
|
645
|
-
function SelectFilter() {
|
|
646
|
-
const classesContainerSelectFilter = useDynamicFilter((state) => state.classes.containerSelectFilter, shallow);
|
|
647
|
-
const dataTestId = useDynamicFilter((state) => state.classes.containerSelectFilter, shallow);
|
|
648
|
-
const {
|
|
649
|
-
getLabel
|
|
650
|
-
} = useModuleDictionary();
|
|
651
|
-
const field = useDynamicFilter((state) => state.popoverFilterData?.field, shallow);
|
|
652
|
-
if (!field?.selectOptions?.endPoint) {
|
|
653
|
-
throw new Error("El filtro tipo Select requiere la configuraci\xF3n del Endpoint");
|
|
654
|
-
}
|
|
655
|
-
const autocompleteProps = field?.selectOptions;
|
|
656
|
-
const operators = useMemo(() => SELECT_OPERATORS.map((o) => ({
|
|
657
|
-
id: o,
|
|
658
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
659
|
-
})), [getLabel]);
|
|
660
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
661
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
662
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerSelectFilter", dataTestId)
|
|
663
|
-
} : {},
|
|
664
|
-
className: classesContainerSelectFilter,
|
|
665
|
-
children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
666
|
-
name: "formValueOperator",
|
|
667
|
-
autoComplete: "off",
|
|
668
|
-
options: operators,
|
|
669
|
-
getOptionLabel: (option) => option.label,
|
|
670
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
671
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operator))
|
|
672
|
-
}), /* @__PURE__ */ jsx(RHFAutocompleteAsync, {
|
|
673
|
-
...autocompleteProps,
|
|
674
|
-
name: "formValueOperandsArray",
|
|
675
|
-
autoComplete: "off",
|
|
676
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operands_array))
|
|
677
|
-
})]
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
const strategiesEditFilterComponent = {
|
|
681
|
-
boolean: BooleanFilter,
|
|
682
|
-
datetime: DateTimeFilter,
|
|
683
|
-
number: NumberFilter,
|
|
684
|
-
string: StringFilter,
|
|
685
|
-
select: SelectFilter,
|
|
686
|
-
__default__: () => {
|
|
687
|
-
throw new Error("Type no defined");
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
const DataTypeComponent = (props) => {
|
|
691
|
-
const {
|
|
692
|
-
formFilter,
|
|
693
|
-
statusLoad
|
|
694
|
-
} = props;
|
|
695
|
-
const {
|
|
696
|
-
setFocus
|
|
697
|
-
} = useFormContext();
|
|
698
|
-
const Component = strategiesEditFilterComponent[formFilter.field.type] ?? strategiesEditFilterComponent.__default__;
|
|
699
|
-
useEffect(() => {
|
|
700
|
-
setTimeout(() => setFocus("formValueOperand1"), 100);
|
|
701
|
-
}, [statusLoad]);
|
|
702
|
-
return /* @__PURE__ */ jsx(Component, {});
|
|
703
|
-
};
|
|
704
|
-
const strategiesLabelsFilters = {
|
|
705
|
-
boolean: getBooleanLabels,
|
|
706
|
-
datetime: getDateLabels,
|
|
707
|
-
number: getNumberLabels,
|
|
708
|
-
string: getStringLabels,
|
|
709
|
-
select: getSelectLabels,
|
|
710
|
-
__default__: () => {
|
|
711
|
-
throw new Error("Type no defined");
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
const getLabelsFilter = (filter, getLabel, formatters, field) => {
|
|
715
|
-
const transformer = strategiesLabelsFilters[filter.field.type] ?? strategiesLabelsFilters.__default__;
|
|
716
|
-
return transformer(filter, getLabel, formatters, field);
|
|
717
|
-
};
|
|
718
|
-
const strategiesDefaultFilterValues = {
|
|
719
|
-
boolean: getDefaultBooleanFilter,
|
|
720
|
-
datetime: getDefaultDateTimeFilter,
|
|
721
|
-
number: getDefaultNumberFilter,
|
|
722
|
-
string: getDefaultStringFilter,
|
|
723
|
-
select: getDefaultSelectFilter,
|
|
724
|
-
__default__: () => {
|
|
725
|
-
throw new Error("Type no defined");
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
const getDefaultValues = (field, fixed) => {
|
|
729
|
-
const transformer = strategiesDefaultFilterValues[field.type] ?? strategiesDefaultFilterValues.__default__;
|
|
730
|
-
return transformer(field, fixed);
|
|
731
|
-
};
|
|
732
|
-
const strategiesSchemaValidationsFilters = {
|
|
733
|
-
boolean: getBooleanSchema,
|
|
734
|
-
datetime: getDateTimeSchema,
|
|
735
|
-
number: getNumberSchema,
|
|
736
|
-
string: getStringSchema,
|
|
737
|
-
select: getSelectSchema,
|
|
738
|
-
__default__: () => {
|
|
739
|
-
throw new Error("Type no defined");
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
const getSchemaValidations = (field, getLabel) => {
|
|
743
|
-
const transformer = strategiesSchemaValidationsFilters[field.type] ?? strategiesSchemaValidationsFilters.__default__;
|
|
744
|
-
return transformer(getLabel);
|
|
745
|
-
};
|
|
746
|
-
const strategiesFormValue = {
|
|
747
|
-
boolean: getBooleanFormValue,
|
|
748
|
-
datetime: getDateTimeFormValue,
|
|
749
|
-
number: getNumberFormValue,
|
|
750
|
-
string: getStringFormValue,
|
|
751
|
-
select: getSelectFormValue,
|
|
752
|
-
__default__: () => {
|
|
753
|
-
throw new Error("Type no defined");
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
const getFormValue = (field, getLabel, filter) => {
|
|
757
|
-
const transformer = strategiesFormValue[field.type] ?? strategiesFormValue.__default__;
|
|
758
|
-
return transformer(field, getLabel, filter);
|
|
759
|
-
};
|
|
760
|
-
const strategiesFilterFromFormValue = {
|
|
761
|
-
boolean: getFilterFromBooleanFormValue,
|
|
762
|
-
datetime: getFilterFromDateTimeFormValue,
|
|
763
|
-
number: getFilterFromNumberFormValue,
|
|
764
|
-
string: getFilterFromStringFormValue,
|
|
765
|
-
select: getFilterFromSelectFormValue,
|
|
766
|
-
__default__: () => {
|
|
767
|
-
throw new Error("Type no defined");
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
const getFilterFromFormValue = (filter) => {
|
|
771
|
-
const transformer = strategiesFilterFromFormValue[filter.fieldType] ?? strategiesFilterFromFormValue.__default__;
|
|
772
|
-
return transformer(filter);
|
|
773
|
-
};
|
|
774
|
-
const verifyBooleanFilter = (filter) => {
|
|
775
|
-
if (typeof filter.operator !== "string") {
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
return typeof filter.operand1 === "boolean";
|
|
782
|
-
};
|
|
783
|
-
const verifyDateTime = (filter) => {
|
|
784
|
-
if (typeof filter.operator !== "string") {
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
788
|
-
return false;
|
|
789
|
-
}
|
|
790
|
-
if (typeof filter.operand1 !== "string") {
|
|
791
|
-
return false;
|
|
792
|
-
}
|
|
793
|
-
if (!isValidDate(new Date(filter.operand1))) {
|
|
794
|
-
return false;
|
|
795
|
-
}
|
|
796
|
-
if (filter.operator === "b") {
|
|
797
|
-
if (typeof filter.operand2 !== "string") {
|
|
798
|
-
return false;
|
|
799
|
-
}
|
|
800
|
-
if (!isValidDate(new Date(filter.operand1))) {
|
|
801
|
-
return false;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
return true;
|
|
805
|
-
};
|
|
806
|
-
const verifyNumberFilter = (filter) => {
|
|
807
|
-
if (typeof filter.operator !== "number") {
|
|
808
|
-
return false;
|
|
809
|
-
}
|
|
810
|
-
if (NUMBER_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
811
|
-
return false;
|
|
812
|
-
}
|
|
813
|
-
if (typeof filter.operand1 !== "number") {
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
816
|
-
if (filter.operator === "b" && typeof filter.operand2 !== "number") {
|
|
817
|
-
return false;
|
|
818
|
-
}
|
|
819
|
-
return true;
|
|
820
|
-
};
|
|
821
|
-
const verifyStringFilter = (filter) => {
|
|
822
|
-
if (typeof filter.operator !== "string") {
|
|
823
|
-
return false;
|
|
824
|
-
}
|
|
825
|
-
if (STRING_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
826
|
-
return false;
|
|
827
|
-
}
|
|
828
|
-
if (typeof filter.operand1 !== "string") {
|
|
829
|
-
return false;
|
|
830
|
-
}
|
|
831
|
-
return true;
|
|
832
|
-
};
|
|
833
|
-
const verifySelectFilter = (filter, field) => {
|
|
834
|
-
if (typeof filter.operator !== "string") {
|
|
835
|
-
return false;
|
|
836
|
-
}
|
|
837
|
-
if (SELECT_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
838
|
-
return false;
|
|
839
|
-
}
|
|
840
|
-
if (!filter.operandsArray || typeof filter.operandsArray !== "object") {
|
|
841
|
-
return false;
|
|
842
|
-
}
|
|
843
|
-
const validOperandsArray = filterValidOperandsArraySelect(
|
|
844
|
-
filter.operandsArray,
|
|
845
|
-
field
|
|
846
|
-
);
|
|
847
|
-
if (!validOperandsArray || validOperandsArray?.length === 0) {
|
|
848
|
-
return false;
|
|
849
|
-
}
|
|
850
|
-
return true;
|
|
851
|
-
};
|
|
852
|
-
const formatToInitialFilters = (applyedFilters) => {
|
|
853
|
-
return applyedFilters.map((af) => {
|
|
854
|
-
const ret = {
|
|
855
|
-
name: af.field.name,
|
|
856
|
-
operator: af.operator,
|
|
857
|
-
operand1: af.operand1,
|
|
858
|
-
operand2: af.operator === "b" ? af.operand2 : void 0
|
|
859
|
-
};
|
|
860
|
-
if (af.fieldType === "datetime") {
|
|
861
|
-
ret.operand1 = af.operand1.toISOString();
|
|
862
|
-
ret.operand2 = af.operator === "b" ? af.operand2.toISOString() : void 0;
|
|
863
|
-
}
|
|
864
|
-
if (af.fieldType === "select") {
|
|
865
|
-
const validOperandsArray = filterValidOperandsArraySelect(af.operandsArray, af.field);
|
|
866
|
-
if (validOperandsArray && validOperandsArray?.length > 0) {
|
|
867
|
-
ret.operandsArray = validOperandsArray;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
if (ret.operand2 === void 0) {
|
|
871
|
-
delete ret.operand2;
|
|
872
|
-
}
|
|
873
|
-
return ret;
|
|
874
|
-
});
|
|
875
|
-
};
|
|
876
|
-
const formatToRawFilter = (appliedFilters) => {
|
|
877
|
-
return appliedFilters.map((af) => {
|
|
878
|
-
let oa = void 0;
|
|
879
|
-
if (af.field.type === "select" && af.operandsArray) {
|
|
880
|
-
oa = Array.isArray(af.operandsArray) ? af.operandsArray.map(af.field.selectOptions.getOptionId) : [af.field.selectOptions.getOptionId(af.operandsArray)];
|
|
881
|
-
}
|
|
882
|
-
return {
|
|
883
|
-
n: af.field.name,
|
|
884
|
-
o: af.operator,
|
|
885
|
-
o1: af.operand1,
|
|
886
|
-
o2: af.operator === "b" ? af.operand2 : void 0,
|
|
887
|
-
oa
|
|
888
|
-
};
|
|
889
|
-
});
|
|
890
|
-
};
|
|
891
|
-
const getPurgedInitialFiltersApplyed = (fields, initialFilters, getFieldByName) => {
|
|
892
|
-
const newFilters = [];
|
|
893
|
-
const fixedFields = [];
|
|
894
|
-
for (let index = 0; index < initialFilters.length; index++) {
|
|
895
|
-
try {
|
|
896
|
-
let add;
|
|
897
|
-
const initialFilter = initialFilters[index];
|
|
898
|
-
const field = getFieldByName(initialFilter.name);
|
|
899
|
-
const filter = {
|
|
900
|
-
id: 0,
|
|
901
|
-
isSetted: true,
|
|
902
|
-
fixed: false,
|
|
903
|
-
field,
|
|
904
|
-
fieldType: field.type,
|
|
905
|
-
operator: initialFilters[index].operator,
|
|
906
|
-
operand1: initialFilters[index].operand1,
|
|
907
|
-
operand2: initialFilters[index].operand2,
|
|
908
|
-
operandsArray: initialFilters[index].operandsArray
|
|
909
|
-
};
|
|
910
|
-
if (!field)
|
|
911
|
-
continue;
|
|
912
|
-
switch (field.type) {
|
|
913
|
-
case "string":
|
|
914
|
-
add = verifyStringFilter(initialFilter);
|
|
915
|
-
break;
|
|
916
|
-
case "number":
|
|
917
|
-
add = verifyNumberFilter(initialFilter);
|
|
918
|
-
break;
|
|
919
|
-
case "boolean":
|
|
920
|
-
add = verifyBooleanFilter(initialFilter);
|
|
921
|
-
break;
|
|
922
|
-
case "datetime":
|
|
923
|
-
add = verifyDateTime(initialFilter);
|
|
924
|
-
break;
|
|
925
|
-
case "select":
|
|
926
|
-
add = verifySelectFilter(initialFilter, field);
|
|
927
|
-
break;
|
|
928
|
-
default:
|
|
929
|
-
add = false;
|
|
930
|
-
}
|
|
931
|
-
if (add) {
|
|
932
|
-
if (filter.fieldType === "datetime") {
|
|
933
|
-
filter.operand1 = new Date(filter.operand1 + "");
|
|
934
|
-
filter.operand2 = new Date(filter.operand2 + "");
|
|
935
|
-
}
|
|
936
|
-
if (field.presence === "fixed") {
|
|
937
|
-
if (fixedFields.findIndex((f) => f === field.name) === -1) {
|
|
938
|
-
filter.fixed = true;
|
|
939
|
-
fixedFields.push(field.name);
|
|
940
|
-
} else {
|
|
941
|
-
filter.fixed = false;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
filter.isSetted = true;
|
|
945
|
-
filter.id = newFilters.length + 1;
|
|
946
|
-
newFilters.push(filter);
|
|
947
|
-
}
|
|
948
|
-
} catch (error) {
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
for (let index = 0; index < fields.length; index++) {
|
|
952
|
-
const field = fields[index];
|
|
953
|
-
if (field.presence === "initialized" || field.presence === "fixed") {
|
|
954
|
-
if (!initialFilters.find((f) => f.name === field.name)) {
|
|
955
|
-
const newFilter = getDefaultValues(field, field.presence === "fixed");
|
|
956
|
-
newFilter.id = newFilters.length + 1;
|
|
957
|
-
newFilters.push(newFilter);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
return newFilters;
|
|
962
|
-
};
|
|
963
|
-
const updateAvailableFields = (state) => {
|
|
964
|
-
const newFields = [];
|
|
965
|
-
for (let index = 0; index < state.fields.length; index++) {
|
|
966
|
-
let add;
|
|
967
|
-
const field = state.fields[index];
|
|
968
|
-
add = true;
|
|
969
|
-
if (field.multiple !== void 0 && field.multiple === false) {
|
|
970
|
-
const fIndx = state.applyedFilters.findIndex((f) => f.field.name === field.name);
|
|
971
|
-
if (fIndx > -1) {
|
|
972
|
-
add = false;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
if (add) {
|
|
976
|
-
newFields.push(field);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
state.availableFields = newFields;
|
|
980
|
-
};
|
|
981
|
-
const updateOwnerStateIsValid = (state) => {
|
|
982
|
-
state.ownerState.isValid = true;
|
|
983
|
-
for (let index = 0; index < state.applyedFilters.length; index++) {
|
|
984
|
-
const element = state.applyedFilters[index];
|
|
985
|
-
if (!element.isSetted) {
|
|
986
|
-
state.ownerState.isValid = false;
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
};
|
|
990
|
-
const updateOwnerStateClasses = (state) => {
|
|
991
|
-
state.classes = useUtilityClasses(state.ownerState);
|
|
992
|
-
};
|
|
993
|
-
const updateAutomatic = (state) => {
|
|
994
|
-
updateOwnerStateIsValid(state);
|
|
995
|
-
updateAvailableFields(state);
|
|
996
|
-
if (state.ownerState.isValid) {
|
|
997
|
-
if (state.automatic) {
|
|
998
|
-
state.ownerState.isDirty = false;
|
|
999
|
-
state.countOnChangeFiltersApplyed++;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
updateOwnerStateClasses(state);
|
|
1003
|
-
};
|
|
1004
|
-
const createAreaStore = (initProps) => {
|
|
1005
|
-
const startProps = {
|
|
1006
|
-
countOnChangeFiltersApplyed: 0,
|
|
1007
|
-
applyedFilters: [],
|
|
1008
|
-
availableFields: [],
|
|
1009
|
-
fnAnchorEl: void 0,
|
|
1010
|
-
popoverFilterData: void 0,
|
|
1011
|
-
classes: useUtilityClasses(initProps.ownerState),
|
|
1012
|
-
inputData: "",
|
|
1013
|
-
...initProps
|
|
1014
|
-
};
|
|
1015
|
-
return createStore(
|
|
1016
|
-
devtools(
|
|
1017
|
-
immer((set, get) => ({
|
|
1018
|
-
...startProps,
|
|
1019
|
-
actions: {
|
|
1020
|
-
init: (initialFiltersApplyed) => {
|
|
1021
|
-
set((state) => {
|
|
1022
|
-
state.applyedFilters = getPurgedInitialFiltersApplyed(
|
|
1023
|
-
state.fields,
|
|
1024
|
-
initialFiltersApplyed,
|
|
1025
|
-
state.actions.getFieldByName
|
|
1026
|
-
);
|
|
1027
|
-
state.ownerState.isEmpty = state.applyedFilters.length > 0 ? false : true;
|
|
1028
|
-
updateOwnerStateClasses(state);
|
|
1029
|
-
updateAutomatic(state);
|
|
1030
|
-
});
|
|
1031
|
-
},
|
|
1032
|
-
getFieldByName: (name) => {
|
|
1033
|
-
const field = (get().withAllField ? get().fields.concat(get().allField) : get().fields).find((f) => {
|
|
1034
|
-
return f.name === name;
|
|
1035
|
-
});
|
|
1036
|
-
if (field) {
|
|
1037
|
-
return field;
|
|
1038
|
-
}
|
|
1039
|
-
throw new Error("No exist field");
|
|
1040
|
-
},
|
|
1041
|
-
removeFilter: (id) => {
|
|
1042
|
-
set((state) => {
|
|
1043
|
-
const index_to_remove = state.applyedFilters.findIndex(
|
|
1044
|
-
(f) => id === f.id && !f.fixed
|
|
1045
|
-
);
|
|
1046
|
-
if (index_to_remove > -1) {
|
|
1047
|
-
state.applyedFilters.splice(index_to_remove, 1);
|
|
1048
|
-
if (state.applyedFilters.length === 0) {
|
|
1049
|
-
state.ownerState.isEmpty = true;
|
|
1050
|
-
updateOwnerStateClasses(state);
|
|
1051
|
-
}
|
|
1052
|
-
updateAutomatic(state);
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
},
|
|
1056
|
-
showPopoverFilterForAdd: (anchorEl, field) => {
|
|
1057
|
-
set((state) => {
|
|
1058
|
-
state.fnAnchorEl = void 0;
|
|
1059
|
-
state.inputData = "";
|
|
1060
|
-
state.popoverFilterData = {
|
|
1061
|
-
openFor: "add",
|
|
1062
|
-
fnAnchorEl: () => anchorEl,
|
|
1063
|
-
field
|
|
1064
|
-
};
|
|
1065
|
-
});
|
|
1066
|
-
get().actions.setInEdition(true);
|
|
1067
|
-
},
|
|
1068
|
-
showPopoverFilterForEdit: (anchorEl, filterToEdit) => {
|
|
1069
|
-
set((state) => {
|
|
1070
|
-
state.popoverFilterData = {
|
|
1071
|
-
openFor: "edit",
|
|
1072
|
-
fnAnchorEl: () => anchorEl,
|
|
1073
|
-
filter: filterToEdit,
|
|
1074
|
-
field: filterToEdit.field
|
|
1075
|
-
};
|
|
1076
|
-
});
|
|
1077
|
-
get().actions.setInEdition(true);
|
|
1078
|
-
},
|
|
1079
|
-
hidePopoverFilter: (stayInEdition) => {
|
|
1080
|
-
set((state) => {
|
|
1081
|
-
state.popoverFilterData = void 0;
|
|
1082
|
-
});
|
|
1083
|
-
get().actions.setInEdition(stayInEdition);
|
|
1084
|
-
},
|
|
1085
|
-
clearFilters: () => {
|
|
1086
|
-
set((state) => {
|
|
1087
|
-
state.applyedFilters = state.applyedFilters.filter((f) => f.fixed);
|
|
1088
|
-
if (state.applyedFilters.length === 0) {
|
|
1089
|
-
state.ownerState.isEmpty = true;
|
|
1090
|
-
updateOwnerStateClasses(state);
|
|
1091
|
-
}
|
|
1092
|
-
updateAvailableFields(state);
|
|
1093
|
-
});
|
|
1094
|
-
},
|
|
1095
|
-
fireOnChangeFilters: () => {
|
|
1096
|
-
set((state) => {
|
|
1097
|
-
if (state.ownerState.isValid) {
|
|
1098
|
-
state.ownerState.isDirty = false;
|
|
1099
|
-
state.countOnChangeFiltersApplyed++;
|
|
1100
|
-
updateOwnerStateClasses(state);
|
|
1101
|
-
}
|
|
1102
|
-
});
|
|
1103
|
-
},
|
|
1104
|
-
getNewId: () => {
|
|
1105
|
-
return get().applyedFilters.reduce((prev, n) => {
|
|
1106
|
-
return n.id > prev ? n.id : prev;
|
|
1107
|
-
}, 0) + 1;
|
|
1108
|
-
},
|
|
1109
|
-
addFilter: (newFilter) => {
|
|
1110
|
-
set((state) => {
|
|
1111
|
-
state.applyedFilters.push(newFilter);
|
|
1112
|
-
if (state.applyedFilters.length > 0) {
|
|
1113
|
-
state.ownerState.isEmpty = false;
|
|
1114
|
-
updateOwnerStateClasses(state);
|
|
1115
|
-
}
|
|
1116
|
-
updateAutomatic(state);
|
|
1117
|
-
});
|
|
1118
|
-
},
|
|
1119
|
-
updateFilter: (editFilter) => {
|
|
1120
|
-
set((state) => {
|
|
1121
|
-
const index = state.applyedFilters.findIndex(
|
|
1122
|
-
(ap) => ap.id === editFilter.id
|
|
1123
|
-
);
|
|
1124
|
-
if (index > -1) {
|
|
1125
|
-
state.applyedFilters[index] = editFilter;
|
|
1126
|
-
}
|
|
1127
|
-
updateAutomatic(state);
|
|
1128
|
-
});
|
|
1129
|
-
},
|
|
1130
|
-
setInputData: (inputData) => {
|
|
1131
|
-
set((state) => {
|
|
1132
|
-
state.inputData = inputData;
|
|
1133
|
-
});
|
|
1134
|
-
},
|
|
1135
|
-
setInEdition: (newInEdition) => {
|
|
1136
|
-
set((state) => {
|
|
1137
|
-
state.ownerState.inEdition = newInEdition;
|
|
1138
|
-
updateOwnerStateClasses(state);
|
|
1139
|
-
});
|
|
1140
|
-
},
|
|
1141
|
-
setExternalState: (newExternalState) => {
|
|
1142
|
-
set((state) => {
|
|
1143
|
-
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
1144
|
-
updateOwnerStateClasses(state);
|
|
1145
|
-
});
|
|
1146
|
-
},
|
|
1147
|
-
openPopoverMenuFields: (anchorEl) => {
|
|
1148
|
-
set((state) => {
|
|
1149
|
-
state.fnAnchorEl = () => anchorEl;
|
|
1150
|
-
});
|
|
1151
|
-
},
|
|
1152
|
-
closePopoverMenuFields: (newInEdition) => {
|
|
1153
|
-
set((state) => {
|
|
1154
|
-
state.fnAnchorEl = void 0;
|
|
1155
|
-
state.ownerState.inEdition = newInEdition || false;
|
|
1156
|
-
updateOwnerStateClasses(state);
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
})),
|
|
1161
|
-
{ name: `Dynamic filter` }
|
|
1162
|
-
)
|
|
1163
|
-
);
|
|
1164
|
-
};
|
|
1165
|
-
const DynamicFilterContext = createContext(null);
|
|
1166
|
-
function DynamicFilterProvider(props) {
|
|
1167
|
-
const {
|
|
1168
|
-
automatic = true,
|
|
1169
|
-
withAllField = true,
|
|
1170
|
-
fields,
|
|
1171
|
-
initialApplyedFilters = [],
|
|
1172
|
-
onChangeFilters,
|
|
1173
|
-
children,
|
|
1174
|
-
dataTestId = ""
|
|
1175
|
-
} = props;
|
|
1176
|
-
const {
|
|
1177
|
-
getLabel
|
|
1178
|
-
} = useModuleDictionary();
|
|
1179
|
-
const dynamicFilterStoreRef = useRef();
|
|
1180
|
-
const {
|
|
1181
|
-
host_static_assets,
|
|
1182
|
-
environment_assets
|
|
1183
|
-
} = useEnvironment();
|
|
1184
|
-
const isDesktop = useResponsiveDesktop();
|
|
1185
|
-
const isSkeleton = useModuleSkeleton();
|
|
1186
|
-
const isFirstRender = useFirstRender([isDesktop, isSkeleton]);
|
|
1187
|
-
if (!dynamicFilterStoreRef.current) {
|
|
1188
|
-
dynamicFilterStoreRef.current = createAreaStore({
|
|
1189
|
-
allField: {
|
|
1190
|
-
...ALL_FIELDS,
|
|
1191
|
-
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
|
|
1192
|
-
},
|
|
1193
|
-
withAllField,
|
|
1194
|
-
fields,
|
|
1195
|
-
automatic,
|
|
1196
|
-
getLabel,
|
|
1197
|
-
dataTestId,
|
|
1198
|
-
ownerState: {
|
|
1199
|
-
isSkeleton,
|
|
1200
|
-
isDirty: !automatic,
|
|
1201
|
-
inEdition: false,
|
|
1202
|
-
isValid: true,
|
|
1203
|
-
isMobile: !isDesktop,
|
|
1204
|
-
isEmpty: true
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
|
-
dynamicFilterStoreRef.current.getState().actions.init(initialApplyedFilters);
|
|
1208
|
-
}
|
|
1209
|
-
const countOnChangeFiltersApplyed = useStore(dynamicFilterStoreRef.current, (state) => state.countOnChangeFiltersApplyed, shallow);
|
|
1210
|
-
useEffect(() => {
|
|
1211
|
-
if (countOnChangeFiltersApplyed === 0) {
|
|
1212
|
-
return;
|
|
1213
|
-
}
|
|
1214
|
-
const state = dynamicFilterStoreRef.current?.getState();
|
|
1215
|
-
if (state) {
|
|
1216
|
-
onChangeFilters(formatToInitialFilters(state.applyedFilters), formatToRawFilter(state.applyedFilters));
|
|
1217
|
-
}
|
|
1218
|
-
}, [countOnChangeFiltersApplyed]);
|
|
1219
|
-
useEffect(() => {
|
|
1220
|
-
if (isFirstRender) {
|
|
1221
|
-
return;
|
|
1222
|
-
}
|
|
1223
|
-
dynamicFilterStoreRef.current?.getState().actions.setExternalState({
|
|
1224
|
-
isMobile: !isDesktop,
|
|
1225
|
-
isSkeleton
|
|
1226
|
-
});
|
|
1227
|
-
}, [isDesktop, isSkeleton]);
|
|
1228
|
-
useEffect(() => {
|
|
1229
|
-
if (automatic) {
|
|
1230
|
-
dynamicFilterStoreRef.current?.getState().actions.fireOnChangeFilters();
|
|
1231
|
-
return;
|
|
1232
|
-
}
|
|
1233
|
-
}, []);
|
|
1234
|
-
return /* @__PURE__ */ jsx(DynamicFilterContext.Provider, {
|
|
1235
|
-
value: dynamicFilterStoreRef.current,
|
|
1236
|
-
children
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
const DynamicFilterRoot = styled("div", {})(({
|
|
1240
|
-
theme
|
|
1241
|
-
}) => ({
|
|
1242
|
-
display: "flex",
|
|
1243
|
-
alignItems: "center",
|
|
1244
|
-
justifyContent: "flex-start",
|
|
1245
|
-
height: "auto",
|
|
1246
|
-
width: "100%",
|
|
1247
|
-
padding: theme.spacing(0.5),
|
|
1248
|
-
borderRadius: theme.spacing(1),
|
|
1249
|
-
border: `1px solid ${theme.palette.divider}`,
|
|
1250
|
-
[`&.${dynamicFilterClasses.isMobile}`]: {
|
|
1251
|
-
flexDirection: "column",
|
|
1252
|
-
justifyContent: "space-between",
|
|
1253
|
-
minWidth: theme.spacing(25)
|
|
1254
|
-
},
|
|
1255
|
-
[`&.${dynamicFilterClasses.root}.${dynamicFilterClasses.inEdition}`]: {
|
|
1256
|
-
border: `1px solid ${theme.palette.primary.main}`
|
|
1257
|
-
},
|
|
1258
|
-
[`&.${dynamicFilterClasses.isMobile} .${dynamicFilterClasses.containerApplyedFilters}`]: {
|
|
1259
|
-
margin: "0px",
|
|
1260
|
-
padding: "0px",
|
|
1261
|
-
border: "0px"
|
|
1262
|
-
},
|
|
1263
|
-
[`&.${dynamicFilterClasses.filterButton}.${dynamicFilterClasses.isDirty}`]: {
|
|
1264
|
-
animationName: "dirtyEffect",
|
|
1265
|
-
animationDuration: "1s",
|
|
1266
|
-
animationFillMode: "both",
|
|
1267
|
-
animationIterationCount: "infinite",
|
|
1268
|
-
transition: "all .3s",
|
|
1269
|
-
"@keyframes dirtyEffect": {
|
|
1270
|
-
"20%": {
|
|
1271
|
-
opacity: 1
|
|
1272
|
-
},
|
|
1273
|
-
"50%": {
|
|
1274
|
-
opacity: 0.5
|
|
1275
|
-
},
|
|
1276
|
-
"100%": {
|
|
1277
|
-
opacity: 1
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
},
|
|
1281
|
-
[`&.${dynamicFilterClasses.isInvalid} .${dynamicFilterClasses.filterButton}`]: {
|
|
1282
|
-
border: `1px dashed ${theme.palette.error.main}`
|
|
1283
|
-
},
|
|
1284
|
-
[`& .${dynamicFilterClasses.applyedFilter}.${dynamicFilterClasses.noSetted}`]: {
|
|
1285
|
-
border: `1px dashed ${theme.palette.error.main}`
|
|
1286
|
-
},
|
|
1287
|
-
...theme.components?.M4LDynamicFilter?.styleOverrides
|
|
1288
|
-
}));
|
|
1289
|
-
const ContainerFistRow = styled("div")(() => ({
|
|
1290
|
-
width: "100%",
|
|
1291
|
-
display: "flex"
|
|
1292
|
-
}));
|
|
1293
|
-
const WrapperApplyedFilter = styled("div")(({
|
|
1294
|
-
theme
|
|
1295
|
-
}) => ({
|
|
1296
|
-
width: "auto",
|
|
1297
|
-
display: "flex",
|
|
1298
|
-
justifyContent: "center",
|
|
1299
|
-
alignItems: "center",
|
|
1300
|
-
height: "100%",
|
|
1301
|
-
minHeight: theme.spacing(3),
|
|
1302
|
-
paddingLeft: theme.spacing(1),
|
|
1303
|
-
backgroundColor: theme.palette.grid?.sectionHeader,
|
|
1304
|
-
border: "1px solid",
|
|
1305
|
-
borderColor: alpha(`${theme.palette.divider}`, 0.1),
|
|
1306
|
-
overflow: "visible",
|
|
1307
|
-
borderRadius: theme.spacing(1)
|
|
1308
|
-
}));
|
|
1309
|
-
const AplyedFilterStyled = styled("div")(({
|
|
1310
|
-
theme
|
|
1311
|
-
}) => ({
|
|
1312
|
-
...theme.typography.body2,
|
|
1313
|
-
display: "flex",
|
|
1314
|
-
justifyContent: "center",
|
|
1315
|
-
alignItems: "center",
|
|
1316
|
-
width: "auto",
|
|
1317
|
-
height: "100%",
|
|
1318
|
-
marginRight: theme.spacing(1),
|
|
1319
|
-
marginLeft: theme.spacing(1),
|
|
1320
|
-
whiteSpace: "nowrap"
|
|
1321
|
-
}));
|
|
1322
|
-
const ContainerField = styled("span")(({
|
|
1323
|
-
theme
|
|
1324
|
-
}) => ({
|
|
1325
|
-
...theme.typography.subtitle2
|
|
1326
|
-
}));
|
|
1327
|
-
const ContainerOperator = styled("span")(({
|
|
1328
|
-
theme
|
|
1329
|
-
}) => ({
|
|
1330
|
-
...theme.typography.body2,
|
|
1331
|
-
marginLeft: theme.spacing(1.5),
|
|
1332
|
-
fontStyle: "italic"
|
|
1333
|
-
}));
|
|
1334
|
-
const ContainerOperands = styled("span")(({
|
|
1335
|
-
theme
|
|
1336
|
-
}) => ({
|
|
1337
|
-
...theme.typography.body2,
|
|
1338
|
-
marginLeft: theme.spacing(1.5)
|
|
1339
|
-
}));
|
|
1340
|
-
function ApplyedFilter(props) {
|
|
1341
|
-
const {
|
|
1342
|
-
id,
|
|
1343
|
-
fixed,
|
|
1344
|
-
field,
|
|
1345
|
-
isSetted
|
|
1346
|
-
} = props;
|
|
1347
|
-
const classesApplyedFilter = useDynamicFilter((state) => state.classes.applyedFilter);
|
|
1348
|
-
const formatters = useFormatter();
|
|
1349
|
-
const {
|
|
1350
|
-
getLabel
|
|
1351
|
-
} = useModuleDictionary();
|
|
1352
|
-
const {
|
|
1353
|
-
host_static_assets,
|
|
1354
|
-
environment_assets
|
|
1355
|
-
} = useEnvironment();
|
|
1356
|
-
const {
|
|
1357
|
-
removeFilter,
|
|
1358
|
-
hidePopoverFilter: hidePopupEdit,
|
|
1359
|
-
showPopoverFilterForEdit: showPopupForEdit
|
|
1360
|
-
} = useDynamicFilter((state) => state.actions);
|
|
1361
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId);
|
|
1362
|
-
const labels = useMemo(() => {
|
|
1363
|
-
return getLabelsFilter(props, getLabel, formatters, field);
|
|
1364
|
-
}, [props, getLabel]);
|
|
1365
|
-
const urlIcon = useMemo(() => {
|
|
1366
|
-
return field.urlIcon;
|
|
1367
|
-
}, [field]);
|
|
1368
|
-
const onDelete = () => {
|
|
1369
|
-
hidePopupEdit(false);
|
|
1370
|
-
removeFilter(id);
|
|
1371
|
-
};
|
|
1372
|
-
const onClick = (event) => {
|
|
1373
|
-
hidePopupEdit(false);
|
|
1374
|
-
const currentTarget = event.currentTarget;
|
|
1375
|
-
setTimeout(() => showPopupForEdit(currentTarget, props), 10);
|
|
1376
|
-
};
|
|
1377
|
-
return /* @__PURE__ */ jsxs(WrapperApplyedFilter, {
|
|
1378
|
-
className: clsx(classesApplyedFilter, !isSetted ? `${COMPONENT_CLASS_NAME}-noSetted` : null),
|
|
1379
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1380
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "applyedFilter", `${dataTestId}-${field.name}`)
|
|
1381
|
-
} : {},
|
|
1382
|
-
children: [urlIcon && /* @__PURE__ */ jsx(IconButton, {
|
|
1383
|
-
src: urlIcon,
|
|
1384
|
-
onClick
|
|
1385
|
-
}), /* @__PURE__ */ jsxs(AplyedFilterStyled, {
|
|
1386
|
-
onClick,
|
|
1387
|
-
children: [/* @__PURE__ */ jsx(ContainerField, {
|
|
1388
|
-
children: labels.labelField
|
|
1389
|
-
}), /* @__PURE__ */ jsx(ContainerOperator, {
|
|
1390
|
-
children: labels.labelOperator
|
|
1391
|
-
}), /* @__PURE__ */ jsx(ContainerOperands, {
|
|
1392
|
-
children: labels.labelOperands
|
|
1393
|
-
})]
|
|
1394
|
-
}), !fixed && /* @__PURE__ */ jsx(IconButton, {
|
|
1395
|
-
size: "small",
|
|
1396
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
|
|
1397
|
-
onClick: onDelete,
|
|
1398
|
-
dictionaryTooltipId: "dynamic_filter.tooltip_clear_filter"
|
|
1399
|
-
})]
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
const WrapperApplyedFilters = styled("div")(({
|
|
1403
|
-
theme
|
|
1404
|
-
}) => ({
|
|
1405
|
-
width: "100%",
|
|
1406
|
-
margin: theme.spacing(0, 1),
|
|
1407
|
-
paddingLeft: theme.spacing(1),
|
|
1408
|
-
borderLeft: `1px solid ${theme.palette.divider}`
|
|
1409
|
-
}));
|
|
1410
|
-
const ContainerApplyedFilters = styled("div")(({
|
|
1411
|
-
theme
|
|
1412
|
-
}) => ({
|
|
1413
|
-
width: "100%",
|
|
1414
|
-
display: "flex",
|
|
1415
|
-
justifyContent: "flex-start",
|
|
1416
|
-
alignItems: "center",
|
|
1417
|
-
height: "auto",
|
|
1418
|
-
gap: theme.spacing(1.5)
|
|
1419
|
-
}));
|
|
1420
|
-
function ApplyedFilters() {
|
|
1421
|
-
const classesWrapperApplyedFilters = useDynamicFilter((state) => state.classes.wrapperApplyedFilters, shallow);
|
|
1422
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1423
|
-
const classesContainerApplyedFilters = useDynamicFilter((state) => state.classes.containerApplyedFilters, shallow);
|
|
1424
|
-
const applyedFilters = useDynamicFilter((state) => state.applyedFilters, shallow);
|
|
1425
|
-
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton, shallow);
|
|
1426
|
-
if (isSkeleton) {
|
|
1427
|
-
return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
|
|
1428
|
-
className: classesWrapperApplyedFilters
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
const appliedFiltersSorted = [...applyedFilters].sort((filterA, filterB) => filterA.isSetted !== filterB.isSetted ? Number(filterA.isSetted) - Number(filterB.isSetted) : filterB.id - filterA.id);
|
|
1432
|
-
return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
|
|
1433
|
-
className: classesWrapperApplyedFilters,
|
|
1434
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1435
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "wrapperApplyedFilters", dataTestId)
|
|
1436
|
-
} : {},
|
|
1437
|
-
children: /* @__PURE__ */ jsx(ScrollBar, {
|
|
1438
|
-
children: /* @__PURE__ */ jsx(ContainerApplyedFilters, {
|
|
1439
|
-
className: classesContainerApplyedFilters,
|
|
1440
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1441
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerApplyedFilters", dataTestId)
|
|
1442
|
-
} : {},
|
|
1443
|
-
children: appliedFiltersSorted.map((filter) => /* @__PURE__ */ jsx(ApplyedFilter, {
|
|
1444
|
-
...filter
|
|
1445
|
-
}, filter.id))
|
|
1446
|
-
})
|
|
1447
|
-
})
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
const SKTClearFilters = styled("div")(() => ({
|
|
1451
|
-
display: "flex",
|
|
1452
|
-
justifyContent: "center",
|
|
1453
|
-
alignItems: "center",
|
|
1454
|
-
width: "24px",
|
|
1455
|
-
height: "24px"
|
|
1456
|
-
}));
|
|
1457
|
-
styled("div")(({
|
|
1458
|
-
theme
|
|
1459
|
-
}) => ({
|
|
1460
|
-
paddingLeft: theme.spacing(0.5),
|
|
1461
|
-
borderLeft: `1px solid ${theme.palette.divider}`
|
|
1462
|
-
}));
|
|
1463
|
-
const ClearFiltersButton = () => {
|
|
1464
|
-
const {
|
|
1465
|
-
host_static_assets,
|
|
1466
|
-
environment_assets
|
|
1467
|
-
} = useEnvironment();
|
|
1468
|
-
const {
|
|
1469
|
-
clearFilters,
|
|
1470
|
-
fireOnChangeFilters,
|
|
1471
|
-
hidePopoverFilter: hidePopupEdit
|
|
1472
|
-
} = useDynamicFilter((state) => state.actions);
|
|
1473
|
-
const applyedFilters = useDynamicFilter((state) => state.applyedFilters, shallow);
|
|
1474
|
-
const clearFiltersButtonClasses = useDynamicFilter((state) => state.classes.clearFiltersButton, shallow);
|
|
1475
|
-
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton);
|
|
1476
|
-
if (isSkeleton) {
|
|
1477
|
-
return /* @__PURE__ */ jsx(SKTClearFilters, {
|
|
1478
|
-
className: clearFiltersButtonClasses,
|
|
1479
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1480
|
-
variant: "circular",
|
|
1481
|
-
width: "16px",
|
|
1482
|
-
height: "16px"
|
|
1483
|
-
})
|
|
1484
|
-
});
|
|
1485
|
-
}
|
|
1486
|
-
const onClickClearFilters = () => {
|
|
1487
|
-
hidePopupEdit(false);
|
|
1488
|
-
clearFilters();
|
|
1489
|
-
fireOnChangeFilters();
|
|
1490
|
-
};
|
|
1491
|
-
if (applyedFilters.findIndex((f) => f.fixed == false) > -1) {
|
|
1492
|
-
return /* @__PURE__ */ jsx(IconButton, {
|
|
1493
|
-
className: clearFiltersButtonClasses,
|
|
1494
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/close.svg`,
|
|
1495
|
-
onClick: onClickClearFilters,
|
|
1496
|
-
dictionaryTooltipId: "dynamic_filter.tooltip_clear_filters"
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
return null;
|
|
1500
|
-
};
|
|
1501
|
-
const SKTWrapperFilterButton = styled("div")(() => ({
|
|
1502
|
-
display: "flex",
|
|
1503
|
-
justifyContent: "center",
|
|
1504
|
-
alignItems: "center",
|
|
1505
|
-
width: "24px",
|
|
1506
|
-
height: "24px"
|
|
1507
|
-
}));
|
|
1508
|
-
styled("div")(() => ({
|
|
1509
|
-
display: "block"
|
|
1510
|
-
}));
|
|
1511
|
-
function FilterButton() {
|
|
1512
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId);
|
|
1513
|
-
const automatic = useDynamicFilter((state) => state.automatic);
|
|
1514
|
-
const isValid = useDynamicFilter((state) => state.ownerState.isValid);
|
|
1515
|
-
const isDirty = useDynamicFilter((state) => state.ownerState.isDirty);
|
|
1516
|
-
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton);
|
|
1517
|
-
const {
|
|
1518
|
-
fireOnChangeFilters
|
|
1519
|
-
} = useDynamicFilter((state) => state.actions);
|
|
1520
|
-
const classesFilterButton = useDynamicFilter((state) => state.classes.filterButton);
|
|
1521
|
-
const {
|
|
1522
|
-
host_static_assets,
|
|
1523
|
-
environment_assets
|
|
1524
|
-
} = useEnvironment();
|
|
1525
|
-
if (isSkeleton) {
|
|
1526
|
-
return /* @__PURE__ */ jsx(SKTWrapperFilterButton, {
|
|
1527
|
-
className: classesFilterButton,
|
|
1528
|
-
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1529
|
-
variant: "circular",
|
|
1530
|
-
width: 16,
|
|
1531
|
-
height: 16
|
|
1532
|
-
})
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
return /* @__PURE__ */ jsx(IconButton, {
|
|
1536
|
-
className: classesFilterButton,
|
|
1537
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1538
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "classesFilterButton", dataTestId)
|
|
1539
|
-
} : {},
|
|
1540
|
-
dictionaryTooltipId: getDynamicFilterDictionary(isValid ? isDirty ? DICCTIONARY.filter_tooltip_dirty : DICCTIONARY.filter_tooltip_refresh : DICCTIONARY.filter_tooltip_invalid),
|
|
1541
|
-
onClick: fireOnChangeFilters,
|
|
1542
|
-
"aria-label": "settings",
|
|
1543
|
-
src: `${host_static_assets}/${environment_assets}/${ASSETS_URL}/${automatic ? ASSETS.refresh : ASSETS.search}`
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
function PopoverMenuFields(props) {
|
|
1547
|
-
const {
|
|
1548
|
-
selectFieldIndex,
|
|
1549
|
-
fields
|
|
1550
|
-
} = props;
|
|
1551
|
-
const fnAnchorEl = useDynamicFilter((state) => state.fnAnchorEl, shallow);
|
|
1552
|
-
const classesPopUpMenuFields = useDynamicFilter((state) => state.classes.popoverMenuFields, shallow);
|
|
1553
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1554
|
-
const classesPopUpMenuFieldsPaper = useDynamicFilter((state) => state.classes.popoverMenuFieldsPaper, shallow);
|
|
1555
|
-
const classespopoverMenuFieldsItem = useDynamicFilter((state) => state.classes.popoverMenuFieldsItem, shallow);
|
|
1556
|
-
const classespopoverLabelMemuItem = useDynamicFilter((state) => state.classes.classespopoverLabelMemuItem, shallow);
|
|
1557
|
-
const {
|
|
1558
|
-
showPopoverFilterForAdd,
|
|
1559
|
-
closePopoverMenuFields
|
|
1560
|
-
} = useDynamicFilter((state) => state.actions, shallow);
|
|
1561
|
-
const {
|
|
1562
|
-
getLabel
|
|
1563
|
-
} = useModuleDictionary();
|
|
1564
|
-
const handleClosePopover = () => {
|
|
1565
|
-
closePopoverMenuFields(false);
|
|
1566
|
-
};
|
|
1567
|
-
const theme = useTheme();
|
|
1568
|
-
const handleOpenPopUpClickItem = (_event, field) => {
|
|
1569
|
-
if (fnAnchorEl) {
|
|
1570
|
-
showPopoverFilterForAdd(fnAnchorEl(), field);
|
|
1571
|
-
}
|
|
1572
|
-
};
|
|
1573
|
-
return /* @__PURE__ */ jsx(Popover, {
|
|
1574
|
-
className: classesPopUpMenuFields,
|
|
1575
|
-
disableRestoreFocus: true,
|
|
1576
|
-
open: Boolean(fnAnchorEl),
|
|
1577
|
-
anchorEl: fnAnchorEl && fnAnchorEl(),
|
|
1578
|
-
onClose: handleClosePopover,
|
|
1579
|
-
anchorOrigin: {
|
|
1580
|
-
vertical: "bottom",
|
|
1581
|
-
horizontal: "left"
|
|
1582
|
-
},
|
|
1583
|
-
transformOrigin: {
|
|
1584
|
-
vertical: "top",
|
|
1585
|
-
horizontal: "left"
|
|
1586
|
-
},
|
|
1587
|
-
disableAutoFocus: true,
|
|
1588
|
-
arrowType: "top-left",
|
|
1589
|
-
sx: {
|
|
1590
|
-
...theme.components?.M4LDynamicFilterPopoverMenuFields?.styleOverrides
|
|
1591
|
-
},
|
|
1592
|
-
PaperProps: {
|
|
1593
|
-
className: classesPopUpMenuFieldsPaper,
|
|
1594
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1595
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "popoverMenuFieldsPaper", dataTestId)
|
|
1596
|
-
} : {}
|
|
1597
|
-
},
|
|
1598
|
-
children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ createElement(MenuItem, {
|
|
1599
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1600
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "popoverMenuFieldsItem", `${dataTestId}-${field.name}`)
|
|
1601
|
-
} : {},
|
|
1602
|
-
className: classespopoverMenuFieldsItem,
|
|
1603
|
-
key: `menu_action_${field.label ?? getLabel(field.dictionaryId)}`,
|
|
1604
|
-
dense: true,
|
|
1605
|
-
onClick: (event) => handleOpenPopUpClickItem(event, field),
|
|
1606
|
-
selected: index === selectFieldIndex
|
|
1607
|
-
}, /* @__PURE__ */ jsx(Icon, {
|
|
1608
|
-
src: field.urlIcon
|
|
1609
|
-
}), /* @__PURE__ */ jsx(LabelMemuItem, {
|
|
1610
|
-
className: classespopoverLabelMemuItem,
|
|
1611
|
-
children: field.label ?? getLabel(field.dictionaryId)
|
|
1612
|
-
})))
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
function InputFilter() {
|
|
1616
|
-
const anchorEl = useDynamicFilter((state) => state.fnAnchorEl, shallow);
|
|
1617
|
-
const withAllField = useDynamicFilter((state) => state.withAllField);
|
|
1618
|
-
const inputData = useDynamicFilter((state) => state.inputData);
|
|
1619
|
-
const availableFields = useDynamicFilter((state) => state.availableFields, shallow);
|
|
1620
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1621
|
-
const classesContainerInputFilter = useDynamicFilter((state) => state.classes.containerInputFilter, shallow);
|
|
1622
|
-
const classesInputFilter = useDynamicFilter((state) => state.classes.inputFilter, shallow);
|
|
1623
|
-
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton, shallow);
|
|
1624
|
-
const {
|
|
1625
|
-
showPopoverFilterForAdd,
|
|
1626
|
-
addFilter,
|
|
1627
|
-
openPopoverMenuFields,
|
|
1628
|
-
closePopoverMenuFields,
|
|
1629
|
-
hidePopoverFilter,
|
|
1630
|
-
getFieldByName,
|
|
1631
|
-
getNewId,
|
|
1632
|
-
setInEdition,
|
|
1633
|
-
setInputData
|
|
1634
|
-
} = useDynamicFilter((state) => state.actions, shallow);
|
|
1635
|
-
const {
|
|
1636
|
-
getLabel
|
|
1637
|
-
} = useModuleDictionary();
|
|
1638
|
-
const {
|
|
1639
|
-
host_static_assets,
|
|
1640
|
-
environment_assets
|
|
1641
|
-
} = useEnvironment();
|
|
1642
|
-
const [selectFieldIndex, setSelectFieldIndex] = useState(-1);
|
|
1643
|
-
const [finalFields, setFinalFields] = useState([]);
|
|
1644
|
-
useEffect(() => {
|
|
1645
|
-
if (!anchorEl) {
|
|
1646
|
-
setFinalFields([]);
|
|
1647
|
-
return;
|
|
1648
|
-
}
|
|
1649
|
-
setFinalFields(availableFields.filter((field) => (field.label ?? getLabel(field.dictionaryId)).includes(inputData)));
|
|
1650
|
-
setSelectFieldIndex(-1);
|
|
1651
|
-
}, [anchorEl, inputData, availableFields, getLabel]);
|
|
1652
|
-
const handleOpenPopUpClickItem = (field) => {
|
|
1653
|
-
closePopoverMenuFields();
|
|
1654
|
-
if (anchorEl)
|
|
1655
|
-
showPopoverFilterForAdd(anchorEl(), field);
|
|
1656
|
-
};
|
|
1657
|
-
const onFocusInputFilter = (event) => {
|
|
1658
|
-
openPopoverMenuFields(event.currentTarget);
|
|
1659
|
-
setInEdition(true);
|
|
1660
|
-
};
|
|
1661
|
-
const onChangeInputFilter = (event) => {
|
|
1662
|
-
setInputData(event.target.value);
|
|
1663
|
-
if (!anchorEl) {
|
|
1664
|
-
openPopoverMenuFields(event.currentTarget);
|
|
1665
|
-
}
|
|
1666
|
-
hidePopoverFilter(true);
|
|
1667
|
-
};
|
|
1668
|
-
const handleKeyDown = (event) => {
|
|
1669
|
-
if (event.key === "ArrowDown") {
|
|
1670
|
-
let newIndex = -1;
|
|
1671
|
-
if (finalFields.length > 0) {
|
|
1672
|
-
if (selectFieldIndex < finalFields.length - 1) {
|
|
1673
|
-
newIndex = selectFieldIndex + 1;
|
|
1674
|
-
} else {
|
|
1675
|
-
newIndex = finalFields.length - 1;
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
setSelectFieldIndex(newIndex);
|
|
1679
|
-
}
|
|
1680
|
-
if (event.key === "ArrowUp") {
|
|
1681
|
-
let newIndex = -1;
|
|
1682
|
-
if (finalFields.length > 0) {
|
|
1683
|
-
if (selectFieldIndex > -1) {
|
|
1684
|
-
newIndex = selectFieldIndex - 1;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
setSelectFieldIndex(newIndex);
|
|
1688
|
-
}
|
|
1689
|
-
if (event.key === "Escape") {
|
|
1690
|
-
closePopoverMenuFields();
|
|
1691
|
-
}
|
|
1692
|
-
if (event.key !== "Enter")
|
|
1693
|
-
return;
|
|
1694
|
-
if (selectFieldIndex === -1) {
|
|
1695
|
-
if (inputData.trim() === "") {
|
|
1696
|
-
closePopoverMenuFields();
|
|
1697
|
-
return;
|
|
1698
|
-
}
|
|
1699
|
-
if (withAllField) {
|
|
1700
|
-
addFilter({
|
|
1701
|
-
id: getNewId(),
|
|
1702
|
-
fieldType: "string",
|
|
1703
|
-
field: getFieldByName(ALL_FIELDS.name),
|
|
1704
|
-
isSetted: true,
|
|
1705
|
-
fixed: false,
|
|
1706
|
-
operator: "c",
|
|
1707
|
-
operand1: inputData
|
|
1708
|
-
});
|
|
1709
|
-
setInputData("");
|
|
1710
|
-
closePopoverMenuFields();
|
|
1711
|
-
}
|
|
1712
|
-
} else {
|
|
1713
|
-
handleOpenPopUpClickItem(finalFields[selectFieldIndex]);
|
|
1714
|
-
}
|
|
1715
|
-
};
|
|
1716
|
-
if (!withAllField && availableFields.length == 0) {
|
|
1717
|
-
return null;
|
|
1718
|
-
}
|
|
1719
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1720
|
-
className: classesContainerInputFilter,
|
|
1721
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1722
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "containerInputFilter", dataTestId)
|
|
1723
|
-
} : {},
|
|
1724
|
-
children: [!isSkeleton ? /* @__PURE__ */ jsxs(Fragment, {
|
|
1725
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1726
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/filter.svg`,
|
|
1727
|
-
size: "small"
|
|
1728
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
1729
|
-
type: "text",
|
|
1730
|
-
value: inputData,
|
|
1731
|
-
placeholder: getLabel(getDynamicFilterDictionary(DICCTIONARY.input_placeholder)),
|
|
1732
|
-
onFocus: onFocusInputFilter,
|
|
1733
|
-
className: classesInputFilter,
|
|
1734
|
-
onChange: onChangeInputFilter,
|
|
1735
|
-
onKeyDown: handleKeyDown
|
|
1736
|
-
})]
|
|
1737
|
-
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
1738
|
-
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
1739
|
-
variant: "circular",
|
|
1740
|
-
width: "16px",
|
|
1741
|
-
height: "16px",
|
|
1742
|
-
sx: {
|
|
1743
|
-
minWidth: "16px",
|
|
1744
|
-
minHeight: "16px"
|
|
1745
|
-
}
|
|
1746
|
-
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
1747
|
-
variant: "text",
|
|
1748
|
-
width: "100%",
|
|
1749
|
-
height: "16px"
|
|
1750
|
-
})]
|
|
1751
|
-
}), /* @__PURE__ */ jsx(PopoverMenuFields, {
|
|
1752
|
-
selectFieldIndex,
|
|
1753
|
-
fields: finalFields
|
|
1754
|
-
})]
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
const StyledHeaderFilter = styled("div")(({
|
|
1758
|
-
theme
|
|
1759
|
-
}) => ({
|
|
1760
|
-
width: "100%",
|
|
1761
|
-
display: "flex",
|
|
1762
|
-
justifyContent: "flex-start",
|
|
1763
|
-
alignItems: "center",
|
|
1764
|
-
borderBottom: `1px solid ${theme.palette.divider}`
|
|
1765
|
-
}));
|
|
1766
|
-
const PopoverFilter = () => {
|
|
1767
|
-
let popupValidationSchema;
|
|
1768
|
-
let field;
|
|
1769
|
-
let formFilter;
|
|
1770
|
-
let filterFormValue;
|
|
1771
|
-
let anchorEl;
|
|
1772
|
-
const theme = useTheme();
|
|
1773
|
-
const popoverFilterData = useDynamicFilter((state) => state.popoverFilterData, shallow);
|
|
1774
|
-
const refPreviousPopoverFilterData = useRef(popoverFilterData);
|
|
1775
|
-
const classesPopoverFilter = useDynamicFilter((state) => state.classes.popoverFilter, shallow);
|
|
1776
|
-
const classesPopoverFilterPapper = useDynamicFilter((state) => state.classes.popoverFilterPaper, shallow);
|
|
1777
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1778
|
-
const classesPopoverFilterHeader = useDynamicFilter((state) => state.classes.popoverFilterHeader, shallow);
|
|
1779
|
-
const classesPopoverHeaderTitle = useDynamicFilter((state) => state.classes.popoverHeaderTitle, shallow);
|
|
1780
|
-
const classesPopoverContainerFields = useDynamicFilter((state) => state.classes.popoverContainerFields, shallow);
|
|
1781
|
-
const {
|
|
1782
|
-
hidePopoverFilter,
|
|
1783
|
-
addFilter,
|
|
1784
|
-
updateFilter,
|
|
1785
|
-
getNewId
|
|
1786
|
-
} = useDynamicFilter((state) => state.actions);
|
|
1787
|
-
const {
|
|
1788
|
-
getLabel
|
|
1789
|
-
} = useModuleDictionary();
|
|
1790
|
-
const onClose = useCallback(() => {
|
|
1791
|
-
hidePopoverFilter(false);
|
|
1792
|
-
}, []);
|
|
1793
|
-
const handleKeyDownPopper = useCallback((event) => {
|
|
1794
|
-
if (event.key === "Escape") {
|
|
1795
|
-
onClose();
|
|
1796
|
-
}
|
|
1797
|
-
}, []);
|
|
1798
|
-
const statusLoad = useMemo(() => {
|
|
1799
|
-
let returnStatus;
|
|
1800
|
-
if (popoverFilterData && refPreviousPopoverFilterData.current === void 0) {
|
|
1801
|
-
returnStatus = "ready";
|
|
1802
|
-
} else if (!popoverFilterData) {
|
|
1803
|
-
returnStatus = "initial";
|
|
1804
|
-
} else {
|
|
1805
|
-
returnStatus = "reload_values_provider";
|
|
1806
|
-
}
|
|
1807
|
-
refPreviousPopoverFilterData.current = popoverFilterData;
|
|
1808
|
-
return returnStatus;
|
|
1809
|
-
}, [popoverFilterData]);
|
|
1810
|
-
if (!popoverFilterData) {
|
|
1811
|
-
return null;
|
|
1812
|
-
}
|
|
1813
|
-
if (popoverFilterData.openFor === "add") {
|
|
1814
|
-
popupValidationSchema = getSchemaValidations(popoverFilterData.field, getLabel);
|
|
1815
|
-
field = popoverFilterData.field;
|
|
1816
|
-
anchorEl = popoverFilterData.fnAnchorEl();
|
|
1817
|
-
filterFormValue = getFormValue(field, getLabel);
|
|
1818
|
-
formFilter = {
|
|
1819
|
-
field,
|
|
1820
|
-
id: getNewId(),
|
|
1821
|
-
isSetted: true,
|
|
1822
|
-
fixed: false,
|
|
1823
|
-
...filterFormValue
|
|
1824
|
-
};
|
|
1825
|
-
} else {
|
|
1826
|
-
field = popoverFilterData.filter.field;
|
|
1827
|
-
anchorEl = popoverFilterData.fnAnchorEl();
|
|
1828
|
-
popupValidationSchema = getSchemaValidations(popoverFilterData.filter.field, getLabel);
|
|
1829
|
-
filterFormValue = getFormValue(field, getLabel, popoverFilterData.filter);
|
|
1830
|
-
formFilter = {
|
|
1831
|
-
...popoverFilterData.filter,
|
|
1832
|
-
...filterFormValue
|
|
1833
|
-
};
|
|
1834
|
-
}
|
|
1835
|
-
const onSubmit = async (data) => {
|
|
1836
|
-
const newFilter = {
|
|
1837
|
-
...formFilter,
|
|
1838
|
-
...getFilterFromFormValue({
|
|
1839
|
-
...filterFormValue,
|
|
1840
|
-
...data
|
|
1841
|
-
}),
|
|
1842
|
-
isSetted: true
|
|
1843
|
-
};
|
|
1844
|
-
if (popoverFilterData?.openFor === "add") {
|
|
1845
|
-
addFilter(newFilter);
|
|
1846
|
-
} else {
|
|
1847
|
-
updateFilter(newFilter);
|
|
1848
|
-
}
|
|
1849
|
-
hidePopoverFilter(false);
|
|
1850
|
-
};
|
|
1851
|
-
const handleClosePopover = () => {
|
|
1852
|
-
hidePopoverFilter(false);
|
|
1853
|
-
};
|
|
1854
|
-
return /* @__PURE__ */ jsx(Popover, {
|
|
1855
|
-
className: classesPopoverFilter,
|
|
1856
|
-
transitionDuration: 0,
|
|
1857
|
-
open: true,
|
|
1858
|
-
anchorEl,
|
|
1859
|
-
disableRestoreFocus: true,
|
|
1860
|
-
onKeyDown: handleKeyDownPopper,
|
|
1861
|
-
onClose: handleClosePopover,
|
|
1862
|
-
anchorOrigin: {
|
|
1863
|
-
vertical: "bottom",
|
|
1864
|
-
horizontal: "left"
|
|
1865
|
-
},
|
|
1866
|
-
transformOrigin: {
|
|
1867
|
-
vertical: "top",
|
|
1868
|
-
horizontal: "left"
|
|
1869
|
-
},
|
|
1870
|
-
arrowType: "top-left",
|
|
1871
|
-
sx: {
|
|
1872
|
-
...theme.components?.M4LDynamicFilterPopoverFilter?.styleOverrides
|
|
1873
|
-
},
|
|
1874
|
-
PaperProps: {
|
|
1875
|
-
className: classesPopoverFilterPapper,
|
|
1876
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1877
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "popoverFilterPaper", dataTestId)
|
|
1878
|
-
} : {}
|
|
1879
|
-
},
|
|
1880
|
-
children: /* @__PURE__ */ jsxs(RHFormProvider, {
|
|
1881
|
-
onSubmit,
|
|
1882
|
-
values: filterFormValue,
|
|
1883
|
-
validationSchema: popupValidationSchema,
|
|
1884
|
-
statusLoad,
|
|
1885
|
-
children: [/* @__PURE__ */ jsxs(StyledHeaderFilter, {
|
|
1886
|
-
className: classesPopoverFilterHeader,
|
|
1887
|
-
children: [field.urlIcon && /* @__PURE__ */ jsx(Icon, {
|
|
1888
|
-
src: field.urlIcon
|
|
1889
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
1890
|
-
variant: "paragraphDens",
|
|
1891
|
-
className: classesPopoverHeaderTitle,
|
|
1892
|
-
children: field.label ?? getLabel(field.dictionaryId)
|
|
1893
|
-
})]
|
|
1894
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1895
|
-
className: classesPopoverContainerFields,
|
|
1896
|
-
children: /* @__PURE__ */ jsx(DataTypeComponent, {
|
|
1897
|
-
formFilter,
|
|
1898
|
-
statusLoad
|
|
1899
|
-
})
|
|
1900
|
-
}), /* @__PURE__ */ jsxs(Actions, {
|
|
1901
|
-
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
1902
|
-
onClick: onClose,
|
|
1903
|
-
skeletonWidth: "68px"
|
|
1904
|
-
}), /* @__PURE__ */ jsx(ActionIntro, {
|
|
1905
|
-
skeletonWidth: "64px"
|
|
1906
|
-
})]
|
|
1907
|
-
})]
|
|
1908
|
-
})
|
|
1909
|
-
});
|
|
1910
|
-
};
|
|
1911
|
-
const TEST_PROPS_DATA = `data-testing`;
|
|
1912
|
-
const InnerForHooks = () => {
|
|
1913
|
-
const isMobile = useDynamicFilter((state) => state.ownerState.isMobile, shallow);
|
|
1914
|
-
const dataTestId = useDynamicFilter((state) => state.dataTestId, shallow);
|
|
1915
|
-
const classesRoot = useDynamicFilter((state) => state.classes.root, shallow);
|
|
1916
|
-
const containerClearFilter = useDynamicFilter((state) => state.classes.containerClearFilter, shallow);
|
|
1917
|
-
const classesContainerFistRow = useDynamicFilter((state) => state.classes.containerFistRow, shallow);
|
|
1918
|
-
const fields = useDynamicFilter((state) => state.fields, shallow);
|
|
1919
|
-
return /* @__PURE__ */ jsx(DynamicFilterRoot, {
|
|
1920
|
-
className: classesRoot,
|
|
1921
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1922
|
-
[TEST_PROPS_DATA]: JSON.stringify(fields),
|
|
1923
|
-
[TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "root", dataTestId)
|
|
1924
|
-
} : {},
|
|
1925
|
-
children: !isMobile ? /* @__PURE__ */ jsxs(Fragment, {
|
|
1926
|
-
children: [/* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopoverFilter, {}), /* @__PURE__ */ jsxs("div", {
|
|
1927
|
-
className: containerClearFilter,
|
|
1928
|
-
children: [/* @__PURE__ */ jsx(ClearFiltersButton, {}), /* @__PURE__ */ jsx(FilterButton, {})]
|
|
1929
|
-
})]
|
|
1930
|
-
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
1931
|
-
children: [/* @__PURE__ */ jsxs(ContainerFistRow, {
|
|
1932
|
-
className: classesContainerFistRow,
|
|
1933
|
-
children: [/* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsxs("div", {
|
|
1934
|
-
className: containerClearFilter,
|
|
1935
|
-
children: [/* @__PURE__ */ jsx(ClearFiltersButton, {}), /* @__PURE__ */ jsx(FilterButton, {})]
|
|
1936
|
-
})]
|
|
1937
|
-
}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopoverFilter, {})]
|
|
1938
|
-
})
|
|
1939
|
-
});
|
|
1940
|
-
};
|
|
1941
|
-
const DynamicFilter = (props) => {
|
|
1942
|
-
const render = useFlagsPresent([CommonFlags.FLAG_DICTIONARY_LOADED]);
|
|
1943
|
-
if (!render) {
|
|
1944
|
-
return null;
|
|
1945
|
-
}
|
|
1946
|
-
return /* @__PURE__ */ jsx(DynamicFilterProvider, {
|
|
1947
|
-
...props,
|
|
1948
|
-
children: /* @__PURE__ */ jsx(InnerForHooks, {})
|
|
1949
|
-
});
|
|
1950
|
-
};
|
|
1951
|
-
export {
|
|
1952
|
-
DynamicFilter as D,
|
|
1953
|
-
getDynamicFilterComponentsDictionary as g
|
|
1954
|
-
};
|