@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,20 +0,0 @@
1
- import { default as React } from 'react';
2
- import { DragResizeWindowProps, DragResizeWindowRefHandler } from './types';
3
- /**
4
- * Este component es un wrapper o ventana draggable y resizable al children.
5
- * Características
6
- * - Permite definir bounds para que la ventana no se salga del contenedor padre.
7
- * - Es obligarlo pasarle como props el containerElement (HTMLElement) del padre.
8
- * - Reajusta el Resizable para que los handlers n, w, crezcan en la dirección correcta.
9
- * Funcionamiento interno:
10
- * - DraggableCore clona el children y le agrega un handle para poder arrastrar la ventana
11
- * - DraggableCore recomienda pasarle el nodeRef del wrapper Element , para que no tenga que hacer FindDOMNode.
12
- * - DraggableCore No se le puede poner estilo, ya que no aporta className ni html, solo clona el children
13
- * internamente le agrega las clases propias del componente: react-draggable,react-draggable-dragging,react-draggable-dragged
14
- * Por lo tanto todo el estilo, va directamente a WrapperWindowRoot.
15
- * Consideraciones:
16
- * @param props
17
- * @returns
18
- */
19
- export declare const DragResizeWindow: React.ForwardRefExoticComponent<DragResizeWindowProps & React.RefAttributes<DragResizeWindowRefHandler>>;
20
- export default DragResizeWindow;
@@ -1,226 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import React, { forwardRef, useState, useMemo, useRef, useImperativeHandle, useCallback } from "react";
3
- import { DraggableCore } from "react-draggable";
4
- import clsx from "clsx";
5
- import { d as dragResizeWindowClasses } from "./classes/index.js";
6
- import { D as DEFAULT_TRANSFORM_SCALE } from "./constants.js";
7
- import { s as setTransform } from "./utils.js";
8
- import { useForkRef } from "@mui/material";
9
- import { u as useDragOptions } from "./hooks/useDragOptions.js";
10
- import { u as useResizeOptions } from "./hooks/useResizeOptions.js";
11
- import { u as useDimensionEffects } from "./hooks/useDimensionEffects.js";
12
- import { R as RootStyled } from "./slots/DragResizeWindowSlots.js";
13
- import { g as getInitialSize } from "./helpers/getInitialSize.js";
14
- import { R as Resizable } from "../extended/React-Resizable/Resizable/Resizable.js";
15
- const DragResizeWindow = forwardRef((props, ref) => {
16
- const {
17
- //Comunes
18
- style,
19
- className,
20
- children,
21
- defaultPosition = { vertical: { top: 0, height: 100 }, horizontal: { left: 0, width: 100 } },
22
- containerElement,
23
- containerSize = { containerWidth: 200, containerHeight: 200 },
24
- transformScale = DEFAULT_TRANSFORM_SCALE,
25
- bounds = { left: 5, top: 5, right: -5, bottom: -5 },
26
- minWindowWidth = 200,
27
- minWindowHeight = 100,
28
- //Draggable
29
- draggableHandle = `.${dragResizeWindowClasses.draggableHandle}`,
30
- draggableCancel = `.${dragResizeWindowClasses.draggableCancel}`,
31
- draggable = true,
32
- onDragStart,
33
- onDrag,
34
- onDragStop,
35
- onMouseDown,
36
- //resizable
37
- resizable = true,
38
- resizeHandles = ["se", "nw"],
39
- resizeHandle,
40
- onResizeStart,
41
- onResize,
42
- onResizeStop,
43
- hidden,
44
- allowHeightResizeContainer = false,
45
- allowWidthResizeContainer = false,
46
- windowRef,
47
- //Otras
48
- ...others
49
- } = props;
50
- const [currentState, setCurrentState] = useState(
51
- () => getInitialSize(containerSize, defaultPosition, containerElement)
52
- );
53
- const minConstraints = useMemo(() => [minWindowWidth, minWindowHeight], [minWindowWidth, minWindowHeight]);
54
- const stateRef = useRef({
55
- bounds,
56
- data: void 0,
57
- dragging: void 0,
58
- containerSize: containerSize ? { ...containerSize } : void 0,
59
- left: currentState.left,
60
- top: currentState.top,
61
- width: currentState.width,
62
- height: currentState.height,
63
- minConstraints
64
- });
65
- const wrapperRef = useRef(null);
66
- useImperativeHandle(ref, () => ({
67
- /**
68
- * "ensureVisible" enfoca la ventana para que esté visible, cuando se requiere desde afuera ubicarla en el contenedor padre
69
- */
70
- ensureVisible: () => {
71
- if (!wrapperRef.current || !containerElement) {
72
- return;
73
- }
74
- const containerRect = containerElement.getBoundingClientRect();
75
- const elementRect = wrapperRef.current.getBoundingClientRect();
76
- const elementHeight = elementRect.height;
77
- const elementWidth = elementRect.width;
78
- const relativeTop = elementRect.top - containerRect.top + containerElement.scrollTop;
79
- const relativeLeft = elementRect.left - containerRect.left + containerElement.scrollLeft;
80
- const relativeBottom = relativeTop + elementHeight;
81
- const relativeRight = relativeLeft + elementWidth;
82
- const containerViewportHeight = containerElement.clientHeight;
83
- const containerViewportWidth = containerElement.clientWidth;
84
- const containerRelativeBottom = containerElement.scrollTop + containerViewportHeight;
85
- const tolerance = 0.5;
86
- const isInViewportVertically = relativeTop >= containerElement.scrollTop - tolerance && relativeBottom <= containerRelativeBottom + tolerance;
87
- const isInViewportHorizontally = relativeLeft >= containerElement.scrollLeft - tolerance && relativeRight <= containerElement.scrollLeft + containerViewportWidth + tolerance;
88
- if (!isInViewportVertically || !isInViewportHorizontally) {
89
- let newScrollTop, newScrollLeft;
90
- if (elementHeight > containerViewportHeight) {
91
- newScrollTop = relativeTop;
92
- } else {
93
- newScrollTop = relativeTop - containerViewportHeight / 2 + elementHeight / 2;
94
- }
95
- if (elementWidth > containerViewportWidth) {
96
- newScrollLeft = relativeLeft;
97
- } else {
98
- newScrollLeft = relativeLeft - containerViewportWidth / 2 + elementWidth / 2;
99
- }
100
- containerElement.scrollTo({
101
- top: Math.max(0, newScrollTop),
102
- left: Math.max(0, newScrollLeft),
103
- behavior: "smooth"
104
- });
105
- }
106
- },
107
- /**
108
- * "current" devuelve el elemento DOM de la ventana
109
- */
110
- current: wrapperRef.current
111
- }), [containerElement]);
112
- const handleAllRefs = useForkRef(wrapperRef, windowRef);
113
- const { localOnDragStart, localOnDrag, localOnDragStop } = useDragOptions({
114
- allowHeightResizeContainer,
115
- allowWidthResizeContainer,
116
- containerElement,
117
- transformScale,
118
- onDragStart,
119
- onDrag,
120
- onDragStop,
121
- stateRef,
122
- setCurrentState
123
- });
124
- const { localOnResize, localOnResizeStart, localOnResizeStop } = useResizeOptions({
125
- allowHeightResizeContainer,
126
- allowWidthResizeContainer,
127
- containerElement,
128
- onResizeStart,
129
- onResize,
130
- onResizeStop,
131
- stateRef,
132
- setCurrentState
133
- });
134
- useDimensionEffects({
135
- containerElement,
136
- bounds,
137
- containerSize,
138
- setCurrentState,
139
- stateRef,
140
- minWindowWidth,
141
- minWindowHeight,
142
- wrapperRef,
143
- currentState,
144
- allowHeightResizeContainer,
145
- allowWidthResizeContainer
146
- });
147
- const mixinResizable = useCallback(
148
- (child, position) => {
149
- return /* @__PURE__ */ jsx(
150
- Resizable,
151
- {
152
- draggableOpts: {
153
- disabled: !resizable
154
- },
155
- className: resizable ? void 0 : "react-resizable-hide",
156
- width: position.width,
157
- height: position.height,
158
- minConstraints,
159
- onResizeStop: localOnResizeStop,
160
- onResizeStart: localOnResizeStart,
161
- onResize: localOnResize,
162
- transformScale,
163
- resizeHandles,
164
- handle: resizeHandle,
165
- children: child
166
- }
167
- );
168
- },
169
- [resizable, minConstraints, localOnResizeStop, localOnResizeStart, localOnResize, transformScale, resizeHandles, resizeHandle]
170
- );
171
- const mixinDraggable = useCallback(
172
- (child) => {
173
- return /* @__PURE__ */ jsx(
174
- DraggableCore,
175
- {
176
- onStart: localOnDragStart,
177
- onDrag: localOnDrag,
178
- onStop: localOnDragStop,
179
- handle: draggableHandle,
180
- cancel: ".react-resizable-handle" + (draggableCancel ? "," + draggableCancel : ""),
181
- scale: transformScale,
182
- nodeRef: wrapperRef,
183
- onMouseDown,
184
- ...others,
185
- children: child
186
- }
187
- );
188
- },
189
- // eslint-disable-next-line react-hooks/exhaustive-deps
190
- [wrapperRef, transformScale, draggableHandle, draggableCancel, localOnDragStart]
191
- );
192
- const classNameFinal = clsx(className, {
193
- "react-draggable": draggable,
194
- //Requerido para el componente Draggable
195
- [dragResizeWindowClasses.hidden]: hidden,
196
- [dragResizeWindowClasses.dragging]: currentState.dragging,
197
- [dragResizeWindowClasses.resizing]: currentState.resizing
198
- // dropping: Boolean(droppingPosition),
199
- });
200
- const styleFinal = {
201
- ...style,
202
- ...setTransform(currentState)
203
- };
204
- const memoChildren = useMemo(() => {
205
- return children;
206
- }, [children]);
207
- const wrapperRoot = /* @__PURE__ */ jsx(
208
- RootStyled,
209
- {
210
- ownerState: { hidden },
211
- className: classNameFinal,
212
- ref: handleAllRefs,
213
- style: styleFinal,
214
- role: "none",
215
- children: memoChildren
216
- }
217
- );
218
- if (!containerElement) {
219
- return null;
220
- }
221
- const dragResizeWindow = mixinDraggable(mixinResizable(wrapperRoot, currentState));
222
- return /* @__PURE__ */ jsx(React.Fragment, { children: dragResizeWindow });
223
- });
224
- export {
225
- DragResizeWindow as D
226
- };
@@ -1,5 +0,0 @@
1
- import { DragResizeWindowStyles } from '../DragResizeWindow/types';
2
- /**
3
- * Style definitions for the DragResizeWindow component.
4
- */
5
- export declare const dragResizeWindowStyles: DragResizeWindowStyles;
@@ -1,47 +0,0 @@
1
- const CONTAINER_QUERY_NAME = "window_root";
2
- const dragResizeWindowStyles = {
3
- /**
4
- * Styles for the root container of the DragResizeWindow component.
5
- * @param {Object} params - Object containing theme and ownerState properties.
6
- * @param {Object} params.theme - Theme object for accessing theme variables.
7
- * @param {Object} params.ownerState - Object holding the component's current state.
8
- * @param {boolean} [params.ownerState.hidden] - Controls visibility; if true, sets the component to be hidden and disables pointer events.
9
- * @returns {Object} - Style object for the root container.
10
- */
11
- root: ({ theme, ownerState }) => ({
12
- containerName: CONTAINER_QUERY_NAME,
13
- containerType: "inline-size",
14
- position: "absolute",
15
- left: "0px",
16
- top: "0px",
17
- width: "0px",
18
- height: "0px",
19
- backgroundColor: theme.vars.palette.background.default,
20
- ...ownerState?.hidden ? {
21
- visibility: "hidden",
22
- pointerEvents: "none"
23
- } : {}
24
- }),
25
- /**
26
- * Styles for the icon formatter container in the DragResizeWindow component.
27
- *
28
- * This container serves as the base for resize icons, setting up initial styles
29
- * like position, size, and default background color. Adjustments for cursor style
30
- * and additional customization are also defined here.
31
- * @returns {Object} - Style object for the icon formatter container.
32
- */
33
- iconResizeFormatterRoot: () => ({
34
- containerName: CONTAINER_QUERY_NAME,
35
- containerType: "inline-size",
36
- position: "absolute",
37
- left: "0px",
38
- top: "0px",
39
- width: "0px",
40
- height: "0px",
41
- backgroundColor: "gray",
42
- cursor: "default"
43
- })
44
- };
45
- export {
46
- dragResizeWindowStyles as d
47
- };
@@ -1,2 +0,0 @@
1
- import { DraggableWindowClasses } from './types';
2
- export declare const dragResizeWindowClasses: DraggableWindowClasses;
@@ -1,17 +0,0 @@
1
- import { generateUtilityClasses } from "@mui/material";
2
- import { C as COMPONENT_KEY_COMPONENT } from "../constants.js";
3
- const dragResizeWindowClasses = generateUtilityClasses(
4
- COMPONENT_KEY_COMPONENT,
5
- [
6
- /* elements */
7
- "draggableHandle",
8
- "draggableCancel",
9
- // state
10
- "dragging",
11
- "resizing",
12
- "hidden"
13
- ]
14
- );
15
- export {
16
- dragResizeWindowClasses as d
17
- };
@@ -1,8 +0,0 @@
1
- export interface DraggableWindowClasses {
2
- draggableHandle: string;
3
- draggableCancel: string;
4
- dragging: string;
5
- resizing: string;
6
- hidden: string;
7
- }
8
- export type DraggableWindowClassesKey = keyof DraggableWindowClasses;
@@ -1,3 +0,0 @@
1
- export declare const COMPONENT_TEST_ID = "M4LDragResizeWindow";
2
- export declare const COMPONENT_KEY_COMPONENT = "M4LDragResizeWindow";
3
- export declare const DEFAULT_TRANSFORM_SCALE = 1;
@@ -1,6 +0,0 @@
1
- const COMPONENT_KEY_COMPONENT = "M4LDragResizeWindow";
2
- const DEFAULT_TRANSFORM_SCALE = 1;
3
- export {
4
- COMPONENT_KEY_COMPONENT as C,
5
- DEFAULT_TRANSFORM_SCALE as D
6
- };
@@ -1,7 +0,0 @@
1
- import { CurrentState, DraggableWindowBounds, StateRef } from '../types';
2
- /**
3
- * "draggingOrResizingWindow": Encargada de garantizar las medidas cuando se hace dragging o cuando se hace resizig
4
- * no desborden en el contenedor padre.
5
- * @deprecated NO USAR ESTA FUNCION, ya que los controles se estan haciendo directamente en los handlers onResize y onDrag
6
- */
7
- export declare const draggingOrResizingWindow: (stateRef: React.MutableRefObject<StateRef>, newState: CurrentState, _currentState: CurrentState, containerDimension: number, _divRoot: HTMLDivElement, dimension: "Width" | "Height", allowResizeContainer?: boolean, bounds?: DraggableWindowBounds) => void;
@@ -1,12 +0,0 @@
1
- import { CurrentState, DraggableWindowBounds } from '../types';
2
- /**
3
- * "expandingParentContainer": Encargada de manejar la expansión de la ventana padre
4
- * 1. Si el ancho y alto fue compactado, los recupera si es el contenedor padre volvió a crecer
5
- * 2. Si el left o top fue desplazado, recupera de nuevo las posiciones donde estaban.
6
- *
7
- * Consideraciones:
8
- * Si por alguna razón el cliente mueve o redimensiona la ventana,
9
- * se borran los flags que indican que hay que recuperar el ancho y alto, o el left y top.
10
- * (shrinkLeftTopAt, overflowDimensionAt)
11
- */
12
- export declare const expandingParentContainer: (newState: CurrentState, _currentState: CurrentState, containerDimension: number, _divRoot: HTMLDivElement, dimension: "Width" | "Height", bounds?: DraggableWindowBounds) => void;
@@ -1,31 +0,0 @@
1
- const expandingParentContainer = (newState, _currentState, containerDimension, _divRoot, dimension, bounds) => {
2
- const lDimension = dimension === "Width" ? "width" : "height";
3
- const leftTop = dimension === "Width" ? "left" : "top";
4
- const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
5
- const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
6
- const boundsLefTop = dimension === "Width" ? 0 : 0;
7
- const initialPosition = dimension === "Width" ? 0 : 0;
8
- const maxDimensionElement = containerDimension - boundsLefTop + initialPosition;
9
- const valOverflowDimensionAt = newState[overflowDimensionAt];
10
- if (valOverflowDimensionAt) {
11
- if (valOverflowDimensionAt > maxDimensionElement) {
12
- newState[lDimension] = maxDimensionElement;
13
- } else {
14
- newState[lDimension] = valOverflowDimensionAt;
15
- newState[overflowDimensionAt] = void 0;
16
- }
17
- }
18
- const valShrinkLeftTopAt = newState[shrinkLeftTopAt];
19
- if (valShrinkLeftTopAt && !newState[overflowDimensionAt]) {
20
- const dimensionAvailable = containerDimension - boundsLefTop - newState[lDimension] + initialPosition;
21
- if (valShrinkLeftTopAt <= dimensionAvailable) {
22
- newState[leftTop] = valShrinkLeftTopAt;
23
- newState[shrinkLeftTopAt] = void 0;
24
- } else {
25
- newState[leftTop] = dimensionAvailable;
26
- }
27
- }
28
- };
29
- export {
30
- expandingParentContainer as e
31
- };
@@ -1,15 +0,0 @@
1
- import { ContainerSize } from '../../../utils/types';
2
- import { CurrentState, DefaultPosition } from '../types';
3
- /**
4
- * Calculates the initial size and position of an element based on the provided container size
5
- * and default position values.
6
- *
7
- * This function returns an object with `top`, `left`, `width`, and `height` properties,
8
- * which specify the initial position and size of the element. If values for `right` or `bottom`
9
- * are provided instead of `top` and `left`, the function calculates the starting position based
10
- * on the container dimensions, ensuring that the element is correctly positioned.
11
- * @param {ContainerSize | undefined} containerSize - Object containing `containerHeight` and `containerWidth`. Defaults to 200 for both if not provided.
12
- * @param {DefaultPosition} defaultPosition - Object defining the default vertical and horizontal positions (`top`, `bottom`, `height`, `left`, `right`, `width`).
13
- * @returns {CurrentState} - The initial size and position of the element with `top`, `left`, `width`, and `height` properties.
14
- */
15
- export declare const getInitialSize: (containerSize: ContainerSize | undefined, defaultPosition: DefaultPosition, containerElement: HTMLElement | undefined) => CurrentState;
@@ -1,56 +0,0 @@
1
- const getInitialSize = (containerSize, defaultPosition, containerElement) => {
2
- let top;
3
- let bottom;
4
- let height;
5
- let left;
6
- let right;
7
- let width;
8
- const containerHeight = containerSize?.containerHeight || 200;
9
- const containerWidth = containerSize?.containerWidth || 200;
10
- const scrollTop = containerElement?.scrollTop || 0;
11
- const scrollLeft = containerElement?.scrollLeft || 0;
12
- if ("top" in defaultPosition.vertical) {
13
- top = defaultPosition.vertical.top;
14
- }
15
- if ("bottom" in defaultPosition.vertical) {
16
- bottom = defaultPosition.vertical.bottom;
17
- }
18
- if ("height" in defaultPosition.vertical) {
19
- height = defaultPosition.vertical.height;
20
- }
21
- if ("left" in defaultPosition.horizontal) {
22
- left = defaultPosition.horizontal.left;
23
- }
24
- if ("right" in defaultPosition.horizontal) {
25
- right = defaultPosition.horizontal.right;
26
- }
27
- if ("width" in defaultPosition.horizontal) {
28
- width = defaultPosition.horizontal.width;
29
- if (!("left" in defaultPosition.horizontal)) {
30
- left = scrollLeft + (containerWidth - width) / 2;
31
- }
32
- }
33
- if ("height" in defaultPosition.vertical) {
34
- height = defaultPosition.vertical.height;
35
- if (!("top" in defaultPosition.vertical)) {
36
- top = scrollTop + (containerHeight - height) / 2;
37
- }
38
- }
39
- if ("percent" in defaultPosition.vertical) {
40
- height = containerHeight * defaultPosition.vertical.percent;
41
- top = (containerHeight - height) / 2;
42
- }
43
- if ("percent" in defaultPosition.horizontal) {
44
- width = containerWidth * defaultPosition.horizontal.percent;
45
- left = (containerWidth - width) / 2;
46
- }
47
- return {
48
- top: top ?? (bottom ? containerHeight - bottom - (height || 0) : 0),
49
- height: height ?? containerHeight - (top || 0) - (bottom || 0),
50
- left: left ?? (right ? containerWidth - right - (width || 0) : 0),
51
- width: width ?? containerWidth - (left || 0) - (right || 0)
52
- };
53
- };
54
- export {
55
- getInitialSize as g
56
- };
@@ -1,6 +0,0 @@
1
- export * from './draggingOrResizingWindow';
2
- export * from './expandingParentContainer';
3
- export * from './isElmentInViewport';
4
- export * from './pointPosition';
5
- export * from './shrinkingParentContainer';
6
- export * from './getInitialSize';
@@ -1,15 +0,0 @@
1
- /**
2
- * Determina si un elemento está visible dentro del viewport de un contenedor
3
- * @param element - El elemento a verificar
4
- * @param container - El contenedor que define el viewport
5
- * @param options - Opciones adicionales
6
- * @returns Un objeto con información sobre la visibilidad horizontal y vertical
7
- */
8
- export declare const isElementInViewport: (element: HTMLElement, container: HTMLElement, options?: {
9
- tolerance: number;
10
- }) => {
11
- isVisibleVertically: boolean;
12
- isVisibleHorizontally: boolean;
13
- isFullyVisible: boolean;
14
- visiblePercentage: number;
15
- };
@@ -1,36 +0,0 @@
1
- import { DraggableWindowBounds } from '../types';
2
- /**
3
- * Verifica si el punto está dentro del rectángulo del contenedor
4
- */
5
- export declare function isPointInsideContainer(e: React.MouseEvent<HTMLElement, MouseEvent>, container?: HTMLElement, bounds?: DraggableWindowBounds): boolean[];
6
- /**
7
- * Resultado extendido que indica la posición del punto respecto al contenedor.
8
- */
9
- export interface PointPosition {
10
- isInside: boolean;
11
- isLeft: boolean;
12
- isRight: boolean;
13
- isAbove: boolean;
14
- isBelow: boolean;
15
- }
16
- /**
17
- * Versión extendida que proporciona información detallada sobre la posición.
18
- * Esta función se puede usar junto con la original cuando se necesite información adicional.
19
- */
20
- export declare function getDetailedPointPosition(e: React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement>, element?: HTMLElement, bounds?: DraggableWindowBounds): [PointPosition, PointPosition];
21
- /**
22
- * Resultado que indica si el punto está en la franja de arrastre en cada eje
23
- */
24
- export interface DragStripPosition {
25
- isInside: boolean;
26
- isInStrip: boolean;
27
- }
28
- /**
29
- * Verifica si un punto está dentro de las franjas de arrastre de un elemento
30
- * y devuelve información detallada para los ejes X e Y
31
- * @param e - Evento del mouse o touch
32
- * @param element - Elemento a verificar
33
- * @param stripWidth - Ancho de las franjas de arrastre (en píxeles)
34
- * @returns - Tupla con información para el eje X y el eje Y
35
- */
36
- export declare function isPointInDragStrip(e: React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement>, element?: HTMLElement, stripWidth?: number): [DragStripPosition, DragStripPosition];
@@ -1,82 +0,0 @@
1
- function getDetailedPointPosition(e, element, bounds = { left: 0, top: 0, right: 0, bottom: 0 }) {
2
- if (!element) {
3
- return [
4
- { isInside: false, isLeft: false, isRight: false, isAbove: false, isBelow: false },
5
- { isInside: false, isLeft: false, isRight: false, isAbove: false, isBelow: false }
6
- ];
7
- }
8
- let clientX, clientY;
9
- if ("touches" in e) {
10
- if (e.touches.length === 0) {
11
- return [
12
- { isInside: false, isLeft: false, isRight: false, isAbove: false, isBelow: false },
13
- { isInside: false, isLeft: false, isRight: false, isAbove: false, isBelow: false }
14
- ];
15
- }
16
- clientX = e.touches[0].clientX;
17
- clientY = e.touches[0].clientY;
18
- } else {
19
- clientX = e.clientX;
20
- clientY = e.clientY;
21
- }
22
- const rect = element.getBoundingClientRect();
23
- const leftBound = rect.left + (bounds.left || 0);
24
- const rightBound = rect.left + element.clientWidth + (bounds.right || 0);
25
- const topBound = rect.top + (bounds.top || 0);
26
- const bottomBound = rect.top + element.clientHeight + (bounds.bottom || 0);
27
- const xPosition = {
28
- isInside: clientX >= leftBound && clientX <= rightBound,
29
- isLeft: clientX < leftBound,
30
- isRight: clientX > rightBound,
31
- isAbove: false,
32
- isBelow: false
33
- };
34
- const yPosition = {
35
- isInside: clientY >= topBound && clientY <= bottomBound,
36
- isLeft: false,
37
- isRight: false,
38
- isAbove: clientY < topBound,
39
- isBelow: clientY > bottomBound
40
- };
41
- return [xPosition, yPosition];
42
- }
43
- function isPointInDragStrip(e, element, stripWidth = 1) {
44
- const defaultResult = {
45
- isInside: false,
46
- isInStrip: false
47
- };
48
- if (!element) {
49
- return [{ ...defaultResult }, { ...defaultResult }];
50
- }
51
- let clientX, clientY;
52
- if ("touches" in e) {
53
- if (e.touches.length === 0) {
54
- return [{ ...defaultResult }, { ...defaultResult }];
55
- }
56
- clientX = e.touches[0].clientX;
57
- clientY = e.touches[0].clientY;
58
- } else {
59
- clientX = e.clientX;
60
- clientY = e.clientY;
61
- }
62
- const rect = element.getBoundingClientRect();
63
- const isInsideX = clientX >= rect.left && clientX <= rect.right;
64
- const isInsideY = clientY >= rect.top && clientY <= rect.bottom;
65
- const stripBoundLeft = rect.left - stripWidth;
66
- const stripBoundRight = rect.right + stripWidth;
67
- const stripBoundTop = rect.top - stripWidth;
68
- const stripBoundBottom = rect.bottom + stripWidth;
69
- const xPosition = {
70
- isInside: isInsideX,
71
- isInStrip: clientX >= stripBoundLeft && clientX <= stripBoundRight
72
- };
73
- const yPosition = {
74
- isInside: isInsideY,
75
- isInStrip: clientY >= stripBoundTop && clientY <= stripBoundBottom
76
- };
77
- return [xPosition, yPosition];
78
- }
79
- export {
80
- getDetailedPointPosition as g,
81
- isPointInDragStrip as i
82
- };
@@ -1,6 +0,0 @@
1
- import { CurrentState, DraggableWindowBounds } from '../types';
2
- /**
3
- * "shrinkingParentContainer": Encargada de manejar la contracción de la ventana padre
4
- * 1. Si el ancho o alto de la ventana cuando se va compactando toca
5
- */
6
- export declare const shrinkingParentContainer: (newState: CurrentState, cState: CurrentState, containerDimension: number, divRoot: HTMLDivElement, dimension: "Width" | "Height", allowResizeContainer: boolean | undefined, minWindowWidth: number, minWindowHeight: number, bounds?: DraggableWindowBounds) => void;
@@ -1,34 +0,0 @@
1
- const shrinkingParentContainer = (newState, cState, containerDimension, divRoot, dimension, allowResizeContainer = false, minWindowWidth, minWindowHeight, bounds) => {
2
- const lDimension = dimension === "Width" ? "width" : "height";
3
- const leftTop = dimension === "Width" ? "left" : "top";
4
- const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
5
- const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
6
- const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
7
- const boundsRightBottom = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
8
- const minWindowDimension = dimension === "Width" ? minWindowWidth : minWindowHeight;
9
- const minDimension = containerDimension - boundsLefTop + boundsRightBottom > minWindowDimension ? containerDimension - boundsLefTop + boundsRightBottom : minWindowDimension;
10
- let maxDimensionElement = containerDimension - cState[leftTop] + boundsRightBottom;
11
- if (divRoot[`client${dimension}`] > maxDimensionElement && !allowResizeContainer) {
12
- const shrunkenPixels = divRoot[`client${dimension}`] - maxDimensionElement;
13
- if (shrunkenPixels < cState[leftTop] - boundsLefTop) {
14
- newState[leftTop] = newState[leftTop] - shrunkenPixels;
15
- newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[leftTop];
16
- } else if (shrunkenPixels > cState[leftTop] - boundsLefTop) {
17
- newState[leftTop] = boundsLefTop;
18
- newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[leftTop];
19
- maxDimensionElement = containerDimension - boundsLefTop + boundsRightBottom;
20
- if (divRoot[`client${dimension}`] > maxDimensionElement) {
21
- newState[lDimension] = maxDimensionElement;
22
- newState[overflowDimensionAt] = newState[overflowDimensionAt] || cState[lDimension];
23
- if (newState[lDimension] < minDimension) {
24
- newState[lDimension] = minDimension;
25
- }
26
- }
27
- }
28
- } else {
29
- return;
30
- }
31
- };
32
- export {
33
- shrinkingParentContainer as s
34
- };