@m4l/components 9.2.12 → 9.2.15-beta.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.
Files changed (188) hide show
  1. package/@types/types.d.ts +1 -4
  2. package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +3 -3
  3. package/components/AppBar/slots/AppBarSlots.d.ts +2 -2
  4. package/components/Chip/slots/ChipSlots.d.ts +1 -1
  5. package/components/Color/slots/ColorSlots.d.ts +1 -1
  6. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
  7. package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
  8. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
  9. package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
  10. package/components/DataGrid/contexts/DataGridContext/index.js +3 -3
  11. package/components/DataGrid/contexts/DataGridContext/types.d.ts +7 -4
  12. package/components/DataGrid/formatters/ColumnBooleanFormatter/formatter.d.ts +5 -0
  13. package/components/DataGrid/formatters/ColumnBooleanFormatter/formatter.js +27 -0
  14. package/components/DataGrid/formatters/ColumnBooleanFormatter/index.d.ts +3 -5
  15. package/components/DataGrid/formatters/ColumnBooleanFormatter/index.js +1 -27
  16. package/components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.js +1 -1
  17. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/formatter.d.ts +7 -0
  18. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/formatter.js +23 -0
  19. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.d.ts +3 -7
  20. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.js +1 -23
  21. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/useColumnConcatenatedValue.js +1 -1
  22. package/components/DataGrid/formatters/ColumnDateFormatter/formatter.d.ts +5 -0
  23. package/components/DataGrid/formatters/ColumnDateFormatter/formatter.js +20 -0
  24. package/components/DataGrid/formatters/ColumnDateFormatter/index.d.ts +3 -5
  25. package/components/DataGrid/formatters/ColumnDateFormatter/index.js +1 -20
  26. package/components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.js +1 -1
  27. package/components/DataGrid/formatters/ColumnIconFormatter/formatter.d.ts +5 -0
  28. package/components/DataGrid/formatters/ColumnIconFormatter/formatter.js +12 -0
  29. package/components/DataGrid/formatters/ColumnIconFormatter/index.d.ts +2 -5
  30. package/components/DataGrid/formatters/ColumnIconFormatter/index.js +1 -12
  31. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/formatter.d.ts +6 -0
  32. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/formatter.js +21 -0
  33. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.d.ts +3 -6
  34. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.js +1 -21
  35. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/useColumnInteractiveCheck.js +1 -1
  36. package/components/DataGrid/formatters/ColumnNestedValueFormatter/formatter.d.ts +5 -0
  37. package/components/DataGrid/formatters/ColumnNestedValueFormatter/formatter.js +14 -0
  38. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.d.ts +3 -5
  39. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.js +1 -14
  40. package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +1 -1
  41. package/components/DataGrid/formatters/ColumnPointsFormatter/formatter.d.ts +5 -0
  42. package/components/DataGrid/formatters/ColumnPointsFormatter/formatter.js +12 -0
  43. package/components/DataGrid/formatters/ColumnPointsFormatter/index.d.ts +3 -5
  44. package/components/DataGrid/formatters/ColumnPointsFormatter/index.js +1 -12
  45. package/components/DataGrid/formatters/ColumnPointsFormatter/useColumnPoints.js +1 -1
  46. package/components/DataGrid/formatters/ColumnPriceFormatter/formatter.d.ts +5 -0
  47. package/components/DataGrid/formatters/ColumnPriceFormatter/formatter.js +12 -0
  48. package/components/DataGrid/formatters/ColumnPriceFormatter/index.d.ts +3 -5
  49. package/components/DataGrid/formatters/ColumnPriceFormatter/index.js +1 -12
  50. package/components/DataGrid/formatters/ColumnPriceFormatter/useColumnPrice.js +1 -1
  51. package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.d.ts +9 -0
  52. package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +36 -0
  53. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.d.ts +3 -9
  54. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.js +1 -36
  55. package/components/DataGrid/formatters/ColumnSetCheckFormatter/useColumnSetCheck.js +1 -1
  56. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/formatter.d.ts +5 -0
  57. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/formatter.js +12 -0
  58. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.d.ts +3 -5
  59. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.js +1 -12
  60. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts +1 -1
  61. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js +3 -3
  62. package/components/DataGrid/formatters/index.d.ts +11 -21
  63. package/components/DataGrid/index.d.ts +1 -1
  64. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  65. package/components/DragResizeWindowRND/DragResizeWindowRND.d.ts +2 -2
  66. package/components/DragResizeWindowRND/slots/DragResizeWindowRNDSlots.js +1 -1
  67. package/components/DragResizeWindowRND/types.d.ts +1 -1
  68. package/components/DynamicFilter/constants.d.ts +1 -0
  69. package/components/DynamicFilter/constants.js +3 -1
  70. package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
  71. package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +3 -3
  72. package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.js +17 -0
  73. package/components/DynamicSort/constants.d.ts +1 -0
  74. package/components/DynamicSort/constants.js +3 -1
  75. package/components/DynamicSort/icons.d.ts +4 -2
  76. package/components/DynamicSort/icons.js +5 -4
  77. package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
  78. package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.js +2 -2
  79. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.js +3 -3
  80. package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +17 -0
  81. package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +3 -3
  82. package/components/Label/slots/LabelSlots.d.ts +1 -1
  83. package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +1 -1
  84. package/components/MenuActions/index.d.ts +1 -0
  85. package/components/MenuActions/slots/MenuActionsSlots.d.ts +2 -2
  86. package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
  87. package/components/NumberInput/slots/NumberInputSlots.d.ts +2 -2
  88. package/components/PropertyValue/PropertyValue.js +2 -1
  89. package/components/ToastContainer/slots/toastContainerSlots.d.ts +2 -2
  90. package/components/WindowBase/hooks/useWindowToolsMF/index.d.ts +1 -1
  91. package/components/WindowBase/index.d.ts +1 -0
  92. package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +2 -2
  93. package/components/areas/types.d.ts +2 -2
  94. package/components/extended/React-Splitter-Layout/index.d.ts +1 -0
  95. package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
  96. package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +2 -2
  97. package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
  98. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
  99. package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +2 -2
  100. package/components/index.d.ts +1 -5
  101. package/components/mui_extended/Accordion/Accordion.js +1 -1
  102. package/components/mui_extended/Accordion/index.d.ts +1 -0
  103. package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +2 -2
  104. package/components/mui_extended/Accordion/types.d.ts +3 -3
  105. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +4 -4
  106. package/components/mui_extended/Avatar/slots/AvatarSlots.d.ts +1 -1
  107. package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
  108. package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
  109. package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +1 -1
  110. package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +4 -4
  111. package/components/mui_extended/Divider/slots/DividerSlots.d.ts +1 -1
  112. package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +2 -2
  113. package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
  114. package/components/mui_extended/MenuDivider/slots/MenuDividerSlots.d.ts +1 -1
  115. package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
  116. package/components/mui_extended/Popper/slots/PopperStlots.d.ts +1 -1
  117. package/components/mui_extended/Select/slots/SelectSlots.d.ts +2 -2
  118. package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
  119. package/components/mui_extended/Stack/slots/StackSlot.d.ts +1 -1
  120. package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
  121. package/components/mui_extended/Tab/index.d.ts +1 -0
  122. package/components/mui_extended/Tabs/index.d.ts +1 -0
  123. package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +2 -2
  124. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
  125. package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +3 -3
  126. package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
  127. package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
  128. package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
  129. package/components/mui_extended/index.d.ts +3 -3
  130. package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.d.ts +1 -1
  131. package/index.js +191 -193
  132. package/package.json +7 -9
  133. package/patchLibErrors/index.d.ts +1 -1
  134. package/patchLibErrors/patchErrors.d.ts +5 -0
  135. package/utils/getNullGuard.d.ts +4 -0
  136. package/utils/getNullGuard.js +9 -0
  137. package/utils/index.d.ts +2 -1
  138. package/components/DragResizeWindow/DragResizeWindow.d.ts +0 -20
  139. package/components/DragResizeWindow/DragResizeWindow.js +0 -226
  140. package/components/DragResizeWindow/DragResizeWindow.styles.d.ts +0 -5
  141. package/components/DragResizeWindow/DragResizeWindow.styles.js +0 -47
  142. package/components/DragResizeWindow/classes/index.d.ts +0 -2
  143. package/components/DragResizeWindow/classes/index.js +0 -17
  144. package/components/DragResizeWindow/classes/types.d.ts +0 -8
  145. package/components/DragResizeWindow/constants.d.ts +0 -3
  146. package/components/DragResizeWindow/constants.js +0 -6
  147. package/components/DragResizeWindow/helpers/draggingOrResizingWindow.d.ts +0 -7
  148. package/components/DragResizeWindow/helpers/expandingParentContainer.d.ts +0 -12
  149. package/components/DragResizeWindow/helpers/expandingParentContainer.js +0 -31
  150. package/components/DragResizeWindow/helpers/getInitialSize.d.ts +0 -15
  151. package/components/DragResizeWindow/helpers/getInitialSize.js +0 -56
  152. package/components/DragResizeWindow/helpers/index.d.ts +0 -6
  153. package/components/DragResizeWindow/helpers/isElmentInViewport.d.ts +0 -15
  154. package/components/DragResizeWindow/helpers/isElmentInViewport.js +0 -1
  155. package/components/DragResizeWindow/helpers/pointPosition.d.ts +0 -36
  156. package/components/DragResizeWindow/helpers/pointPosition.js +0 -82
  157. package/components/DragResizeWindow/helpers/shrinkingParentContainer.d.ts +0 -6
  158. package/components/DragResizeWindow/helpers/shrinkingParentContainer.js +0 -34
  159. package/components/DragResizeWindow/hooks/useDimensionEffects.d.ts +0 -23
  160. package/components/DragResizeWindow/hooks/useDimensionEffects.js +0 -92
  161. package/components/DragResizeWindow/hooks/useDragOptions.d.ts +0 -28
  162. package/components/DragResizeWindow/hooks/useDragOptions.js +0 -167
  163. package/components/DragResizeWindow/hooks/useResizeOptions.d.ts +0 -45
  164. package/components/DragResizeWindow/hooks/useResizeOptions.js +0 -218
  165. package/components/DragResizeWindow/icons.d.ts +0 -3
  166. package/components/DragResizeWindow/index.d.ts +0 -2
  167. package/components/DragResizeWindow/slots/DragResizeWindowSlots.d.ts +0 -6
  168. package/components/DragResizeWindow/slots/DragResizeWindowSlots.js +0 -14
  169. package/components/DragResizeWindow/slots/slots.d.ts +0 -4
  170. package/components/DragResizeWindow/slots/slots.js +0 -8
  171. package/components/DragResizeWindow/tests/DragResizeWindow.test.d.ts +0 -1
  172. package/components/DragResizeWindow/types.d.ts +0 -316
  173. package/components/DragResizeWindow/utils.d.ts +0 -15
  174. package/components/DragResizeWindow/utils.js +0 -36
  175. package/components/ScrollToTop/index.d.ts +0 -4
  176. package/components/ScrollToTop/index.js +0 -12
  177. package/components/WrapperComponent/index.js +0 -14
  178. package/not_recognized/index.js +0 -1280
  179. package/patchLibErrors/defaultPropsError.d.ts +0 -5
  180. package/patchLibErrors/defaultPropsError.js +0 -1
  181. package/storybook/components/DragResizeWindow/stories/DragResizeWindow.stories.d.ts +0 -7
  182. package/storybook/components/DragResizeWindow/stories/constants.d.ts +0 -3
  183. package/storybook/components/DragResizeWindow/stories/subcomponents/ContentExample.d.ts +0 -4
  184. package/storybook/components/DragResizeWindow/stories/subcomponents/WithExtendedContainer.d.ts +0 -5
  185. package/storybook/components/DragResizeWindow/stories/types.d.ts +0 -3
  186. /package/components/{DragResizeWindow/helpers → DataGrid/formatters/ColumnChipStatusFormatter}/index.js +0 -0
  187. /package/components/{DragResizeWindow → mui_extended/Tab}/index.js +0 -0
  188. /package/{components/DragResizeWindow/helpers/draggingOrResizingWindow.js → patchLibErrors/patchErrors.js} +0 -0
@@ -1,23 +0,0 @@
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<HTMLDivElement>;
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 useDimensionEffects: (props: useOnDragStartProps) => void;
23
- export {};
@@ -1,92 +0,0 @@
1
- import { useEffect } from "react";
2
- import { e as expandingParentContainer } from "../helpers/expandingParentContainer.js";
3
- import { s as shrinkingParentContainer } from "../helpers/shrinkingParentContainer.js";
4
- const useDimensionEffects = (props) => {
5
- const {
6
- containerElement,
7
- containerSize,
8
- bounds,
9
- minWindowWidth,
10
- minWindowHeight,
11
- stateRef,
12
- wrapperRef,
13
- currentState,
14
- setCurrentState,
15
- allowHeightResizeContainer,
16
- allowWidthResizeContainer
17
- } = props;
18
- useEffect(() => {
19
- if (!containerElement) {
20
- return;
21
- }
22
- if (containerSize?.containerHeight === 0 && containerSize?.containerWidth === 0) {
23
- return;
24
- }
25
- if (stateRef.current.containerSize === void 0 && containerSize) {
26
- stateRef.current.containerSize = containerSize;
27
- }
28
- if (!(containerSize && wrapperRef?.current && stateRef.current.containerSize)) {
29
- return;
30
- }
31
- if (currentState?.dragging) {
32
- return;
33
- }
34
- if (currentState?.resizing) {
35
- return;
36
- }
37
- const newState = { ...currentState };
38
- const handleDimension = (dimension, allowResizeContainer = false) => {
39
- if (stateRef.current?.containerSize && wrapperRef.current) {
40
- const containerSizeKey = `container${dimension}`;
41
- const containerSizeValue = containerSize[containerSizeKey];
42
- const previousContainerSizeValue = stateRef.current.containerSize[containerSizeKey];
43
- if (containerSizeValue > previousContainerSizeValue) {
44
- expandingParentContainer(
45
- newState,
46
- currentState,
47
- containerSizeValue,
48
- wrapperRef.current,
49
- dimension
50
- );
51
- } else if (containerSizeValue < previousContainerSizeValue) {
52
- shrinkingParentContainer(
53
- newState,
54
- currentState,
55
- containerSizeValue,
56
- wrapperRef.current,
57
- dimension,
58
- allowResizeContainer,
59
- minWindowWidth,
60
- minWindowHeight,
61
- bounds
62
- );
63
- }
64
- }
65
- };
66
- handleDimension("Width", allowWidthResizeContainer);
67
- handleDimension("Height", allowHeightResizeContainer);
68
- stateRef.current.containerSize = { ...containerSize };
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) {
70
- setCurrentState(newState);
71
- }
72
- if (!newState.resizing) {
73
- stateRef.current.left = newState.left;
74
- stateRef.current.top = newState.top;
75
- stateRef.current.height = newState.height;
76
- stateRef.current.width = newState.width;
77
- }
78
- }, [
79
- containerElement,
80
- currentState,
81
- wrapperRef.current,
82
- bounds?.left,
83
- bounds?.top,
84
- bounds?.right,
85
- bounds?.bottom,
86
- containerSize?.containerWidth,
87
- containerSize?.containerHeight
88
- ]);
89
- };
90
- export {
91
- useDimensionEffects as u
92
- };
@@ -1,28 +0,0 @@
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: (e: DraggableEvent, draggableData: DraggableData) => void;
27
- };
28
- export {};
@@ -1,167 +0,0 @@
1
- import { useRef, useCallback } from "react";
2
- import { g as getDetailedPointPosition } from "../helpers/pointPosition.js";
3
- const useDragOptions = (props) => {
4
- const {
5
- containerElement,
6
- onDragStart,
7
- onDrag,
8
- onDragStop,
9
- transformScale,
10
- stateRef,
11
- setCurrentState,
12
- allowHeightResizeContainer,
13
- allowWidthResizeContainer
14
- } = props;
15
- const dragPointRef = useRef({ x: 0, y: 0 });
16
- const localOnDragStart = useCallback(
17
- (e, draggableData) => {
18
- const { node } = draggableData;
19
- const newPosition = { top: 0, left: 0 };
20
- if (!containerElement) {
21
- return;
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
- }
30
- const parentRect = containerElement.getBoundingClientRect();
31
- const clientRect = node.getBoundingClientRect();
32
- const cLeft = clientRect.left / transformScale;
33
- const pLeft = parentRect.left / transformScale;
34
- const cTop = clientRect.top / transformScale;
35
- const pTop = parentRect.top / transformScale;
36
- newPosition.left = cLeft - pLeft + containerElement.scrollLeft;
37
- newPosition.top = cTop - pTop + containerElement.scrollTop;
38
- if (onDragStart) {
39
- if (onDragStart(e, draggableData) === false) {
40
- return false;
41
- }
42
- }
43
- stateRef.current.dragging = newPosition;
44
- setCurrentState((prev) => ({
45
- ...prev,
46
- ...newPosition,
47
- shrinkLeftAt: void 0,
48
- //Cancelar los flags de memoria de encogimiento del contenedor padre
49
- shrinkTopAt: void 0,
50
- //Cancelar los flags de memoria de encogimiento del contenedor padre
51
- overflowWidthAt: void 0,
52
- //Cancelar los flags de memoria de encogimiento del contenedor padre
53
- overflowHeightAt: void 0,
54
- //Cancelar los flags de memoria de encogimiento del contenedor padre
55
- dragging: newPosition
56
- }));
57
- },
58
- // eslint-disable-next-line react-hooks/exhaustive-deps
59
- [containerElement, onDragStart, transformScale]
60
- );
61
- const localOnDrag = useCallback((e, draggableData) => {
62
- const { deltaX, deltaY } = draggableData;
63
- const finalDeltaY = deltaY;
64
- const finalDeltaX = deltaX;
65
- if (!stateRef.current.dragging) {
66
- return;
67
- }
68
- if (!containerElement) {
69
- return;
70
- }
71
- if (onDrag) {
72
- if (onDrag(e, draggableData) === false) {
73
- return false;
74
- }
75
- }
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
- }
135
- const newPosition = { top, left };
136
- stateRef.current.dragging = newPosition;
137
- setCurrentState((prev) => ({ ...prev, ...newPosition, dragging: newPosition }));
138
- }, [allowHeightResizeContainer, allowWidthResizeContainer, containerElement, onDrag, setCurrentState, stateRef]);
139
- const localOnDragStop = useCallback(
140
- (e, draggableData) => {
141
- if (!stateRef.current.dragging) {
142
- return;
143
- }
144
- const { left, top } = stateRef.current.dragging;
145
- stateRef.current = {
146
- ...stateRef.current,
147
- left,
148
- top,
149
- dragging: void 0
150
- };
151
- setCurrentState((prev) => ({
152
- ...prev,
153
- left,
154
- top,
155
- dragging: void 0
156
- }));
157
- if (onDragStop) {
158
- onDragStop(e, draggableData);
159
- }
160
- },
161
- [stateRef, setCurrentState, onDragStop]
162
- );
163
- return { localOnDragStart, localOnDrag, localOnDragStop };
164
- };
165
- export {
166
- useDragOptions as u
167
- };
@@ -1,45 +0,0 @@
1
- import { default as React, SyntheticEvent } from 'react';
2
- import { CurrentState, StateRef, ResizeCallback } from '../types';
3
- import { ResizeCallbackData } from 'react-resizable';
4
- type useResizeOptionsProps = {
5
- allowHeightResizeContainer?: boolean;
6
- allowWidthResizeContainer?: boolean;
7
- containerElement?: HTMLElement;
8
- onResizeStart?: ResizeCallback;
9
- onResize?: ResizeCallback;
10
- onResizeStop?: ResizeCallback;
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: useResizeOptionsProps) => {
41
- localOnResize: (e: SyntheticEvent, callbackData: ResizeCallbackData) => void;
42
- localOnResizeStart: (e: SyntheticEvent, callbackData: ResizeCallbackData) => void;
43
- localOnResizeStop: (e: SyntheticEvent, callbackData: ResizeCallbackData) => void;
44
- };
45
- export {};
@@ -1,218 +0,0 @@
1
- import { useEffect, useCallback } from "react";
2
- import { g as getDetailedPointPosition, i as isPointInDragStrip } from "../helpers/pointPosition.js";
3
- const useResizeOptions = (props) => {
4
- const { onResizeStart: _onResizeStart, onResize: _onResize, stateRef, setCurrentState, containerElement, allowHeightResizeContainer, allowWidthResizeContainer } = props;
5
- useEffect(() => {
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]);
55
- const onResizeHandler = useCallback(
56
- (e, data, handlerName) => {
57
- const { size, handle, node: nodeElement } = data;
58
- const handler = props[handlerName];
59
- if (handler) {
60
- handler(e, data);
61
- }
62
- e.stopPropagation();
63
- if (!containerElement) {
64
- return;
65
- }
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;
104
- }
105
- if (handle.includes("n")) {
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
- }
144
- }
145
- if (handle.includes("s")) {
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);
167
- }
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
- };
176
- setCurrentState({
177
- ...newState,
178
- resizing
179
- });
180
- stateRef.current = {
181
- ...stateRef.current,
182
- ...newState,
183
- resizing
184
- };
185
- },
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]
189
- );
190
- const localOnResizeStart = useCallback(
191
- (e, callbackData) => {
192
- onResizeHandler(e, callbackData, "onResizeStart");
193
- },
194
- [onResizeHandler]
195
- );
196
- const localOnResize = useCallback(
197
- (e, callbackData) => {
198
- onResizeHandler(e, callbackData, "onResize");
199
- },
200
- [onResizeHandler]
201
- );
202
- const localOnResizeStop = useCallback(
203
- (e, callbackData) => {
204
- onResizeHandler(e, callbackData, "onResizeStop");
205
- stateRef.current = {
206
- ...stateRef.current,
207
- ...callbackData.size,
208
- resizing: void 0
209
- };
210
- },
211
- // eslint-disable-next-line react-hooks/exhaustive-deps
212
- [onResizeHandler]
213
- );
214
- return { localOnResize, localOnResizeStart, localOnResizeStop };
215
- };
216
- export {
217
- useResizeOptions as u
218
- };
@@ -1,3 +0,0 @@
1
- export declare const ICONS: {
2
- RESIZE: string;
3
- };
@@ -1,2 +0,0 @@
1
- export { DragResizeWindow } from './DragResizeWindow';
2
- export { dragResizeWindowClasses } from './classes/index';
@@ -1,6 +0,0 @@
1
- export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
2
- ownerState: Partial<import('../types').DragResizeWindowOwnerState> & Record<string, unknown>;
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> & Record<string, unknown> & {
5
- ownerState: Partial<import('../types').DragResizeWindowOwnerState> & Record<string, unknown>;
6
- }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
@@ -1,14 +0,0 @@
1
- import { styled } from "@mui/material/styles";
2
- import { C as COMPONENT_KEY_COMPONENT } from "../constants.js";
3
- import { d as dragResizeWindowStyles } from "../DragResizeWindow.styles.js";
4
- import { D as DragResizeWindowSlots } from "./slots.js";
5
- const RootStyled = styled("div", { name: COMPONENT_KEY_COMPONENT, slot: DragResizeWindowSlots.root })(
6
- dragResizeWindowStyles?.root
7
- );
8
- styled("div", {
9
- name: COMPONENT_KEY_COMPONENT,
10
- slot: DragResizeWindowSlots.iconResizeFormatterRoot
11
- })(dragResizeWindowStyles?.iconResizeFormatterRoot);
12
- export {
13
- RootStyled as R
14
- };
@@ -1,4 +0,0 @@
1
- export declare enum DragResizeWindowSlots {
2
- root = "root",
3
- iconResizeFormatterRoot = "iconResizeFormatterRoot"
4
- }
@@ -1,8 +0,0 @@
1
- var DragResizeWindowSlots = /* @__PURE__ */ ((DragResizeWindowSlots2) => {
2
- DragResizeWindowSlots2["root"] = "root";
3
- DragResizeWindowSlots2["iconResizeFormatterRoot"] = "iconResizeFormatterRoot";
4
- return DragResizeWindowSlots2;
5
- })(DragResizeWindowSlots || {});
6
- export {
7
- DragResizeWindowSlots as D
8
- };