@m4l/components 9.3.19 → 9.3.21-JAEBeta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/types.d.ts +1 -1
- package/components/Chip/Chip.js +9 -7
- package/components/Chip/ChipStyles.js +4 -31
- package/components/Chip/helpers.d.ts +10 -0
- package/components/Chip/helpers.js +34 -0
- package/components/Chip/types.d.ts +6 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
- package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
- package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
- package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
- package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
- package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
- package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
- package/components/DragResizeWindowRND/index.d.ts +1 -0
- package/components/DragResizeWindowRND/types.d.ts +12 -2
- package/components/DynamicFilter/DynamicFilter.js +2 -1
- package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
- package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/DynamicSort/DynamicSort.js +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
- package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/Image/Image.js +4 -1
- package/components/MFLoader/MFLoader.js +3 -2
- package/components/MFLoader/types.d.ts +5 -0
- package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
- package/components/Stepper/Stepper.styles.js +17 -14
- package/components/Stepper/helpers/getInitialFieldValues/index.d.ts +12 -0
- package/components/Stepper/helpers/getInitialFieldValues/index.js +14 -0
- package/components/Stepper/helpers/index.d.ts +2 -0
- package/components/Stepper/helpers/parseWatchedValues/index.d.ts +17 -0
- package/components/Stepper/helpers/parseWatchedValues/index.js +12 -0
- package/components/Stepper/hooks/useDynamicValidation/index.d.ts +11 -0
- package/components/Stepper/hooks/useDynamicValidation/index.js +69 -0
- package/components/Stepper/hooks/useStepperActions/index.js +19 -3
- package/components/Stepper/store/StepperStore/index.js +20 -1
- package/components/Stepper/subcomponents/StepArea/index.js +45 -25
- package/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.js +18 -10
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +38 -5
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +5 -3
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +5 -3
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.d.ts +2 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +5 -3
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +30 -11
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.js +20 -10
- package/components/Stepper/types.d.ts +7 -0
- package/components/WindowBase/WindowBase.js +3 -3
- package/components/WindowBase/WindowBase.styles.js +36 -31
- package/components/WindowBase/constants.d.ts +1 -1
- package/components/WindowBase/constants.js +2 -2
- package/components/WindowBase/index.d.ts +1 -0
- package/components/WindowBase/subcomponents/Component/index.js +2 -2
- package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
- package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
- package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
- package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +2 -0
- package/components/WindowBase/types.d.ts +3 -3
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +3 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +17 -2
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/areas/index.d.ts +1 -1
- package/components/areas/types.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
- package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
- package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
- package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
- package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
- package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +5 -1
- package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/constants.js +5 -1
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +3 -1
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
- package/components/hook-form/RHFormContext/index.d.ts +1 -1
- package/components/hook-form/RHFormContext/index.js +29 -4
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
- package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
- package/components/mui_extended/index.d.ts +1 -1
- package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
- package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
- package/components/popups/components/PopupsViewer/PopupsViewer.js +2 -2
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +3 -1
- package/components/popups/components/PopupsViewer/types.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/useSizeContainer/index.d.ts +2 -1
- package/hooks/useSizeContainer/index.js +22 -13
- package/hooks/useSizeContainer/types.d.ts +6 -0
- package/hooks/useStateRef/index.js +4 -4
- package/index.js +45 -38
- package/package.json +1 -1
- package/utils/deepShallow.d.ts +17 -0
- package/utils/deepShallow.js +76 -0
- package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
- package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
- package/utils/formatDistanceToNow/types.d.ts +13 -0
- package/utils/index.d.ts +1 -0
|
@@ -22,7 +22,8 @@ function RHFAutocompleteAsync(props) {
|
|
|
22
22
|
multiple,
|
|
23
23
|
disabled,
|
|
24
24
|
skeletonWidth,
|
|
25
|
-
responseToCamelCase
|
|
25
|
+
responseToCamelCase,
|
|
26
|
+
className
|
|
26
27
|
} = props;
|
|
27
28
|
const [state, dispatch] = useReducer(
|
|
28
29
|
RHFAutocompleteAsyncReducer(onChangeFilterParms),
|
|
@@ -74,6 +75,7 @@ function RHFAutocompleteAsync(props) {
|
|
|
74
75
|
return /* @__PURE__ */ jsx(
|
|
75
76
|
RHFAutocomplete,
|
|
76
77
|
{
|
|
78
|
+
className,
|
|
77
79
|
name,
|
|
78
80
|
loading: state.loading,
|
|
79
81
|
label,
|
|
@@ -41,6 +41,10 @@ export interface RHFAutocompleteAsyncProps<T extends any = unknown> extends Omit
|
|
|
41
41
|
* Whether the autocomplete is multiple
|
|
42
42
|
*/
|
|
43
43
|
multiple?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Class name for the autocomplete
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Defines the types of Slots available for the Autocomplete.
|
|
@@ -3,7 +3,7 @@ import { CustomFormArguments, FormProviderCustomProps, FormProviderProps } from
|
|
|
3
3
|
/**
|
|
4
4
|
* TODO: Documentar
|
|
5
5
|
*/
|
|
6
|
-
export declare function useCustomForm({ validationSchema, values, statusLoad, mode }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any,
|
|
6
|
+
export declare function useCustomForm({ validationSchema, values, statusLoad, mode, }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, undefined>;
|
|
7
7
|
/**
|
|
8
8
|
* TODO: Documentar
|
|
9
9
|
*/
|
|
@@ -6,7 +6,12 @@ import { yupResolver } from "@hookform/resolvers/yup";
|
|
|
6
6
|
import { F as FormProviderRoot } from "./styles.js";
|
|
7
7
|
import { R as RHFormProviderUtilityClasses } from "./classes/index.js";
|
|
8
8
|
const classes = RHFormProviderUtilityClasses();
|
|
9
|
-
function useCustomForm({
|
|
9
|
+
function useCustomForm({
|
|
10
|
+
validationSchema,
|
|
11
|
+
values,
|
|
12
|
+
statusLoad,
|
|
13
|
+
mode
|
|
14
|
+
}) {
|
|
10
15
|
const formMethods = useForm({
|
|
11
16
|
resolver: yupResolver(validationSchema),
|
|
12
17
|
defaultValues: values,
|
|
@@ -39,11 +44,31 @@ function useCustomForm({ validationSchema, values, statusLoad, mode }) {
|
|
|
39
44
|
}
|
|
40
45
|
function FormProviderCustom(props) {
|
|
41
46
|
const { children, onSubmit, className, handleSubmit } = props;
|
|
42
|
-
return /* @__PURE__ */ jsx(FormProvider, { ...props, children: /* @__PURE__ */ jsx(
|
|
47
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...props, children: /* @__PURE__ */ jsx(
|
|
48
|
+
FormProviderRoot,
|
|
49
|
+
{
|
|
50
|
+
className: clsx(classes.root, className),
|
|
51
|
+
onSubmit: handleSubmit(onSubmit),
|
|
52
|
+
children
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
43
55
|
}
|
|
44
56
|
function RHFormProvider(props) {
|
|
45
|
-
const {
|
|
46
|
-
|
|
57
|
+
const {
|
|
58
|
+
children,
|
|
59
|
+
onSubmit,
|
|
60
|
+
values,
|
|
61
|
+
validationSchema,
|
|
62
|
+
statusLoad = "ready",
|
|
63
|
+
className,
|
|
64
|
+
mode
|
|
65
|
+
} = props;
|
|
66
|
+
const formMethods = useCustomForm({
|
|
67
|
+
validationSchema,
|
|
68
|
+
statusLoad,
|
|
69
|
+
values,
|
|
70
|
+
mode
|
|
71
|
+
});
|
|
47
72
|
return /* @__PURE__ */ jsx(
|
|
48
73
|
FormProviderCustom,
|
|
49
74
|
{
|
|
@@ -14,20 +14,24 @@ const ToggleAbleIconButton = ({
|
|
|
14
14
|
variant = "text",
|
|
15
15
|
color,
|
|
16
16
|
badgeProps,
|
|
17
|
+
disabled,
|
|
18
|
+
className,
|
|
17
19
|
...props
|
|
18
20
|
}) => {
|
|
19
21
|
const ownerState = {
|
|
20
22
|
isToggled,
|
|
21
|
-
variant
|
|
23
|
+
variant,
|
|
24
|
+
disabled
|
|
22
25
|
};
|
|
23
26
|
return /* @__PURE__ */ jsx(
|
|
24
27
|
ToggleIconButtonRootStyled,
|
|
25
28
|
{
|
|
26
29
|
...props,
|
|
27
30
|
variant,
|
|
31
|
+
disabled,
|
|
28
32
|
color,
|
|
29
33
|
badgeProps,
|
|
30
|
-
className: clsx(getComponentSlotRoot(TOGGLE_ICON_BUTTON_KEY_COMPONENT), TOGGLE_ICON_BUTTON_CLASS_NAME_SPECIFY),
|
|
34
|
+
className: clsx(className, getComponentSlotRoot(TOGGLE_ICON_BUTTON_KEY_COMPONENT), TOGGLE_ICON_BUTTON_CLASS_NAME_SPECIFY),
|
|
31
35
|
...getPropDataTestId(TOGGLE_ICON_BUTTON_KEY_COMPONENT, ToggleIconButtonSlots.toggleIconButtonRoot, dataTestId),
|
|
32
36
|
role: "toggle-iconButton",
|
|
33
37
|
ownerState,
|
|
@@ -24,6 +24,15 @@ const toggleIconButtonStyles = {
|
|
|
24
24
|
},
|
|
25
25
|
"&:focus-visible": {
|
|
26
26
|
backgroundColor: theme.vars.palette.primary.enabledOpacity
|
|
27
|
+
},
|
|
28
|
+
...ownerState?.disabled && {
|
|
29
|
+
backgroundColor: theme.vars.palette.default.opacity,
|
|
30
|
+
"& .M4LIcon-root .M4LIcon-icon": {
|
|
31
|
+
backgroundColor: `${theme.vars.palette.text.disabled} !important`
|
|
32
|
+
},
|
|
33
|
+
...ownerState?.variant === "outline" && {
|
|
34
|
+
backgroundColor: theme.vars.palette.border.disabled
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
}
|
|
@@ -22,6 +22,7 @@ export interface ToggleIconButtonProps extends Omit<IconButtonProps, 'onClick' |
|
|
|
22
22
|
* Estado del propietario del componente ToggleIconButton.
|
|
23
23
|
*/
|
|
24
24
|
export interface ToggleIconButtonOwnerState extends Record<string, unknown> {
|
|
25
|
+
disabled?: boolean;
|
|
25
26
|
/** Indica si el valor es verdadero o falso. */
|
|
26
27
|
isToggled?: boolean;
|
|
27
28
|
/** Valor de la variante del componente. */
|
|
@@ -23,7 +23,7 @@ export * from './Tabs';
|
|
|
23
23
|
export * from './TabContent';
|
|
24
24
|
export * from './TabContext';
|
|
25
25
|
export { getPagerComponentsDictionary } from '../Pager/dicctionary';
|
|
26
|
-
export * from './Typography
|
|
26
|
+
export * from './Typography';
|
|
27
27
|
export * from './ToggleButton';
|
|
28
28
|
export * from './ToggleIconButton';
|
|
29
29
|
export * from './NavLink';
|
|
@@ -17,7 +17,7 @@ export declare const usePopups: (popupId: string) => {
|
|
|
17
17
|
iconUrl: string;
|
|
18
18
|
selected: boolean;
|
|
19
19
|
mfProps: import('../../../../MFLoader/types').MFBaseProps | undefined;
|
|
20
|
-
component: import('../../../../WindowBase
|
|
20
|
+
component: import('../../../../WindowBase').JSX_REACT_NODE;
|
|
21
21
|
loading: boolean | undefined;
|
|
22
22
|
status: import('../../PopupsViewer/types').PopupStatus;
|
|
23
23
|
version: string | undefined;
|
|
@@ -32,7 +32,7 @@ export declare const usePopups: (popupId: string) => {
|
|
|
32
32
|
variant: import('../contexts/PopupsContext/types').PopupVariantType;
|
|
33
33
|
draggable: boolean;
|
|
34
34
|
resizable: boolean;
|
|
35
|
-
defaultPosition: import('
|
|
35
|
+
defaultPosition: import('../../../..').RNDDefaultPosition | undefined;
|
|
36
36
|
bounds: import('../../../../DragResizeWindowRND/types').DraggableWindowBounds | undefined;
|
|
37
37
|
onMouseDown: ((e: MouseEvent) => void) | undefined;
|
|
38
38
|
allowHeightResizeContainer: boolean | undefined;
|
|
@@ -7,7 +7,7 @@ import { u as useSizeContainer } from "../../../../hooks/useSizeContainer/index.
|
|
|
7
7
|
import { R as RootStyled } from "./slots/popupsViewerSlots.js";
|
|
8
8
|
import { useRef, createRef, useEffect, memo } from "react";
|
|
9
9
|
const PopupsViewer = (props) => {
|
|
10
|
-
const { groupId = "global", onResizeStart, onResizeStop, onDragStart, onDragStop, containerElement } = props;
|
|
10
|
+
const { groupId = "global", onResizeStart, onResizeStop, onDragStart, onDragStop, containerElement, className } = props;
|
|
11
11
|
const popupsIds = usePopupsStore(
|
|
12
12
|
(state) => state.popupsIds.filter((pId) => groupId === state.hashPopups[pId].groupId && state.hashPopups[pId].status !== "closing"),
|
|
13
13
|
shallow
|
|
@@ -29,7 +29,7 @@ const PopupsViewer = (props) => {
|
|
|
29
29
|
if (!containerElement || !containerSize) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
-
return /* @__PURE__ */ jsx(RootStyled, { ownerState: { baseZindex }, children: /* @__PURE__ */ jsx(TransitionGroup, { children: popupsIds.map((id) => {
|
|
32
|
+
return /* @__PURE__ */ jsx(RootStyled, { ownerState: { baseZindex }, className, children: /* @__PURE__ */ jsx(TransitionGroup, { children: popupsIds.map((id) => {
|
|
33
33
|
return /* @__PURE__ */ jsx(
|
|
34
34
|
CSSTransition,
|
|
35
35
|
{
|
|
@@ -118,7 +118,7 @@ const Popup = forwardRef((props, ref) => {
|
|
|
118
118
|
isLoading: loading,
|
|
119
119
|
windowId: popupId,
|
|
120
120
|
selected,
|
|
121
|
-
|
|
121
|
+
emergeType: "popup",
|
|
122
122
|
variant: "outlined",
|
|
123
123
|
...process.env.NODE_ENV !== "production" ? {
|
|
124
124
|
[TEST_PROP_ID]: getNameDataTestId(
|
|
@@ -129,6 +129,7 @@ const Popup = forwardRef((props, ref) => {
|
|
|
129
129
|
children: winType === "microfrontend" ? /* @__PURE__ */ jsx(
|
|
130
130
|
MemonizedWindowBaseMicroFrontend,
|
|
131
131
|
{
|
|
132
|
+
emergeType: "popup",
|
|
132
133
|
moduleId,
|
|
133
134
|
dynamicMFStore,
|
|
134
135
|
windowTools,
|
|
@@ -137,6 +138,7 @@ const Popup = forwardRef((props, ref) => {
|
|
|
137
138
|
) : /* @__PURE__ */ jsx(
|
|
138
139
|
WindowBaseComponent,
|
|
139
140
|
{
|
|
141
|
+
emergeType: "popup",
|
|
140
142
|
dynamicMFStore,
|
|
141
143
|
windowTools,
|
|
142
144
|
component
|
|
@@ -5,6 +5,7 @@ import { PopupStoreProps, PopupsProviderStoreState } from '../PopupsProvider/con
|
|
|
5
5
|
import { M4LOverridesStyleRules } from '../../../../@types/augmentations';
|
|
6
6
|
export type PopupViewerSlotsType = keyof typeof PopupViewerSlots;
|
|
7
7
|
export type PopupsViewerProps = {
|
|
8
|
+
className?: string;
|
|
8
9
|
containerElement?: HTMLElement;
|
|
9
10
|
groupId?: string;
|
|
10
11
|
onResizeStart?: () => void;
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ContainerSize } from '../../utils/types';
|
|
2
|
+
import { UseSizeContainerOptions } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* useSizeContainer: hook encargado de obtener el tamaño de un elemento contenedor
|
|
4
5
|
* TODO: Usar throttle para evitar llamadas innecesarias
|
|
5
6
|
* @param containerElement
|
|
6
7
|
* @returns un objeto con el ancho y alto del contenedor
|
|
7
8
|
*/
|
|
8
|
-
export declare function useSizeContainer(containerElement?: HTMLElement | undefined | null): ContainerSize | undefined;
|
|
9
|
+
export declare function useSizeContainer(containerElement?: HTMLElement | undefined | null, options?: UseSizeContainerOptions): ContainerSize | undefined;
|
|
@@ -1,35 +1,44 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { T as THROTTLE_RESIZE_TIMEOUT } from "./contants.js";
|
|
3
3
|
import throttle from "lodash-es/throttle";
|
|
4
|
-
function useSizeContainer(containerElement) {
|
|
5
|
-
const
|
|
4
|
+
function useSizeContainer(containerElement, options) {
|
|
5
|
+
const { throttleTime = THROTTLE_RESIZE_TIMEOUT, excludePadding = false, leading = false, trailing = true } = options || {};
|
|
6
|
+
const [currentState, setCurrentState] = useState(void 0);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
if (!containerElement) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const setter = (size) => {
|
|
12
|
+
setCurrentState(size);
|
|
13
|
+
};
|
|
14
|
+
const throttleResize = throttle(setter, throttleTime, {
|
|
15
|
+
leading,
|
|
16
|
+
// Evento de resizing (Por defecto false)
|
|
17
|
+
trailing
|
|
14
18
|
// Incluir siempre el ultimo evento en la cola, para que no quede se quedee a la mitad de resizing
|
|
15
19
|
});
|
|
16
20
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
17
|
-
|
|
21
|
+
if (excludePadding) {
|
|
18
22
|
throttleResize({
|
|
19
|
-
containerWidth: Math.round(
|
|
20
|
-
containerHeight: Math.round(
|
|
23
|
+
containerWidth: Math.round(containerElement.clientWidth),
|
|
24
|
+
containerHeight: Math.round(containerElement.clientHeight)
|
|
21
25
|
});
|
|
26
|
+
} else {
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
throttleResize({
|
|
29
|
+
containerWidth: Math.round(entry.contentRect.width),
|
|
30
|
+
containerHeight: Math.round(entry.contentRect.height)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
22
33
|
}
|
|
23
34
|
});
|
|
24
|
-
|
|
25
|
-
resizeObserver.observe(containerElement);
|
|
26
|
-
}
|
|
35
|
+
resizeObserver.observe(containerElement);
|
|
27
36
|
return () => {
|
|
28
37
|
if (containerElement) {
|
|
29
38
|
resizeObserver.unobserve(containerElement);
|
|
30
39
|
}
|
|
31
40
|
};
|
|
32
|
-
}, [containerElement]);
|
|
41
|
+
}, [containerElement, excludePadding, leading, throttleTime, trailing]);
|
|
33
42
|
return currentState;
|
|
34
43
|
}
|
|
35
44
|
export {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useState, useRef } from "react";
|
|
1
|
+
import { useState, useRef, useCallback } from "react";
|
|
2
2
|
function useStateRef(initialValue) {
|
|
3
3
|
const [refState, setRefState] = useState(initialValue);
|
|
4
4
|
const nodeRef = useRef(null);
|
|
5
|
-
const ref = (nodeElement) => {
|
|
6
|
-
if (nodeRef.current !== nodeElement) {
|
|
5
|
+
const ref = useCallback((nodeElement) => {
|
|
6
|
+
if (nodeElement && nodeRef.current !== nodeElement) {
|
|
7
7
|
nodeRef.current = nodeElement;
|
|
8
8
|
setRefState(nodeElement);
|
|
9
9
|
}
|
|
10
|
-
};
|
|
10
|
+
}, []);
|
|
11
11
|
return [refState, ref];
|
|
12
12
|
}
|
|
13
13
|
export {
|
package/index.js
CHANGED
|
@@ -122,6 +122,7 @@ import { P as P5, g as g16 } from "./components/formatters/PriceFormatter/PriceF
|
|
|
122
122
|
import { C as C18 } from "./components/formatters/ChipStatusFormatter/ChipStatusFormatter.js";
|
|
123
123
|
import { g as g17 } from "./components/formatters/DistanceToNowFormatter/dictionary.js";
|
|
124
124
|
import { D as D9 } from "./components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js";
|
|
125
|
+
import { u as u13 } from "./components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js";
|
|
125
126
|
import { g as g18 } from "./components/formatters/dictionary.js";
|
|
126
127
|
import { F as F2 } from "./components/FormContainer/FormContainer.js";
|
|
127
128
|
import { G } from "./components/GridLayout/GridLayout.js";
|
|
@@ -175,7 +176,7 @@ import { g as g27 } from "./components/ObjectLogs/dictionary.js";
|
|
|
175
176
|
import { O } from "./components/ObjectLogs/ObjectLogs.js";
|
|
176
177
|
import { P as P7 } from "./components/PaperForm/PaperForm.js";
|
|
177
178
|
import { P as P8 } from "./components/PDFViewer/PDFViewer.js";
|
|
178
|
-
import { u as
|
|
179
|
+
import { u as u14 } from "./components/popups/components/PopupsProvider/hooks/usePopupsStore.js";
|
|
179
180
|
import { a as a10, P as P9 } from "./components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.js";
|
|
180
181
|
import { P as P10 } from "./components/popups/components/PopupsViewer/PopupsViewer.js";
|
|
181
182
|
import { P as P11 } from "./components/PrintingSystem/PrintingSystem.js";
|
|
@@ -185,8 +186,8 @@ import { S as S9 } from "./components/SideBar/SideBar.js";
|
|
|
185
186
|
import { T as T17 } from "./components/ToastContainer/ToastContainer.js";
|
|
186
187
|
import { T as T18 } from "./components/ToastContainer/subcomponents/ToastMessage/ToastMessage.js";
|
|
187
188
|
import { W as W2 } from "./components/WindowBase/WindowBase.js";
|
|
188
|
-
import { u as
|
|
189
|
-
import { u as
|
|
189
|
+
import { u as u15 } from "./components/WindowBase/hooks/useWindowToolsMF/index.js";
|
|
190
|
+
import { u as u16, a as a11 } from "./components/WindowBase/hooks/useDynamicMFParameters/index.js";
|
|
190
191
|
import { M as M6, W as W3, a as a12 } from "./components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js";
|
|
191
192
|
import { c as c3 } from "./components/WindowBase/contexts/DynamicMFParmsContext/store.js";
|
|
192
193
|
import { D as D10, a as a13, M as M7 } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
|
|
@@ -195,7 +196,7 @@ import { a as a14, g as g28 } from "./components/ModalDialog/dictionary.js";
|
|
|
195
196
|
import { M as M8 } from "./components/ModalDialog/ModalDialog.js";
|
|
196
197
|
import { S as S10 } from "./components/SettingsLayout/SettingsLayout.js";
|
|
197
198
|
import { P as P13 } from "./components/Pager/Pager.js";
|
|
198
|
-
import { u as
|
|
199
|
+
import { u as u17 } from "./components/Stepper/hooks/useStepper/index.js";
|
|
199
200
|
import { S as S11 } from "./components/Stepper/Stepper.js";
|
|
200
201
|
import { S as S12 } from "./components/Stepper/subcomponents/StepperContent/index.js";
|
|
201
202
|
import { S as S13 } from "./components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js";
|
|
@@ -208,26 +209,27 @@ import { S as S19 } from "./components/Stepper/subcomponents/StepperButtons/Step
|
|
|
208
209
|
import { S as S20 } from "./components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js";
|
|
209
210
|
import { e as e3 } from "./components/Stepper/helpers/evaluateVisibilityStepCondition/index.js";
|
|
210
211
|
import { g as g29 } from "./components/Stepper/dictionary.js";
|
|
211
|
-
import { F as F3, R as R23, u as
|
|
212
|
+
import { F as F3, R as R23, u as u18 } from "./components/hook-form/RHFormContext/index.js";
|
|
212
213
|
import { g as g30 } from "./components/hook-form/RHFormContext/dictionary.js";
|
|
213
|
-
import { u as
|
|
214
|
+
import { u as u19 } from "./contexts/AppearanceComponentContext/useAppearanceComponentStore.js";
|
|
214
215
|
import { A as A16 } from "./contexts/AppearanceComponentContext/AppearanceComponentContext.js";
|
|
215
216
|
import { a as a15, M as M9 } from "./contexts/ModalContext/index.js";
|
|
216
|
-
import { u as
|
|
217
|
-
import { u as
|
|
218
|
-
import { u as
|
|
217
|
+
import { u as u20 } from "./hooks/useFormAddEdit/index.js";
|
|
218
|
+
import { u as u21 } from "./hooks/useModal/index.js";
|
|
219
|
+
import { u as u22 } from "./hooks/useTab/index.js";
|
|
219
220
|
import { g as g31 } from "./hooks/useFormAddEdit/dictionary.js";
|
|
220
|
-
import { u as
|
|
221
|
-
import { u as
|
|
222
|
-
import { u as
|
|
223
|
-
import { u as
|
|
224
|
-
import { u as
|
|
221
|
+
import { u as u23 } from "./hooks/useFormFocus/index.js";
|
|
222
|
+
import { u as u24 } from "./hooks/useInterval/index.js";
|
|
223
|
+
import { u as u25 } from "./hooks/useComponentSize/useComponentSize.js";
|
|
224
|
+
import { u as u26 } from "./hooks/useFormReadyForUpdate/index.js";
|
|
225
|
+
import { u as u27 } from "./hooks/useStateRef/index.js";
|
|
225
226
|
import { S as S21 } from "./hooks/useSvgColor/constants.js";
|
|
226
|
-
import { u as
|
|
227
|
-
import { u as
|
|
228
|
-
import { u as
|
|
229
|
-
import { u as
|
|
230
|
-
import { u as
|
|
227
|
+
import { u as u28 } from "./hooks/useSvgColor/useSvgColor.js";
|
|
228
|
+
import { u as u29 } from "./hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js";
|
|
229
|
+
import { u as u30 } from "./hooks/useDataGridPersistence/useDataGridPersistence.js";
|
|
230
|
+
import { u as u31 } from "./hooks/usePopoverContainer/usePopoverContainer.js";
|
|
231
|
+
import { u as u32 } from "./hooks/useIsVisible/useIsVisible.js";
|
|
232
|
+
import { u as u33 } from "./hooks/useSizeContainer/index.js";
|
|
231
233
|
import { c as c4 } from "./utils/capitalizeFirstLetter.js";
|
|
232
234
|
import { i as i2 } from "./utils/isValidDate.js";
|
|
233
235
|
import { g as g32 } from "./utils/getComponentUtilityClass.js";
|
|
@@ -240,6 +242,7 @@ import { g as g37, a as a17 } from "./utils/getComponentSlotRoot.js";
|
|
|
240
242
|
import { f } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
241
243
|
import { g as g38 } from "./utils/getValidDate.js";
|
|
242
244
|
import { g as g39 } from "./utils/getNullGuard.js";
|
|
245
|
+
import { c as c5, d as d4 } from "./utils/deepShallow.js";
|
|
243
246
|
import { g as g40 } from "./helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.js";
|
|
244
247
|
export {
|
|
245
248
|
A7 as AREAS_DICCTIONARY,
|
|
@@ -428,8 +431,10 @@ export {
|
|
|
428
431
|
e2 as addLayoutItemToBreakPoints,
|
|
429
432
|
c4 as capitalizeFirstLetter,
|
|
430
433
|
d3 as cloneLayouts,
|
|
434
|
+
c5 as createCustomDeepShallow,
|
|
431
435
|
c3 as createDynamicMFStore,
|
|
432
436
|
c as createToaster,
|
|
437
|
+
d4 as deepShallow,
|
|
433
438
|
d as defaultCommonActionsDictionary,
|
|
434
439
|
d2 as dragResizeWindowRNDClasses,
|
|
435
440
|
e3 as evaluateVisibilityStepCondition,
|
|
@@ -486,7 +491,7 @@ export {
|
|
|
486
491
|
r as rhfPeriodStyles,
|
|
487
492
|
t as toggleButtonStyles,
|
|
488
493
|
t2 as toggleIconButtonStyles,
|
|
489
|
-
|
|
494
|
+
u19 as useAppearanceComponentStore,
|
|
490
495
|
u as useAreasStore,
|
|
491
496
|
u2 as useColumnBoolean,
|
|
492
497
|
u11 as useColumnChipStatus,
|
|
@@ -498,26 +503,28 @@ export {
|
|
|
498
503
|
u8 as useColumnPrice,
|
|
499
504
|
u9 as useColumnSetCheck,
|
|
500
505
|
u10 as useColumnUncertanity,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
+
u25 as useComponentSize,
|
|
507
|
+
u18 as useCustomForm,
|
|
508
|
+
u30 as useDataGridPersistence,
|
|
509
|
+
u13 as useDistanceToNowFormatter,
|
|
510
|
+
u29 as useDynamicFilterAndSort,
|
|
511
|
+
u16 as useDynamicMFParameters,
|
|
506
512
|
a11 as useDynamicMFParametersStore,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
513
|
+
u20 as useFormAddEdit,
|
|
514
|
+
u23 as useFormFocus,
|
|
515
|
+
u26 as useFormReadyForUpdate,
|
|
510
516
|
u12 as useFormatPeriod,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
517
|
+
u24 as useInterval,
|
|
518
|
+
u32 as useIsVisible,
|
|
519
|
+
u21 as useModal,
|
|
520
|
+
u31 as usePopoverContainer,
|
|
521
|
+
u14 as usePopupsStore,
|
|
522
|
+
u33 as useSizeContainer,
|
|
523
|
+
u27 as useStateRef,
|
|
524
|
+
u17 as useStepper,
|
|
525
|
+
u28 as useSvgColor,
|
|
526
|
+
u22 as useTab,
|
|
527
|
+
u15 as useWindowToolsMF,
|
|
521
528
|
v2 as varBounce,
|
|
522
529
|
v3 as varContainer,
|
|
523
530
|
v as varFade,
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type DeepShallowOptions = {
|
|
2
|
+
maxDepth?: number;
|
|
3
|
+
ignoreTypes?: Array<string>;
|
|
4
|
+
compareArrays?: boolean;
|
|
5
|
+
compareObjects?: boolean;
|
|
6
|
+
customComparers?: Record<string, (a: any, b: any) => boolean>;
|
|
7
|
+
log?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Comparador con profundidad
|
|
11
|
+
*/
|
|
12
|
+
export declare const deepShallow: <T>(objA: T, objB: T, depth?: number, options?: DeepShallowOptions) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Crea una función de comparación profunda con opciones personalizadas
|
|
15
|
+
*/
|
|
16
|
+
export declare const createCustomDeepShallow: <T>(options?: DeepShallowOptions) => (objA: T, objB: T, depth?: number) => boolean;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const deepShallow = (objA, objB, depth = 0, options) => {
|
|
2
|
+
const {
|
|
3
|
+
maxDepth = 10,
|
|
4
|
+
ignoreTypes = ["function"],
|
|
5
|
+
compareArrays = true,
|
|
6
|
+
compareObjects = true,
|
|
7
|
+
customComparers = {},
|
|
8
|
+
log = false
|
|
9
|
+
} = options || {};
|
|
10
|
+
if (log && process.env.NODE_ENV === "development" && depth === 0) {
|
|
11
|
+
console.log("deepShallow**", objA, objB, depth);
|
|
12
|
+
}
|
|
13
|
+
if (depth >= maxDepth) {
|
|
14
|
+
return Object.is(objA, objB);
|
|
15
|
+
}
|
|
16
|
+
if (objA === objB) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (objA == null || objB == null) {
|
|
20
|
+
return objA === objB;
|
|
21
|
+
}
|
|
22
|
+
if (typeof objA !== "object" || typeof objB !== "object") {
|
|
23
|
+
return objA === objB;
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(objA) && Array.isArray(objB)) {
|
|
26
|
+
if (!compareArrays) {
|
|
27
|
+
return Object.is(objA, objB);
|
|
28
|
+
}
|
|
29
|
+
if (objA.length !== objB.length) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
for (let i = 0; i < objA.length; i++) {
|
|
33
|
+
if (!deepShallow(objA[i], objB[i], depth + 1, options)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(objA) || Array.isArray(objB)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (!compareObjects) {
|
|
43
|
+
return Object.is(objA, objB);
|
|
44
|
+
}
|
|
45
|
+
const keysA = Object.keys(objA);
|
|
46
|
+
const keysB = Object.keys(objB);
|
|
47
|
+
if (keysA.length !== keysB.length) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
51
|
+
const key = keysA[i];
|
|
52
|
+
const valueA = objA[key];
|
|
53
|
+
const valueB = objB[key];
|
|
54
|
+
if (ignoreTypes.includes(typeof valueA)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const valueType = typeof valueA;
|
|
58
|
+
if (customComparers[valueType]) {
|
|
59
|
+
if (!customComparers[valueType](valueA, valueB)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (!deepShallow(valueA, valueB, depth + 1, options)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
};
|
|
70
|
+
const createCustomDeepShallow = (options) => {
|
|
71
|
+
return (objA, objB, depth = 0) => deepShallow(objA, objB, depth, options);
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
createCustomDeepShallow as c,
|
|
75
|
+
deepShallow as d
|
|
76
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PresentationTimeType, FormatDistanteToNowDictionary } from './types';
|
|
1
|
+
import { PresentationTimeType, FormatDistanteToNowDictionary, FormatDistanceToNowReturn } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* TODO: Documentar
|
|
4
4
|
*/
|
|
5
|
-
export declare const formatDistanceToNow: (type: PresentationTimeType, date: Date, dictionary: FormatDistanteToNowDictionary) =>
|
|
5
|
+
export declare const formatDistanceToNow: (type: PresentationTimeType, date: Date, dictionary: FormatDistanteToNowDictionary) => FormatDistanceToNowReturn;
|