@m4l/components 9.2.0 → 9.2.2
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/.storybook/decorators/WithPopupsProvider/WithPopupsProvider.d.ts +6 -1
- package/.storybook/decorators/WithWindowsContainerSizer/WithWindowsContainerSizer.d.ts +5 -0
- package/@types/types.d.ts +11 -0
- package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +3 -3
- package/components/AppBar/slots/AppBarSlots.d.ts +2 -2
- package/components/Chip/slots/ChipSlots.d.ts +1 -1
- package/components/Color/slots/ColorSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +1 -1
- package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
- package/components/DragResizeWindow/DragResizeWindow.d.ts +2 -2
- package/components/DragResizeWindow/DragResizeWindow.js +69 -11
- package/components/DragResizeWindow/DragResizeWindow.styles.js +0 -2
- package/components/DragResizeWindow/classes/index.js +1 -0
- package/components/DragResizeWindow/classes/types.d.ts +1 -0
- package/components/DragResizeWindow/helpers/draggingOrResizingWindow.d.ts +7 -0
- package/components/DragResizeWindow/helpers/draggingOrResizingWindow.js +1 -0
- package/components/DragResizeWindow/helpers/expandingParentContainer.d.ts +12 -0
- package/components/DragResizeWindow/helpers/expandingParentContainer.js +31 -0
- package/components/DragResizeWindow/helpers/getInitialSize.d.ts +15 -0
- package/components/DragResizeWindow/helpers/getInitialSize.js +56 -0
- package/components/DragResizeWindow/helpers/index.d.ts +6 -15
- package/components/DragResizeWindow/helpers/index.js +1 -37
- package/components/DragResizeWindow/helpers/isElmentInViewport.d.ts +15 -0
- package/components/DragResizeWindow/helpers/isElmentInViewport.js +1 -0
- package/components/DragResizeWindow/helpers/pointPosition.d.ts +36 -0
- package/components/DragResizeWindow/helpers/pointPosition.js +82 -0
- package/components/DragResizeWindow/helpers/shrinkingParentContainer.d.ts +6 -0
- package/components/DragResizeWindow/helpers/shrinkingParentContainer.js +34 -0
- package/components/DragResizeWindow/hooks/useDimensionEffects.d.ts +2 -0
- package/components/DragResizeWindow/hooks/useDimensionEffects.js +20 -223
- package/components/DragResizeWindow/hooks/useDragOptions.d.ts +8 -1
- package/components/DragResizeWindow/hooks/useDragOptions.js +79 -6
- package/components/DragResizeWindow/hooks/useResizeOptions.d.ts +11 -0
- package/components/DragResizeWindow/hooks/useResizeOptions.js +164 -19
- package/components/DragResizeWindow/slots/DragResizeWindowSlots.d.ts +2 -2
- package/components/DragResizeWindow/types.d.ts +53 -4
- package/components/DragResizeWindow/utils.d.ts +5 -2
- package/components/DragResizeWindow/utils.js +32 -13
- package/components/DragResizeWindowRND/DragResizeWindowRND.d.ts +19 -0
- package/components/DragResizeWindowRND/DragResizeWindowRND.js +224 -0
- package/components/DragResizeWindowRND/DragResizeWindowRND.styles.d.ts +5 -0
- package/components/DragResizeWindowRND/DragResizeWindowRND.styles.js +75 -0
- package/components/DragResizeWindowRND/classes/index.d.ts +2 -0
- package/components/DragResizeWindowRND/classes/index.js +18 -0
- package/components/DragResizeWindowRND/classes/types.d.ts +9 -0
- package/components/DragResizeWindowRND/constants.d.ts +3 -0
- package/components/DragResizeWindowRND/constants.js +6 -0
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +12 -0
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +31 -0
- package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +15 -0
- package/components/DragResizeWindowRND/helpers/getInitialSize.js +56 -0
- package/components/DragResizeWindowRND/helpers/index.d.ts +5 -0
- package/components/DragResizeWindowRND/helpers/index.js +1 -0
- package/components/DragResizeWindowRND/helpers/isElmentInViewport.d.ts +15 -0
- package/components/DragResizeWindowRND/helpers/isElmentInViewport.js +1 -0
- package/components/DragResizeWindowRND/helpers/pointPosition.d.ts +36 -0
- package/components/DragResizeWindowRND/helpers/pointPosition.js +1 -0
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +6 -0
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +34 -0
- package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.d.ts +23 -0
- package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +90 -0
- package/components/DragResizeWindowRND/hooks/useRNDDragOptions.d.ts +28 -0
- package/components/DragResizeWindowRND/hooks/useRNDDragOptions.js +220 -0
- package/components/DragResizeWindowRND/hooks/useRNDReResizeOptions.d.ts +45 -0
- package/components/DragResizeWindowRND/hooks/useRNDReResizeOptions.js +173 -0
- package/components/DragResizeWindowRND/icons.d.ts +3 -0
- package/components/DragResizeWindowRND/index.d.ts +2 -0
- package/components/DragResizeWindowRND/index.js +1 -0
- package/components/DragResizeWindowRND/slots/DragResizeWindowRNDSlots.d.ts +12 -0
- package/components/DragResizeWindowRND/slots/DragResizeWindowRNDSlots.js +19 -0
- package/components/DragResizeWindowRND/slots/slots.d.ts +5 -0
- package/components/DragResizeWindowRND/slots/slots.js +9 -0
- package/components/DragResizeWindowRND/types.d.ts +295 -0
- package/components/DragResizeWindowRND/utils.d.ts +15 -0
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +4 -4
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +3 -3
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
- package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +3 -3
- package/components/GridLayout/GridLayout.d.ts +2 -1
- package/components/GridLayout/GridLayout.js +10 -5
- package/components/GridLayout/classes/index.d.ts +1 -1
- package/components/GridLayout/subcomponents/Responsive/index.d.ts +1 -1
- package/components/GridLayout/subcomponents/Responsive/index.js +4 -3
- package/components/GridLayout/subcomponents/Responsive/types.d.ts +4 -0
- package/components/GridLayout/subcomponents/withSizeProvider/index.d.ts +3 -1
- package/components/GridLayout/subcomponents/withSizeProvider/index.js +11 -15
- package/components/GridLayout/types.d.ts +4 -0
- package/components/Label/slots/LabelSlots.d.ts +1 -1
- package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +1 -1
- package/components/MFIsolationApp/MFIsolationApp.js +24 -11
- package/components/MFIsolationApp/types.d.ts +8 -1
- package/components/MFLoader/styles.js +17 -2
- package/components/MFLoader/types.d.ts +19 -2
- package/components/MenuActions/slots/MenuActionsSlots.d.ts +2 -2
- package/components/ModalDialog/ModalDialog.js +2 -2
- package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
- package/components/NumberInput/slots/NumberInputSlots.d.ts +2 -2
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +2 -2
- package/components/ToastContainer/slots/toastContainerSlots.js +1 -1
- package/components/WindowBase/WindowBase.js +3 -5
- package/components/WindowBase/WindowBase.styles.js +26 -17
- package/components/{areas/contexts/DynamicMFParmsContext/index.js → WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js} +2 -2
- package/components/WindowBase/contexts/DynamicMFParmsContext/index.d.ts +4 -0
- package/components/WindowBase/contexts/DynamicMFParmsContext/index.js +1 -0
- package/components/{areas → WindowBase}/contexts/DynamicMFParmsContext/store.d.ts +0 -1
- package/components/{areas/contexts/WindowToolsMFContext/index.js → WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js} +4 -3
- package/components/WindowBase/contexts/WindowToolsMFContext/index.d.ts +2 -0
- package/components/WindowBase/contexts/WindowToolsMFContext/index.js +1 -0
- package/components/{areas → WindowBase}/contexts/WindowToolsMFContext/types.d.ts +3 -2
- package/components/WindowBase/contexts/index.d.ts +2 -0
- package/components/WindowBase/helpers.d.ts +22 -0
- package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/helper.js → WindowBase/helpers.js} +17 -13
- package/components/{areas → WindowBase}/hooks/useDynamicMFParameters/index.js +9 -1
- package/components/{areas → WindowBase}/hooks/useWindowToolsMF/index.js +1 -1
- package/components/WindowBase/index.d.ts +5 -0
- package/components/WindowBase/slots/WindowBaseEnum.d.ts +2 -1
- package/components/WindowBase/slots/WindowBaseEnum.js +1 -0
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +45 -14
- package/components/WindowBase/slots/WindowBaseSlots.js +10 -5
- package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window → WindowBase}/subcomponents/Component/index.d.ts +1 -1
- package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window → WindowBase}/subcomponents/Component/index.js +6 -6
- package/components/WindowBase/subcomponents/Component/types.d.ts +9 -0
- package/components/WindowBase/subcomponents/EditionInfo/EditionInfo.js +1 -1
- package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +52 -24
- package/components/WindowBase/subcomponents/Header/types.d.ts +1 -38
- package/components/WindowBase/subcomponents/MicroFrontend/MicroFrontend.d.ts +8 -0
- package/components/WindowBase/subcomponents/MicroFrontend/MicroFrontend.js +10 -0
- package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +8 -0
- package/components/WindowBase/types.d.ts +52 -18
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +2 -2
- package/components/areas/components/AreasViewer/AreasViewer.d.ts +1 -1
- package/components/areas/components/AreasViewer/AreasViewer.js +7 -9
- package/components/areas/components/AreasViewer/AreasViewer.styles.js +12 -11
- package/components/areas/components/AreasViewer/slots/AreasViewerEnum.d.ts +2 -2
- package/components/areas/components/AreasViewer/slots/AreasViewerEnum.js +1 -1
- package/components/areas/components/AreasViewer/slots/AreasViewerSlots.d.ts +3 -3
- package/components/areas/components/AreasViewer/slots/AreasViewerSlots.js +6 -5
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/AreaGridLayout.js +44 -4
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.d.ts +7 -5
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +9 -9
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions.d.ts +12 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions.js +58 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useRightActions.d.ts +6 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useRightActions.js +88 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/{useWindow/useWindow.d.ts → useWindow.d.ts} +7 -7
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/{useWindow/useWindow.js → useWindow.js} +13 -11
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/types.d.ts +7 -3
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowModal/WindowModal.d.ts +5 -4
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowModal/WindowModal.js +25 -25
- package/components/areas/components/AreasViewer/types.d.ts +3 -1
- package/components/areas/components/index.d.ts +1 -1
- package/components/areas/constants.d.ts +1 -0
- package/components/areas/constants.js +3 -1
- package/components/areas/contexts/AreasContext/helpers/generateModuleCount.d.ts +2 -2
- package/components/areas/contexts/AreasContext/helpers/getWindowForAreaTest.d.ts +2 -2
- package/components/areas/contexts/AreasContext/helpers/helper.d.ts +4 -4
- package/components/areas/contexts/AreasContext/helpers/helper.js +6 -8
- package/components/areas/contexts/AreasContext/helpers/selectLayout.d.ts +6 -0
- package/components/areas/contexts/AreasContext/helpers/selectLayout.js +27 -0
- package/components/areas/contexts/AreasContext/index.d.ts +4 -4
- package/components/areas/contexts/AreasContext/index.js +24 -4
- package/components/areas/contexts/AreasContext/store.d.ts +4 -4
- package/components/areas/contexts/AreasContext/store.js +128 -86
- package/components/areas/contexts/AreasContext/types.d.ts +142 -31
- package/components/areas/contexts/index.d.ts +0 -6
- package/components/areas/hooks/index.d.ts +0 -2
- package/components/areas/hooks/useAreas/index.d.ts +5 -5
- package/components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle.js +2 -2
- package/components/areas/types.d.ts +109 -100
- package/components/extended/React-Resizable/Resizable/Resizable.js +2 -1
- package/components/extended/React-Resizable/Resizable/slots/ResizableSlots.d.ts +1 -1
- package/components/extended/React-Resizable/ResizableBox/slots/ResizableBoxSlots.d.ts +1 -1
- package/components/extended/React-Resizable/helpers.d.ts +6 -1
- package/components/extended/React-Resizable/helpers.js +11 -2
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +2 -2
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +2 -2
- package/components/index.d.ts +1 -0
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +2 -2
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +4 -4
- package/components/mui_extended/Avatar/slots/AvatarSlots.d.ts +1 -1
- package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +1 -1
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +4 -4
- package/components/mui_extended/Divider/slots/DividerSlots.d.ts +1 -1
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +2 -2
- package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
- package/components/mui_extended/MenuDivider/slots/MenuDividerSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/types.d.ts +1 -1
- package/components/mui_extended/Popper/slots/PopperStlots.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +2 -2
- package/components/mui_extended/Select/slots/SelectSlots.js +1 -1
- package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
- package/components/mui_extended/Stack/slots/StackSlot.d.ts +1 -1
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
- package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
- package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +3 -3
- package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
- package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.d.ts +8 -2
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.js +6 -24
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.d.ts +9 -3
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +278 -211
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/tests/PopupContext.test.d.ts +1 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/tests/PopusContext.store.test.d.ts +1 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/tests/__mocks__/storeMock.d.ts +29 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +183 -79
- package/components/popups/components/PopupsProvider/hooks/{useHeaderActionsPopups/useHeaderActionsPopups.d.ts → useHeaderActionsPopups.d.ts} +2 -8
- package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups.js +60 -0
- package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +43 -0
- package/components/popups/components/PopupsProvider/hooks/usePopups.js +138 -0
- package/components/popups/components/PopupsProvider/hooks/usePopupsStore.d.ts +5 -0
- package/components/popups/components/PopupsProvider/hooks/{usePopupsStore/index.js → usePopupsStore.js} +1 -1
- package/components/popups/components/PopupsViewer/PopupsViewer.d.ts +13 -4
- package/components/popups/components/PopupsViewer/PopupsViewer.js +27 -6
- package/components/popups/components/PopupsViewer/PopupsViewer.styles.js +3 -11
- package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.d.ts +7 -10
- package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.js +3 -8
- package/components/popups/components/PopupsViewer/slots/slots.d.ts +1 -2
- package/components/popups/components/PopupsViewer/slots/slots.js +0 -1
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.d.ts +1 -1
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +69 -53
- package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +16 -0
- package/components/popups/components/PopupsViewer/tests/PopupsViewer.integration.test.d.ts +1 -0
- package/components/popups/components/PopupsViewer/types.d.ts +13 -5
- package/contexts/AppearanceComponentContext/AppearanceComponentContext.d.ts +8 -0
- package/contexts/AppearanceComponentContext/AppearanceComponentContext.js +4 -3
- package/contexts/AppearanceComponentContext/AppearanceComponentStore.d.ts +8 -1
- package/contexts/AppearanceComponentContext/AppearanceComponentStore.js +10 -3
- package/contexts/index.d.ts +1 -1
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +4 -4
- package/hooks/useDynamicFilterAndSort/types.d.ts +1 -1
- package/hooks/useSizeContainer/index.js +2 -2
- package/index.js +91 -85
- package/not_recognized/index.js +1280 -0
- package/package.json +2 -1
- package/storybook/components/Areas/AreasViewer/{AreasViewr.stories.d.ts → AreasViewer.stories.d.ts} +2 -2
- package/storybook/components/Areas/AreasViewer/hooks/useWindowsActions.d.ts +4 -0
- package/storybook/components/Areas/AreasViewer/subcomponents/AreasViewerRender.d.ts +4 -0
- package/storybook/components/Areas/AreasViewer/subcomponents/Launcher/Launcher.d.ts +5 -0
- package/storybook/components/Areas/AreasViewer/subcomponents/Launcher/PopupButton.d.ts +21 -0
- package/storybook/components/Areas/AreasViewer/subcomponents/Launcher/PopupContentExample.d.ts +4 -0
- package/storybook/components/Areas/AreasViewer/subcomponents/layouts/ClientsLayout.d.ts +4 -0
- package/storybook/components/Areas/AreasViewer/subcomponents/layouts/UsersLayout.d.ts +4 -0
- package/storybook/components/DragResizeWindowRND/stories/DragResizeWindowRND.stories.d.ts +8 -0
- package/storybook/components/DragResizeWindowRND/stories/constants.d.ts +3 -0
- package/storybook/components/DragResizeWindowRND/stories/subcomponents/ContentExample.d.ts +4 -0
- package/storybook/components/DragResizeWindowRND/stories/subcomponents/RNDWindowsContainer/RNDWindowsContainer.d.ts +5 -0
- package/storybook/components/DragResizeWindowRND/stories/subcomponents/RNDWindowsContainer/index.d.ts +1 -0
- package/storybook/components/DragResizeWindowRND/stories/subcomponents/RNDWindowsContainer/types.d.ts +4 -0
- package/storybook/components/{Areas/AreasViewer → DragResizeWindowRND/stories}/subcomponents/WithExtendedContainer.d.ts +1 -1
- package/storybook/components/DragResizeWindowRND/stories/types.d.ts +3 -0
- package/storybook/components/PopupsViewer/basic.stories.d.ts +12 -2
- package/storybook/components/PopupsViewer/subcomponents/PopupActions.d.ts +3 -1
- package/storybook/components/PopupsViewer/subcomponents/PopupContentExample.d.ts +2 -1
- package/storybook/components/PopupsViewer/subcomponents/initialPopups.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/helper.d.ts +0 -22
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/useHeaderActions.d.ts +0 -28
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/useHeaderActions.js +0 -155
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/types.d.ts +0 -10
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/MicroFrontend.d.ts +0 -8
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/MicroFrontend.js +0 -10
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/types.d.ts +0 -8
- package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/helper.d.ts +0 -28
- package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/helper.js +0 -44
- package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/useHeaderActionsPopups.js +0 -157
- package/components/popups/components/PopupsProvider/hooks/usePopops/usePopups.d.ts +0 -28
- package/components/popups/components/PopupsProvider/hooks/usePopops/usePopups.js +0 -117
- package/components/popups/components/PopupsProvider/hooks/usePopupsStore/index.d.ts +0 -6
- package/storybook/components/Areas/AreasViewer/subcomponents/ClientsHeaderActions.d.ts +0 -4
- package/storybook/components/Areas/AreasViewer/subcomponents/UsersHeaderActions.d.ts +0 -4
- /package/components/{popups/components/PopupsProvider/tests/PopupsProvider.test.d.ts → DragResizeWindowRND/tests/DragResizeWindow.test.d.ts} +0 -0
- /package/components/{areas/contexts/DynamicMFParmsContext/index.d.ts → WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.d.ts} +0 -0
- /package/components/{areas → WindowBase}/contexts/DynamicMFParmsContext/store.js +0 -0
- /package/components/{areas → WindowBase}/contexts/DynamicMFParmsContext/types.d.ts +0 -0
- /package/components/{areas/contexts/WindowToolsMFContext/index.d.ts → WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.d.ts} +0 -0
- /package/components/{areas → WindowBase}/hooks/useDynamicMFParameters/index.d.ts +0 -0
- /package/components/{areas → WindowBase}/hooks/useWindowToolsMF/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determina si un elemento está visible dentro del viewport de un contenedor
|
|
3
|
+
* @param element - El elemento a verificar
|
|
4
|
+
* @param container - El contenedor que define el viewport
|
|
5
|
+
* @param options - Opciones adicionales
|
|
6
|
+
* @returns Un objeto con información sobre la visibilidad horizontal y vertical
|
|
7
|
+
*/
|
|
8
|
+
export declare const isElementInViewport: (element: HTMLElement, container: HTMLElement, options?: {
|
|
9
|
+
tolerance: number;
|
|
10
|
+
}) => {
|
|
11
|
+
isVisibleVertically: boolean;
|
|
12
|
+
isVisibleHorizontally: boolean;
|
|
13
|
+
isFullyVisible: boolean;
|
|
14
|
+
visiblePercentage: number;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DraggableWindowBounds } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Verifica si el punto está dentro del rectángulo del contenedor
|
|
4
|
+
*/
|
|
5
|
+
export declare function isPointInsideContainer(e: React.MouseEvent<HTMLElement, MouseEvent>, container?: HTMLElement, bounds?: DraggableWindowBounds): boolean[];
|
|
6
|
+
/**
|
|
7
|
+
* Resultado extendido que indica la posición del punto respecto al contenedor.
|
|
8
|
+
*/
|
|
9
|
+
export interface PointPosition {
|
|
10
|
+
isInside: boolean;
|
|
11
|
+
isLeft: boolean;
|
|
12
|
+
isRight: boolean;
|
|
13
|
+
isAbove: boolean;
|
|
14
|
+
isBelow: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Versión extendida que proporciona información detallada sobre la posición.
|
|
18
|
+
* Esta función se puede usar junto con la original cuando se necesite información adicional.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDetailedPointPosition(e: React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement>, element?: HTMLElement, bounds?: DraggableWindowBounds): [PointPosition, PointPosition];
|
|
21
|
+
/**
|
|
22
|
+
* Resultado que indica si el punto está en la franja de arrastre en cada eje
|
|
23
|
+
*/
|
|
24
|
+
export interface DragStripPosition {
|
|
25
|
+
isInside: boolean;
|
|
26
|
+
isInStrip: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Verifica si un punto está dentro de las franjas de arrastre de un elemento
|
|
30
|
+
* y devuelve información detallada para los ejes X e Y
|
|
31
|
+
* @param e - Evento del mouse o touch
|
|
32
|
+
* @param element - Elemento a verificar
|
|
33
|
+
* @param stripWidth - Ancho de las franjas de arrastre (en píxeles)
|
|
34
|
+
* @returns - Tupla con información para el eje X y el eje Y
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPointInDragStrip(e: React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement>, element?: HTMLElement, stripWidth?: number): [DragStripPosition, DragStripPosition];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CurrentState, DraggableWindowBounds } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* "shrinkingParentContainer": Encargada de manejar la contracción de la ventana padre
|
|
4
|
+
* 1. Si el ancho o alto de la ventana cuando se va compactando toca
|
|
5
|
+
*/
|
|
6
|
+
export declare const shrinkingParentContainer: (newState: CurrentState, cState: CurrentState, containerDimension: number, divRoot: HTMLElement, dimension: "Width" | "Height", allowResizeContainer: boolean | undefined, minWindowWidth: number, minWindowHeight: number, bounds?: DraggableWindowBounds) => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const shrinkingParentContainer = (newState, cState, containerDimension, divRoot, dimension, allowResizeContainer = false, minWindowWidth, minWindowHeight, bounds) => {
|
|
2
|
+
const lDimension = dimension === "Width" ? "width" : "height";
|
|
3
|
+
const xOrY = dimension === "Width" ? "x" : "y";
|
|
4
|
+
const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
|
|
5
|
+
const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
|
|
6
|
+
const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
|
|
7
|
+
const boundsRightBottom = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
|
|
8
|
+
const minWindowDimension = dimension === "Width" ? minWindowWidth : minWindowHeight;
|
|
9
|
+
const minDimension = containerDimension - boundsLefTop + boundsRightBottom > minWindowDimension ? containerDimension - boundsLefTop + boundsRightBottom : minWindowDimension;
|
|
10
|
+
let maxDimensionElement = containerDimension - cState[xOrY] + boundsRightBottom;
|
|
11
|
+
if (divRoot[`client${dimension}`] > maxDimensionElement && !allowResizeContainer) {
|
|
12
|
+
const shrunkenPixels = divRoot[`client${dimension}`] - maxDimensionElement;
|
|
13
|
+
if (shrunkenPixels < cState[xOrY] - boundsLefTop) {
|
|
14
|
+
newState[xOrY] = newState[xOrY] - shrunkenPixels;
|
|
15
|
+
newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[xOrY];
|
|
16
|
+
} else if (shrunkenPixels > cState[xOrY] - boundsLefTop) {
|
|
17
|
+
newState[xOrY] = boundsLefTop;
|
|
18
|
+
newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[xOrY];
|
|
19
|
+
maxDimensionElement = containerDimension - boundsLefTop + boundsRightBottom;
|
|
20
|
+
if (divRoot[`client${dimension}`] > maxDimensionElement) {
|
|
21
|
+
newState[lDimension] = maxDimensionElement;
|
|
22
|
+
newState[overflowDimensionAt] = newState[overflowDimensionAt] || cState[lDimension];
|
|
23
|
+
if (newState[lDimension] < minDimension) {
|
|
24
|
+
newState[lDimension] = minDimension;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
shrinkingParentContainer as s
|
|
34
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CurrentState, StateRef, DraggableWindowBounds } from '../types';
|
|
3
|
+
import { ContainerSize } from '../../../utils/types';
|
|
4
|
+
type useOnDragStartProps = {
|
|
5
|
+
containerElement?: HTMLElement | null;
|
|
6
|
+
containerSize: ContainerSize | undefined;
|
|
7
|
+
bounds?: DraggableWindowBounds;
|
|
8
|
+
minWindowWidth: number;
|
|
9
|
+
minWindowHeight: number;
|
|
10
|
+
stateRef: React.MutableRefObject<StateRef>;
|
|
11
|
+
wrapperRef: React.RefObject<HTMLElement>;
|
|
12
|
+
currentState: CurrentState;
|
|
13
|
+
setCurrentState: React.Dispatch<React.SetStateAction<CurrentState>>;
|
|
14
|
+
allowHeightResizeContainer?: boolean;
|
|
15
|
+
allowWidthResizeContainer?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* "useDimensionEffects" Redimensiona la ventana si el contenedor padre es desbordado por ella.
|
|
19
|
+
* Guarda las posiciones de la ventana cuando se encoge el contenedor padre, para recuperarlas cuando se expanda.
|
|
20
|
+
* @param props
|
|
21
|
+
*/
|
|
22
|
+
export declare const useRNDDimensionEffects: (props: useOnDragStartProps) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { e as expandingParentContainer } from "../helpers/expandingParentContainer.js";
|
|
3
|
+
import { s as shrinkingParentContainer } from "../helpers/shrinkingParentContainer.js";
|
|
4
|
+
const useRNDDimensionEffects = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
containerElement,
|
|
7
|
+
containerSize,
|
|
8
|
+
bounds,
|
|
9
|
+
minWindowWidth,
|
|
10
|
+
minWindowHeight,
|
|
11
|
+
stateRef,
|
|
12
|
+
wrapperRef,
|
|
13
|
+
setCurrentState,
|
|
14
|
+
allowHeightResizeContainer,
|
|
15
|
+
allowWidthResizeContainer
|
|
16
|
+
} = props;
|
|
17
|
+
const refPreviousContainerSize = useRef(void 0);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!containerElement) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!containerSize) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!wrapperRef.current) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (stateRef.current?.dragging) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (stateRef.current?.resizing) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (containerSize.containerHeight === 0 && containerSize.containerWidth === 0) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!refPreviousContainerSize.current) {
|
|
38
|
+
refPreviousContainerSize.current = { ...containerSize };
|
|
39
|
+
}
|
|
40
|
+
const newState = { ...stateRef.current };
|
|
41
|
+
const handleDimension = (dimension, allowResizeContainer = false, previousContainerSize) => {
|
|
42
|
+
if (stateRef.current?.containerSize && wrapperRef.current) {
|
|
43
|
+
const containerSizeKey = `container${dimension}`;
|
|
44
|
+
const containerSizeValue = containerSize[containerSizeKey];
|
|
45
|
+
const previousContainerSizeValue = previousContainerSize[containerSizeKey];
|
|
46
|
+
if (containerSizeValue > previousContainerSizeValue) {
|
|
47
|
+
expandingParentContainer(
|
|
48
|
+
newState,
|
|
49
|
+
containerSizeValue,
|
|
50
|
+
dimension
|
|
51
|
+
);
|
|
52
|
+
} else if (containerSizeValue < previousContainerSizeValue) {
|
|
53
|
+
shrinkingParentContainer(
|
|
54
|
+
newState,
|
|
55
|
+
stateRef.current,
|
|
56
|
+
containerSizeValue,
|
|
57
|
+
wrapperRef.current,
|
|
58
|
+
dimension,
|
|
59
|
+
allowResizeContainer,
|
|
60
|
+
minWindowWidth,
|
|
61
|
+
minWindowHeight,
|
|
62
|
+
bounds
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
handleDimension("Width", allowWidthResizeContainer, refPreviousContainerSize.current);
|
|
68
|
+
handleDimension("Height", allowHeightResizeContainer, refPreviousContainerSize.current);
|
|
69
|
+
if (newState.x !== stateRef.current.x || newState.y !== stateRef.current.y || newState.width !== stateRef.current.width || newState.height !== stateRef.current.height || newState.shrinkLeftAt !== stateRef.current.shrinkLeftAt || newState.shrinkTopAt !== stateRef.current.shrinkTopAt || newState.overflowWidthAt !== stateRef.current.overflowWidthAt || newState.overflowHeightAt !== stateRef.current.overflowHeightAt) {
|
|
70
|
+
stateRef.current = {
|
|
71
|
+
...stateRef.current,
|
|
72
|
+
...newState
|
|
73
|
+
};
|
|
74
|
+
setCurrentState(newState);
|
|
75
|
+
}
|
|
76
|
+
refPreviousContainerSize.current = { ...containerSize };
|
|
77
|
+
}, [
|
|
78
|
+
containerElement,
|
|
79
|
+
wrapperRef.current,
|
|
80
|
+
bounds?.left,
|
|
81
|
+
bounds?.top,
|
|
82
|
+
bounds?.right,
|
|
83
|
+
bounds?.bottom,
|
|
84
|
+
containerSize?.containerWidth,
|
|
85
|
+
containerSize?.containerHeight
|
|
86
|
+
]);
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
useRNDDimensionEffects as u
|
|
90
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DraggableData, DraggableEvent } from 'react-draggable';
|
|
3
|
+
import { CurrentState, StateRef } from '../types';
|
|
4
|
+
type useDragOptionsProps = {
|
|
5
|
+
allowHeightResizeContainer?: boolean;
|
|
6
|
+
allowWidthResizeContainer?: boolean;
|
|
7
|
+
containerElement?: HTMLElement;
|
|
8
|
+
onDragStart?: (e: DraggableEvent, draggableData: DraggableData) => boolean | void;
|
|
9
|
+
onDrag?: (e: DraggableEvent, draggableData: DraggableData) => boolean | void;
|
|
10
|
+
onDragStop?: (e: DraggableEvent, draggableData: DraggableData) => boolean | void;
|
|
11
|
+
transformScale: number;
|
|
12
|
+
stateRef: React.MutableRefObject<StateRef>;
|
|
13
|
+
setCurrentState: React.Dispatch<React.SetStateAction<CurrentState>>;
|
|
14
|
+
autoScroll?: {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
speed?: number;
|
|
17
|
+
threshold?: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* "useDragOptions" hook que maneja las opciones de dragging
|
|
22
|
+
*/
|
|
23
|
+
export declare const useDragOptions: (props: useDragOptionsProps) => {
|
|
24
|
+
localOnDragStart: (e: DraggableEvent, draggableData: DraggableData) => false | undefined;
|
|
25
|
+
localOnDrag: (e: DraggableEvent, draggableData: DraggableData) => false | undefined;
|
|
26
|
+
localOnDragStop: import('react-draggable').DraggableEventHandler;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
const useDragOptions = (props) => {
|
|
3
|
+
const {
|
|
4
|
+
containerElement,
|
|
5
|
+
onDragStart,
|
|
6
|
+
onDrag,
|
|
7
|
+
onDragStop,
|
|
8
|
+
transformScale,
|
|
9
|
+
stateRef,
|
|
10
|
+
setCurrentState,
|
|
11
|
+
allowHeightResizeContainer,
|
|
12
|
+
allowWidthResizeContainer
|
|
13
|
+
} = props;
|
|
14
|
+
const localOnDragStart = useCallback(
|
|
15
|
+
(e, draggableData) => {
|
|
16
|
+
const { node } = draggableData;
|
|
17
|
+
const newPosition = { y: 0, x: 0, width: 0, height: 0 };
|
|
18
|
+
if (!containerElement) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (onDragStart) {
|
|
22
|
+
if (onDragStart(e, draggableData) === false) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const parentRect = containerElement.getBoundingClientRect();
|
|
27
|
+
const clientRect = node.getBoundingClientRect();
|
|
28
|
+
const cLeft = clientRect.left / transformScale;
|
|
29
|
+
const pLeft = parentRect.left / transformScale;
|
|
30
|
+
const cTop = clientRect.top / transformScale;
|
|
31
|
+
const pTop = parentRect.top / transformScale;
|
|
32
|
+
newPosition.x = cLeft - pLeft + containerElement.scrollLeft;
|
|
33
|
+
newPosition.y = cTop - pTop + containerElement.scrollTop;
|
|
34
|
+
newPosition.width = stateRef.current.width;
|
|
35
|
+
newPosition.height = stateRef.current.height;
|
|
36
|
+
stateRef.current.dragging = newPosition;
|
|
37
|
+
setCurrentState((prev) => ({
|
|
38
|
+
...prev,
|
|
39
|
+
...newPosition,
|
|
40
|
+
shrinkLeftAt: void 0,
|
|
41
|
+
//Cancelar los flags de memoria de encogimiento del contenedor padre
|
|
42
|
+
shrinkTopAt: void 0,
|
|
43
|
+
//Cancelar los flags de memoria de encogimiento del contenedor padre
|
|
44
|
+
overflowWidthAt: void 0,
|
|
45
|
+
//Cancelar los flags de memoria de encogimiento del contenedor padre
|
|
46
|
+
overflowHeightAt: void 0,
|
|
47
|
+
//Cancelar los flags de memoria de encogimiento del contenedor padre
|
|
48
|
+
dragging: newPosition
|
|
49
|
+
}));
|
|
50
|
+
},
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
[containerElement, onDragStart, transformScale]
|
|
53
|
+
);
|
|
54
|
+
const localOnDrag = useCallback((e, draggableData) => {
|
|
55
|
+
const { x, y, deltaX, deltaY } = draggableData;
|
|
56
|
+
if (!stateRef.current.dragging) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!containerElement) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (onDrag) {
|
|
63
|
+
if (onDrag(e, draggableData) === false) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const elementHeight = stateRef.current.height;
|
|
68
|
+
const elementWidth = stateRef.current.width;
|
|
69
|
+
const elementBottom = y + elementHeight;
|
|
70
|
+
const containerScrollTop = containerElement.scrollTop;
|
|
71
|
+
const containerHeight = containerElement.clientHeight;
|
|
72
|
+
const containerWidth = containerElement.clientWidth;
|
|
73
|
+
const containerScrollLeft = containerElement.scrollLeft;
|
|
74
|
+
const containerVisibleTop = containerScrollTop;
|
|
75
|
+
const containerVisibleBottom = containerVisibleTop + containerHeight;
|
|
76
|
+
const containerVisibleLeft = containerElement.scrollLeft;
|
|
77
|
+
const containerVisibleRight = containerVisibleLeft + containerElement.clientWidth;
|
|
78
|
+
const scrollThreshold = 15;
|
|
79
|
+
let newScrollLeft;
|
|
80
|
+
let newScrollTop;
|
|
81
|
+
if (deltaY < 0 && y < containerVisibleTop && containerScrollTop > 0) {
|
|
82
|
+
const scrollNeeded = Math.min(15, Math.min(scrollThreshold, containerScrollTop));
|
|
83
|
+
newScrollTop = containerElement.scrollTop - scrollNeeded;
|
|
84
|
+
} else if (deltaY > 0) {
|
|
85
|
+
if (allowHeightResizeContainer) {
|
|
86
|
+
if (elementBottom > containerVisibleBottom) {
|
|
87
|
+
if (elementHeight > containerHeight) {
|
|
88
|
+
newScrollTop = y;
|
|
89
|
+
} else {
|
|
90
|
+
newScrollTop = y + scrollThreshold;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (deltaX < 0 && x < containerVisibleLeft && containerScrollLeft > 0) {
|
|
96
|
+
const scrollNeeded = Math.min(15, Math.min(scrollThreshold, containerScrollLeft));
|
|
97
|
+
newScrollLeft = containerElement.scrollLeft - scrollNeeded;
|
|
98
|
+
} else if (deltaX > 0) {
|
|
99
|
+
if (allowWidthResizeContainer) {
|
|
100
|
+
if (x > containerVisibleRight) {
|
|
101
|
+
if (elementWidth > containerWidth) {
|
|
102
|
+
newScrollLeft = x;
|
|
103
|
+
} else {
|
|
104
|
+
newScrollLeft = x + scrollThreshold;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (newScrollLeft !== void 0 || newScrollTop !== void 0) {
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
containerElement.scrollTo({
|
|
112
|
+
left: newScrollLeft,
|
|
113
|
+
top: newScrollTop,
|
|
114
|
+
behavior: "smooth"
|
|
115
|
+
});
|
|
116
|
+
}, 10);
|
|
117
|
+
}
|
|
118
|
+
stateRef.current.dragging = {
|
|
119
|
+
...stateRef.current.dragging,
|
|
120
|
+
x,
|
|
121
|
+
y
|
|
122
|
+
};
|
|
123
|
+
}, [allowHeightResizeContainer, allowWidthResizeContainer, containerElement, onDrag, stateRef]);
|
|
124
|
+
const localOnDragStop = useCallback(
|
|
125
|
+
(e, draggableData) => {
|
|
126
|
+
if (!stateRef.current.dragging) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (!containerElement) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const containerWidth = stateRef.current.containerSize?.containerWidth || containerElement.clientWidth;
|
|
133
|
+
const containerHeight = stateRef.current.containerSize?.containerHeight || containerElement.clientHeight;
|
|
134
|
+
const elementWidth = stateRef.current.dragging.width;
|
|
135
|
+
const elementHeight = stateRef.current.dragging.height;
|
|
136
|
+
const scrollThreshold = 15;
|
|
137
|
+
const bounds = {
|
|
138
|
+
left: stateRef.current.bounds?.left || 0,
|
|
139
|
+
top: stateRef.current.bounds?.top || 0,
|
|
140
|
+
right: stateRef.current.bounds?.right || 0,
|
|
141
|
+
bottom: stateRef.current.bounds?.bottom || 0
|
|
142
|
+
};
|
|
143
|
+
let finalX = stateRef.current.dragging.x;
|
|
144
|
+
let finalY = stateRef.current.dragging.y;
|
|
145
|
+
if (finalX < bounds.left) {
|
|
146
|
+
finalX = bounds.left;
|
|
147
|
+
} else if (finalX + stateRef.current.width > containerWidth + bounds.right) {
|
|
148
|
+
if (!allowWidthResizeContainer) {
|
|
149
|
+
finalX = containerWidth - elementWidth + bounds.right;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (finalY < bounds.top) {
|
|
153
|
+
finalY = bounds.top;
|
|
154
|
+
} else if (finalY + elementHeight > containerHeight + bounds.bottom) {
|
|
155
|
+
if (!allowHeightResizeContainer) {
|
|
156
|
+
finalY = containerHeight - elementHeight + bounds.bottom;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
let newScrollLeft;
|
|
160
|
+
let newScrollTop;
|
|
161
|
+
if (allowWidthResizeContainer) {
|
|
162
|
+
if (finalX > containerWidth) {
|
|
163
|
+
if (elementWidth < containerWidth) {
|
|
164
|
+
newScrollLeft = finalX + scrollThreshold;
|
|
165
|
+
} else {
|
|
166
|
+
newScrollLeft = finalX;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
if (containerElement.scrollLeft > 0) {
|
|
171
|
+
newScrollLeft = 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (allowHeightResizeContainer) {
|
|
175
|
+
if (finalY > containerHeight) {
|
|
176
|
+
if (elementHeight < containerHeight) {
|
|
177
|
+
newScrollTop = finalY + scrollThreshold;
|
|
178
|
+
} else {
|
|
179
|
+
newScrollTop = finalY;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
if (containerElement.scrollTop > 0) {
|
|
184
|
+
newScrollTop = 0;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (newScrollLeft !== void 0 || newScrollTop !== void 0) {
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
containerElement.scrollTo({
|
|
190
|
+
left: newScrollLeft,
|
|
191
|
+
top: newScrollTop,
|
|
192
|
+
behavior: "smooth"
|
|
193
|
+
});
|
|
194
|
+
}, 10);
|
|
195
|
+
}
|
|
196
|
+
finalX = Math.round(finalX);
|
|
197
|
+
finalY = Math.round(finalY);
|
|
198
|
+
stateRef.current = {
|
|
199
|
+
...stateRef.current,
|
|
200
|
+
x: finalX,
|
|
201
|
+
y: finalY,
|
|
202
|
+
dragging: void 0
|
|
203
|
+
};
|
|
204
|
+
setCurrentState((prev) => ({
|
|
205
|
+
...prev,
|
|
206
|
+
x: finalX,
|
|
207
|
+
y: finalY,
|
|
208
|
+
dragging: void 0
|
|
209
|
+
}));
|
|
210
|
+
if (onDragStop) {
|
|
211
|
+
onDragStop(e, draggableData);
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
[stateRef, containerElement, setCurrentState, onDragStop, allowWidthResizeContainer, allowHeightResizeContainer]
|
|
215
|
+
);
|
|
216
|
+
return { localOnDragStart, localOnDrag, localOnDragStop };
|
|
217
|
+
};
|
|
218
|
+
export {
|
|
219
|
+
useDragOptions as u
|
|
220
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CurrentState, StateRef } from '../types';
|
|
3
|
+
import { RndResizeCallback, RndResizeStartCallback } from 'react-rnd';
|
|
4
|
+
type useReResizeOptionsProps = {
|
|
5
|
+
allowHeightResizeContainer?: boolean;
|
|
6
|
+
allowWidthResizeContainer?: boolean;
|
|
7
|
+
containerElement?: HTMLElement;
|
|
8
|
+
onResizeStart?: RndResizeStartCallback;
|
|
9
|
+
onResize?: RndResizeCallback;
|
|
10
|
+
onResizeStop?: RndResizeCallback;
|
|
11
|
+
stateRef: React.MutableRefObject<StateRef>;
|
|
12
|
+
setCurrentState: React.Dispatch<React.SetStateAction<CurrentState>>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* QUe solo se mueva si esta sobre el elemento de drag (Ok)
|
|
16
|
+
* Cuadra el resize que no esta funcionando bien con los bounds (Ok)
|
|
17
|
+
* QUe solo haga resize si el mouse esta sobre el elemento
|
|
18
|
+
* Que cuaando se este arrando o resize no gener eventos en los layouts (Ok)
|
|
19
|
+
* Enfocar cuando es replaceMeId
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* `useResizeOptions` provides a set of handler functions for managing
|
|
24
|
+
* resizing events (start, resize, and stop) on a component. This hook
|
|
25
|
+
* centralizes the resize logic and coordinates state updates, including
|
|
26
|
+
* calculating position changes and applying constraints.
|
|
27
|
+
* @param props - The options required to configure the resize behavior,
|
|
28
|
+
* including callbacks, references, and state setters.
|
|
29
|
+
* @returns An object containing `localOnResize`, `localOnResizeStart`,
|
|
30
|
+
* and `localOnResizeStop` handlers.
|
|
31
|
+
* @example
|
|
32
|
+
* const { localOnResize, localOnResizeStart, localOnResizeStop } = useResizeOptions({
|
|
33
|
+
* onResizeStart: handleResizeStart,
|
|
34
|
+
* onResize: handleResize,
|
|
35
|
+
* onResizeStop: handleResizeStop,
|
|
36
|
+
* stateRef,
|
|
37
|
+
* setCurrentState,
|
|
38
|
+
* });
|
|
39
|
+
*/
|
|
40
|
+
export declare const useResizeOptions: (props: useReResizeOptionsProps) => {
|
|
41
|
+
localOnResize: RndResizeCallback;
|
|
42
|
+
localOnResizeStart: RndResizeStartCallback;
|
|
43
|
+
localOnResizeStop: RndResizeCallback;
|
|
44
|
+
};
|
|
45
|
+
export {};
|