@m4l/components 9.3.20 → 9.3.21-JAEBeta.1

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 (91) hide show
  1. package/@types/types.d.ts +1 -1
  2. package/components/Chip/Chip.js +9 -7
  3. package/components/Chip/ChipStyles.js +4 -31
  4. package/components/Chip/helpers.d.ts +10 -0
  5. package/components/Chip/helpers.js +34 -0
  6. package/components/Chip/types.d.ts +6 -0
  7. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
  8. package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
  9. package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
  10. package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
  11. package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
  12. package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
  13. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
  14. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
  15. package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
  16. package/components/DragResizeWindowRND/index.d.ts +1 -0
  17. package/components/DragResizeWindowRND/types.d.ts +12 -2
  18. package/components/DynamicFilter/DynamicFilter.js +2 -1
  19. package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
  20. package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
  21. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
  22. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
  23. package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
  24. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
  25. package/components/DynamicFilter/types.d.ts +4 -0
  26. package/components/DynamicSort/DynamicSort.js +2 -1
  27. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
  28. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
  29. package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
  30. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
  31. package/components/DynamicSort/types.d.ts +4 -0
  32. package/components/Image/Image.js +4 -1
  33. package/components/MFLoader/MFLoader.js +8 -3
  34. package/components/MFLoader/styles.js +1 -1
  35. package/components/MFLoader/types.d.ts +10 -0
  36. package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
  37. package/components/WindowBase/WindowBase.js +3 -3
  38. package/components/WindowBase/WindowBase.styles.js +36 -31
  39. package/components/WindowBase/constants.d.ts +1 -1
  40. package/components/WindowBase/constants.js +2 -2
  41. package/components/WindowBase/index.d.ts +1 -0
  42. package/components/WindowBase/subcomponents/Component/index.js +2 -2
  43. package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
  44. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
  45. package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
  46. package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +4 -0
  47. package/components/WindowBase/types.d.ts +3 -3
  48. package/components/WindowConfirm/WindowConfirm.js +1 -1
  49. package/components/areas/components/AreasViewer/AreasViewer.styles.js +1 -1
  50. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +6 -2
  51. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -0
  52. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +21 -3
  53. package/components/areas/contexts/AreasContext/store.js +2 -2
  54. package/components/areas/index.d.ts +1 -1
  55. package/components/areas/types.d.ts +1 -1
  56. package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
  57. package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
  58. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
  59. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
  60. package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
  61. package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
  62. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +5 -1
  63. package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
  64. package/components/hook-form/RHFAutocomplete/constants.js +5 -1
  65. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +3 -1
  66. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
  67. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  68. package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
  69. package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
  70. package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
  71. package/components/mui_extended/index.d.ts +1 -1
  72. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
  73. package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
  74. package/components/popups/components/PopupsViewer/PopupsViewer.js +4 -3
  75. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +5 -2
  76. package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +5 -0
  77. package/components/popups/components/PopupsViewer/types.d.ts +3 -0
  78. package/hooks/index.d.ts +1 -0
  79. package/hooks/useSizeContainer/index.d.ts +2 -1
  80. package/hooks/useSizeContainer/index.js +22 -13
  81. package/hooks/useSizeContainer/types.d.ts +6 -0
  82. package/hooks/useStateRef/index.d.ts +1 -1
  83. package/hooks/useStateRef/index.js +6 -6
  84. package/index.js +45 -38
  85. package/package.json +1 -2
  86. package/utils/deepShallow.d.ts +17 -0
  87. package/utils/deepShallow.js +76 -0
  88. package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
  89. package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
  90. package/utils/formatDistanceToNow/types.d.ts +13 -0
  91. package/utils/index.d.ts +1 -0
package/@types/types.d.ts CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  TextFieldOwnerState,
39
39
  TextFieldSlotsType,
40
40
  } from '../components/mui_extended/TextField/types';
41
- type Theme = Omit<MuiTheme, 'components'>;
41
+ // type Theme = Omit<MuiTheme, 'components'>;
42
42
  import {
43
43
  TooltipOwnerState,
44
44
  TooltipSlotsType,
@@ -23,6 +23,7 @@ const Chip = forwardRef((props, ref) => {
23
23
  className,
24
24
  dataTestId,
25
25
  disabledDeleteButton,
26
+ ellipsis = false,
26
27
  ...others
27
28
  } = props;
28
29
  const { currentSize } = useComponentSize(size);
@@ -34,8 +35,9 @@ const Chip = forwardRef((props, ref) => {
34
35
  variant,
35
36
  color,
36
37
  opacity,
37
- externalColor
38
- }), [currentSize, variant, color, opacity, externalColor, onClick]);
38
+ externalColor,
39
+ ellipsis
40
+ }), [onClick, currentSize, variant, color, opacity, externalColor, ellipsis]);
39
41
  const renderIcon = useMemo(() => (icon, instaceDataTestId) => {
40
42
  if (!icon) {
41
43
  return null;
@@ -46,7 +48,7 @@ const Chip = forwardRef((props, ref) => {
46
48
  return /* @__PURE__ */ jsx(
47
49
  IconStyled,
48
50
  {
49
- ownerState: { ...ownerState },
51
+ ownerState,
50
52
  src: icon,
51
53
  size: currentSize,
52
54
  instaceDataTestId
@@ -60,7 +62,7 @@ const Chip = forwardRef((props, ref) => {
60
62
  {
61
63
  "data-testid": "SkeletonButton",
62
64
  width: skeletonWidth,
63
- ownerState: { ...ownerState }
65
+ ownerState
64
66
  }
65
67
  );
66
68
  }
@@ -75,7 +77,7 @@ const Chip = forwardRef((props, ref) => {
75
77
  role: "button-chip",
76
78
  size: currentSize,
77
79
  onClick,
78
- ownerState: { ...ownerState },
80
+ ownerState,
79
81
  className: clsx(className, CHIP_CLASSES.root),
80
82
  ref,
81
83
  ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: dataTestId } : {},
@@ -83,7 +85,7 @@ const Chip = forwardRef((props, ref) => {
83
85
  ...others,
84
86
  children: [
85
87
  renderIcon(startIcon, "ChipStartIcon"),
86
- /* @__PURE__ */ jsx(TextChipStyled, { size: currentSize, ownerState: { ...ownerState }, color, children: label }),
88
+ /* @__PURE__ */ jsx(TextChipStyled, { size: currentSize, ownerState: { ...ownerState }, color, ellipsis, children: label }),
87
89
  renderIcon(endIcon, "ChipEndIcon"),
88
90
  onDeleted && /* @__PURE__ */ jsx(
89
91
  IconButtonStyled,
@@ -91,7 +93,7 @@ const Chip = forwardRef((props, ref) => {
91
93
  ...iconButtonProps,
92
94
  src: iconClose,
93
95
  size: currentSize,
94
- ownerState: { ...ownerState },
96
+ ownerState,
95
97
  onClick: handleDelete,
96
98
  disabled: disabledDeleteButton,
97
99
  className: CHIP_CLASSES.closeIcon
@@ -1,35 +1,5 @@
1
1
  import { g as getSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
2
- import { darken, lighten } from "@mui/material/styles";
3
- const getExternalColor = (externalColor) => {
4
- try {
5
- return {
6
- color: externalColor.color,
7
- backgroundColor: lighten(externalColor.backgroundColor, 0.5),
8
- backgroundHover: lighten(externalColor.backgroundColor, 0.3),
9
- backgroundActive: lighten(externalColor.backgroundColor, 0.7),
10
- colorTone: lighten(externalColor.color, 1),
11
- backgroundColorTone: externalColor.backgroundColor,
12
- backgroundHoverTone: lighten(externalColor.backgroundColor, 0.2),
13
- backgroundActiveTone: darken(externalColor.backgroundColor, 0.2)
14
- };
15
- } catch (_error) {
16
- return {
17
- color: "",
18
- backgroundColor: "",
19
- backgroundHover: "",
20
- backgroundActive: "",
21
- colorTone: "",
22
- backgroundColorTone: "",
23
- backgroundHoverTone: "",
24
- backgroundActiveTone: ""
25
- };
26
- }
27
- };
28
- const getColors = (theme, ownerState) => {
29
- const finalPalette = ownerState?.externalColor ? getExternalColor(ownerState?.externalColor) : theme.vars.palette.chips[ownerState?.color ?? "default"][ownerState?.variant || "contained"];
30
- const color = ownerState?.opacity ? finalPalette.color : finalPalette.colorTone;
31
- return { color, finalPalette };
32
- };
2
+ import { g as getColors } from "./helpers.js";
33
3
  const chipStyles = {
34
4
  /**
35
5
  * Styles for the root element of the chip.
@@ -46,6 +16,9 @@ const chipStyles = {
46
16
  borderRadius: theme.vars.size.borderRadius["r1-5"],
47
17
  gap: theme.vars.size.baseSpacings["sp0-5"],
48
18
  width: "max-content",
19
+ ...ownerState?.ellipsis && {
20
+ maxWidth: "100%"
21
+ },
49
22
  cursor: "pointer",
50
23
  color,
51
24
  backgroundColor: !(ownerState?.variant === "outlined") ? bgColor : "transparent",
@@ -0,0 +1,10 @@
1
+ import { ChipColor } from '@m4l/styles';
2
+ import { Theme } from '@mui/material/styles';
3
+ import { ChipOwnerState } from './types';
4
+ /**
5
+ * Obtiene los colores del chip
6
+ */
7
+ export declare const getColors: (theme: Theme, ownerState: ChipOwnerState) => {
8
+ color: string;
9
+ finalPalette: ChipColor;
10
+ };
@@ -0,0 +1,34 @@
1
+ import { darken, lighten } from "@mui/material/styles";
2
+ const getExternalColor = (externalColor) => {
3
+ try {
4
+ return {
5
+ color: externalColor.color,
6
+ backgroundColor: lighten(externalColor.backgroundColor, 0.5),
7
+ backgroundHover: lighten(externalColor.backgroundColor, 0.3),
8
+ backgroundActive: lighten(externalColor.backgroundColor, 0.7),
9
+ colorTone: lighten(externalColor.color, 1),
10
+ backgroundColorTone: externalColor.backgroundColor,
11
+ backgroundHoverTone: lighten(externalColor.backgroundColor, 0.2),
12
+ backgroundActiveTone: darken(externalColor.backgroundColor, 0.2)
13
+ };
14
+ } catch (_error) {
15
+ return {
16
+ color: "",
17
+ backgroundColor: "",
18
+ backgroundHover: "",
19
+ backgroundActive: "",
20
+ colorTone: "",
21
+ backgroundColorTone: "",
22
+ backgroundHoverTone: "",
23
+ backgroundActiveTone: ""
24
+ };
25
+ }
26
+ };
27
+ const getColors = (theme, ownerState) => {
28
+ const finalPalette = ownerState?.externalColor ? getExternalColor(ownerState?.externalColor) : theme.vars.palette.chips[ownerState?.color ?? "default"][ownerState?.variant || "contained"];
29
+ const color = ownerState?.opacity ? finalPalette.color : finalPalette.colorTone;
30
+ return { color, finalPalette };
31
+ };
32
+ export {
33
+ getColors as g
34
+ };
@@ -78,12 +78,18 @@ export interface ChipProps {
78
78
  * If the `Chip` delete button is disabled.
79
79
  */
80
80
  disabledDeleteButton?: boolean;
81
+ /**
82
+ * If the `Chip` is ellipsis.
83
+ */
84
+ ellipsis?: boolean;
81
85
  }
82
86
  /**
83
87
  * Owner state of the `Chip` used to define internal style and behavior properties.
84
88
  */
85
89
  export interface ChipOwnerState extends Pick<ChipProps, 'variant' | 'externalColor' | 'opacity' | 'size' | 'color'> {
86
90
  interactive: boolean;
91
+ ellipsis: boolean;
92
+ [key: string]: unknown;
87
93
  }
88
94
  /**
89
95
  * Defines the types of Slots available for the `Chip`.
@@ -42,7 +42,7 @@ const useModalSettings = (size, columns) => {
42
42
  onClose: closeModal,
43
43
  className: "settings-modal",
44
44
  variant: "outlined",
45
- type: "modal",
45
+ emergeType: "modal",
46
46
  children: /* @__PURE__ */ jsxs(ContentModalSettingStyled, { classes: classes?.contentModalSetting, children: [
47
47
  /* @__PURE__ */ jsx(DataGridRootStyled, { children: /* @__PURE__ */ jsx(
48
48
  ColumnsConfig,
@@ -44,7 +44,7 @@ const DragResizeWindowRND = forwardRef((props, ref) => {
44
44
  ...others
45
45
  } = props;
46
46
  const [currentState, setCurrentState] = useState(
47
- () => getInitialSize(containerSize, defaultPosition, containerElement, allowHeightResizeContainer, allowWidthResizeContainer)
47
+ () => getInitialSize(containerSize, bounds, defaultPosition, containerElement, allowHeightResizeContainer, allowWidthResizeContainer)
48
48
  );
49
49
  const minConstraints = useMemo(() => [minWidth, minHeight], [minWidth, minHeight]);
50
50
  const stateRef = useRef({
@@ -56,7 +56,9 @@ const DragResizeWindowRND = forwardRef((props, ref) => {
56
56
  y: currentState.y,
57
57
  width: currentState.width,
58
58
  height: currentState.height,
59
- minConstraints
59
+ minConstraints,
60
+ magnetizeRight: currentState.magnetizeRight,
61
+ magnetizeBottom: currentState.magnetizeBottom
60
62
  });
61
63
  if (containerSize && (stateRef.current.containerSize?.containerWidth !== containerSize.containerWidth || stateRef.current.containerSize?.containerHeight !== containerSize.containerHeight)) {
62
64
  stateRef.current.containerSize = { ...containerSize };
@@ -165,6 +167,7 @@ const DragResizeWindowRND = forwardRef((props, ref) => {
165
167
  if (!containerElement) {
166
168
  return null;
167
169
  }
170
+ const marginResize = `5px`;
168
171
  return /* @__PURE__ */ jsx(
169
172
  RndStyled,
170
173
  {
@@ -186,15 +189,16 @@ const DragResizeWindowRND = forwardRef((props, ref) => {
186
189
  className: classNameFinal,
187
190
  enableUserSelectHack: true,
188
191
  resizeHandleStyles: {
192
+ zIndex: 1,
189
193
  //Se debe mover lo handler de resize para queden dentro de la ventana, o genería un scroll innecesario.
190
- bottom: { bottom: "0px" },
191
- right: { right: "0px" },
192
- top: { top: "0px" },
193
- left: { left: "0px" },
194
- bottomRight: { bottom: "0px", right: "0px", height: "10px", width: "10px" },
195
- bottomLeft: { bottom: "0px", left: "0px", height: "10px", width: "10px" },
196
- topRight: { top: "0px", right: "0px", height: "10px", width: "10px" },
197
- topLeft: { top: "0px", left: "0px", height: "10px", width: "10px" }
194
+ bottom: { bottom: "0px", zIndex: 1, height: marginResize },
195
+ right: { right: "0px", zIndex: 1, width: marginResize },
196
+ top: { top: "0px", zIndex: 1, height: marginResize },
197
+ left: { left: "0px", zIndex: 1, width: marginResize },
198
+ bottomRight: { bottom: "0px", right: "0px", zIndex: 1 },
199
+ bottomLeft: { bottom: "0px", left: "0px", zIndex: 1 },
200
+ topRight: { top: "0px", right: "0px", zIndex: 1 },
201
+ topLeft: { top: "0px", left: "0px", zIndex: 1 }
198
202
  },
199
203
  resizeHandleClasses: {
200
204
  left: "resize-handle-left",
@@ -9,4 +9,4 @@ import { CurrentState, DraggableWindowBounds } from '../types';
9
9
  * se borran los flags que indican que hay que recuperar el ancho y alto, o el left y top.
10
10
  * (shrinkLeftTopAt, overflowDimensionAt)
11
11
  */
12
- export declare const expandingParentContainer: (newState: CurrentState, containerDimension: number, dimension: "Width" | "Height", bounds?: DraggableWindowBounds) => void;
12
+ export declare const expandingParentContainer: (newState: CurrentState, containerDimension: number, dimension: "Width" | "Height", value: number, bounds?: DraggableWindowBounds) => void;
@@ -1,29 +1,34 @@
1
- const expandingParentContainer = (newState, containerDimension, dimension, bounds) => {
1
+ const expandingParentContainer = (newState, containerDimension, dimension, value, bounds) => {
2
2
  const lDimension = dimension === "Width" ? "width" : "height";
3
3
  const leftTop = dimension === "Width" ? "x" : "y";
4
4
  const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
5
5
  const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
6
- const boundsLefTop = dimension === "Width" ? 0 : 0;
7
- const initialPosition = dimension === "Width" ? 0 : 0;
6
+ const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
7
+ const initialPosition = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
8
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;
9
+ const magnetize = dimension === "Width" ? newState.magnetizeRight : newState.magnetizeBottom;
10
+ if (!magnetize) {
11
+ const valOverflowDimensionAt = newState[overflowDimensionAt];
12
+ if (valOverflowDimensionAt) {
13
+ if (valOverflowDimensionAt > maxDimensionElement) {
14
+ newState[lDimension] = maxDimensionElement;
15
+ } else {
16
+ newState[lDimension] = valOverflowDimensionAt;
17
+ newState[overflowDimensionAt] = void 0;
18
+ }
16
19
  }
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;
20
+ const valShrinkLeftTopAt = newState[shrinkLeftTopAt];
21
+ if (valShrinkLeftTopAt && !newState[overflowDimensionAt]) {
22
+ const dimensionAvailable = containerDimension - boundsLefTop - newState[lDimension] + initialPosition;
23
+ if (valShrinkLeftTopAt <= dimensionAvailable) {
24
+ newState[leftTop] = valShrinkLeftTopAt;
25
+ newState[shrinkLeftTopAt] = void 0;
26
+ } else {
27
+ newState[leftTop] = dimensionAvailable;
28
+ }
26
29
  }
30
+ } else {
31
+ newState[leftTop] = newState[leftTop] + value;
27
32
  }
28
33
  };
29
34
  export {
@@ -1,5 +1,5 @@
1
1
  import { ContainerSize } from '../../../utils/types';
2
- import { CurrentState, DefaultPosition } from '../types';
2
+ import { CurrentState, DraggableWindowBounds, RNDDefaultPosition } from '../types';
3
3
  /**
4
4
  * Calculates the initial size and position of an element based on the provided container size
5
5
  * and default position values.
@@ -9,7 +9,7 @@ import { CurrentState, DefaultPosition } from '../types';
9
9
  * are provided instead of `top` and `left`, the function calculates the starting position based
10
10
  * on the container dimensions, ensuring that the element is correctly positioned.
11
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`).
12
+ * @param {RNDDefaultPosition} defaultPosition - Object defining the default vertical and horizontal positions (`top`, `bottom`, `height`, `left`, `right`, `width`).
13
13
  * @returns {CurrentState} - The initial size and position of the element with `top`, `left`, `width`, and `height` properties.
14
14
  */
15
- export declare const getInitialSize: (containerSize: ContainerSize | undefined, defaultPosition: DefaultPosition, containerElement: HTMLElement | undefined, allowHeightResizeContainer: boolean, allowWidthResizeContainer: boolean) => CurrentState;
15
+ export declare const getInitialSize: (containerSize: ContainerSize | undefined, bounds: DraggableWindowBounds | undefined, defaultPosition: RNDDefaultPosition, containerElement: HTMLElement | undefined, allowHeightResizeContainer: boolean, allowWidthResizeContainer: boolean) => CurrentState;
@@ -1,11 +1,18 @@
1
- const getInitialSize = (containerSize, defaultPosition, containerElement, allowHeightResizeContainer, allowWidthResizeContainer) => {
1
+ const getInitialSize = (containerSize, bounds, defaultPosition, containerElement, allowHeightResizeContainer, allowWidthResizeContainer) => {
2
2
  let top;
3
3
  let bottom;
4
4
  let height;
5
5
  let left;
6
6
  let right;
7
7
  let width;
8
- const LIMIT_PX = 20;
8
+ let magnetizeBottom = false;
9
+ let magnetizeRight = false;
10
+ if ("magnetize" in defaultPosition.vertical) {
11
+ magnetizeBottom = defaultPosition.vertical.magnetize || false;
12
+ }
13
+ if ("magnetize" in defaultPosition.horizontal) {
14
+ magnetizeRight = defaultPosition.horizontal.magnetize || false;
15
+ }
9
16
  const containerHeight = containerSize?.containerHeight || 200;
10
17
  const containerWidth = containerSize?.containerWidth || 200;
11
18
  const scrollTop = containerElement?.scrollTop || 0;
@@ -49,25 +56,21 @@ const getInitialSize = (containerSize, defaultPosition, containerElement, allowH
49
56
  y: Math.round(top ?? (bottom !== void 0 ? containerHeight + bottom - (height || 0) : 0)),
50
57
  height: Math.round(height ?? containerHeight - (top || 0) - (bottom || 0)),
51
58
  x: Math.round(left ?? (right !== void 0 ? containerWidth + right - (width || 0) : 0)),
52
- width: Math.round(width ?? containerWidth - (left || 0) - (right || 0))
59
+ width: Math.round(width ?? containerWidth - (left || 0) - (right || 0)),
60
+ magnetizeBottom,
61
+ magnetizeRight
53
62
  };
54
63
  if (!allowHeightResizeContainer) {
55
- const boundTop = 0 + LIMIT_PX;
56
- const boundBottom = Math.max(containerHeight - LIMIT_PX - (height || 0), LIMIT_PX);
64
+ const boundTop = bounds?.top || 0;
65
+ const boundBottom = bounds?.bottom || 0;
57
66
  initialSize.y = Math.max(initialSize.y, boundTop);
58
- initialSize.height = Math.min(initialSize.height, containerHeight - LIMIT_PX);
59
- if (initialSize.y > boundBottom) {
60
- initialSize.y = boundBottom;
61
- }
67
+ initialSize.height = Math.min(initialSize.height, containerHeight - boundTop + boundBottom);
62
68
  }
63
69
  if (!allowWidthResizeContainer) {
64
- const boundLeft = 0 + LIMIT_PX;
65
- const boundRight = Math.max(containerWidth - LIMIT_PX - (width || 0), LIMIT_PX);
70
+ const boundLeft = bounds?.left || 0;
71
+ const boundRight = bounds?.right || 0;
66
72
  initialSize.x = Math.max(initialSize.x, boundLeft);
67
- initialSize.width = Math.min(initialSize.width, containerWidth - LIMIT_PX);
68
- if (initialSize.x > boundRight) {
69
- initialSize.x = boundRight;
70
- }
73
+ initialSize.width = Math.min(initialSize.width, containerWidth - boundLeft + boundRight);
71
74
  }
72
75
  return initialSize;
73
76
  };
@@ -3,4 +3,4 @@ import { CurrentState, DraggableWindowBounds } from '../types';
3
3
  * "shrinkingParentContainer": Encargada de manejar la contracción de la ventana padre
4
4
  * 1. Si el ancho o alto de la ventana cuando se va compactando toca
5
5
  */
6
- export declare const shrinkingParentContainer: (newState: CurrentState, cState: CurrentState, containerDimension: number, divRoot: HTMLElement, dimension: "Width" | "Height", allowResizeContainer: boolean | undefined, minWindowWidth: number, minWindowHeight: number, bounds?: DraggableWindowBounds) => void;
6
+ export declare const shrinkingParentContainer: (newState: CurrentState, cState: CurrentState, containerDimension: number, divRoot: HTMLElement, dimension: "Width" | "Height", allowResizeContainer: boolean | undefined, minWindowWidth: number, minWindowHeight: number, value: number, bounds?: DraggableWindowBounds) => void;
@@ -1,21 +1,26 @@
1
- const shrinkingParentContainer = (newState, cState, containerDimension, divRoot, dimension, allowResizeContainer = false, minWindowWidth, minWindowHeight, bounds) => {
1
+ const shrinkingParentContainer = (newState, cState, containerDimension, divRoot, dimension, allowResizeContainer = false, minWindowWidth, minWindowHeight, value, bounds) => {
2
2
  const lDimension = dimension === "Width" ? "width" : "height";
3
- const xOrY = dimension === "Width" ? "x" : "y";
3
+ const leftTop = dimension === "Width" ? "x" : "y";
4
4
  const shrinkLeftTopAt = dimension === "Width" ? "shrinkLeftAt" : "shrinkTopAt";
5
5
  const overflowDimensionAt = dimension === "Width" ? "overflowWidthAt" : "overflowHeightAt";
6
6
  const boundsLefTop = dimension === "Width" ? bounds?.left || 0 : bounds?.top || 0;
7
7
  const boundsRightBottom = dimension === "Width" ? bounds?.right || 0 : bounds?.bottom || 0;
8
8
  const minWindowDimension = dimension === "Width" ? minWindowWidth : minWindowHeight;
9
9
  const minDimension = containerDimension - boundsLefTop + boundsRightBottom > minWindowDimension ? containerDimension - boundsLefTop + boundsRightBottom : minWindowDimension;
10
- let maxDimensionElement = containerDimension - cState[xOrY] + boundsRightBottom;
10
+ const magnetize = dimension === "Width" ? newState.magnetizeRight : newState.magnetizeBottom;
11
+ let maxDimensionElement = containerDimension - cState[leftTop] + boundsRightBottom;
11
12
  if (divRoot[`client${dimension}`] > maxDimensionElement && !allowResizeContainer) {
12
13
  const shrunkenPixels = divRoot[`client${dimension}`] - maxDimensionElement;
13
- if (shrunkenPixels < cState[xOrY] - boundsLefTop) {
14
- newState[xOrY] = newState[xOrY] - shrunkenPixels;
15
- newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[xOrY];
16
- } else if (shrunkenPixels > cState[xOrY] - boundsLefTop) {
17
- newState[xOrY] = boundsLefTop;
18
- newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[xOrY];
14
+ if (shrunkenPixels < cState[leftTop] - boundsLefTop) {
15
+ if (!magnetize) {
16
+ newState[leftTop] = newState[leftTop] - shrunkenPixels;
17
+ newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[leftTop];
18
+ } else {
19
+ newState[leftTop] = newState[leftTop] + value;
20
+ }
21
+ } else if (shrunkenPixels > cState[leftTop] - boundsLefTop) {
22
+ newState[leftTop] = boundsLefTop;
23
+ newState[shrinkLeftTopAt] = newState[shrinkLeftTopAt] || cState[leftTop];
19
24
  maxDimensionElement = containerDimension - boundsLefTop + boundsRightBottom;
20
25
  if (divRoot[`client${dimension}`] > maxDimensionElement) {
21
26
  newState[lDimension] = maxDimensionElement;
@@ -26,6 +31,9 @@ const shrinkingParentContainer = (newState, cState, containerDimension, divRoot,
26
31
  }
27
32
  }
28
33
  } else {
34
+ if (magnetize) {
35
+ newState[leftTop] = newState[leftTop] + value;
36
+ }
29
37
  return;
30
38
  }
31
39
  };
@@ -47,7 +47,9 @@ const useRNDDimensionEffects = (props) => {
47
47
  expandingParentContainer(
48
48
  newState,
49
49
  containerSizeValue,
50
- dimension
50
+ dimension,
51
+ containerSizeValue - previousContainerSizeValue,
52
+ bounds
51
53
  );
52
54
  } else if (containerSizeValue < previousContainerSizeValue) {
53
55
  shrinkingParentContainer(
@@ -59,6 +61,7 @@ const useRNDDimensionEffects = (props) => {
59
61
  allowResizeContainer,
60
62
  minWindowWidth,
61
63
  minWindowHeight,
64
+ containerSizeValue - previousContainerSizeValue,
62
65
  bounds
63
66
  );
64
67
  }
@@ -1,3 +1,4 @@
1
1
  export { DragResizeWindowRND } from './DragResizeWindowRND';
2
2
  export { dragResizeWindowRNDClasses } from './classes/index';
3
3
  export { WINDOW_SIZES } from './constants';
4
+ export type { RNDDefaultPosition } from './types';
@@ -78,6 +78,14 @@ export interface CurrentState extends Position {
78
78
  * "minConstraints" Indica los límites mínimos de la ventana
79
79
  */
80
80
  minConstraints?: [number, number];
81
+ /**
82
+ * "magnetizeBottom" Indica si se debe magnetizar la ventana a la top ante un resize, conserve el mismo top
83
+ */
84
+ magnetizeBottom?: boolean;
85
+ /**
86
+ * "magnetizeRight" Indica si se debe magnetizar la ventana a la derecha ante un resize, conserve el mismo rigth
87
+ */
88
+ magnetizeRight?: boolean;
81
89
  }
82
90
  /**
83
91
  * Representa una posición parcial, solo incluye las propiedades left y top.
@@ -122,7 +130,7 @@ export type DraggableWindowRefProps = {
122
130
  /**
123
131
  * Tipo que representa las posiciones predeterminadas (vertical y horizontal) de la ventana.
124
132
  */
125
- export interface DefaultPosition {
133
+ export interface RNDDefaultPosition {
126
134
  vertical: {
127
135
  top: number;
128
136
  bottom: number;
@@ -134,6 +142,7 @@ export interface DefaultPosition {
134
142
  } | {
135
143
  bottom: number;
136
144
  height: number;
145
+ magnetize?: boolean;
137
146
  } | {
138
147
  percent: number;
139
148
  };
@@ -146,6 +155,7 @@ export interface DefaultPosition {
146
155
  } | {
147
156
  right: number;
148
157
  width: number;
158
+ magnetize?: boolean;
149
159
  } | {
150
160
  percent: number;
151
161
  } | {
@@ -177,7 +187,7 @@ export interface DragResizeWindowPropsRND extends Partial<Omit<RndProps, 'handle
177
187
  * defaultPosition permite definir la posición inicial de la ventana
178
188
  * TODO: Debe también recibir anchorEl y anchorPosition y calcular la posición en base a este
179
189
  */
180
- defaultPosition?: DefaultPosition;
190
+ defaultPosition?: RNDDefaultPosition;
181
191
  /**
182
192
  * "bounds" permite definir los limites de movimiento de la ventana
183
193
  */
@@ -4,11 +4,12 @@ import { forwardRef } from "react";
4
4
  import { D as DynamicFilterProvider } from "./store/DynamicFilterContext.js";
5
5
  import { D as DynamicFilterBase } from "./subcomponents/DynamicFilterBase/DynamicFilterBase.js";
6
6
  const DynamicFilter = forwardRef((props, ref) => {
7
+ const { className, ...others } = props;
7
8
  const hasPresentFlags = useFlagsPresent([CommonFlags.FLAG_DICTIONARY_LOADED]);
8
9
  if (!hasPresentFlags) {
9
10
  return null;
10
11
  }
11
- return /* @__PURE__ */ jsx(DynamicFilterProvider, { ...props, ref, children: /* @__PURE__ */ jsx(DynamicFilterBase, {}) });
12
+ return /* @__PURE__ */ jsx(DynamicFilterProvider, { ...others, ref, children: /* @__PURE__ */ jsx(DynamicFilterBase, { className }) });
12
13
  });
13
14
  export {
14
15
  DynamicFilter as D
@@ -1,10 +1,10 @@
1
- import { RawFilterFieldApply } from '../types';
1
+ import { FilterField, RawFilterFieldApply } from '../types';
2
2
  type ObjectData = Record<any, any>;
3
3
  /**
4
4
  * Función que verifica si el objectData cumple con todos los filtros de DynamicFilter
5
5
  * Para usar en el frontEnd, y no atraves de la API
6
6
  */
7
- export declare const getIsIfInDynamicFilter: (objectData: ObjectData, groupedFields: Record<string, RawFilterFieldApply[]>) => boolean;
7
+ export declare const getIsIfInDynamicFilter: (filterFields: Array<FilterField>, objectData: ObjectData, groupedFields: Record<string, RawFilterFieldApply[]>) => boolean;
8
8
  /**
9
9
  * getFilterGroupFieldsByName agrupa los campos por nombre, para procesarlos en una OR
10
10
  */
@@ -16,7 +16,7 @@ const isInBooleanFilter = (objectData, field) => {
16
16
  }
17
17
  return true;
18
18
  };
19
- const isInStringFilter = (objectData, field) => {
19
+ const isInStringFilter = (objectData, field, defaultUndefinedValue = true) => {
20
20
  const objectDataValue = getPropertyByString(objectData, field.n, void 0);
21
21
  if (typeof field.o1 !== "string") {
22
22
  return true;
@@ -31,19 +31,19 @@ const isInStringFilter = (objectData, field) => {
31
31
  return true;
32
32
  }
33
33
  } else if (field.o === "c") {
34
- if (objectDataValue.includes(field.o1)) {
34
+ if (objectDataValue.toLocaleLowerCase().includes(field.o1.toLocaleLowerCase())) {
35
35
  return true;
36
36
  }
37
37
  } else if (field.o === "nc") {
38
- if (!objectDataValue.includes(field.o1)) {
38
+ if (!objectDataValue.toLocaleLowerCase().includes(field.o1.toLocaleLowerCase())) {
39
39
  return true;
40
40
  }
41
41
  }
42
42
  return false;
43
43
  }
44
- return true;
44
+ return defaultUndefinedValue;
45
45
  };
46
- const isInNumberFilter = (objectData, field) => {
46
+ const isInNumberFilter = (objectData, field, defaultUndefinedValue = true) => {
47
47
  const objectDataValue = getPropertyByString(objectData, field.n, void 0);
48
48
  if (typeof field.o1 !== "number") {
49
49
  return true;
@@ -83,7 +83,7 @@ const isInNumberFilter = (objectData, field) => {
83
83
  }
84
84
  return false;
85
85
  }
86
- return true;
86
+ return defaultUndefinedValue;
87
87
  };
88
88
  const isInDateTimeFilter = (objectData, field) => {
89
89
  const objectDataValueString = getPropertyByString(objectData, field.n, void 0);
@@ -169,13 +169,34 @@ const isInSelectFilter = (objectData, field) => {
169
169
  }
170
170
  return false;
171
171
  };
172
- const getIsIfInDynamicFilter = (objectData, groupedFields) => {
172
+ const getIsIfInDynamicFilter = (filterFields, objectData, groupedFields) => {
173
173
  let InAllFilters = true;
174
174
  for (const fieldName of Object.keys(groupedFields)) {
175
175
  const fieldGroup = groupedFields[fieldName];
176
176
  let inFilter = false;
177
177
  fieldGroup.forEach((field) => {
178
- if (field.ft === "boolean") {
178
+ if (field.n === "all") {
179
+ filterFields.forEach((filterField) => {
180
+ const isNumber = !isNaN(Number(field.o1));
181
+ const artificialField = {
182
+ n: filterField.name,
183
+ o: "c",
184
+ o1: field.o1,
185
+ ft: filterField.type
186
+ };
187
+ if (filterField.type === "string") {
188
+ const isInString = isInStringFilter(objectData, artificialField, false);
189
+ inFilter = inFilter || isInString;
190
+ }
191
+ if (isNumber && filterField.type === "number") {
192
+ inFilter = inFilter || isInNumberFilter(objectData, {
193
+ ...artificialField,
194
+ o: "e",
195
+ o1: Number(field.o1)
196
+ }, false);
197
+ }
198
+ });
199
+ } else if (field.ft === "boolean") {
179
200
  inFilter = inFilter || isInBooleanFilter(objectData, field);
180
201
  } else if (field.ft === "string") {
181
202
  inFilter = inFilter || isInStringFilter(objectData, field);
@@ -199,13 +220,14 @@ const getIsIfInDynamicFilter = (objectData, groupedFields) => {
199
220
  return InAllFilters;
200
221
  };
201
222
  function getFilterGroupFieldsByName(fields) {
202
- return fields.reduce((acc, field) => {
223
+ const result = fields.reduce((acc, field) => {
203
224
  if (!acc[field.n]) {
204
225
  acc[field.n] = [];
205
226
  }
206
227
  acc[field.n].push(field);
207
228
  return acc;
208
229
  }, {});
230
+ return result;
209
231
  }
210
232
  export {
211
233
  getFilterGroupFieldsByName as a,
@@ -1,5 +1,6 @@
1
+ import { DynamicFilterBaseProps } from './types';
1
2
  /**
2
3
  * DynamicFilterBase: Componente base del DynamicFilter.
3
4
  */
4
- declare function DynamicFilterBase(): import("react/jsx-runtime").JSX.Element;
5
+ declare function DynamicFilterBase(props: DynamicFilterBaseProps): import("react/jsx-runtime").JSX.Element;
5
6
  export default DynamicFilterBase;