@m4l/components 0.2.34 → 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
|
@@ -0,0 +1,2086 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary, useEnvironment, useModuleSkeleton, useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
3
|
+
import { useMemo, useContext, createContext, useRef, useEffect, useState, useCallback } from "react";
|
|
4
|
+
import { useStore, createStore } from "zustand";
|
|
5
|
+
import { shallow } from "zustand/shallow";
|
|
6
|
+
import { useResponsiveDesktop, useFirstRender, useFormatter } from "@m4l/graphics";
|
|
7
|
+
import { devtools } from "zustand/middleware";
|
|
8
|
+
import { immer } from "zustand/middleware/immer";
|
|
9
|
+
import * as Yup from "yup";
|
|
10
|
+
import { g as getCommonActionsDictionary, A as Actions } from "../CommonActions/components/Actions/index.273645af.js";
|
|
11
|
+
import { g as getRHFAutocompleteComponentsDictionary, R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.ea2ac2b1.js";
|
|
12
|
+
import { R as RHFTextField } from "../hook-form/RHFTextField/index.fa97889a.js";
|
|
13
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
14
|
+
import { R as RHFDateTime } from "../hook-form/RHFDateTime/index.ac27deab.js";
|
|
15
|
+
import { i as isValidDate, c as containerQuery } from "../../utils/index.0718eeac.js";
|
|
16
|
+
import { R as RHFAutocompleteAsync } from "../hook-form/RHFAutocompleteAsync/index.98dcf0de.js";
|
|
17
|
+
import { styled } from "@mui/material/styles";
|
|
18
|
+
import { Skeleton, alpha, MenuItem } from "@mui/material";
|
|
19
|
+
import { I as Icon } from "../Icon/index.ee7b85c9.js";
|
|
20
|
+
import { I as IconButton } from "../mui_extended/IconButton/index.b0ee4965.js";
|
|
21
|
+
import { P as Popover } from "../mui_extended/Popover/index.4e7340b4.js";
|
|
22
|
+
import { T as Typography } from "../mui_extended/Typography/index.a1e774a2.js";
|
|
23
|
+
import { a as getPropDataTestId } from "../../test/getNameDataTestId.0faeade8.js";
|
|
24
|
+
import { S as ScrollBar } from "../ScrollBar/index.4b965665.js";
|
|
25
|
+
import { R as RHFormProvider } from "../../contexts/RHFormContext/index.bf3a2812.js";
|
|
26
|
+
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.46f636e9.js";
|
|
27
|
+
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.7406bd47.js";
|
|
28
|
+
const DYNAMIC_FILTER_DICTIONARY_ID = "dynamic_filter";
|
|
29
|
+
function getDynamicFilterComponentsDictionary() {
|
|
30
|
+
return [DYNAMIC_FILTER_DICTIONARY_ID].concat(
|
|
31
|
+
getCommonActionsDictionary().concat(getRHFAutocompleteComponentsDictionary())
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
const DICCTIONARY = {
|
|
35
|
+
input_placeholder: "input_placeholder",
|
|
36
|
+
operand_true: "operand_true",
|
|
37
|
+
operand_false: "operand_false",
|
|
38
|
+
filter_tooltip_refresh: "filter_tooltip_refresh",
|
|
39
|
+
filter_tooltip_dirty: "filter_tooltip_dirty",
|
|
40
|
+
filter_tooltip_invalid: "filter_tooltip_invalid",
|
|
41
|
+
operator_b: "operator_b",
|
|
42
|
+
operator_e: "operator_e",
|
|
43
|
+
operator_ne: "operator_ne",
|
|
44
|
+
operator_gt: "operator_gt",
|
|
45
|
+
operator_gte: "operator_gte",
|
|
46
|
+
operator_lt: "operator_lt",
|
|
47
|
+
operator_lte: "operator_lte",
|
|
48
|
+
operator_c: "operator_c",
|
|
49
|
+
operator_nc: "operator_nc",
|
|
50
|
+
operator_in: "operator_in",
|
|
51
|
+
operator_nin: "operator_nin",
|
|
52
|
+
label_boolean_operator: "label_boolean_operator",
|
|
53
|
+
label_boolean_operand1: "label_boolean_operand1",
|
|
54
|
+
label_operator_date_time: "label_operator_date_time",
|
|
55
|
+
label_operand1_date_time: "label_operand1_date_time",
|
|
56
|
+
label_operand2_date_time: "label_operand2_date_time",
|
|
57
|
+
label_operator_number: "label_operator_number",
|
|
58
|
+
label_operand1_number: "label_operand1_number",
|
|
59
|
+
label_operand2_number: "label_operand2_number",
|
|
60
|
+
label_operator_string: "label_operator_string",
|
|
61
|
+
label_operand1_string: "label_operand1_string",
|
|
62
|
+
operator_required: "operator_required",
|
|
63
|
+
error_invalid_date: "error_invalid_date",
|
|
64
|
+
error_less_than_start: "error_less_than_start",
|
|
65
|
+
label_select_operator: "label_select_operator",
|
|
66
|
+
label_select_operands_array: "label_select_operands_array",
|
|
67
|
+
error_operand_required: "error_operand_required"
|
|
68
|
+
};
|
|
69
|
+
const getDynamicFilterDictionary = (key) => {
|
|
70
|
+
return `${DYNAMIC_FILTER_DICTIONARY_ID}.${key}`;
|
|
71
|
+
};
|
|
72
|
+
const DYNAMIC_FILTER_KEY_COMPONENT = "M4LDynamicFilter";
|
|
73
|
+
const ALL_FIELD = {
|
|
74
|
+
name: "all",
|
|
75
|
+
dictionaryId: "dynamic_filter.all_fields",
|
|
76
|
+
urlIcon: "",
|
|
77
|
+
type: "string",
|
|
78
|
+
multiple: true,
|
|
79
|
+
presence: "optional"
|
|
80
|
+
};
|
|
81
|
+
const STRING_OPERATORS = ["c", "nc"];
|
|
82
|
+
const NUMBER_OPERATORS = ["b", "e", "ne", "gt", "gte", "lt", "lte"];
|
|
83
|
+
const BOOLEAN_OPERATORS = ["e", "ne"];
|
|
84
|
+
const SELECT_OPERATORS = ["in", "nin"];
|
|
85
|
+
const DATE_TIME_OPERATORS = [
|
|
86
|
+
"b",
|
|
87
|
+
"e",
|
|
88
|
+
"ne",
|
|
89
|
+
"gt",
|
|
90
|
+
"gte",
|
|
91
|
+
"lt",
|
|
92
|
+
"lte"
|
|
93
|
+
];
|
|
94
|
+
function BooleanFilter() {
|
|
95
|
+
const { getLabel } = useModuleDictionary();
|
|
96
|
+
const operators = useMemo(
|
|
97
|
+
() => BOOLEAN_OPERATORS.map((o) => ({
|
|
98
|
+
id: o,
|
|
99
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
100
|
+
})),
|
|
101
|
+
[getLabel]
|
|
102
|
+
);
|
|
103
|
+
const optionsYesNo = useMemo(
|
|
104
|
+
() => [
|
|
105
|
+
{
|
|
106
|
+
value: true,
|
|
107
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_true))
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: false,
|
|
111
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_false))
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
[getLabel]
|
|
115
|
+
);
|
|
116
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
RHFAutocomplete,
|
|
119
|
+
{
|
|
120
|
+
name: "formValueOperator",
|
|
121
|
+
autoComplete: "off",
|
|
122
|
+
options: operators,
|
|
123
|
+
getOptionLabel: (option) => option.label,
|
|
124
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
125
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operator))
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
RHFAutocomplete,
|
|
130
|
+
{
|
|
131
|
+
name: "formValueOperand1",
|
|
132
|
+
autoComplete: "off",
|
|
133
|
+
options: optionsYesNo,
|
|
134
|
+
getOptionLabel: (option) => option.label,
|
|
135
|
+
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
136
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operand1))
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
] });
|
|
140
|
+
}
|
|
141
|
+
class BooleanFilterHelpers {
|
|
142
|
+
getComponent() {
|
|
143
|
+
return BooleanFilter;
|
|
144
|
+
}
|
|
145
|
+
getDefaultFilter(field, fixed) {
|
|
146
|
+
const defaultOperand1 = field.defaultOperand1;
|
|
147
|
+
const defaultFilter = {
|
|
148
|
+
id: 0,
|
|
149
|
+
fieldType: "boolean",
|
|
150
|
+
field,
|
|
151
|
+
fixed,
|
|
152
|
+
isSet: true,
|
|
153
|
+
operator: "e",
|
|
154
|
+
operand1: true
|
|
155
|
+
};
|
|
156
|
+
if (defaultOperand1 !== void 0 && typeof defaultOperand1 === "boolean") {
|
|
157
|
+
defaultFilter.operand1 = defaultOperand1;
|
|
158
|
+
}
|
|
159
|
+
return defaultFilter;
|
|
160
|
+
}
|
|
161
|
+
getFilterFromFormValue(formFilterValue) {
|
|
162
|
+
const operator = formFilterValue.formValueOperator.id;
|
|
163
|
+
const operand1 = formFilterValue.formValueOperand1?.value || false;
|
|
164
|
+
return {
|
|
165
|
+
fieldType: "boolean",
|
|
166
|
+
operator,
|
|
167
|
+
operand1
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
getFormValue(field, getLabel, filterValue) {
|
|
171
|
+
const filterValueBoolean = filterValue ? filterValue : void 0;
|
|
172
|
+
const operator = filterValueBoolean ? filterValueBoolean.operator : field.defaultOperator ?? "e";
|
|
173
|
+
const formValueOperand1 = filterValueBoolean ? {
|
|
174
|
+
value: filterValueBoolean.operand1,
|
|
175
|
+
label: getLabel(getDynamicFilterDictionary(`operand_${filterValueBoolean.operand1}`))
|
|
176
|
+
} : null;
|
|
177
|
+
return {
|
|
178
|
+
fieldType: "boolean",
|
|
179
|
+
formValueOperator: {
|
|
180
|
+
id: operator,
|
|
181
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
182
|
+
},
|
|
183
|
+
formValueOperand1
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
getLabels(filter, getLabel, _formatters, _field) {
|
|
187
|
+
const labelOperands = filter.operand1 ? getLabel(getDynamicFilterDictionary("operand_true")) : getLabel(getDynamicFilterDictionary("operand_false"));
|
|
188
|
+
return {
|
|
189
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
190
|
+
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
191
|
+
labelOperands
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
getSchema(getLabel) {
|
|
195
|
+
return Yup.object({
|
|
196
|
+
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
197
|
+
formValueOperand1: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`))
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
verifyFilter(filter, _field) {
|
|
201
|
+
if (typeof filter.operator !== "string") {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
return typeof filter.operand1 === "boolean";
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function StringFilter() {
|
|
211
|
+
const { getLabel } = useModuleDictionary();
|
|
212
|
+
const operators = useMemo(
|
|
213
|
+
() => STRING_OPERATORS.map((o) => ({
|
|
214
|
+
id: o,
|
|
215
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
216
|
+
})),
|
|
217
|
+
[getLabel]
|
|
218
|
+
);
|
|
219
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
RHFAutocomplete,
|
|
222
|
+
{
|
|
223
|
+
name: "formValueOperator",
|
|
224
|
+
autoComplete: "off",
|
|
225
|
+
options: operators,
|
|
226
|
+
getOptionLabel: (option) => option.label,
|
|
227
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
228
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_string))
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ jsx(
|
|
232
|
+
RHFTextField,
|
|
233
|
+
{
|
|
234
|
+
name: "formValueOperand1",
|
|
235
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_string))
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
] });
|
|
239
|
+
}
|
|
240
|
+
class StringFilterHelpers {
|
|
241
|
+
getComponent() {
|
|
242
|
+
return StringFilter;
|
|
243
|
+
}
|
|
244
|
+
getDefaultFilter(field, fixed) {
|
|
245
|
+
const defaultOperand1 = field.defaultOperand1;
|
|
246
|
+
const defaultFilter = {
|
|
247
|
+
id: 0,
|
|
248
|
+
fieldType: "string",
|
|
249
|
+
field,
|
|
250
|
+
fixed,
|
|
251
|
+
isSet: false,
|
|
252
|
+
operator: "c",
|
|
253
|
+
operand1: ""
|
|
254
|
+
};
|
|
255
|
+
if (defaultOperand1 !== void 0 && typeof defaultOperand1 === "string") {
|
|
256
|
+
defaultFilter.operand1 = defaultOperand1;
|
|
257
|
+
}
|
|
258
|
+
return defaultFilter;
|
|
259
|
+
}
|
|
260
|
+
getFilterFromFormValue(formFilterValue) {
|
|
261
|
+
const operator = formFilterValue.formValueOperator.id;
|
|
262
|
+
const operand1 = formFilterValue.formValueOperand1;
|
|
263
|
+
return {
|
|
264
|
+
fieldType: "string",
|
|
265
|
+
operator,
|
|
266
|
+
operand1
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
getFormValue(field, getLabel, filterValue) {
|
|
270
|
+
const filterValueString = filterValue;
|
|
271
|
+
const operator = filterValueString ? filterValueString.operator : field.defaultOperator ?? "c";
|
|
272
|
+
const formValueOperand1 = filterValueString ? filterValueString.operand1 : "";
|
|
273
|
+
return {
|
|
274
|
+
fieldType: "string",
|
|
275
|
+
formValueOperator: {
|
|
276
|
+
id: operator,
|
|
277
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
278
|
+
},
|
|
279
|
+
formValueOperand1
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
getLabels(filter, getLabel, _formatters, _field) {
|
|
283
|
+
const labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
284
|
+
return {
|
|
285
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
286
|
+
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
287
|
+
labelOperands
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
getSchema(getLabel) {
|
|
291
|
+
return Yup.object({
|
|
292
|
+
formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
|
|
293
|
+
formValueOperand1: Yup.string().required(
|
|
294
|
+
getLabel(getDynamicFilterDictionary(DICCTIONARY.error_operand_required))
|
|
295
|
+
)
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
verifyFilter(filter, _field) {
|
|
299
|
+
if (typeof filter.operator !== "string") {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
if (STRING_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
if (typeof filter.operand1 !== "string") {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function DateTimeFilter() {
|
|
312
|
+
const { getLabel } = useModuleDictionary();
|
|
313
|
+
const { control } = useFormContext();
|
|
314
|
+
const operator = useWatch({
|
|
315
|
+
control,
|
|
316
|
+
name: "formValueOperator"
|
|
317
|
+
});
|
|
318
|
+
const operators = useMemo(
|
|
319
|
+
() => DATE_TIME_OPERATORS.map((o) => ({
|
|
320
|
+
id: o,
|
|
321
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
322
|
+
})),
|
|
323
|
+
[getLabel]
|
|
324
|
+
);
|
|
325
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
326
|
+
/* @__PURE__ */ jsx(
|
|
327
|
+
RHFAutocomplete,
|
|
328
|
+
{
|
|
329
|
+
name: "formValueOperator",
|
|
330
|
+
autoComplete: "off",
|
|
331
|
+
options: operators,
|
|
332
|
+
getOptionLabel: (option) => option.label,
|
|
333
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
334
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_date_time))
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
/* @__PURE__ */ jsx(
|
|
338
|
+
RHFDateTime,
|
|
339
|
+
{
|
|
340
|
+
name: "formValueOperand1",
|
|
341
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_date_time))
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
operator && operator.id === "b" && /* @__PURE__ */ jsx(
|
|
345
|
+
RHFDateTime,
|
|
346
|
+
{
|
|
347
|
+
name: "formValueOperand2",
|
|
348
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_date_time))
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
] });
|
|
352
|
+
}
|
|
353
|
+
class DateTimeFilterHelpers {
|
|
354
|
+
getComponent() {
|
|
355
|
+
return DateTimeFilter;
|
|
356
|
+
}
|
|
357
|
+
getDefaultFilter(field, fixed) {
|
|
358
|
+
const defaultStartDate = new Date();
|
|
359
|
+
const defaultEndDate = new Date();
|
|
360
|
+
defaultStartDate.setHours(0, 0, 0, 0);
|
|
361
|
+
defaultEndDate.setHours(23, 59, 59, 999);
|
|
362
|
+
const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
363
|
+
const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
364
|
+
return {
|
|
365
|
+
id: 0,
|
|
366
|
+
fieldType: "datetime",
|
|
367
|
+
field,
|
|
368
|
+
fixed,
|
|
369
|
+
isSet: true,
|
|
370
|
+
operator: "b",
|
|
371
|
+
operand1: defaultOperand1,
|
|
372
|
+
operand2: defaultOperand2
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
getFormValue(field, getLabel, filterValueDateTime) {
|
|
376
|
+
const filterValue = filterValueDateTime;
|
|
377
|
+
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "b";
|
|
378
|
+
const defaultStartDate = new Date();
|
|
379
|
+
const defaultEndDate = new Date();
|
|
380
|
+
const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
381
|
+
const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
382
|
+
const formValueOperand1 = filterValue ? filterValue.operand1 : defaultOperand1;
|
|
383
|
+
const formValueOperand2 = filterValue && filterValue.operator === "b" ? filterValue.operand2 : defaultOperand2;
|
|
384
|
+
return {
|
|
385
|
+
fieldType: "datetime",
|
|
386
|
+
formValueOperator: {
|
|
387
|
+
id: operator,
|
|
388
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
389
|
+
},
|
|
390
|
+
formValueOperand1,
|
|
391
|
+
formValueOperand2
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
getFilterFromFormValue(formFilterValue) {
|
|
395
|
+
const operator = formFilterValue.formValueOperator.id;
|
|
396
|
+
const operand1 = formFilterValue.formValueOperand1;
|
|
397
|
+
if (operator === "b") {
|
|
398
|
+
const operand2 = formFilterValue.formValueOperand2;
|
|
399
|
+
return {
|
|
400
|
+
fieldType: "datetime",
|
|
401
|
+
operator,
|
|
402
|
+
operand1,
|
|
403
|
+
operand2
|
|
404
|
+
};
|
|
405
|
+
} else {
|
|
406
|
+
return {
|
|
407
|
+
fieldType: "datetime",
|
|
408
|
+
operator,
|
|
409
|
+
operand1
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
getLabels(filter, getLabel, formatters, _field) {
|
|
414
|
+
const { dateFormatter } = formatters;
|
|
415
|
+
let labelOperands;
|
|
416
|
+
if (filter.operator === "b") {
|
|
417
|
+
labelOperands = filter.operand1 && filter.operand2 ? `${dateFormatter.formatDate(
|
|
418
|
+
filter.operand1,
|
|
419
|
+
dateFormatter.datetimeFormat
|
|
420
|
+
)} - ${dateFormatter.formatDate(filter.operand2, dateFormatter.datetimeFormat)}` : "";
|
|
421
|
+
} else {
|
|
422
|
+
labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
426
|
+
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
427
|
+
labelOperands
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
getSchema(getLabel) {
|
|
431
|
+
return Yup.object({
|
|
432
|
+
formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
|
|
433
|
+
formValueOperand1: Yup.date().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))),
|
|
434
|
+
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
435
|
+
is: "b",
|
|
436
|
+
then: Yup.date().typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).min(
|
|
437
|
+
Yup.ref("formValueOperand1"),
|
|
438
|
+
getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))
|
|
439
|
+
)
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
verifyFilter(filter, _field) {
|
|
444
|
+
if (typeof filter.operator !== "string") {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
if (typeof filter.operand1 !== "string") {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
if (!isValidDate(new Date(filter.operand1))) {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
if (filter.operator === "b") {
|
|
457
|
+
if (typeof filter.operand2 !== "string") {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
if (!isValidDate(new Date(filter.operand1))) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function NumberFilter() {
|
|
468
|
+
const { getLabel } = useModuleDictionary();
|
|
469
|
+
const { control } = useFormContext();
|
|
470
|
+
const operator = useWatch({
|
|
471
|
+
control,
|
|
472
|
+
name: "formValueOperator"
|
|
473
|
+
});
|
|
474
|
+
const operators = useMemo(
|
|
475
|
+
() => NUMBER_OPERATORS.map((o) => ({
|
|
476
|
+
id: o,
|
|
477
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
478
|
+
})),
|
|
479
|
+
[getLabel]
|
|
480
|
+
);
|
|
481
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
482
|
+
/* @__PURE__ */ jsx(
|
|
483
|
+
RHFAutocomplete,
|
|
484
|
+
{
|
|
485
|
+
name: "formValueOperator",
|
|
486
|
+
autoComplete: "off",
|
|
487
|
+
options: operators,
|
|
488
|
+
getOptionLabel: (option) => option.label,
|
|
489
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
490
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_number))
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
/* @__PURE__ */ jsx(
|
|
494
|
+
RHFTextField,
|
|
495
|
+
{
|
|
496
|
+
name: "formValueOperand1",
|
|
497
|
+
type: "number",
|
|
498
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_number))
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
operator && operator.id === "b" && /* @__PURE__ */ jsx(
|
|
502
|
+
RHFTextField,
|
|
503
|
+
{
|
|
504
|
+
name: "formValueOperand2",
|
|
505
|
+
type: "number",
|
|
506
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_number))
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
] });
|
|
510
|
+
}
|
|
511
|
+
class NumberFilterHelpers {
|
|
512
|
+
getComponent() {
|
|
513
|
+
return NumberFilter;
|
|
514
|
+
}
|
|
515
|
+
getDefaultFilter(fieldNumber, fixed) {
|
|
516
|
+
const field = fieldNumber;
|
|
517
|
+
const dOperator = field.defaultOperator ?? "e";
|
|
518
|
+
const defaultOperand1 = field.defaultOperand1 ?? null;
|
|
519
|
+
const defaultOperand2 = field.defaultOperand2 ?? null;
|
|
520
|
+
return {
|
|
521
|
+
id: 0,
|
|
522
|
+
fieldType: "number",
|
|
523
|
+
field,
|
|
524
|
+
fixed,
|
|
525
|
+
isSet: false,
|
|
526
|
+
operator: dOperator,
|
|
527
|
+
operand1: defaultOperand1,
|
|
528
|
+
operand2: defaultOperand2
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
getFormValue(field, getLabel, filterValue) {
|
|
532
|
+
const filterValueNumber = filterValue;
|
|
533
|
+
const operator = filterValueNumber ? filterValueNumber.operator : field.defaultOperator ?? "e";
|
|
534
|
+
const formValueOperand1 = filterValueNumber ? filterValueNumber.operand1 : null;
|
|
535
|
+
const formValueOperand2 = filterValueNumber && filterValueNumber?.operator === "b" ? filterValueNumber.operand2 : null;
|
|
536
|
+
return {
|
|
537
|
+
fieldType: "number",
|
|
538
|
+
formValueOperator: {
|
|
539
|
+
id: operator,
|
|
540
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
541
|
+
},
|
|
542
|
+
formValueOperand1,
|
|
543
|
+
formValueOperand2
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
getFilterFromFormValue(formFilterValue) {
|
|
547
|
+
const operator = formFilterValue.formValueOperator.id;
|
|
548
|
+
const operand1 = formFilterValue.formValueOperand1 ? formFilterValue.formValueOperand1 : 0;
|
|
549
|
+
if (operator === "b") {
|
|
550
|
+
const operand2 = formFilterValue.formValueOperand2 ? formFilterValue.formValueOperand2 : 0;
|
|
551
|
+
return {
|
|
552
|
+
fieldType: "number",
|
|
553
|
+
operator,
|
|
554
|
+
operand1,
|
|
555
|
+
operand2
|
|
556
|
+
};
|
|
557
|
+
} else {
|
|
558
|
+
return {
|
|
559
|
+
fieldType: "number",
|
|
560
|
+
operator,
|
|
561
|
+
operand1
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
getLabels(filter, getLabel, _formatters, _field) {
|
|
566
|
+
let labelOperands;
|
|
567
|
+
if (filter.operator === "b") {
|
|
568
|
+
labelOperands = filter.operand1 && filter.operand2 ? `${filter.operand1} - ${filter.operand2}` : "";
|
|
569
|
+
} else {
|
|
570
|
+
labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
571
|
+
}
|
|
572
|
+
return {
|
|
573
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
574
|
+
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
575
|
+
labelOperands
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
getSchema(getLabel) {
|
|
579
|
+
return Yup.object({
|
|
580
|
+
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
581
|
+
formValueOperand1: Yup.number().typeError(
|
|
582
|
+
getLabel(`dynamic_filter.error_operand_mustbe_number`)
|
|
583
|
+
),
|
|
584
|
+
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
585
|
+
is: "b",
|
|
586
|
+
then: Yup.number().typeError(getLabel(`dynamic_filter.error_operand_mustbe_number`)).min(Yup.ref("formValueOperand1"), getLabel(`dynamic_filter.error_less_than_start`))
|
|
587
|
+
})
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
verifyFilter(filter, _field) {
|
|
591
|
+
if (typeof filter.operator !== "number") {
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
if (NUMBER_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
if (typeof filter.operand1 !== "number") {
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
if (filter.operator === "b" && typeof filter.operand2 !== "number") {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
function useDynamicFilterStore(selector, equalityFn) {
|
|
607
|
+
const store = useContext(DynamicFilterContext);
|
|
608
|
+
if (!store)
|
|
609
|
+
throw new Error("useDynamicFilterStore context must be use inside DynamicFilterContext");
|
|
610
|
+
return useStore(store, selector, equalityFn ?? shallow);
|
|
611
|
+
}
|
|
612
|
+
function SelectFilter() {
|
|
613
|
+
const { getLabel } = useModuleDictionary();
|
|
614
|
+
const field = useDynamicFilterStore((state) => state.popoverFilterData?.field);
|
|
615
|
+
if (!field?.selectOptions?.endPoint) {
|
|
616
|
+
throw new Error("El filtro tipo Select requiere la configuraci\xF3n del Endpoint");
|
|
617
|
+
}
|
|
618
|
+
const autocompleteProps = field?.selectOptions;
|
|
619
|
+
const operators = useMemo(
|
|
620
|
+
() => SELECT_OPERATORS.map((o) => ({
|
|
621
|
+
id: o,
|
|
622
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
623
|
+
})),
|
|
624
|
+
[getLabel]
|
|
625
|
+
);
|
|
626
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
627
|
+
/* @__PURE__ */ jsx(
|
|
628
|
+
RHFAutocomplete,
|
|
629
|
+
{
|
|
630
|
+
name: "formValueOperator",
|
|
631
|
+
autoComplete: "off",
|
|
632
|
+
options: operators,
|
|
633
|
+
getOptionLabel: (option) => option.label,
|
|
634
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
635
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operator))
|
|
636
|
+
}
|
|
637
|
+
),
|
|
638
|
+
/* @__PURE__ */ jsx(
|
|
639
|
+
RHFAutocompleteAsync,
|
|
640
|
+
{
|
|
641
|
+
...autocompleteProps,
|
|
642
|
+
name: "formValueOperandsArray",
|
|
643
|
+
autoComplete: "off",
|
|
644
|
+
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operands_array))
|
|
645
|
+
}
|
|
646
|
+
)
|
|
647
|
+
] });
|
|
648
|
+
}
|
|
649
|
+
function filterValidOperandsArraySelect(operandsArray, field) {
|
|
650
|
+
const operandsArrayFormatted = Array.isArray(operandsArray) ? operandsArray : [operandsArray];
|
|
651
|
+
const getOptionId = field?.selectOptions?.getOptionId;
|
|
652
|
+
const getOptionLabel = field?.selectOptions?.getOptionLabel;
|
|
653
|
+
return operandsArrayFormatted?.filter((operand) => {
|
|
654
|
+
return typeof operand === "object" && getOptionId?.(operand) && getOptionLabel?.(operand);
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
class SelectFilterHelpers {
|
|
658
|
+
getComponent() {
|
|
659
|
+
return SelectFilter;
|
|
660
|
+
}
|
|
661
|
+
getDefaultFilter(field, fixed) {
|
|
662
|
+
const defaultOperand = field.defaultOperandsArray;
|
|
663
|
+
const defaultFilter = {
|
|
664
|
+
id: 0,
|
|
665
|
+
fieldType: "select",
|
|
666
|
+
field,
|
|
667
|
+
fixed,
|
|
668
|
+
isSet: true,
|
|
669
|
+
operator: "in",
|
|
670
|
+
operandsArray: []
|
|
671
|
+
};
|
|
672
|
+
if (defaultOperand !== void 0 && Array.isArray(defaultOperand)) {
|
|
673
|
+
const validOperandsArray = filterValidOperandsArraySelect(defaultOperand, field);
|
|
674
|
+
defaultFilter.operandsArray = validOperandsArray || [];
|
|
675
|
+
}
|
|
676
|
+
return defaultFilter;
|
|
677
|
+
}
|
|
678
|
+
getFormValue(field, getLabel, filterValueSelect) {
|
|
679
|
+
const filterValue = filterValueSelect ? filterValueSelect : void 0;
|
|
680
|
+
const isMultiple = field?.selectOptions?.multiple ?? false;
|
|
681
|
+
const formValueOperandsArray = isMultiple ? filterValueSelect?.operandsArray : filterValueSelect?.operandsArray?.[0] || filterValueSelect?.operandsArray;
|
|
682
|
+
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "in";
|
|
683
|
+
return {
|
|
684
|
+
fieldType: "select",
|
|
685
|
+
formValueOperator: {
|
|
686
|
+
id: operator,
|
|
687
|
+
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
688
|
+
},
|
|
689
|
+
formValueOperandsArray
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
getFilterFromFormValue(formFilterValue) {
|
|
693
|
+
const operator = formFilterValue.formValueOperator.id;
|
|
694
|
+
const operandsArray = Array.isArray(formFilterValue.formValueOperandsArray) ? formFilterValue.formValueOperandsArray : [formFilterValue.formValueOperandsArray];
|
|
695
|
+
return {
|
|
696
|
+
fieldType: "select",
|
|
697
|
+
operator,
|
|
698
|
+
operandsArray
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
getLabels(filter, getLabel, _formatters, field) {
|
|
702
|
+
const operandsArray = filter.operandsArray;
|
|
703
|
+
const labelOperands = operandsArray?.reduce?.((label, operand) => {
|
|
704
|
+
const textLabel = field.selectOptions?.getOptionLabel?.(operand) || "";
|
|
705
|
+
return label ? `${label} | ${textLabel}` : textLabel;
|
|
706
|
+
}, "")?.toString() || "";
|
|
707
|
+
return {
|
|
708
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
709
|
+
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
710
|
+
labelOperands
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
getSchema(getLabel) {
|
|
714
|
+
return Yup.object({
|
|
715
|
+
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
716
|
+
formValueOperandsArray: Yup.lazy((value) => {
|
|
717
|
+
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`));
|
|
718
|
+
})
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
verifyFilter(filter, field) {
|
|
722
|
+
if (typeof filter.operator !== "string") {
|
|
723
|
+
return false;
|
|
724
|
+
}
|
|
725
|
+
if (!field) {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
if (SELECT_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
729
|
+
return false;
|
|
730
|
+
}
|
|
731
|
+
if (!filter.operandsArray || typeof filter.operandsArray !== "object") {
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
const validOperandsArray = filterValidOperandsArraySelect(
|
|
735
|
+
filter.operandsArray,
|
|
736
|
+
field
|
|
737
|
+
);
|
|
738
|
+
if (!validOperandsArray || validOperandsArray?.length === 0) {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
return true;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
const helpersStrategies = {
|
|
745
|
+
boolean: new BooleanFilterHelpers(),
|
|
746
|
+
string: new StringFilterHelpers(),
|
|
747
|
+
number: new NumberFilterHelpers(),
|
|
748
|
+
datetime: new DateTimeFilterHelpers(),
|
|
749
|
+
select: new SelectFilterHelpers(),
|
|
750
|
+
__default__: () => {
|
|
751
|
+
throw new Error("Type no defined");
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
function fieldFactory(type) {
|
|
755
|
+
const selectedHelper = helpersStrategies?.[type];
|
|
756
|
+
if (!selectedHelper) {
|
|
757
|
+
return helpersStrategies.__default__();
|
|
758
|
+
}
|
|
759
|
+
return selectedHelper;
|
|
760
|
+
}
|
|
761
|
+
function getPurgedInitialFiltersApplied(fields, initialFilters, getFieldByName) {
|
|
762
|
+
const newFilters = [];
|
|
763
|
+
const fixedFields = [];
|
|
764
|
+
for (let index = 0; index < initialFilters.length; index++) {
|
|
765
|
+
try {
|
|
766
|
+
const initialFilter = initialFilters[index];
|
|
767
|
+
const field = getFieldByName(initialFilter.name);
|
|
768
|
+
const filter = {
|
|
769
|
+
id: 0,
|
|
770
|
+
isSet: true,
|
|
771
|
+
fixed: false,
|
|
772
|
+
field,
|
|
773
|
+
fieldType: field.type,
|
|
774
|
+
operator: initialFilters[index].operator,
|
|
775
|
+
operand1: initialFilters[index].operand1,
|
|
776
|
+
operand2: initialFilters[index].operand2,
|
|
777
|
+
operandsArray: initialFilters[index].operandsArray
|
|
778
|
+
};
|
|
779
|
+
if (!field)
|
|
780
|
+
continue;
|
|
781
|
+
const canAddField = fieldFactory(field.type).verifyFilter(initialFilter, field);
|
|
782
|
+
if (canAddField) {
|
|
783
|
+
if (filter.fieldType === "datetime") {
|
|
784
|
+
filter.operand1 = new Date(filter.operand1 + "");
|
|
785
|
+
filter.operand2 = new Date(filter.operand2 + "");
|
|
786
|
+
}
|
|
787
|
+
if (field.presence === "fixed") {
|
|
788
|
+
if (fixedFields.findIndex((f) => f === field.name) === -1) {
|
|
789
|
+
filter.fixed = true;
|
|
790
|
+
fixedFields.push(field.name);
|
|
791
|
+
} else {
|
|
792
|
+
filter.fixed = false;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
filter.isSet = true;
|
|
796
|
+
filter.id = newFilters.length + 1;
|
|
797
|
+
newFilters.push(filter);
|
|
798
|
+
}
|
|
799
|
+
} catch (error) {
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
for (let index = 0; index < fields.length; index++) {
|
|
803
|
+
const field = fields[index];
|
|
804
|
+
if (field.presence === "initialized" || field.presence === "fixed") {
|
|
805
|
+
if (!initialFilters.find((f) => f.name === field.name)) {
|
|
806
|
+
const newFilter = fieldFactory(field.type).getDefaultFilter(
|
|
807
|
+
field,
|
|
808
|
+
field.presence === "fixed"
|
|
809
|
+
);
|
|
810
|
+
newFilter.id = newFilters.length + 1;
|
|
811
|
+
newFilters.push(newFilter);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return newFilters;
|
|
816
|
+
}
|
|
817
|
+
function updateAvailableFields(state) {
|
|
818
|
+
state.availableFields = state.fields.filter((field) => {
|
|
819
|
+
if (field.multiple === void 0 || field.multiple) {
|
|
820
|
+
return true;
|
|
821
|
+
}
|
|
822
|
+
const appliedFilterNames = new Set(state.appliedFilters.map((f) => f.field.name));
|
|
823
|
+
return !appliedFilterNames.has(field.name);
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
function updateOwnerStateIsValid(state) {
|
|
827
|
+
state.ownerState.isValid = state.appliedFilters.every((filter) => filter.isSet);
|
|
828
|
+
}
|
|
829
|
+
const updateAutomatic = (state) => {
|
|
830
|
+
updateOwnerStateIsValid(state);
|
|
831
|
+
updateAvailableFields(state);
|
|
832
|
+
if (state.ownerState.isValid && state.automatic) {
|
|
833
|
+
state.ownerState.isDirty = false;
|
|
834
|
+
state.countOnChangeFiltersApplied++;
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
const createAreaStore = (initProps) => {
|
|
838
|
+
const startProps = {
|
|
839
|
+
countOnChangeFiltersApplied: 0,
|
|
840
|
+
appliedFilters: [],
|
|
841
|
+
availableFields: [],
|
|
842
|
+
fnAnchorEl: void 0,
|
|
843
|
+
popoverFilterData: void 0,
|
|
844
|
+
inputData: "",
|
|
845
|
+
...initProps
|
|
846
|
+
};
|
|
847
|
+
return createStore(
|
|
848
|
+
devtools(
|
|
849
|
+
immer((set, get) => ({
|
|
850
|
+
...startProps,
|
|
851
|
+
actions: {
|
|
852
|
+
init: (initialFiltersApplied) => {
|
|
853
|
+
set((state) => {
|
|
854
|
+
state.appliedFilters = getPurgedInitialFiltersApplied(
|
|
855
|
+
state.fields,
|
|
856
|
+
initialFiltersApplied,
|
|
857
|
+
state.actions.getFieldByName
|
|
858
|
+
);
|
|
859
|
+
state.ownerState.isEmpty = state.appliedFilters.length <= 0;
|
|
860
|
+
updateAutomatic(state);
|
|
861
|
+
});
|
|
862
|
+
},
|
|
863
|
+
getFieldByName: (name) => {
|
|
864
|
+
const field = (get().withAllField ? get().fields.concat(get().allField) : get().fields).find((f) => {
|
|
865
|
+
return f.name === name;
|
|
866
|
+
});
|
|
867
|
+
if (field) {
|
|
868
|
+
return field;
|
|
869
|
+
}
|
|
870
|
+
throw new Error("No exist field");
|
|
871
|
+
},
|
|
872
|
+
removeFilter: (id) => {
|
|
873
|
+
set((state) => {
|
|
874
|
+
const indexToRemoved = state.appliedFilters.findIndex((f) => id === f.id && !f.fixed);
|
|
875
|
+
if (indexToRemoved > -1) {
|
|
876
|
+
state.appliedFilters.splice(indexToRemoved, 1);
|
|
877
|
+
state.ownerState.isEmpty = state.appliedFilters.length === 0;
|
|
878
|
+
updateAutomatic(state);
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
},
|
|
882
|
+
showPopoverFilterForAdd: (anchorEl, field) => {
|
|
883
|
+
set((state) => {
|
|
884
|
+
state.fnAnchorEl = void 0;
|
|
885
|
+
state.inputData = "";
|
|
886
|
+
state.popoverFilterData = {
|
|
887
|
+
openFor: "add",
|
|
888
|
+
fnAnchorEl: () => anchorEl,
|
|
889
|
+
field
|
|
890
|
+
};
|
|
891
|
+
});
|
|
892
|
+
get().actions.setInEdition(true);
|
|
893
|
+
},
|
|
894
|
+
showPopoverFilterForEdit: (anchorEl, filterToEdit) => {
|
|
895
|
+
set((state) => {
|
|
896
|
+
state.popoverFilterData = {
|
|
897
|
+
openFor: "edit",
|
|
898
|
+
fnAnchorEl: () => anchorEl,
|
|
899
|
+
filter: filterToEdit,
|
|
900
|
+
field: filterToEdit.field
|
|
901
|
+
};
|
|
902
|
+
});
|
|
903
|
+
get().actions.setInEdition(true);
|
|
904
|
+
},
|
|
905
|
+
hidePopoverFilter: (stayInEdition) => {
|
|
906
|
+
set((state) => {
|
|
907
|
+
state.popoverFilterData = void 0;
|
|
908
|
+
});
|
|
909
|
+
get().actions.setInEdition(stayInEdition);
|
|
910
|
+
},
|
|
911
|
+
clearFilters: () => {
|
|
912
|
+
set((state) => {
|
|
913
|
+
state.appliedFilters = state.appliedFilters.filter((f) => f.fixed);
|
|
914
|
+
state.ownerState.isEmpty = state.appliedFilters.length === 0;
|
|
915
|
+
updateAvailableFields(state);
|
|
916
|
+
});
|
|
917
|
+
},
|
|
918
|
+
fireOnChangeFilters: () => {
|
|
919
|
+
set((state) => {
|
|
920
|
+
if (state.ownerState.isValid) {
|
|
921
|
+
state.ownerState.isDirty = false;
|
|
922
|
+
state.countOnChangeFiltersApplied++;
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
},
|
|
926
|
+
getNewId: () => {
|
|
927
|
+
return get().appliedFilters.reduce((prev, filterField) => {
|
|
928
|
+
return filterField.id > prev ? filterField.id : prev;
|
|
929
|
+
}, 0) + 1;
|
|
930
|
+
},
|
|
931
|
+
addFilter: (newFilter) => {
|
|
932
|
+
set((state) => {
|
|
933
|
+
state.appliedFilters.push(newFilter);
|
|
934
|
+
state.ownerState.isEmpty = state.appliedFilters.length === 0;
|
|
935
|
+
updateAutomatic(state);
|
|
936
|
+
});
|
|
937
|
+
},
|
|
938
|
+
updateFilter: (editFilter) => {
|
|
939
|
+
set((state) => {
|
|
940
|
+
const index = state.appliedFilters.findIndex(
|
|
941
|
+
(filterField) => filterField.id === editFilter.id
|
|
942
|
+
);
|
|
943
|
+
if (index > -1) {
|
|
944
|
+
state.appliedFilters[index] = editFilter;
|
|
945
|
+
}
|
|
946
|
+
updateAutomatic(state);
|
|
947
|
+
});
|
|
948
|
+
},
|
|
949
|
+
setInputData: (inputData) => {
|
|
950
|
+
set((state) => {
|
|
951
|
+
state.inputData = inputData;
|
|
952
|
+
});
|
|
953
|
+
},
|
|
954
|
+
setInEdition: (newInEdition) => {
|
|
955
|
+
set((state) => {
|
|
956
|
+
state.ownerState.inEdition = newInEdition;
|
|
957
|
+
});
|
|
958
|
+
},
|
|
959
|
+
setExternalState: (newExternalState) => {
|
|
960
|
+
set((state) => {
|
|
961
|
+
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
962
|
+
});
|
|
963
|
+
},
|
|
964
|
+
openPopoverMenuFields: (anchorEl) => {
|
|
965
|
+
set((state) => {
|
|
966
|
+
state.fnAnchorEl = () => anchorEl;
|
|
967
|
+
});
|
|
968
|
+
},
|
|
969
|
+
closePopoverMenuFields: (newInEdition) => {
|
|
970
|
+
set((state) => {
|
|
971
|
+
state.fnAnchorEl = void 0;
|
|
972
|
+
state.ownerState.inEdition = newInEdition || false;
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
})),
|
|
977
|
+
{ name: `Dynamic filter` }
|
|
978
|
+
)
|
|
979
|
+
);
|
|
980
|
+
};
|
|
981
|
+
const formatToRawFilter = (appliedFilters) => {
|
|
982
|
+
return appliedFilters.map((af) => {
|
|
983
|
+
let oa = void 0;
|
|
984
|
+
if (af.field.type === "select" && af.operandsArray) {
|
|
985
|
+
oa = Array.isArray(af.operandsArray) ? af.operandsArray.map(af.field.selectOptions.getOptionId) : [af.field.selectOptions.getOptionId(af.operandsArray)];
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
n: af.field.name,
|
|
989
|
+
o: af.operator,
|
|
990
|
+
o1: af.operand1,
|
|
991
|
+
o2: af.operator === "b" ? af.operand2 : void 0,
|
|
992
|
+
oa
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
};
|
|
996
|
+
function formatToInitialFilters(appliedFilters) {
|
|
997
|
+
return appliedFilters.map((appliedFilter) => {
|
|
998
|
+
const ret = {
|
|
999
|
+
name: appliedFilter.field.name,
|
|
1000
|
+
operator: appliedFilter.operator,
|
|
1001
|
+
operand1: appliedFilter.operand1,
|
|
1002
|
+
operand2: appliedFilter.operator === "b" ? appliedFilter.operand2 : void 0
|
|
1003
|
+
};
|
|
1004
|
+
if (appliedFilter.fieldType === "datetime") {
|
|
1005
|
+
ret.operand1 = appliedFilter.operand1.toISOString();
|
|
1006
|
+
ret.operand2 = appliedFilter.operator === "b" ? appliedFilter.operand2.toISOString() : void 0;
|
|
1007
|
+
}
|
|
1008
|
+
if (appliedFilter.fieldType === "select") {
|
|
1009
|
+
const validOperandsArray = filterValidOperandsArraySelect(
|
|
1010
|
+
appliedFilter.operandsArray,
|
|
1011
|
+
appliedFilter.field
|
|
1012
|
+
);
|
|
1013
|
+
if (validOperandsArray && validOperandsArray?.length > 0) {
|
|
1014
|
+
ret.operandsArray = validOperandsArray;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
if (ret.operand2 === void 0) {
|
|
1018
|
+
delete ret.operand2;
|
|
1019
|
+
}
|
|
1020
|
+
return ret;
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
const DynamicFilterContext = createContext(null);
|
|
1024
|
+
function DynamicFilterProvider(props) {
|
|
1025
|
+
const {
|
|
1026
|
+
automatic = true,
|
|
1027
|
+
withAllField = true,
|
|
1028
|
+
fields,
|
|
1029
|
+
initialAppliedFilters = [],
|
|
1030
|
+
onChangeFilters,
|
|
1031
|
+
dataTestId = "",
|
|
1032
|
+
children
|
|
1033
|
+
} = props;
|
|
1034
|
+
const { getLabel } = useModuleDictionary();
|
|
1035
|
+
const dynamicFilterStoreRef = useRef();
|
|
1036
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
1037
|
+
const isDesktop = useResponsiveDesktop();
|
|
1038
|
+
const isSkeleton = useModuleSkeleton();
|
|
1039
|
+
const isFirstRender = useFirstRender([isDesktop, isSkeleton]);
|
|
1040
|
+
if (!dynamicFilterStoreRef.current) {
|
|
1041
|
+
dynamicFilterStoreRef.current = createAreaStore({
|
|
1042
|
+
allField: {
|
|
1043
|
+
...ALL_FIELD,
|
|
1044
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
|
|
1045
|
+
},
|
|
1046
|
+
withAllField,
|
|
1047
|
+
fields,
|
|
1048
|
+
automatic,
|
|
1049
|
+
getLabel,
|
|
1050
|
+
dataTestId,
|
|
1051
|
+
ownerState: {
|
|
1052
|
+
isSkeleton,
|
|
1053
|
+
isDirty: !automatic,
|
|
1054
|
+
inEdition: false,
|
|
1055
|
+
isValid: true,
|
|
1056
|
+
isMobile: !isDesktop,
|
|
1057
|
+
isEmpty: true
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
dynamicFilterStoreRef.current.getState().actions.init(initialAppliedFilters);
|
|
1061
|
+
}
|
|
1062
|
+
const countOnChangeFiltersApplied = useStore(
|
|
1063
|
+
dynamicFilterStoreRef.current,
|
|
1064
|
+
(state) => state.countOnChangeFiltersApplied,
|
|
1065
|
+
shallow
|
|
1066
|
+
);
|
|
1067
|
+
useEffect(() => {
|
|
1068
|
+
if (countOnChangeFiltersApplied === 0) {
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
const state = dynamicFilterStoreRef.current?.getState();
|
|
1072
|
+
if (state) {
|
|
1073
|
+
onChangeFilters?.(
|
|
1074
|
+
formatToInitialFilters(state.appliedFilters),
|
|
1075
|
+
formatToRawFilter(state.appliedFilters)
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
}, [countOnChangeFiltersApplied]);
|
|
1079
|
+
useEffect(() => {
|
|
1080
|
+
if (isFirstRender) {
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
dynamicFilterStoreRef.current?.getState().actions.setExternalState({ isMobile: !isDesktop, isSkeleton });
|
|
1084
|
+
}, [isDesktop, isSkeleton]);
|
|
1085
|
+
useEffect(() => {
|
|
1086
|
+
if (automatic) {
|
|
1087
|
+
dynamicFilterStoreRef.current?.getState().actions.fireOnChangeFilters();
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
}, []);
|
|
1091
|
+
return /* @__PURE__ */ jsx(DynamicFilterContext.Provider, { value: dynamicFilterStoreRef.current, children });
|
|
1092
|
+
}
|
|
1093
|
+
function useDynamicFilterBase() {
|
|
1094
|
+
const ownerState = useDynamicFilterStore((state) => state.ownerState);
|
|
1095
|
+
const dataTestId = useDynamicFilterStore((state) => state.dataTestId);
|
|
1096
|
+
return { ownerState, dataTestId };
|
|
1097
|
+
}
|
|
1098
|
+
function useInputFilter() {
|
|
1099
|
+
const [selectedFieldIndex, setSelectedFieldIndex] = useState(-1);
|
|
1100
|
+
const [filteredFields, setFilteredFields] = useState([]);
|
|
1101
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
1102
|
+
const { getLabel } = useModuleDictionary();
|
|
1103
|
+
const isSkeleton = useModuleSkeleton();
|
|
1104
|
+
const anchorEl = useDynamicFilterStore((state) => state.fnAnchorEl);
|
|
1105
|
+
const withAllField = useDynamicFilterStore((state) => state.withAllField);
|
|
1106
|
+
const availableFields = useDynamicFilterStore((state) => state.availableFields);
|
|
1107
|
+
const inputData = useDynamicFilterStore((state) => state.inputData);
|
|
1108
|
+
const {
|
|
1109
|
+
addFilter,
|
|
1110
|
+
closePopoverMenuFields,
|
|
1111
|
+
getFieldByName,
|
|
1112
|
+
getNewId,
|
|
1113
|
+
hidePopoverFilter,
|
|
1114
|
+
openPopoverMenuFields,
|
|
1115
|
+
setInEdition,
|
|
1116
|
+
setInputData,
|
|
1117
|
+
showPopoverFilterForAdd
|
|
1118
|
+
} = useDynamicFilterStore((state) => state.actions);
|
|
1119
|
+
useEffect(() => {
|
|
1120
|
+
if (!anchorEl) {
|
|
1121
|
+
setFilteredFields([]);
|
|
1122
|
+
} else {
|
|
1123
|
+
setFilteredFields(
|
|
1124
|
+
availableFields.filter(
|
|
1125
|
+
(field) => (field.label ?? getLabel(field.dictionaryId)).includes(inputData)
|
|
1126
|
+
)
|
|
1127
|
+
);
|
|
1128
|
+
setSelectedFieldIndex(-1);
|
|
1129
|
+
}
|
|
1130
|
+
}, [anchorEl, inputData, availableFields, getLabel]);
|
|
1131
|
+
function handleOpenPopUpClickItem(field) {
|
|
1132
|
+
closePopoverMenuFields();
|
|
1133
|
+
if (anchorEl)
|
|
1134
|
+
showPopoverFilterForAdd(anchorEl(), field);
|
|
1135
|
+
}
|
|
1136
|
+
const inputHandlersProps = {
|
|
1137
|
+
onFocus: (event) => {
|
|
1138
|
+
openPopoverMenuFields(event.currentTarget);
|
|
1139
|
+
setInEdition(true);
|
|
1140
|
+
},
|
|
1141
|
+
onChange: (event) => {
|
|
1142
|
+
setInputData(event.target.value);
|
|
1143
|
+
if (!anchorEl) {
|
|
1144
|
+
openPopoverMenuFields(event.currentTarget);
|
|
1145
|
+
}
|
|
1146
|
+
hidePopoverFilter(true);
|
|
1147
|
+
},
|
|
1148
|
+
onKeyDown: (event) => {
|
|
1149
|
+
if (event.key === "ArrowDown") {
|
|
1150
|
+
let newIndex = -1;
|
|
1151
|
+
if (filteredFields.length > 0) {
|
|
1152
|
+
if (selectedFieldIndex < filteredFields.length - 1) {
|
|
1153
|
+
newIndex = selectedFieldIndex + 1;
|
|
1154
|
+
} else {
|
|
1155
|
+
newIndex = filteredFields.length - 1;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
setSelectedFieldIndex(newIndex);
|
|
1159
|
+
}
|
|
1160
|
+
if (event.key === "ArrowUp") {
|
|
1161
|
+
let newIndex = -1;
|
|
1162
|
+
if (filteredFields.length > 0) {
|
|
1163
|
+
if (selectedFieldIndex > -1) {
|
|
1164
|
+
newIndex = selectedFieldIndex - 1;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
setSelectedFieldIndex(newIndex);
|
|
1168
|
+
}
|
|
1169
|
+
if (event.key === "Escape") {
|
|
1170
|
+
closePopoverMenuFields();
|
|
1171
|
+
}
|
|
1172
|
+
if (event.key !== "Enter")
|
|
1173
|
+
return;
|
|
1174
|
+
if (selectedFieldIndex === -1) {
|
|
1175
|
+
if (inputData.trim() === "") {
|
|
1176
|
+
closePopoverMenuFields();
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
if (withAllField) {
|
|
1180
|
+
addFilter({
|
|
1181
|
+
id: getNewId(),
|
|
1182
|
+
fieldType: "string",
|
|
1183
|
+
field: getFieldByName(ALL_FIELD.name),
|
|
1184
|
+
isSet: true,
|
|
1185
|
+
fixed: false,
|
|
1186
|
+
operator: "c",
|
|
1187
|
+
operand1: inputData
|
|
1188
|
+
});
|
|
1189
|
+
setInputData("");
|
|
1190
|
+
closePopoverMenuFields();
|
|
1191
|
+
}
|
|
1192
|
+
} else {
|
|
1193
|
+
handleOpenPopUpClickItem(filteredFields[selectedFieldIndex]);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
return {
|
|
1198
|
+
iconUrl: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/filter.svg`,
|
|
1199
|
+
isSkeleton,
|
|
1200
|
+
inputPlaceHolder: getLabel(getDynamicFilterDictionary(DICCTIONARY.input_placeholder)),
|
|
1201
|
+
inputData,
|
|
1202
|
+
inputHandlersProps,
|
|
1203
|
+
canRender: !(!withAllField && availableFields.length === 0),
|
|
1204
|
+
filteredFields,
|
|
1205
|
+
selectedFieldIndex
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function InputFilterSkeleton() {
|
|
1209
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1210
|
+
/* @__PURE__ */ jsx(
|
|
1211
|
+
Skeleton,
|
|
1212
|
+
{
|
|
1213
|
+
variant: "circular",
|
|
1214
|
+
width: "16px",
|
|
1215
|
+
height: "16px",
|
|
1216
|
+
sx: { minWidth: "16px", minHeight: "16px" }
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "100%", height: "16px", sx: { minWidth: "80px" } })
|
|
1220
|
+
] });
|
|
1221
|
+
}
|
|
1222
|
+
var DynamicFilterSlots = /* @__PURE__ */ ((DynamicFilterSlots2) => {
|
|
1223
|
+
DynamicFilterSlots2["root"] = "root";
|
|
1224
|
+
DynamicFilterSlots2["innerContainer"] = "innerContainer";
|
|
1225
|
+
DynamicFilterSlots2["inputFilter"] = "inputFilter";
|
|
1226
|
+
DynamicFilterSlots2["inputFilterInput"] = "inputFilterInput";
|
|
1227
|
+
DynamicFilterSlots2["inputFilterIcon"] = "inputFilterIcon";
|
|
1228
|
+
DynamicFilterSlots2["appliedFilters"] = "appliedFilters";
|
|
1229
|
+
DynamicFilterSlots2["appliedFilterInnerContainer"] = "appliedFilterInnerContainer";
|
|
1230
|
+
DynamicFilterSlots2["appliedFilterChip"] = "appliedFilterChip";
|
|
1231
|
+
DynamicFilterSlots2["appliedFilterChipIcon"] = "appliedFilterChipIcon";
|
|
1232
|
+
DynamicFilterSlots2["appliedFilterChipInfo"] = "appliedFilterChipInfo";
|
|
1233
|
+
DynamicFilterSlots2["appliedFilterChipInfoFieldName"] = "appliedFilterChipInfoFieldName";
|
|
1234
|
+
DynamicFilterSlots2["appliedFilterChipInfoOperator"] = "appliedFilterChipInfoOperator";
|
|
1235
|
+
DynamicFilterSlots2["appliedFilterChipInfoOperands"] = "appliedFilterChipInfoOperands";
|
|
1236
|
+
DynamicFilterSlots2["appliedFilterChipRemoveButton"] = "appliedFilterChipRemoveButton";
|
|
1237
|
+
DynamicFilterSlots2["actions"] = "actions";
|
|
1238
|
+
DynamicFilterSlots2["actionsSkeletonButton"] = "actionsSkeletonButton";
|
|
1239
|
+
DynamicFilterSlots2["actionsClearButton"] = "actionsClearButton";
|
|
1240
|
+
DynamicFilterSlots2["actionsSubmitButton"] = "actionsSubmitButton";
|
|
1241
|
+
DynamicFilterSlots2["popoverMenu"] = "popoverMenu";
|
|
1242
|
+
DynamicFilterSlots2["popoverMenuItem"] = "popoverMenuItem";
|
|
1243
|
+
DynamicFilterSlots2["popoverMenuItemIcon"] = "popoverMenuItemIcon";
|
|
1244
|
+
DynamicFilterSlots2["popoverMenuItemLabel"] = "popoverMenuItemLabel";
|
|
1245
|
+
DynamicFilterSlots2["popoverFilter"] = "popoverFilter";
|
|
1246
|
+
DynamicFilterSlots2["popoverFilterContainerFields"] = "popoverFilterContainerFields";
|
|
1247
|
+
DynamicFilterSlots2["popoverFilterHeader"] = "popoverFilterHeader";
|
|
1248
|
+
DynamicFilterSlots2["popoverFilterHeaderIcon"] = "popoverFilterHeaderIcon";
|
|
1249
|
+
DynamicFilterSlots2["popoverFilterHeaderTitle"] = "popoverFilterHeaderTitle";
|
|
1250
|
+
DynamicFilterSlots2["popoverFilterActions"] = "popoverFilterActions";
|
|
1251
|
+
return DynamicFilterSlots2;
|
|
1252
|
+
})(DynamicFilterSlots || {});
|
|
1253
|
+
const CONTAINER_QUERY_NAME = "dynamic";
|
|
1254
|
+
const dynamicFilterStyles = {
|
|
1255
|
+
root: {
|
|
1256
|
+
containerName: CONTAINER_QUERY_NAME,
|
|
1257
|
+
containerType: "inline-size",
|
|
1258
|
+
width: "100%",
|
|
1259
|
+
height: "auto",
|
|
1260
|
+
padding: 0
|
|
1261
|
+
},
|
|
1262
|
+
innerContainer: ({ theme, ownerState }) => ({
|
|
1263
|
+
display: "grid",
|
|
1264
|
+
gridTemplateColumns: "auto 1fr auto",
|
|
1265
|
+
gridTemplateAreas: '"input-filter applied-filters actions-filter"',
|
|
1266
|
+
alignItems: "center",
|
|
1267
|
+
justifyContent: "flex-start",
|
|
1268
|
+
width: "100%",
|
|
1269
|
+
height: "fit-content",
|
|
1270
|
+
border: "1px solid",
|
|
1271
|
+
borderRadius: "4px",
|
|
1272
|
+
borderColor: theme.palette.state?.borderPrimary,
|
|
1273
|
+
background: theme.palette.background.default,
|
|
1274
|
+
[containerQuery(theme.breakpoints, CONTAINER_QUERY_NAME)]: {
|
|
1275
|
+
minHeight: "auto",
|
|
1276
|
+
height: "auto",
|
|
1277
|
+
gridTemplateColumns: "1fr auto",
|
|
1278
|
+
gridTemplateAreas: `"input-filter actions-filter"
|
|
1279
|
+
"applied-filters applied-filters"`
|
|
1280
|
+
},
|
|
1281
|
+
"&:focus-within": {
|
|
1282
|
+
borderColor: !ownerState.isValid ? theme.palette.state.error.normal : theme.palette.state?.focus
|
|
1283
|
+
},
|
|
1284
|
+
...ownerState.isValid === false ? {
|
|
1285
|
+
borderColor: theme.palette.state.error.normal
|
|
1286
|
+
} : {}
|
|
1287
|
+
}),
|
|
1288
|
+
inputFilter: ({ theme }) => ({
|
|
1289
|
+
gridArea: "input-filter",
|
|
1290
|
+
display: "flex",
|
|
1291
|
+
flexDirection: "row",
|
|
1292
|
+
gap: "8px",
|
|
1293
|
+
padding: "4px 6px 4px 4px",
|
|
1294
|
+
height: "100%",
|
|
1295
|
+
maxWidth: "135px",
|
|
1296
|
+
width: "100%",
|
|
1297
|
+
alignItems: "center",
|
|
1298
|
+
borderTopLeftRadius: "4px",
|
|
1299
|
+
borderBottomLeftRadius: "4px",
|
|
1300
|
+
borderRight: "1px solid",
|
|
1301
|
+
borderColor: theme.palette.state?.borderPrimary,
|
|
1302
|
+
[containerQuery(theme.breakpoints, CONTAINER_QUERY_NAME)]: {
|
|
1303
|
+
height: "32px",
|
|
1304
|
+
width: "100%",
|
|
1305
|
+
maxWidth: "100%",
|
|
1306
|
+
borderRight: "none"
|
|
1307
|
+
},
|
|
1308
|
+
[theme.breakpoints.down("sm")]: {
|
|
1309
|
+
height: "44px",
|
|
1310
|
+
justifyContent: "center"
|
|
1311
|
+
}
|
|
1312
|
+
}),
|
|
1313
|
+
inputFilterInput: ({ theme }) => ({
|
|
1314
|
+
...theme.typography.body,
|
|
1315
|
+
background: theme.palette.background.default,
|
|
1316
|
+
color: theme.palette.text.secondary,
|
|
1317
|
+
border: "1px solid",
|
|
1318
|
+
borderColor: "transparent",
|
|
1319
|
+
padding: "4px 8px",
|
|
1320
|
+
width: "100%",
|
|
1321
|
+
height: "100%",
|
|
1322
|
+
"&::placeholder": {
|
|
1323
|
+
color: theme.palette.text.secondary
|
|
1324
|
+
},
|
|
1325
|
+
"&:focus-visible": {
|
|
1326
|
+
color: theme.palette.text.secondary,
|
|
1327
|
+
border: "1px solid",
|
|
1328
|
+
borderColor: theme.palette.state?.active12,
|
|
1329
|
+
background: theme.palette.state?.active12,
|
|
1330
|
+
BorderRadius: "2px",
|
|
1331
|
+
outline: "none!important"
|
|
1332
|
+
},
|
|
1333
|
+
"&:hover": {
|
|
1334
|
+
borderColor: theme.palette.state?.toneOp,
|
|
1335
|
+
background: theme.palette.state?.hoverDefault
|
|
1336
|
+
}
|
|
1337
|
+
}),
|
|
1338
|
+
inputFilterIcon: {},
|
|
1339
|
+
appliedFilters: ({ theme }) => ({
|
|
1340
|
+
gridArea: "applied-filters",
|
|
1341
|
+
width: "100%",
|
|
1342
|
+
height: "fit-content",
|
|
1343
|
+
paddingLeft: theme.spacing(1),
|
|
1344
|
+
borderLeft: "none",
|
|
1345
|
+
margin: "0px",
|
|
1346
|
+
padding: "0px 4px",
|
|
1347
|
+
[containerQuery(theme.breakpoints, CONTAINER_QUERY_NAME)]: {
|
|
1348
|
+
height: "auto",
|
|
1349
|
+
padding: "4px",
|
|
1350
|
+
display: "flex",
|
|
1351
|
+
borderTop: "1px solid ",
|
|
1352
|
+
borderColor: theme.palette.state?.borderSecondary,
|
|
1353
|
+
"&:has(div[class*=appliedFilterInnerContainer]:empty), &:empty": {
|
|
1354
|
+
display: "none"
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}),
|
|
1358
|
+
appliedFilterInnerContainer: ({ theme }) => ({
|
|
1359
|
+
padding: "2px",
|
|
1360
|
+
gap: "4px",
|
|
1361
|
+
height: "fit-content",
|
|
1362
|
+
display: "flex",
|
|
1363
|
+
flexWrap: "nowrap",
|
|
1364
|
+
width: "100%",
|
|
1365
|
+
justifyContent: "flex-start",
|
|
1366
|
+
alignItems: "center",
|
|
1367
|
+
[containerQuery(theme.breakpoints, CONTAINER_QUERY_NAME)]: {
|
|
1368
|
+
height: "32px",
|
|
1369
|
+
padding: 0,
|
|
1370
|
+
margin: 0,
|
|
1371
|
+
border: 0
|
|
1372
|
+
},
|
|
1373
|
+
[theme.breakpoints.down("sm")]: {
|
|
1374
|
+
padding: 0,
|
|
1375
|
+
height: "44px"
|
|
1376
|
+
}
|
|
1377
|
+
}),
|
|
1378
|
+
appliedFilterChip: ({ theme }) => ({
|
|
1379
|
+
display: "flex",
|
|
1380
|
+
justifyContent: "center",
|
|
1381
|
+
alignItems: "center",
|
|
1382
|
+
overflow: "visible",
|
|
1383
|
+
width: "auto",
|
|
1384
|
+
height: "24px",
|
|
1385
|
+
minHeight: theme.spacing(3),
|
|
1386
|
+
paddingLeft: theme.spacing(1),
|
|
1387
|
+
borderColor: alpha(`${theme.palette.divider}`, 0.1),
|
|
1388
|
+
border: "none",
|
|
1389
|
+
borderRadius: "4px",
|
|
1390
|
+
backgroundColor: theme.palette.state?.default,
|
|
1391
|
+
color: theme.palette.text.secondary,
|
|
1392
|
+
...theme.typography.body,
|
|
1393
|
+
[theme.breakpoints.down("sm")]: {
|
|
1394
|
+
height: "fit-content"
|
|
1395
|
+
}
|
|
1396
|
+
}),
|
|
1397
|
+
appliedFilterChipIcon: {},
|
|
1398
|
+
appliedFilterChipInfo: ({ theme }) => ({
|
|
1399
|
+
...theme.typography.body2,
|
|
1400
|
+
display: "flex",
|
|
1401
|
+
justifyContent: "center",
|
|
1402
|
+
alignItems: "center",
|
|
1403
|
+
width: "auto",
|
|
1404
|
+
height: "100%",
|
|
1405
|
+
marginRight: theme.spacing(1),
|
|
1406
|
+
marginLeft: theme.spacing(1),
|
|
1407
|
+
whiteSpace: "nowrap",
|
|
1408
|
+
border: "none",
|
|
1409
|
+
backgroundColor: "transparent"
|
|
1410
|
+
}),
|
|
1411
|
+
appliedFilterChipInfoFieldName: ({ theme }) => ({
|
|
1412
|
+
...theme.typography.subtitle2,
|
|
1413
|
+
color: theme.palette.text.secondary
|
|
1414
|
+
}),
|
|
1415
|
+
appliedFilterChipInfoOperator: ({ theme }) => ({
|
|
1416
|
+
...theme.typography.body2,
|
|
1417
|
+
marginLeft: theme.spacing(1.5),
|
|
1418
|
+
fontStyle: "italic",
|
|
1419
|
+
color: theme.palette.text.secondary
|
|
1420
|
+
}),
|
|
1421
|
+
appliedFilterChipInfoOperands: ({ theme }) => ({
|
|
1422
|
+
...theme.typography.body2,
|
|
1423
|
+
marginLeft: theme.spacing(1.5),
|
|
1424
|
+
color: theme.palette.text.secondary
|
|
1425
|
+
}),
|
|
1426
|
+
appliedFilterChipRemoveButton: {},
|
|
1427
|
+
actions: ({ theme }) => ({
|
|
1428
|
+
gridArea: "actions-filter",
|
|
1429
|
+
display: "flex",
|
|
1430
|
+
flexDirection: "row",
|
|
1431
|
+
gap: "8px",
|
|
1432
|
+
padding: "4px",
|
|
1433
|
+
height: "100%",
|
|
1434
|
+
alignItems: "center",
|
|
1435
|
+
borderTopRightRadius: "4px",
|
|
1436
|
+
borderBottomRightRadius: "4px",
|
|
1437
|
+
borderLeft: "1px solid",
|
|
1438
|
+
borderColor: theme.palette.state?.borderPrimary
|
|
1439
|
+
}),
|
|
1440
|
+
actionsSkeletonButton: {
|
|
1441
|
+
display: "flex",
|
|
1442
|
+
justifyContent: "center",
|
|
1443
|
+
alignItems: "center",
|
|
1444
|
+
width: "24px",
|
|
1445
|
+
height: "24px"
|
|
1446
|
+
},
|
|
1447
|
+
actionsClearButton: {},
|
|
1448
|
+
actionsSubmitButton: ({ theme, ownerState }) => ({
|
|
1449
|
+
...ownerState.isValid === false ? { border: `1px dashed ${theme.palette.error.main}` } : {}
|
|
1450
|
+
}),
|
|
1451
|
+
popoverMenu: ({ theme }) => ({
|
|
1452
|
+
"& .MuiPaper-root": {
|
|
1453
|
+
display: "flex",
|
|
1454
|
+
flexDirection: "column",
|
|
1455
|
+
padding: "8px !important",
|
|
1456
|
+
gap: "4px",
|
|
1457
|
+
borderRadius: "6px",
|
|
1458
|
+
[theme.breakpoints.down("md")]: {
|
|
1459
|
+
gap: "4px"
|
|
1460
|
+
},
|
|
1461
|
+
"& .M4LPopover-arrowStyle": {
|
|
1462
|
+
display: "none"
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}),
|
|
1466
|
+
popoverMenuItem: ({ theme }) => ({
|
|
1467
|
+
paddingLeft: "4px",
|
|
1468
|
+
paddingRight: "4px",
|
|
1469
|
+
borderRadius: "4px",
|
|
1470
|
+
"&:hover": {
|
|
1471
|
+
...theme.typography.body,
|
|
1472
|
+
color: theme.palette.state?.hover,
|
|
1473
|
+
background: theme.palette.state?.default,
|
|
1474
|
+
borderRadius: "4px",
|
|
1475
|
+
padding: "4px 12px 4px 8px"
|
|
1476
|
+
}
|
|
1477
|
+
}),
|
|
1478
|
+
popoverMenuItemLabel: ({ theme }) => ({
|
|
1479
|
+
...theme.typography.body,
|
|
1480
|
+
color: theme.palette.text.primary
|
|
1481
|
+
}),
|
|
1482
|
+
popoverMenuItemIcon: {},
|
|
1483
|
+
popoverFilter: ({ theme }) => ({
|
|
1484
|
+
width: "auto",
|
|
1485
|
+
"& .MuiPaper-root": {
|
|
1486
|
+
padding: "0 !important",
|
|
1487
|
+
minWidth: "220px",
|
|
1488
|
+
maxWidth: "100%",
|
|
1489
|
+
minHeight: "auto",
|
|
1490
|
+
boxShadow: theme.customShadows?.z3,
|
|
1491
|
+
"& .M4LPopover-arrowStyle": {
|
|
1492
|
+
display: "none"
|
|
1493
|
+
},
|
|
1494
|
+
"& .M4LRHFormProvider-root": {
|
|
1495
|
+
gap: "0px",
|
|
1496
|
+
width: "max-content",
|
|
1497
|
+
minWidth: "220px",
|
|
1498
|
+
maxWidth: "420px",
|
|
1499
|
+
height: "fit-content"
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
}),
|
|
1503
|
+
popoverFilterHeader: ({ theme }) => ({
|
|
1504
|
+
backgroundColor: theme.palette.state?.default,
|
|
1505
|
+
display: "flex",
|
|
1506
|
+
alignItems: "center",
|
|
1507
|
+
gap: "8px",
|
|
1508
|
+
padding: "4px 4px 4px 8px",
|
|
1509
|
+
borderTopLeftRadius: "4px",
|
|
1510
|
+
borderTopRightRadius: "4px",
|
|
1511
|
+
borderBottom: "0px",
|
|
1512
|
+
height: "28px",
|
|
1513
|
+
[theme.breakpoints.down("sm")]: {
|
|
1514
|
+
height: "36px"
|
|
1515
|
+
}
|
|
1516
|
+
}),
|
|
1517
|
+
popoverFilterHeaderIcon: {},
|
|
1518
|
+
popoverFilterHeaderTitle: ({ theme }) => ({
|
|
1519
|
+
...theme.typography.paragraphDens,
|
|
1520
|
+
color: theme.palette.text.primary
|
|
1521
|
+
}),
|
|
1522
|
+
popoverFilterContainerFields: ({ theme }) => ({
|
|
1523
|
+
height: "fit-content",
|
|
1524
|
+
"& > div": {
|
|
1525
|
+
display: "flex",
|
|
1526
|
+
height: "auto",
|
|
1527
|
+
flexDirection: "column",
|
|
1528
|
+
padding: "12px 12px 0 12px",
|
|
1529
|
+
gap: "8px",
|
|
1530
|
+
[theme.breakpoints.down("sm")]: {
|
|
1531
|
+
padding: "16px 16px 0 16px",
|
|
1532
|
+
gap: "12px"
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}),
|
|
1536
|
+
popoverFilterActions: ({ theme }) => ({
|
|
1537
|
+
display: "flex",
|
|
1538
|
+
flexDirection: "row",
|
|
1539
|
+
gap: "16px",
|
|
1540
|
+
padding: "16px 12px 12px 12px !important",
|
|
1541
|
+
[theme.breakpoints.down("sm")]: {
|
|
1542
|
+
padding: "24px 16px 16px 16px !important"
|
|
1543
|
+
},
|
|
1544
|
+
"& > .M4LButton-root": {
|
|
1545
|
+
height: "24px",
|
|
1546
|
+
minHeight: "24px",
|
|
1547
|
+
[theme.breakpoints.down("sm")]: {
|
|
1548
|
+
height: "36px"
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
})
|
|
1552
|
+
};
|
|
1553
|
+
const RootStyled = styled("div", { name: DYNAMIC_FILTER_KEY_COMPONENT, slot: DynamicFilterSlots.root })(
|
|
1554
|
+
dynamicFilterStyles?.root
|
|
1555
|
+
);
|
|
1556
|
+
const InnerContainerStyled = styled("div", {
|
|
1557
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1558
|
+
slot: DynamicFilterSlots.innerContainer
|
|
1559
|
+
})(dynamicFilterStyles?.innerContainer);
|
|
1560
|
+
const InputFilterStyled = styled("div", {
|
|
1561
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1562
|
+
slot: DynamicFilterSlots.inputFilter
|
|
1563
|
+
})(dynamicFilterStyles?.inputFilter);
|
|
1564
|
+
const InputFilterInputStyled = styled("input", {
|
|
1565
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1566
|
+
slot: DynamicFilterSlots.inputFilterInput
|
|
1567
|
+
})(dynamicFilterStyles?.inputFilterInput);
|
|
1568
|
+
const InputFilterIconStyled = styled(Icon, {
|
|
1569
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1570
|
+
slot: DynamicFilterSlots.inputFilterIcon
|
|
1571
|
+
})(dynamicFilterStyles?.inputFilterIcon);
|
|
1572
|
+
const AppliedFiltersStyled = styled("div", {
|
|
1573
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1574
|
+
slot: DynamicFilterSlots.appliedFilters
|
|
1575
|
+
})(dynamicFilterStyles?.appliedFilters);
|
|
1576
|
+
const AppliedFilterInnerContainerStyled = styled("div", {
|
|
1577
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1578
|
+
slot: DynamicFilterSlots.appliedFilterInnerContainer
|
|
1579
|
+
})(dynamicFilterStyles?.appliedFilterInnerContainer);
|
|
1580
|
+
const AppliedFilterChipStyled = styled("div", {
|
|
1581
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1582
|
+
slot: DynamicFilterSlots.appliedFilterChip
|
|
1583
|
+
})(dynamicFilterStyles?.appliedFilterChip);
|
|
1584
|
+
const AppliedFilterChipIconStyled = styled(IconButton, {
|
|
1585
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1586
|
+
slot: DynamicFilterSlots.appliedFilterChipIcon
|
|
1587
|
+
})(dynamicFilterStyles?.appliedFilterChipIcon);
|
|
1588
|
+
const AppliedFilterChipInfoStyled = styled("button", {
|
|
1589
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1590
|
+
slot: DynamicFilterSlots.appliedFilterChipInfo
|
|
1591
|
+
})(dynamicFilterStyles?.appliedFilterChipInfo);
|
|
1592
|
+
const AppliedFilterChipInfoFieldNameStyled = styled("span", {
|
|
1593
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1594
|
+
slot: DynamicFilterSlots.appliedFilterChipInfoFieldName
|
|
1595
|
+
})(dynamicFilterStyles?.appliedFilterChipInfoFieldName);
|
|
1596
|
+
const AppliedFilterChipInfoOperatorStyled = styled("span", {
|
|
1597
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1598
|
+
slot: DynamicFilterSlots.appliedFilterChipInfoOperator
|
|
1599
|
+
})(dynamicFilterStyles?.appliedFilterChipInfoOperator);
|
|
1600
|
+
const AppliedFilterChipInfoOperandsStyled = styled("span", {
|
|
1601
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1602
|
+
slot: DynamicFilterSlots.appliedFilterChipInfoOperands
|
|
1603
|
+
})(dynamicFilterStyles?.appliedFilterChipInfoOperands);
|
|
1604
|
+
const AppliedFilterChipRemoveButtonStyled = styled(IconButton, {
|
|
1605
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1606
|
+
slot: DynamicFilterSlots.appliedFilterChipRemoveButton
|
|
1607
|
+
})(dynamicFilterStyles?.appliedFilterChipRemoveButton);
|
|
1608
|
+
const ActionsStyled = styled("div", {
|
|
1609
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1610
|
+
slot: DynamicFilterSlots.actions
|
|
1611
|
+
})(dynamicFilterStyles?.actions);
|
|
1612
|
+
const ActionsSkeletonButtonStyled = styled("div", {
|
|
1613
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1614
|
+
slot: DynamicFilterSlots.actionsSkeletonButton
|
|
1615
|
+
})(dynamicFilterStyles?.actionsSkeletonButton);
|
|
1616
|
+
const ActionsClearButtonStyled = styled(IconButton, {
|
|
1617
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1618
|
+
slot: DynamicFilterSlots.actionsClearButton
|
|
1619
|
+
})(dynamicFilterStyles?.actionsClearButton);
|
|
1620
|
+
const ActionsSubmitButtonStyled = styled(IconButton, {
|
|
1621
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1622
|
+
slot: DynamicFilterSlots.actionsSubmitButton
|
|
1623
|
+
})(dynamicFilterStyles?.actionsSubmitButton);
|
|
1624
|
+
const PopoverMenuStyled = styled(Popover, {
|
|
1625
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1626
|
+
slot: DynamicFilterSlots.popoverMenu
|
|
1627
|
+
})(dynamicFilterStyles?.popoverMenu);
|
|
1628
|
+
const PopoverMenuItemStyled = styled(MenuItem, {
|
|
1629
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1630
|
+
slot: DynamicFilterSlots.popoverMenuItem
|
|
1631
|
+
})(dynamicFilterStyles?.popoverMenuItem);
|
|
1632
|
+
const PopoverMenuItemIconStyled = styled(Icon, {
|
|
1633
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1634
|
+
slot: DynamicFilterSlots.popoverMenuItemIcon
|
|
1635
|
+
})(dynamicFilterStyles?.popoverMenuItemIcon);
|
|
1636
|
+
const PopoverMenuItemLabelStyled = styled("div", {
|
|
1637
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1638
|
+
slot: DynamicFilterSlots.popoverMenuItemLabel
|
|
1639
|
+
})(dynamicFilterStyles?.popoverMenuItemLabel);
|
|
1640
|
+
const PopoverStyled = styled(Popover, {
|
|
1641
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1642
|
+
slot: DynamicFilterSlots.popoverFilter
|
|
1643
|
+
})(dynamicFilterStyles?.popoverFilter);
|
|
1644
|
+
const PopoverContainerFieldsStyled = styled("div", {
|
|
1645
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1646
|
+
slot: DynamicFilterSlots.popoverFilterContainerFields
|
|
1647
|
+
})(dynamicFilterStyles?.popoverFilterContainerFields);
|
|
1648
|
+
const PopoverHeaderStyled = styled("div", {
|
|
1649
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1650
|
+
slot: DynamicFilterSlots.popoverFilterHeader
|
|
1651
|
+
})(dynamicFilterStyles?.popoverFilterHeader);
|
|
1652
|
+
const PopoverHeaderIconStyled = styled(Icon, {
|
|
1653
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1654
|
+
slot: DynamicFilterSlots.popoverFilterHeaderIcon
|
|
1655
|
+
})(dynamicFilterStyles?.popoverFilterHeaderIcon);
|
|
1656
|
+
const PopoverHeaderTitleStyled = styled(Typography, {
|
|
1657
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1658
|
+
slot: DynamicFilterSlots.popoverFilterHeaderTitle
|
|
1659
|
+
})(dynamicFilterStyles?.popoverFilterHeaderTitle);
|
|
1660
|
+
const PopoverHeaderActionsStyled = styled(Actions, {
|
|
1661
|
+
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
1662
|
+
slot: DynamicFilterSlots.popoverFilterActions
|
|
1663
|
+
})(dynamicFilterStyles?.popoverFilterActions);
|
|
1664
|
+
function usePopoverMenuFields() {
|
|
1665
|
+
const { getLabel } = useModuleDictionary();
|
|
1666
|
+
const fnAnchorEl = useDynamicFilterStore((state) => state.fnAnchorEl);
|
|
1667
|
+
const { showPopoverFilterForAdd, closePopoverMenuFields } = useDynamicFilterStore(
|
|
1668
|
+
(state) => state.actions
|
|
1669
|
+
);
|
|
1670
|
+
function handleOpenPopUpClickItem(_event, field) {
|
|
1671
|
+
if (fnAnchorEl) {
|
|
1672
|
+
showPopoverFilterForAdd(fnAnchorEl(), field);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
function handleClosePopover() {
|
|
1676
|
+
closePopoverMenuFields(false);
|
|
1677
|
+
}
|
|
1678
|
+
function getItemLabel(field) {
|
|
1679
|
+
return field.label ?? getLabel(field.dictionaryId);
|
|
1680
|
+
}
|
|
1681
|
+
return {
|
|
1682
|
+
fnAnchorEl,
|
|
1683
|
+
getItemLabel,
|
|
1684
|
+
handleClosePopover,
|
|
1685
|
+
handleOpenPopUpClickItem
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
function PopoverMenuFields(props) {
|
|
1689
|
+
const { fields, selectFieldIndex } = props;
|
|
1690
|
+
const { fnAnchorEl, handleOpenPopUpClickItem, handleClosePopover, getItemLabel } = usePopoverMenuFields();
|
|
1691
|
+
return /* @__PURE__ */ jsx(
|
|
1692
|
+
PopoverMenuStyled,
|
|
1693
|
+
{
|
|
1694
|
+
disableAutoFocus: true,
|
|
1695
|
+
disableRestoreFocus: true,
|
|
1696
|
+
arrowType: "top-left",
|
|
1697
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1698
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
1699
|
+
open: Boolean(fnAnchorEl),
|
|
1700
|
+
onClose: handleClosePopover,
|
|
1701
|
+
anchorEl: fnAnchorEl?.(),
|
|
1702
|
+
ownerState: {},
|
|
1703
|
+
children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ jsxs(
|
|
1704
|
+
PopoverMenuItemStyled,
|
|
1705
|
+
{
|
|
1706
|
+
dense: true,
|
|
1707
|
+
selected: index === selectFieldIndex,
|
|
1708
|
+
onClick: (event) => handleOpenPopUpClickItem(event, field),
|
|
1709
|
+
ownerState: {},
|
|
1710
|
+
children: [
|
|
1711
|
+
/* @__PURE__ */ jsx(PopoverMenuItemIconStyled, { src: field.urlIcon, ownerState: {} }),
|
|
1712
|
+
/* @__PURE__ */ jsx(PopoverMenuItemLabelStyled, { ownerState: {}, children: getItemLabel(field) })
|
|
1713
|
+
]
|
|
1714
|
+
},
|
|
1715
|
+
`menu_action_${getItemLabel(field)}`
|
|
1716
|
+
))
|
|
1717
|
+
}
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
const InputFilter = () => {
|
|
1721
|
+
const {
|
|
1722
|
+
iconUrl,
|
|
1723
|
+
isSkeleton,
|
|
1724
|
+
inputPlaceHolder,
|
|
1725
|
+
inputData,
|
|
1726
|
+
inputHandlersProps,
|
|
1727
|
+
canRender,
|
|
1728
|
+
filteredFields,
|
|
1729
|
+
selectedFieldIndex
|
|
1730
|
+
} = useInputFilter();
|
|
1731
|
+
if (!canRender)
|
|
1732
|
+
return null;
|
|
1733
|
+
if (isSkeleton) {
|
|
1734
|
+
return /* @__PURE__ */ jsx(InputFilterStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(InputFilterSkeleton, {}) });
|
|
1735
|
+
}
|
|
1736
|
+
return /* @__PURE__ */ jsxs(InputFilterStyled, { ownerState: {}, children: [
|
|
1737
|
+
/* @__PURE__ */ jsx(InputFilterIconStyled, { src: iconUrl, ownerState: {} }),
|
|
1738
|
+
/* @__PURE__ */ jsx(
|
|
1739
|
+
InputFilterInputStyled,
|
|
1740
|
+
{
|
|
1741
|
+
type: "text",
|
|
1742
|
+
value: inputData,
|
|
1743
|
+
placeholder: inputPlaceHolder,
|
|
1744
|
+
ownerState: {},
|
|
1745
|
+
...inputHandlersProps
|
|
1746
|
+
}
|
|
1747
|
+
),
|
|
1748
|
+
/* @__PURE__ */ jsx(PopoverMenuFields, { fields: filteredFields, selectFieldIndex: selectedFieldIndex })
|
|
1749
|
+
] });
|
|
1750
|
+
};
|
|
1751
|
+
const InputFilter$1 = InputFilter;
|
|
1752
|
+
function useAppliedFilters() {
|
|
1753
|
+
const appliedFilter = useDynamicFilterStore((state) => state.appliedFilters);
|
|
1754
|
+
const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
|
|
1755
|
+
const appliedFiltersSorted = [...appliedFilter].sort(
|
|
1756
|
+
(filterA, filterB) => filterA.isSet !== filterB.isSet ? Number(filterA.isSet) - Number(filterB.isSet) : filterB.id - filterA.id
|
|
1757
|
+
);
|
|
1758
|
+
return {
|
|
1759
|
+
appliedFiltersSorted,
|
|
1760
|
+
isSkeleton
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
function useAppliedFilterChip(filter) {
|
|
1764
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
1765
|
+
const { getLabel } = useModuleDictionary();
|
|
1766
|
+
const formatters = useFormatter();
|
|
1767
|
+
const { hidePopoverFilter, removeFilter, showPopoverFilterForEdit } = useDynamicFilterStore(
|
|
1768
|
+
(state) => state.actions
|
|
1769
|
+
);
|
|
1770
|
+
const removeIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`;
|
|
1771
|
+
const labels = useMemo(() => {
|
|
1772
|
+
return fieldFactory(filter.field.type).getLabels(filter, getLabel, formatters, filter.field);
|
|
1773
|
+
}, [filter, getLabel]);
|
|
1774
|
+
function onDelete() {
|
|
1775
|
+
hidePopoverFilter(false);
|
|
1776
|
+
removeFilter(filter.id);
|
|
1777
|
+
}
|
|
1778
|
+
function onEditFilter(event) {
|
|
1779
|
+
hidePopoverFilter(false);
|
|
1780
|
+
const currentTarget = event.currentTarget;
|
|
1781
|
+
setTimeout(() => showPopoverFilterForEdit(currentTarget, filter), 10);
|
|
1782
|
+
}
|
|
1783
|
+
return {
|
|
1784
|
+
onDelete,
|
|
1785
|
+
onEditFilter,
|
|
1786
|
+
removeIconUrl,
|
|
1787
|
+
iconFieldUrl: filter.field?.urlIcon,
|
|
1788
|
+
labels
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
function AppliedFilterChip(props) {
|
|
1792
|
+
const { fixed } = props;
|
|
1793
|
+
const { onEditFilter, onDelete, iconFieldUrl, removeIconUrl, labels } = useAppliedFilterChip(props);
|
|
1794
|
+
return /* @__PURE__ */ jsxs(AppliedFilterChipStyled, { ownerState: {}, children: [
|
|
1795
|
+
iconFieldUrl && /* @__PURE__ */ jsx(AppliedFilterChipIconStyled, { onClick: onEditFilter, src: iconFieldUrl, ownerState: {} }),
|
|
1796
|
+
/* @__PURE__ */ jsxs(AppliedFilterChipInfoStyled, { onClick: onEditFilter, ownerState: {}, children: [
|
|
1797
|
+
/* @__PURE__ */ jsx(AppliedFilterChipInfoFieldNameStyled, { ownerState: {}, children: labels.labelField }),
|
|
1798
|
+
/* @__PURE__ */ jsx(AppliedFilterChipInfoOperatorStyled, { ownerState: {}, children: labels.labelOperator }),
|
|
1799
|
+
/* @__PURE__ */ jsx(AppliedFilterChipInfoOperandsStyled, { ownerState: {}, children: labels.labelOperands })
|
|
1800
|
+
] }),
|
|
1801
|
+
!fixed && /* @__PURE__ */ jsx(
|
|
1802
|
+
AppliedFilterChipRemoveButtonStyled,
|
|
1803
|
+
{
|
|
1804
|
+
src: removeIconUrl,
|
|
1805
|
+
size: "small",
|
|
1806
|
+
dictionaryTooltipId: "dynamic_filter.tooltip_clear_filter",
|
|
1807
|
+
onClick: onDelete,
|
|
1808
|
+
ownerState: {}
|
|
1809
|
+
}
|
|
1810
|
+
)
|
|
1811
|
+
] });
|
|
1812
|
+
}
|
|
1813
|
+
function AppliedFilters() {
|
|
1814
|
+
const { appliedFiltersSorted, isSkeleton } = useAppliedFilters();
|
|
1815
|
+
if (isSkeleton) {
|
|
1816
|
+
return /* @__PURE__ */ jsx(AppliedFiltersStyled, { ownerState: {} });
|
|
1817
|
+
}
|
|
1818
|
+
return /* @__PURE__ */ jsx(AppliedFiltersStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(ScrollBar, { children: /* @__PURE__ */ jsx(AppliedFilterInnerContainerStyled, { ownerState: {}, children: appliedFiltersSorted?.map((filter) => /* @__PURE__ */ jsx(AppliedFilterChip, { ...filter }, filter.id)) }) }) });
|
|
1819
|
+
}
|
|
1820
|
+
const ASSETS_URL = "frontend/components/dynamic_filter/assets/icons";
|
|
1821
|
+
const ASSETS = {
|
|
1822
|
+
refresh: "restart.svg",
|
|
1823
|
+
search: "search.svg"
|
|
1824
|
+
};
|
|
1825
|
+
function useFilterActions() {
|
|
1826
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
1827
|
+
const automatic = useDynamicFilterStore((state) => state.automatic);
|
|
1828
|
+
const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
|
|
1829
|
+
const isValid = useDynamicFilterStore((state) => state.ownerState.isValid);
|
|
1830
|
+
const isDirty = useDynamicFilterStore((state) => state.ownerState.isDirty);
|
|
1831
|
+
const appliedFilters = useDynamicFilterStore((state) => state.appliedFilters);
|
|
1832
|
+
const { hidePopoverFilter, clearFilters, fireOnChangeFilters } = useDynamicFilterStore(
|
|
1833
|
+
(state) => state.actions
|
|
1834
|
+
);
|
|
1835
|
+
function onClickClearFilters() {
|
|
1836
|
+
hidePopoverFilter(false);
|
|
1837
|
+
clearFilters();
|
|
1838
|
+
fireOnChangeFilters();
|
|
1839
|
+
}
|
|
1840
|
+
const filterIconUrl = `${host_static_assets}/${environment_assets}/${ASSETS_URL}/${automatic ? ASSETS.refresh : ASSETS.search}`;
|
|
1841
|
+
const clearIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/close.svg`;
|
|
1842
|
+
const canShowRemoveAction = appliedFilters.findIndex((f) => !f.fixed) > -1;
|
|
1843
|
+
const filterButtonDictionaryTooltip = getDynamicFilterDictionary(
|
|
1844
|
+
isValid ? isDirty ? DICCTIONARY.filter_tooltip_dirty : DICCTIONARY.filter_tooltip_refresh : DICCTIONARY.filter_tooltip_invalid
|
|
1845
|
+
);
|
|
1846
|
+
return {
|
|
1847
|
+
isSkeleton,
|
|
1848
|
+
filterIconUrl,
|
|
1849
|
+
clearIconUrl,
|
|
1850
|
+
canShowRemoveAction,
|
|
1851
|
+
onClickClearFilters,
|
|
1852
|
+
onClickFilter: fireOnChangeFilters,
|
|
1853
|
+
filterButtonDictionaryTooltip,
|
|
1854
|
+
ownerState: { isValid }
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
function FilterActionsSkeleton() {
|
|
1858
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1859
|
+
/* @__PURE__ */ jsx(ActionsSkeletonButtonStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: "16px", height: "16px" }) }),
|
|
1860
|
+
/* @__PURE__ */ jsx(ActionsSkeletonButtonStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: "16px", height: "16px" }) })
|
|
1861
|
+
] });
|
|
1862
|
+
}
|
|
1863
|
+
function FilterActions() {
|
|
1864
|
+
const {
|
|
1865
|
+
isSkeleton,
|
|
1866
|
+
filterIconUrl,
|
|
1867
|
+
clearIconUrl,
|
|
1868
|
+
canShowRemoveAction,
|
|
1869
|
+
onClickClearFilters,
|
|
1870
|
+
onClickFilter,
|
|
1871
|
+
filterButtonDictionaryTooltip,
|
|
1872
|
+
ownerState
|
|
1873
|
+
} = useFilterActions();
|
|
1874
|
+
if (isSkeleton) {
|
|
1875
|
+
return /* @__PURE__ */ jsx(ActionsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(FilterActionsSkeleton, {}) });
|
|
1876
|
+
}
|
|
1877
|
+
return /* @__PURE__ */ jsxs(ActionsStyled, { ownerState: {}, children: [
|
|
1878
|
+
canShowRemoveAction && /* @__PURE__ */ jsx(
|
|
1879
|
+
ActionsClearButtonStyled,
|
|
1880
|
+
{
|
|
1881
|
+
src: clearIconUrl,
|
|
1882
|
+
onClick: onClickClearFilters,
|
|
1883
|
+
dictionaryTooltipId: "dynamic_filter.tooltip_clear_filters",
|
|
1884
|
+
ownerState: {}
|
|
1885
|
+
}
|
|
1886
|
+
),
|
|
1887
|
+
/* @__PURE__ */ jsx(
|
|
1888
|
+
ActionsSubmitButtonStyled,
|
|
1889
|
+
{
|
|
1890
|
+
src: filterIconUrl,
|
|
1891
|
+
"aria-label": "settings",
|
|
1892
|
+
dictionaryTooltipId: filterButtonDictionaryTooltip,
|
|
1893
|
+
onClick: onClickFilter,
|
|
1894
|
+
ownerState: { ...ownerState }
|
|
1895
|
+
}
|
|
1896
|
+
)
|
|
1897
|
+
] });
|
|
1898
|
+
}
|
|
1899
|
+
function usePopoverFilter() {
|
|
1900
|
+
let anchorEl;
|
|
1901
|
+
let field;
|
|
1902
|
+
let formFilter;
|
|
1903
|
+
let filterFormValue;
|
|
1904
|
+
let popupValidationSchema;
|
|
1905
|
+
const { getLabel } = useModuleDictionary();
|
|
1906
|
+
const popoverFilterData = useDynamicFilterStore((state) => state.popoverFilterData);
|
|
1907
|
+
const { hidePopoverFilter, addFilter, updateFilter, getNewId } = useDynamicFilterStore(
|
|
1908
|
+
(state) => state.actions
|
|
1909
|
+
);
|
|
1910
|
+
const refPreviousPopoverFilterData = useRef(popoverFilterData);
|
|
1911
|
+
const statusLoad = useMemo(() => {
|
|
1912
|
+
let returnStatus;
|
|
1913
|
+
if (popoverFilterData && refPreviousPopoverFilterData.current === void 0) {
|
|
1914
|
+
returnStatus = "ready";
|
|
1915
|
+
} else if (!popoverFilterData) {
|
|
1916
|
+
returnStatus = "initial";
|
|
1917
|
+
} else {
|
|
1918
|
+
returnStatus = "reload_values_provider";
|
|
1919
|
+
}
|
|
1920
|
+
refPreviousPopoverFilterData.current = popoverFilterData;
|
|
1921
|
+
return returnStatus;
|
|
1922
|
+
}, [popoverFilterData]);
|
|
1923
|
+
if (popoverFilterData?.openFor === "add") {
|
|
1924
|
+
anchorEl = popoverFilterData?.fnAnchorEl();
|
|
1925
|
+
field = popoverFilterData.field;
|
|
1926
|
+
const helperField = fieldFactory(field.type);
|
|
1927
|
+
popupValidationSchema = helperField.getSchema(getLabel);
|
|
1928
|
+
filterFormValue = helperField.getFormValue(field, getLabel);
|
|
1929
|
+
formFilter = {
|
|
1930
|
+
field,
|
|
1931
|
+
id: getNewId(),
|
|
1932
|
+
isSet: true,
|
|
1933
|
+
fixed: false,
|
|
1934
|
+
...filterFormValue
|
|
1935
|
+
};
|
|
1936
|
+
} else if (popoverFilterData) {
|
|
1937
|
+
anchorEl = popoverFilterData?.fnAnchorEl();
|
|
1938
|
+
field = popoverFilterData?.filter.field;
|
|
1939
|
+
const helperField = fieldFactory(field.type);
|
|
1940
|
+
popupValidationSchema = helperField.getSchema(getLabel);
|
|
1941
|
+
filterFormValue = helperField.getFormValue(field, getLabel, popoverFilterData.filter);
|
|
1942
|
+
formFilter = { ...popoverFilterData?.filter, ...filterFormValue };
|
|
1943
|
+
} else {
|
|
1944
|
+
filterFormValue = {};
|
|
1945
|
+
field = {};
|
|
1946
|
+
formFilter = {};
|
|
1947
|
+
anchorEl = {};
|
|
1948
|
+
}
|
|
1949
|
+
const onClose = useCallback(() => {
|
|
1950
|
+
hidePopoverFilter(false);
|
|
1951
|
+
}, []);
|
|
1952
|
+
const handleKeyDownPopper = useCallback((event) => {
|
|
1953
|
+
if (event.key === "Escape") {
|
|
1954
|
+
onClose();
|
|
1955
|
+
}
|
|
1956
|
+
}, []);
|
|
1957
|
+
function handleClosePopover() {
|
|
1958
|
+
hidePopoverFilter(false);
|
|
1959
|
+
}
|
|
1960
|
+
async function onSubmit(dataFieldValues) {
|
|
1961
|
+
const filterField = { ...filterFormValue, ...dataFieldValues };
|
|
1962
|
+
const newFilter = {
|
|
1963
|
+
...formFilter,
|
|
1964
|
+
...fieldFactory(filterField.fieldType).getFilterFromFormValue(filterField),
|
|
1965
|
+
isSet: true
|
|
1966
|
+
};
|
|
1967
|
+
if (popoverFilterData?.openFor === "add") {
|
|
1968
|
+
addFilter(newFilter);
|
|
1969
|
+
} else {
|
|
1970
|
+
updateFilter(newFilter);
|
|
1971
|
+
}
|
|
1972
|
+
hidePopoverFilter(false);
|
|
1973
|
+
}
|
|
1974
|
+
const labelField = field?.label ?? getLabel(field?.dictionaryId ?? "");
|
|
1975
|
+
return {
|
|
1976
|
+
field,
|
|
1977
|
+
labelField,
|
|
1978
|
+
canRender: Boolean(popoverFilterData),
|
|
1979
|
+
anchorEl,
|
|
1980
|
+
handleKeyDownPopper,
|
|
1981
|
+
handleClosePopover,
|
|
1982
|
+
onSubmit,
|
|
1983
|
+
onClose,
|
|
1984
|
+
filterFormValue,
|
|
1985
|
+
formFilter,
|
|
1986
|
+
popupValidationSchema,
|
|
1987
|
+
statusLoad
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
function DataTypeComponent(props) {
|
|
1991
|
+
const { formFilter, statusLoad } = props;
|
|
1992
|
+
const { setFocus } = useFormContext();
|
|
1993
|
+
const Component = fieldFactory(formFilter.field.type).getComponent();
|
|
1994
|
+
useEffect(() => {
|
|
1995
|
+
setTimeout(() => setFocus("formValueOperand1"), 100);
|
|
1996
|
+
}, [statusLoad]);
|
|
1997
|
+
return /* @__PURE__ */ jsx(Component, {});
|
|
1998
|
+
}
|
|
1999
|
+
function PopoverFilter() {
|
|
2000
|
+
const {
|
|
2001
|
+
field,
|
|
2002
|
+
labelField,
|
|
2003
|
+
anchorEl,
|
|
2004
|
+
handleKeyDownPopper,
|
|
2005
|
+
handleClosePopover,
|
|
2006
|
+
onSubmit,
|
|
2007
|
+
onClose,
|
|
2008
|
+
filterFormValue,
|
|
2009
|
+
formFilter,
|
|
2010
|
+
popupValidationSchema,
|
|
2011
|
+
statusLoad,
|
|
2012
|
+
canRender
|
|
2013
|
+
} = usePopoverFilter();
|
|
2014
|
+
if (!canRender) {
|
|
2015
|
+
return null;
|
|
2016
|
+
}
|
|
2017
|
+
return /* @__PURE__ */ jsx(
|
|
2018
|
+
PopoverStyled,
|
|
2019
|
+
{
|
|
2020
|
+
open: true,
|
|
2021
|
+
disableRestoreFocus: true,
|
|
2022
|
+
transitionDuration: 0,
|
|
2023
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2024
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
2025
|
+
arrowType: "top-left",
|
|
2026
|
+
anchorEl,
|
|
2027
|
+
onKeyDown: handleKeyDownPopper,
|
|
2028
|
+
onClose: handleClosePopover,
|
|
2029
|
+
ownerState: {},
|
|
2030
|
+
children: /* @__PURE__ */ jsxs(
|
|
2031
|
+
RHFormProvider,
|
|
2032
|
+
{
|
|
2033
|
+
onSubmit,
|
|
2034
|
+
values: filterFormValue,
|
|
2035
|
+
validationSchema: popupValidationSchema,
|
|
2036
|
+
statusLoad,
|
|
2037
|
+
children: [
|
|
2038
|
+
/* @__PURE__ */ jsxs(PopoverHeaderStyled, { ownerState: {}, children: [
|
|
2039
|
+
field.urlIcon && /* @__PURE__ */ jsx(PopoverHeaderIconStyled, { src: field.urlIcon, ownerState: {} }),
|
|
2040
|
+
/* @__PURE__ */ jsx(PopoverHeaderTitleStyled, { variant: "paragraphDens", ownerState: {}, children: labelField })
|
|
2041
|
+
] }),
|
|
2042
|
+
/* @__PURE__ */ jsx(PopoverContainerFieldsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(DataTypeComponent, { formFilter, statusLoad }) }),
|
|
2043
|
+
/* @__PURE__ */ jsxs(PopoverHeaderActionsStyled, { ownerState: {}, children: [
|
|
2044
|
+
/* @__PURE__ */ jsx(ActionCancel, { onClick: onClose, skeletonWidth: "68px" }),
|
|
2045
|
+
/* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "64px" })
|
|
2046
|
+
] })
|
|
2047
|
+
]
|
|
2048
|
+
}
|
|
2049
|
+
)
|
|
2050
|
+
}
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
function DynamicFilterBase() {
|
|
2054
|
+
const { ownerState, dataTestId } = useDynamicFilterBase();
|
|
2055
|
+
return /* @__PURE__ */ jsx(
|
|
2056
|
+
RootStyled,
|
|
2057
|
+
{
|
|
2058
|
+
ownerState: { ...ownerState },
|
|
2059
|
+
...getPropDataTestId(dataTestId, DynamicFilterSlots.root),
|
|
2060
|
+
children: /* @__PURE__ */ jsxs(
|
|
2061
|
+
InnerContainerStyled,
|
|
2062
|
+
{
|
|
2063
|
+
ownerState: { ...ownerState },
|
|
2064
|
+
...getPropDataTestId(dataTestId, DynamicFilterSlots.innerContainer),
|
|
2065
|
+
children: [
|
|
2066
|
+
/* @__PURE__ */ jsx(InputFilter$1, {}),
|
|
2067
|
+
/* @__PURE__ */ jsx(AppliedFilters, {}),
|
|
2068
|
+
/* @__PURE__ */ jsx(FilterActions, {}),
|
|
2069
|
+
/* @__PURE__ */ jsx(PopoverFilter, {})
|
|
2070
|
+
]
|
|
2071
|
+
}
|
|
2072
|
+
)
|
|
2073
|
+
}
|
|
2074
|
+
);
|
|
2075
|
+
}
|
|
2076
|
+
function DynamicFilter(props) {
|
|
2077
|
+
const hasPresentFlags = useFlagsPresent([CommonFlags.FLAG_DICTIONARY_LOADED]);
|
|
2078
|
+
if (!hasPresentFlags) {
|
|
2079
|
+
return null;
|
|
2080
|
+
}
|
|
2081
|
+
return /* @__PURE__ */ jsx(DynamicFilterProvider, { ...props, children: /* @__PURE__ */ jsx(DynamicFilterBase, {}) });
|
|
2082
|
+
}
|
|
2083
|
+
export {
|
|
2084
|
+
DynamicFilter as D,
|
|
2085
|
+
getDynamicFilterComponentsDictionary as g
|
|
2086
|
+
};
|