@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
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { e as expandingParentContainer } from "../helpers/expandingParentContainer.js";
|
|
3
|
+
import { s as shrinkingParentContainer } from "../helpers/shrinkingParentContainer.js";
|
|
2
4
|
const useDimensionEffects = (props) => {
|
|
3
5
|
const {
|
|
4
6
|
containerElement,
|
|
@@ -9,221 +11,17 @@ const useDimensionEffects = (props) => {
|
|
|
9
11
|
stateRef,
|
|
10
12
|
wrapperRef,
|
|
11
13
|
currentState,
|
|
12
|
-
setCurrentState
|
|
14
|
+
setCurrentState,
|
|
15
|
+
allowHeightResizeContainer,
|
|
16
|
+
allowWidthResizeContainer
|
|
13
17
|
} = props;
|
|
14
|
-
const shrinkingParentContainer = useCallback(
|
|
15
|
-
(newState, cState, containerDimension, divRoot, dimension) => {
|
|
16
|
-
const lDimension = dimension === "Width" ? "width" : "height";
|
|
17
|
-
const leftTop = dimension === "Width" ? "left" : "top";
|
|
18
|
-
const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
|
|
19
|
-
const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
|
|
20
|
-
const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
|
|
21
|
-
const boundsRightBottom = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
|
|
22
|
-
const minWindowDimension = dimension === "Width" ? minWindowWidth : minWindowHeight;
|
|
23
|
-
const minDimension = containerDimension - boundsLefTop + boundsRightBottom > minWindowDimension ? containerDimension - boundsLefTop + boundsRightBottom : minWindowDimension;
|
|
24
|
-
let maxDimensionElement = containerDimension - cState[leftTop] + boundsRightBottom;
|
|
25
|
-
if (divRoot[`client${dimension}`] > maxDimensionElement) {
|
|
26
|
-
const shrunkenPixels = divRoot[`client${dimension}`] - maxDimensionElement;
|
|
27
|
-
if (shrunkenPixels < cState[leftTop] - boundsLefTop) {
|
|
28
|
-
newState[leftTop] = newState[leftTop] - shrunkenPixels;
|
|
29
|
-
newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[leftTop];
|
|
30
|
-
} else if (shrunkenPixels > cState[leftTop] - boundsLefTop) {
|
|
31
|
-
newState[leftTop] = boundsLefTop;
|
|
32
|
-
newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[leftTop];
|
|
33
|
-
maxDimensionElement = containerDimension - boundsLefTop + boundsRightBottom;
|
|
34
|
-
if (divRoot[`client${dimension}`] > maxDimensionElement) {
|
|
35
|
-
newState[lDimension] = maxDimensionElement;
|
|
36
|
-
newState[overflowDimensionAt] = newState[overflowDimensionAt] || cState[lDimension];
|
|
37
|
-
if (newState[lDimension] < minDimension) {
|
|
38
|
-
newState[lDimension] = minDimension;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
-
[]
|
|
48
|
-
);
|
|
49
|
-
const expandingParentContainer = useCallback(
|
|
50
|
-
(newState, _currentState, containerDimension, _divRoot, dimension) => {
|
|
51
|
-
const lDimension = dimension === "Width" ? "width" : "height";
|
|
52
|
-
const leftTop = dimension === "Width" ? "left" : "top";
|
|
53
|
-
const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
|
|
54
|
-
const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
|
|
55
|
-
const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
|
|
56
|
-
const initialPosition = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
|
|
57
|
-
const maxDimensionElement = containerDimension - boundsLefTop + initialPosition;
|
|
58
|
-
const valOverflowDimensionAt = newState[overflowDimensionAt];
|
|
59
|
-
if (valOverflowDimensionAt) {
|
|
60
|
-
if (valOverflowDimensionAt > maxDimensionElement) {
|
|
61
|
-
newState[lDimension] = maxDimensionElement;
|
|
62
|
-
} else {
|
|
63
|
-
newState[lDimension] = valOverflowDimensionAt;
|
|
64
|
-
newState[overflowDimensionAt] = void 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const valShrinkLeftTopAt = newState[shrinkLeftTopAt];
|
|
68
|
-
if (valShrinkLeftTopAt && !newState[overflowDimensionAt]) {
|
|
69
|
-
const dimensionAvailable = containerDimension - boundsLefTop - newState[lDimension] + initialPosition;
|
|
70
|
-
if (valShrinkLeftTopAt <= dimensionAvailable) {
|
|
71
|
-
newState[leftTop] = valShrinkLeftTopAt;
|
|
72
|
-
newState[shrinkLeftTopAt] = void 0;
|
|
73
|
-
} else {
|
|
74
|
-
newState[leftTop] = dimensionAvailable;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
-
[]
|
|
80
|
-
);
|
|
81
|
-
const draggingOrResizingWindow = useCallback(
|
|
82
|
-
(newState, _currentState, containerDimension, _divRoot, dimension) => {
|
|
83
|
-
const lDimension = dimension === "Width" ? "width" : "height";
|
|
84
|
-
const leftTop = dimension === "Width" ? "left" : "top";
|
|
85
|
-
const boundsRightBottom = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
|
|
86
|
-
const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
|
|
87
|
-
const boundsTop = dimension === "Height" ? bounds?.top || 0 : bounds?.top || 0;
|
|
88
|
-
const maxDimensionWithoutBounds = containerDimension - boundsLefTop + boundsRightBottom;
|
|
89
|
-
const rightBottomBoundary = containerDimension - newState[lDimension] + boundsRightBottom;
|
|
90
|
-
const adjustDimension = () => {
|
|
91
|
-
if (newState[lDimension] > maxDimensionWithoutBounds) {
|
|
92
|
-
newState[lDimension] = maxDimensionWithoutBounds;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const adjustLeftTop = () => {
|
|
96
|
-
if (newState[leftTop] < boundsLefTop) {
|
|
97
|
-
newState[leftTop] = boundsLefTop;
|
|
98
|
-
}
|
|
99
|
-
if (newState[leftTop] > rightBottomBoundary) {
|
|
100
|
-
newState[leftTop] = rightBottomBoundary;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
if (newState.resizing && stateRef.current.initialPosition) {
|
|
104
|
-
if (newState.resizing.handle !== "w") {
|
|
105
|
-
if (newState[leftTop] + newState[lDimension] > containerDimension + boundsRightBottom) {
|
|
106
|
-
newState[lDimension] = containerDimension - newState[leftTop] + boundsRightBottom;
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
const dimensionDiff = newState[lDimension] - stateRef.current.initialPosition[lDimension];
|
|
110
|
-
if (dimensionDiff > 0) {
|
|
111
|
-
if (newState[leftTop] - dimensionDiff >= boundsLefTop) {
|
|
112
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + dimensionDiff;
|
|
113
|
-
newState[leftTop] -= dimensionDiff;
|
|
114
|
-
} else {
|
|
115
|
-
newState[leftTop] = boundsLefTop;
|
|
116
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension];
|
|
117
|
-
}
|
|
118
|
-
} else if (dimensionDiff < 0) {
|
|
119
|
-
newState[leftTop] -= dimensionDiff;
|
|
120
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + dimensionDiff;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (newState.resizing.handle === "sw") {
|
|
124
|
-
const difWidth = newState[lDimension] - stateRef.current.initialPosition[lDimension];
|
|
125
|
-
if (dimension === "Width") {
|
|
126
|
-
if (difWidth > 0) {
|
|
127
|
-
if (newState[leftTop] - difWidth >= boundsLefTop) {
|
|
128
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop] - difWidth;
|
|
129
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difWidth;
|
|
130
|
-
} else {
|
|
131
|
-
newState[leftTop] = boundsLefTop;
|
|
132
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + (stateRef.current.initialPosition[leftTop] - boundsLefTop);
|
|
133
|
-
}
|
|
134
|
-
} else if (difWidth < 0) {
|
|
135
|
-
newState[leftTop] -= difWidth;
|
|
136
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difWidth;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (dimension === "Height") {
|
|
140
|
-
if (difWidth > 0) {
|
|
141
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difWidth;
|
|
142
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop];
|
|
143
|
-
} else if (difWidth < 0) {
|
|
144
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difWidth;
|
|
145
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (newState.resizing.handle === "nw") {
|
|
150
|
-
const difWidth = newState[lDimension] - stateRef.current.initialPosition[lDimension];
|
|
151
|
-
const difHeight = newState[lDimension] - stateRef.current.initialPosition[lDimension];
|
|
152
|
-
if (dimension === "Width") {
|
|
153
|
-
if (difWidth > 0) {
|
|
154
|
-
if (newState[leftTop] - difWidth >= boundsLefTop) {
|
|
155
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop] - difWidth;
|
|
156
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difWidth;
|
|
157
|
-
} else {
|
|
158
|
-
newState[leftTop] = boundsLefTop;
|
|
159
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + (stateRef.current.initialPosition[leftTop] - boundsLefTop);
|
|
160
|
-
}
|
|
161
|
-
} else if (difWidth < 0) {
|
|
162
|
-
newState[leftTop] -= difWidth;
|
|
163
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difWidth;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (dimension === "Height") {
|
|
167
|
-
if (difHeight < 0) {
|
|
168
|
-
if (newState[leftTop] - difHeight >= boundsTop) {
|
|
169
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop] - difHeight;
|
|
170
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difHeight;
|
|
171
|
-
} else {
|
|
172
|
-
newState[leftTop] = boundsTop;
|
|
173
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + (stateRef.current.initialPosition[leftTop] - boundsTop);
|
|
174
|
-
}
|
|
175
|
-
} else if (difHeight > 0) {
|
|
176
|
-
newState[leftTop] -= difHeight;
|
|
177
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difHeight;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (newState.resizing.handle === "ne") {
|
|
182
|
-
const difHeight = newState[lDimension] - stateRef.current.initialPosition[lDimension];
|
|
183
|
-
if (dimension === "Height") {
|
|
184
|
-
if (difHeight > 0) {
|
|
185
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difHeight;
|
|
186
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop] - difHeight;
|
|
187
|
-
}
|
|
188
|
-
if (difHeight < 0) {
|
|
189
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difHeight;
|
|
190
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop] - difHeight;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (newState.resizing.handle === "n") {
|
|
195
|
-
const difHeight = newState[lDimension] - stateRef.current.initialPosition[lDimension];
|
|
196
|
-
if (dimension === "Height") {
|
|
197
|
-
if (newState[leftTop] - difHeight < boundsTop) {
|
|
198
|
-
newState[leftTop] = boundsTop;
|
|
199
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + (stateRef.current.initialPosition[leftTop] - boundsTop);
|
|
200
|
-
} else {
|
|
201
|
-
newState[lDimension] = stateRef.current.initialPosition[lDimension] + difHeight;
|
|
202
|
-
newState[leftTop] = stateRef.current.initialPosition[leftTop] - difHeight;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
adjustDimension();
|
|
208
|
-
adjustLeftTop();
|
|
209
|
-
if (!newState.resizing && newState[leftTop] + newState[lDimension] > containerDimension + boundsRightBottom) {
|
|
210
|
-
const outWidthHeight = newState[leftTop] + newState[lDimension] - (containerDimension + boundsRightBottom);
|
|
211
|
-
if (newState[leftTop] - boundsLefTop > outWidthHeight) {
|
|
212
|
-
newState[leftTop] = newState[leftTop] - outWidthHeight;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
if (newState.resizing && stateRef.current.initialPosition) {
|
|
216
|
-
stateRef.current.initialPosition[lDimension] = newState[lDimension];
|
|
217
|
-
stateRef.current.initialPosition[leftTop] = newState[leftTop];
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
221
|
-
[]
|
|
222
|
-
);
|
|
223
18
|
useEffect(() => {
|
|
224
19
|
if (!containerElement) {
|
|
225
20
|
return;
|
|
226
21
|
}
|
|
22
|
+
if (containerSize?.containerHeight === 0 && containerSize?.containerWidth === 0) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
227
25
|
if (stateRef.current.containerSize === void 0 && containerSize) {
|
|
228
26
|
stateRef.current.containerSize = containerSize;
|
|
229
27
|
}
|
|
@@ -233,8 +31,11 @@ const useDimensionEffects = (props) => {
|
|
|
233
31
|
if (currentState?.dragging) {
|
|
234
32
|
return;
|
|
235
33
|
}
|
|
34
|
+
if (currentState?.resizing) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
236
37
|
const newState = { ...currentState };
|
|
237
|
-
const handleDimension = (dimension) => {
|
|
38
|
+
const handleDimension = (dimension, allowResizeContainer = false) => {
|
|
238
39
|
if (stateRef.current?.containerSize && wrapperRef.current) {
|
|
239
40
|
const containerSizeKey = `container${dimension}`;
|
|
240
41
|
const containerSizeValue = containerSize[containerSizeKey];
|
|
@@ -253,21 +54,17 @@ const useDimensionEffects = (props) => {
|
|
|
253
54
|
currentState,
|
|
254
55
|
containerSizeValue,
|
|
255
56
|
wrapperRef.current,
|
|
256
|
-
dimension
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
currentState,
|
|
262
|
-
containerSizeValue,
|
|
263
|
-
wrapperRef.current,
|
|
264
|
-
dimension
|
|
57
|
+
dimension,
|
|
58
|
+
allowResizeContainer,
|
|
59
|
+
minWindowWidth,
|
|
60
|
+
minWindowHeight,
|
|
61
|
+
bounds
|
|
265
62
|
);
|
|
266
63
|
}
|
|
267
64
|
}
|
|
268
65
|
};
|
|
269
|
-
handleDimension("Width");
|
|
270
|
-
handleDimension("Height");
|
|
66
|
+
handleDimension("Width", allowWidthResizeContainer);
|
|
67
|
+
handleDimension("Height", allowHeightResizeContainer);
|
|
271
68
|
stateRef.current.containerSize = { ...containerSize };
|
|
272
69
|
if (newState.left !== currentState.left || newState.top !== currentState.top || newState.width !== currentState.width || newState.height !== currentState.height || newState.shrinkLeftAt !== currentState.shrinkLeftAt || newState.shrinkTopAt !== currentState.shrinkTopAt || newState.overflowWidthAt !== currentState.overflowWidthAt || newState.overflowHeightAt !== currentState.overflowHeightAt) {
|
|
273
70
|
setCurrentState(newState);
|
|
@@ -2,13 +2,20 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { DraggableData, DraggableEvent } from 'react-draggable';
|
|
3
3
|
import { CurrentState, StateRef } from '../types';
|
|
4
4
|
type useDragOptionsProps = {
|
|
5
|
-
|
|
5
|
+
allowHeightResizeContainer?: boolean;
|
|
6
|
+
allowWidthResizeContainer?: boolean;
|
|
7
|
+
containerElement?: HTMLElement;
|
|
6
8
|
onDragStart?: (e: DraggableEvent, draggableData: DraggableData) => boolean | void;
|
|
7
9
|
onDrag?: (e: DraggableEvent, draggableData: DraggableData) => boolean | void;
|
|
8
10
|
onDragStop?: (e: DraggableEvent, draggableData: DraggableData) => boolean | void;
|
|
9
11
|
transformScale: number;
|
|
10
12
|
stateRef: React.MutableRefObject<StateRef>;
|
|
11
13
|
setCurrentState: React.Dispatch<React.SetStateAction<CurrentState>>;
|
|
14
|
+
autoScroll?: {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
speed?: number;
|
|
17
|
+
threshold?: number;
|
|
18
|
+
};
|
|
12
19
|
};
|
|
13
20
|
/**
|
|
14
21
|
* "useDragOptions" hook que maneja las opciones de dragging
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
1
|
+
import { useRef, useCallback } from "react";
|
|
2
|
+
import { g as getDetailedPointPosition } from "../helpers/pointPosition.js";
|
|
2
3
|
const useDragOptions = (props) => {
|
|
3
4
|
const {
|
|
4
5
|
containerElement,
|
|
@@ -7,8 +8,11 @@ const useDragOptions = (props) => {
|
|
|
7
8
|
onDragStop,
|
|
8
9
|
transformScale,
|
|
9
10
|
stateRef,
|
|
10
|
-
setCurrentState
|
|
11
|
+
setCurrentState,
|
|
12
|
+
allowHeightResizeContainer,
|
|
13
|
+
allowWidthResizeContainer
|
|
11
14
|
} = props;
|
|
15
|
+
const dragPointRef = useRef({ x: 0, y: 0 });
|
|
12
16
|
const localOnDragStart = useCallback(
|
|
13
17
|
(e, draggableData) => {
|
|
14
18
|
const { node } = draggableData;
|
|
@@ -16,6 +20,13 @@ const useDragOptions = (props) => {
|
|
|
16
20
|
if (!containerElement) {
|
|
17
21
|
return;
|
|
18
22
|
}
|
|
23
|
+
if (e.type === "mousedown" || e.type === "touchstart") {
|
|
24
|
+
const mouseEvent = e;
|
|
25
|
+
dragPointRef.current = {
|
|
26
|
+
x: mouseEvent.clientX,
|
|
27
|
+
y: mouseEvent.clientY
|
|
28
|
+
};
|
|
29
|
+
}
|
|
19
30
|
const parentRect = containerElement.getBoundingClientRect();
|
|
20
31
|
const clientRect = node.getBoundingClientRect();
|
|
21
32
|
const cLeft = clientRect.left / transformScale;
|
|
@@ -49,20 +60,82 @@ const useDragOptions = (props) => {
|
|
|
49
60
|
);
|
|
50
61
|
const localOnDrag = useCallback((e, draggableData) => {
|
|
51
62
|
const { deltaX, deltaY } = draggableData;
|
|
63
|
+
const finalDeltaY = deltaY;
|
|
64
|
+
const finalDeltaX = deltaX;
|
|
52
65
|
if (!stateRef.current.dragging) {
|
|
53
66
|
return;
|
|
54
67
|
}
|
|
68
|
+
if (!containerElement) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
55
71
|
if (onDrag) {
|
|
56
72
|
if (onDrag(e, draggableData) === false) {
|
|
57
73
|
return false;
|
|
58
74
|
}
|
|
59
75
|
}
|
|
60
|
-
const
|
|
61
|
-
|
|
76
|
+
const [isInsideElementX, isInsideElementY] = getDetailedPointPosition(e, draggableData.node);
|
|
77
|
+
if (!isInsideElementX.isInside && isInsideElementX.isLeft && deltaX > 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!isInsideElementX.isInside && isInsideElementX.isRight && deltaX < 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!isInsideElementY.isInside && isInsideElementY.isAbove && deltaY > 0) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!isInsideElementY.isInside && isInsideElementY.isBelow && deltaY !== 0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let left = stateRef.current.dragging.left + finalDeltaX;
|
|
90
|
+
let top = stateRef.current.dragging.top + finalDeltaY;
|
|
91
|
+
if (left < (stateRef.current.bounds?.left || 0)) {
|
|
92
|
+
left = stateRef.current.bounds?.left || 0;
|
|
93
|
+
}
|
|
94
|
+
if (!allowWidthResizeContainer) {
|
|
95
|
+
const totalWidth = containerElement.clientWidth;
|
|
96
|
+
if (left + stateRef.current.width > totalWidth + (stateRef.current.bounds?.right || 0)) {
|
|
97
|
+
left = totalWidth - stateRef.current.width + (stateRef.current.bounds?.right || 0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (top < (stateRef.current.bounds?.top || 0)) {
|
|
101
|
+
top = stateRef.current.bounds?.top || 0;
|
|
102
|
+
}
|
|
103
|
+
if (!allowHeightResizeContainer) {
|
|
104
|
+
const totalHeight = containerElement.clientHeight;
|
|
105
|
+
if (top + stateRef.current.height > totalHeight + (stateRef.current.bounds?.bottom || 0)) {
|
|
106
|
+
top = totalHeight - stateRef.current.height + (stateRef.current.bounds?.bottom || 0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const elementHeight = stateRef.current.height;
|
|
110
|
+
const elementBottom = top + elementHeight;
|
|
111
|
+
const containerScrollTop = containerElement.scrollTop;
|
|
112
|
+
const containerHeight = containerElement.clientHeight;
|
|
113
|
+
const containerScrollLeft = containerElement.scrollLeft;
|
|
114
|
+
const containerVisibleTop = containerScrollTop;
|
|
115
|
+
const containerVisibleBottom = containerVisibleTop + containerHeight;
|
|
116
|
+
const containerVisibleLeft = containerElement.scrollLeft;
|
|
117
|
+
const containerVisibleRight = containerVisibleLeft + containerElement.clientWidth;
|
|
118
|
+
const scrollThreshold = 50;
|
|
119
|
+
if (deltaY < 0 && top < containerVisibleTop + scrollThreshold && containerScrollTop > 0) {
|
|
120
|
+
const scrollNeeded = Math.min(15, Math.min(scrollThreshold, containerScrollTop));
|
|
121
|
+
containerElement.scrollTop -= scrollNeeded;
|
|
122
|
+
}
|
|
123
|
+
if (deltaY > 0 && elementBottom > containerVisibleBottom - scrollThreshold) {
|
|
124
|
+
const scrollNeeded = Math.min(15, elementBottom - (containerVisibleBottom - scrollThreshold));
|
|
125
|
+
containerElement.scrollTop += scrollNeeded;
|
|
126
|
+
}
|
|
127
|
+
if (deltaX < 0 && left < containerVisibleLeft + scrollThreshold && containerScrollLeft > 0) {
|
|
128
|
+
const scrollNeeded = Math.min(15, Math.min(scrollThreshold, containerScrollLeft));
|
|
129
|
+
containerElement.scrollLeft -= scrollNeeded;
|
|
130
|
+
}
|
|
131
|
+
if (deltaX > 0 && left > containerVisibleRight - scrollThreshold) {
|
|
132
|
+
const scrollNeeded = Math.min(15, left - (containerVisibleRight - scrollThreshold));
|
|
133
|
+
containerElement.scrollLeft += scrollNeeded;
|
|
134
|
+
}
|
|
62
135
|
const newPosition = { top, left };
|
|
63
136
|
stateRef.current.dragging = newPosition;
|
|
64
137
|
setCurrentState((prev) => ({ ...prev, ...newPosition, dragging: newPosition }));
|
|
65
|
-
}, []);
|
|
138
|
+
}, [allowHeightResizeContainer, allowWidthResizeContainer, containerElement, onDrag, setCurrentState, stateRef]);
|
|
66
139
|
const localOnDragStop = useCallback(
|
|
67
140
|
(e, draggableData) => {
|
|
68
141
|
if (!stateRef.current.dragging) {
|
|
@@ -85,7 +158,7 @@ const useDragOptions = (props) => {
|
|
|
85
158
|
onDragStop(e, draggableData);
|
|
86
159
|
}
|
|
87
160
|
},
|
|
88
|
-
[
|
|
161
|
+
[stateRef, setCurrentState, onDragStop]
|
|
89
162
|
);
|
|
90
163
|
return { localOnDragStart, localOnDrag, localOnDragStop };
|
|
91
164
|
};
|
|
@@ -2,12 +2,23 @@ import { default as React, SyntheticEvent } from 'react';
|
|
|
2
2
|
import { CurrentState, StateRef, ResizeCallback } from '../types';
|
|
3
3
|
import { ResizeCallbackData } from 'react-resizable';
|
|
4
4
|
type useResizeOptionsProps = {
|
|
5
|
+
allowHeightResizeContainer?: boolean;
|
|
6
|
+
allowWidthResizeContainer?: boolean;
|
|
7
|
+
containerElement?: HTMLElement;
|
|
5
8
|
onResizeStart?: ResizeCallback;
|
|
6
9
|
onResize?: ResizeCallback;
|
|
7
10
|
onResizeStop?: ResizeCallback;
|
|
8
11
|
stateRef: React.MutableRefObject<StateRef>;
|
|
9
12
|
setCurrentState: React.Dispatch<React.SetStateAction<CurrentState>>;
|
|
10
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
|
+
*/
|
|
11
22
|
/**
|
|
12
23
|
* `useResizeOptions` provides a set of handler functions for managing
|
|
13
24
|
* resizing events (start, resize, and stop) on a component. This hook
|
|
@@ -1,35 +1,178 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useCallback } from "react";
|
|
2
|
+
import { g as getDetailedPointPosition, i as isPointInDragStrip } from "../helpers/pointPosition.js";
|
|
2
3
|
const useResizeOptions = (props) => {
|
|
3
|
-
const { onResizeStart: _onResizeStart, onResize: _onResize, stateRef, setCurrentState } = props;
|
|
4
|
-
const memoizedStateRef = useRef(stateRef.current);
|
|
4
|
+
const { onResizeStart: _onResizeStart, onResize: _onResize, stateRef, setCurrentState, containerElement, allowHeightResizeContainer, allowWidthResizeContainer } = props;
|
|
5
5
|
useEffect(() => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
if (!containerElement) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const handleScroll = (e) => {
|
|
10
|
+
const scrollTop = e.target.scrollTop;
|
|
11
|
+
const scrollLeft = e.target.scrollLeft;
|
|
12
|
+
if (stateRef.current.resizing) {
|
|
13
|
+
let change = false;
|
|
14
|
+
const lastScrollTop = stateRef.current.scrollTop || 0;
|
|
15
|
+
const lastScrollLeft = stateRef.current.scrollLeft || 0;
|
|
16
|
+
const newState = { top: stateRef.current.top, height: stateRef.current.height, left: stateRef.current.left, width: stateRef.current.width, scrollTop: lastScrollTop, scrollLeft: lastScrollLeft, resizeByScroll: stateRef.current.resizeByScroll };
|
|
17
|
+
const deltaTop = lastScrollTop - scrollTop;
|
|
18
|
+
const deltaLeft = lastScrollLeft - scrollLeft;
|
|
19
|
+
if (stateRef.current.resizing?.handle.includes("n")) {
|
|
20
|
+
if (deltaTop !== 0) {
|
|
21
|
+
if (newState.top - deltaTop > (stateRef.current.bounds?.top || 0)) {
|
|
22
|
+
newState.top = newState.top - deltaTop;
|
|
23
|
+
newState.height = newState.height + deltaTop;
|
|
24
|
+
newState.scrollTop = scrollTop;
|
|
25
|
+
newState.resizeByScroll = true;
|
|
26
|
+
change = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (stateRef.current.resizing?.handle.includes("w")) {
|
|
31
|
+
if (newState.left - deltaLeft > (stateRef.current.bounds?.left || 0)) {
|
|
32
|
+
newState.left = newState.left - deltaLeft;
|
|
33
|
+
newState.width = newState.width + deltaLeft;
|
|
34
|
+
newState.scrollLeft = scrollLeft;
|
|
35
|
+
newState.resizeByScroll = true;
|
|
36
|
+
change = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (change) {
|
|
40
|
+
setCurrentState({
|
|
41
|
+
...newState
|
|
42
|
+
});
|
|
43
|
+
stateRef.current = {
|
|
44
|
+
...stateRef.current,
|
|
45
|
+
...newState
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
containerElement.addEventListener("scroll", handleScroll);
|
|
51
|
+
return () => {
|
|
52
|
+
containerElement?.removeEventListener("scroll", handleScroll);
|
|
53
|
+
};
|
|
54
|
+
}, [containerElement, setCurrentState, stateRef]);
|
|
8
55
|
const onResizeHandler = useCallback(
|
|
9
56
|
(e, data, handlerName) => {
|
|
10
|
-
const { size, handle } = data;
|
|
57
|
+
const { size, handle, node: nodeElement } = data;
|
|
11
58
|
const handler = props[handlerName];
|
|
12
59
|
if (handler) {
|
|
13
60
|
handler(e, data);
|
|
14
61
|
}
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
newState.left += diff;
|
|
19
|
-
newState.width = size.width;
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
if (!containerElement) {
|
|
64
|
+
return;
|
|
20
65
|
}
|
|
21
|
-
|
|
22
|
-
|
|
66
|
+
const [xContainerPosition, yContainerPosition] = getDetailedPointPosition(e, containerElement, stateRef.current.bounds);
|
|
67
|
+
const [xNodePosition, yNodePosition] = isPointInDragStrip(e, nodeElement);
|
|
68
|
+
const { containerSize = { containerWidth: 0, containerHeight: 0 } } = stateRef.current;
|
|
69
|
+
if (handlerName === "onResizeStart") {
|
|
70
|
+
stateRef.current.resizing = {
|
|
71
|
+
...size,
|
|
72
|
+
handle,
|
|
73
|
+
startClientX: e.clientX,
|
|
74
|
+
startClientY: e.clientY,
|
|
75
|
+
startHeight: size.height,
|
|
76
|
+
startWidth: size.width
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const newState = { left: stateRef.current.left, width: stateRef.current.width, top: stateRef.current.top, height: stateRef.current.height, resizeByScroll: stateRef.current.resizeByScroll };
|
|
80
|
+
const widthDelta = size.width - stateRef.current.width;
|
|
81
|
+
const heightDelta = size.height - stateRef.current.height;
|
|
82
|
+
if (handle.includes("w")) {
|
|
83
|
+
stateRef.current.scrollLeft = containerElement.scrollLeft;
|
|
84
|
+
const deltaLeft = stateRef.current.left - widthDelta;
|
|
85
|
+
if (xContainerPosition.isInside) {
|
|
86
|
+
if (deltaLeft > (stateRef.current.bounds?.left || 0)) {
|
|
87
|
+
newState.left = deltaLeft;
|
|
88
|
+
newState.width = size.width;
|
|
89
|
+
} else {
|
|
90
|
+
newState.left = stateRef.current.bounds?.left || 0;
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
if (xNodePosition.isInStrip) {
|
|
94
|
+
if (deltaLeft > (stateRef.current.bounds?.left || 0)) {
|
|
95
|
+
newState.left = deltaLeft;
|
|
96
|
+
newState.width = size.width + widthDelta;
|
|
97
|
+
containerElement.scrollLeft = newState.left;
|
|
98
|
+
} else {
|
|
99
|
+
newState.left = stateRef.current.bounds?.left || 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
newState.resizeByScroll = false;
|
|
23
104
|
}
|
|
24
105
|
if (handle.includes("n")) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
106
|
+
stateRef.current.scrollTop = containerElement.scrollTop;
|
|
107
|
+
const deltaTop = stateRef.current.top - heightDelta;
|
|
108
|
+
if (yContainerPosition.isInside) {
|
|
109
|
+
if (deltaTop > (stateRef.current.bounds?.top || 0)) {
|
|
110
|
+
newState.top = deltaTop;
|
|
111
|
+
newState.height = size.height;
|
|
112
|
+
containerElement.scrollTop = newState.top;
|
|
113
|
+
} else {
|
|
114
|
+
newState.top = stateRef.current.bounds?.top || 0;
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
if (yNodePosition.isInStrip) {
|
|
118
|
+
if (deltaTop > (stateRef.current.bounds?.top || 0)) {
|
|
119
|
+
newState.top = deltaTop;
|
|
120
|
+
newState.height = size.height + heightDelta;
|
|
121
|
+
containerElement.scrollTop = newState.top;
|
|
122
|
+
} else {
|
|
123
|
+
newState.top = stateRef.current.bounds?.top || 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
newState.resizeByScroll = false;
|
|
128
|
+
}
|
|
129
|
+
let newScrollLeft;
|
|
130
|
+
let newScrollTop;
|
|
131
|
+
if (handle.includes("e")) {
|
|
132
|
+
if (xContainerPosition.isInside || allowWidthResizeContainer) {
|
|
133
|
+
newState.width = size.width;
|
|
134
|
+
const right = newState.left + newState.width;
|
|
135
|
+
const containerViewportRight = containerElement.scrollLeft + containerElement.clientWidth;
|
|
136
|
+
if (right > containerViewportRight) {
|
|
137
|
+
newScrollLeft = right - containerElement.clientWidth;
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
if (xContainerPosition.isRight) {
|
|
141
|
+
newState.width = containerSize.containerWidth - newState.left + (stateRef.current.bounds?.right || 0);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
28
144
|
}
|
|
29
145
|
if (handle.includes("s")) {
|
|
30
|
-
|
|
146
|
+
if (yContainerPosition.isInside || allowHeightResizeContainer) {
|
|
147
|
+
newState.height = size.height;
|
|
148
|
+
const bottom = newState.top + newState.height;
|
|
149
|
+
const containerViewportBottom = containerElement.scrollTop + containerElement.clientHeight;
|
|
150
|
+
if (bottom > containerViewportBottom) {
|
|
151
|
+
newScrollTop = bottom - containerElement.clientHeight + (handlerName !== "onResizeStop" ? 0 : 10);
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
if (yContainerPosition.isBelow) {
|
|
155
|
+
newState.height = containerSize.containerHeight - newState.top + (stateRef.current.bounds?.bottom || 0);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (newScrollLeft !== void 0 || newScrollTop !== void 0) {
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
containerElement.scrollTo({
|
|
162
|
+
left: newScrollLeft,
|
|
163
|
+
top: newScrollTop,
|
|
164
|
+
behavior: "instant"
|
|
165
|
+
});
|
|
166
|
+
}, 5);
|
|
31
167
|
}
|
|
32
|
-
const resizing = handlerName === "onResizeStop" ? void 0 : {
|
|
168
|
+
const resizing = handlerName === "onResizeStop" ? void 0 : {
|
|
169
|
+
...size,
|
|
170
|
+
startClientX: stateRef.current.resizing?.startClientX,
|
|
171
|
+
startClientY: stateRef.current.resizing?.startClientY,
|
|
172
|
+
startHeight: stateRef.current.resizing?.startHeight,
|
|
173
|
+
startWidth: stateRef.current.resizing?.startWidth,
|
|
174
|
+
handle
|
|
175
|
+
};
|
|
33
176
|
setCurrentState({
|
|
34
177
|
...newState,
|
|
35
178
|
resizing
|
|
@@ -40,7 +183,9 @@ const useResizeOptions = (props) => {
|
|
|
40
183
|
resizing
|
|
41
184
|
};
|
|
42
185
|
},
|
|
43
|
-
|
|
186
|
+
//OJO NO se puede poner a depender solo de props, porque en cada movimiento se regeneraria el useCallback
|
|
187
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
188
|
+
[props["onResize"], props["onResizeStart"], props["onResizeStop"], containerElement, stateRef, setCurrentState, allowHeightResizeContainer, allowWidthResizeContainer]
|
|
44
189
|
);
|
|
45
190
|
const localOnResizeStart = useCallback(
|
|
46
191
|
(e, callbackData) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> &
|
|
1
|
+
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
2
2
|
ownerState: Partial<import('../types').DragResizeWindowOwnerState> & Record<string, unknown>;
|
|
3
3
|
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
-
export declare const IconResizeFormatterStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> &
|
|
4
|
+
export declare const IconResizeFormatterStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
5
5
|
ownerState: Partial<import('../types').DragResizeWindowOwnerState> & Record<string, unknown>;
|
|
6
6
|
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|