@m4l/components 9.3.20 → 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/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/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
|
@@ -148,7 +148,7 @@ export type AreaLayoutStateProps = AreaLayoutProps & WindowState;
|
|
|
148
148
|
export type EmmitNewLayoutProps = Omit<AreaLayoutMFProps, 'windowId' | 'onClose' | 'areaId'> | Omit<AreaLayoutComponentProps, 'windowId' | 'onClose' | 'areaId'> & {
|
|
149
149
|
winType: string;
|
|
150
150
|
emergeType: string;
|
|
151
|
-
layoutProps:
|
|
151
|
+
layoutProps: Omit<LayoutItem, 'i'>;
|
|
152
152
|
moduleId: string;
|
|
153
153
|
dynamicParams: Record<string, any>;
|
|
154
154
|
iconUrl: string;
|
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
5
4
|
import { R as RootStyled } from "./slots/DistanceToNowFormatterSlots.js";
|
|
6
|
-
import { u as useInterval } from "../../../hooks/useInterval/index.js";
|
|
7
|
-
import { D as DTNF_DICCTIONARY } from "./dictionary.js";
|
|
8
5
|
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
9
6
|
import { C as COMPONET_KEY_COMPONENT } from "./constants.js";
|
|
10
7
|
import { D as DistanceToNowFormatterSlots } from "./slots/slots.js";
|
|
11
|
-
import {
|
|
8
|
+
import { u as useDistanceToNowFormatter } from "./hooks/useDistanceToNowFormatter.js";
|
|
12
9
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
13
10
|
function DistanceToNowFormatter(props) {
|
|
14
11
|
const { presentationTime = "present", date, dataTestId, delay, className, Component = RootStyled, componentProps } = props;
|
|
15
|
-
const {
|
|
16
|
-
const dictionary = useMemo(() => {
|
|
17
|
-
const ret = {
|
|
18
|
-
label_sentence_past_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_SECONDS),
|
|
19
|
-
label_sentence_past_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_OTHERS),
|
|
20
|
-
label_sentence_present_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_SECONDS),
|
|
21
|
-
label_sentence_present_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_OTHERS),
|
|
22
|
-
label_sentence_future_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_SECONDS),
|
|
23
|
-
label_sentence_future_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_OTHERS),
|
|
24
|
-
label_unit_time_second: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECOND),
|
|
25
|
-
label_unit_time_seconds: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS),
|
|
26
|
-
label_unit_time_minute: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTE),
|
|
27
|
-
label_unit_time_minutes: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES),
|
|
28
|
-
label_unit_time_hour: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOUR),
|
|
29
|
-
label_unit_time_hours: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS),
|
|
30
|
-
label_unit_time_day: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAY),
|
|
31
|
-
label_unit_time_days: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS),
|
|
32
|
-
label_unit_time_month: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTH),
|
|
33
|
-
label_unit_time_months: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS),
|
|
34
|
-
label_unit_time_year: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEAR),
|
|
35
|
-
label_unit_time_years: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS)
|
|
36
|
-
};
|
|
37
|
-
return ret;
|
|
38
|
-
}, [getLabel]);
|
|
39
|
-
const [time, setTime] = useState(formatDistanceToNow(presentationTime, date, dictionary));
|
|
40
|
-
const updateTime = useCallback(() => {
|
|
41
|
-
setTime(formatDistanceToNow(presentationTime, date, dictionary));
|
|
42
|
-
}, [date, dictionary, presentationTime]);
|
|
43
|
-
useInterval(updateTime, delay);
|
|
12
|
+
const { time } = useDistanceToNowFormatter({ presentationTime, date, delay });
|
|
44
13
|
if (Component === React.Fragment) {
|
|
45
14
|
return time;
|
|
46
15
|
}
|
|
@@ -19,4 +19,12 @@ export declare const DTNF_DICCTIONARY: {
|
|
|
19
19
|
readonly LABEL_UNIT_TIME_MONTHS: "distance_to_now_formmater.label_unit_time_months";
|
|
20
20
|
readonly LABEL_UNIT_TIME_YEAR: "distance_to_now_formmater.label_unit_time_year";
|
|
21
21
|
readonly LABEL_UNIT_TIME_YEARS: "distance_to_now_formmater.label_unit_time_years";
|
|
22
|
+
readonly LABEL_UNIT_TIME_SECONDS_SHORT: "distance_to_now_formmater.label_unit_time_seconds_short";
|
|
23
|
+
readonly LABEL_UNIT_TIME_MINUTES_SHORT: "distance_to_now_formmater.label_unit_time_minutes_short";
|
|
24
|
+
readonly LABEL_UNIT_TIME_HOURS_SHORT: "distance_to_now_formmater.label_unit_time_hours_short";
|
|
25
|
+
readonly LABEL_UNIT_TIME_DAYS_SHORT: "distance_to_now_formmater.label_unit_time_days_short";
|
|
26
|
+
readonly LABEL_UNIT_TIME_MONTHS_SHORT: "distance_to_now_formmater.label_unit_time_months_short";
|
|
27
|
+
readonly LABEL_UNIT_TIME_YEARS_SHORT: "distance_to_now_formmater.label_unit_time_years_short";
|
|
28
|
+
readonly LABEL_SEPARATOR_TIME: "distance_to_now_formmater.label_separator_time";
|
|
29
|
+
readonly LABEL_SEPARATOR_DATE: "distance_to_now_formmater.label_separator_date";
|
|
22
30
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DistanceToNowFormatterProps } from '../types';
|
|
3
|
+
import { FormatDistanceToNowReturn } from '../../../../utils/formatDistanceToNow/types';
|
|
4
|
+
/**
|
|
5
|
+
* "useDistanceToNowFormatter" que se encarga de retornar el tiempo transcurrido desde una fecha hasta la fecha actual.
|
|
6
|
+
* Actualizando cada delay configurable a través de props
|
|
7
|
+
* Tiene 3 tipos de presentaciones:
|
|
8
|
+
* En tiempo pasado
|
|
9
|
+
* En tiempo presente
|
|
10
|
+
* En tiempo futuro
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare function useDistanceToNowFormatter<T extends React.ElementType>(props: DistanceToNowFormatterProps<T>): FormatDistanceToNowReturn;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useMemo, useState, useRef, useCallback, useEffect } from "react";
|
|
2
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
3
|
+
import { u as useInterval } from "../../../../hooks/useInterval/index.js";
|
|
4
|
+
import { D as DTNF_DICCTIONARY } from "../dictionary.js";
|
|
5
|
+
import { f as formatDistanceToNow } from "../../../../utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
6
|
+
function useDistanceToNowFormatter(props) {
|
|
7
|
+
const { presentationTime = "present", date, delay } = props;
|
|
8
|
+
const { getLabel } = useModuleDictionary();
|
|
9
|
+
const dictionary = useMemo(() => {
|
|
10
|
+
const ret = {
|
|
11
|
+
label_sentence_past_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_SECONDS),
|
|
12
|
+
label_sentence_past_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_OTHERS),
|
|
13
|
+
label_sentence_present_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_SECONDS),
|
|
14
|
+
label_sentence_present_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_OTHERS),
|
|
15
|
+
label_sentence_future_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_SECONDS),
|
|
16
|
+
label_sentence_future_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_OTHERS),
|
|
17
|
+
label_unit_time_second: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECOND),
|
|
18
|
+
label_unit_time_seconds: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS),
|
|
19
|
+
label_unit_time_minute: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTE),
|
|
20
|
+
label_unit_time_minutes: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES),
|
|
21
|
+
label_unit_time_hour: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOUR),
|
|
22
|
+
label_unit_time_hours: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS),
|
|
23
|
+
label_unit_time_day: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAY),
|
|
24
|
+
label_unit_time_days: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS),
|
|
25
|
+
label_unit_time_month: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTH),
|
|
26
|
+
label_unit_time_months: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS),
|
|
27
|
+
label_unit_time_year: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEAR),
|
|
28
|
+
label_unit_time_years: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS),
|
|
29
|
+
label_unit_time_seconds_short: "ss",
|
|
30
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS_SHORT),
|
|
31
|
+
label_unit_time_minutes_short: "mm",
|
|
32
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES_SHORT),
|
|
33
|
+
label_unit_time_hours_short: "hh",
|
|
34
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS_SHORT),
|
|
35
|
+
label_unit_time_days_short: "DD",
|
|
36
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS_SHORT),
|
|
37
|
+
label_unit_time_months_short: "MM",
|
|
38
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS_SHORT),
|
|
39
|
+
label_unit_time_years_short: "YY",
|
|
40
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS_SHORT),
|
|
41
|
+
label_separator_time: ":",
|
|
42
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_SEPARATOR_TIME),
|
|
43
|
+
label_separator_date: "-"
|
|
44
|
+
// getLabel(DTNF_DICCTIONARY.LABEL_SEPARATOR_DATE),
|
|
45
|
+
};
|
|
46
|
+
return ret;
|
|
47
|
+
}, [getLabel]);
|
|
48
|
+
const [time, setTime] = useState(formatDistanceToNow(presentationTime, new Date(date), dictionary));
|
|
49
|
+
const refTime = useRef({ ...time });
|
|
50
|
+
const updateTime = useCallback(() => {
|
|
51
|
+
const newTime = formatDistanceToNow(presentationTime, new Date(date), dictionary);
|
|
52
|
+
if (refTime.current.value !== newTime.value || refTime.current.unit !== newTime.unit) {
|
|
53
|
+
refTime.current = newTime;
|
|
54
|
+
setTime(newTime);
|
|
55
|
+
}
|
|
56
|
+
}, [date, dictionary, presentationTime]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
updateTime();
|
|
59
|
+
}, [updateTime]);
|
|
60
|
+
useInterval(updateTime, delay);
|
|
61
|
+
return time;
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
useDistanceToNowFormatter as u
|
|
65
|
+
};
|
|
@@ -11,7 +11,10 @@ export type DistanceToNowFormatterProps<T extends React.ElementType = typeof Roo
|
|
|
11
11
|
*/
|
|
12
12
|
componentProps?: React.ComponentPropsWithoutRef<T>;
|
|
13
13
|
presentationTime: PresentationTimeType;
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Se maneja en string, para evitar re-renderizaciones innecesarias debido a que Date es un objeto y se crea un nuevo objeto cada vez que se pasa como prop.
|
|
16
|
+
*/
|
|
17
|
+
date: string;
|
|
15
18
|
delay?: number;
|
|
16
19
|
dataTestId?: string;
|
|
17
20
|
className?: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFormContext, Controller } from "react-hook-form";
|
|
4
|
+
import { r as rhfAutocompleteClasses } from "./constants.js";
|
|
5
|
+
import clsx from "clsx";
|
|
4
6
|
import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
|
|
5
7
|
import { A as Autocomplete } from "../../mui_extended/Autocomplete/Autocomplete.js";
|
|
6
8
|
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
@@ -21,7 +23,8 @@ function RHFAutocomplete(props) {
|
|
|
21
23
|
mandatory,
|
|
22
24
|
mandatoryMessage,
|
|
23
25
|
multiple,
|
|
24
|
-
refresh
|
|
26
|
+
refresh,
|
|
27
|
+
className
|
|
25
28
|
// onChange: onChangeRHF,
|
|
26
29
|
} = props;
|
|
27
30
|
const htmlForId = useId();
|
|
@@ -59,6 +62,7 @@ function RHFAutocomplete(props) {
|
|
|
59
62
|
return /* @__PURE__ */ jsx(
|
|
60
63
|
AutocompleteRootStyled,
|
|
61
64
|
{
|
|
65
|
+
className: clsx(className, rhfAutocompleteClasses.autocompleteRoot),
|
|
62
66
|
ownerState: { ...ownerState },
|
|
63
67
|
size,
|
|
64
68
|
children: /* @__PURE__ */ jsx(
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { R as RFHAutocompleteSlots } from "./slots/RHFAutocompleteEnum.js";
|
|
1
3
|
const RFHAUTOCOMPLETE_KEY_COMPONENT = "RHFM4LAutocomplete";
|
|
4
|
+
const rhfAutocompleteClasses = getComponentClasses(RFHAUTOCOMPLETE_KEY_COMPONENT, RFHAutocompleteSlots);
|
|
2
5
|
export {
|
|
3
|
-
RFHAUTOCOMPLETE_KEY_COMPONENT as R
|
|
6
|
+
RFHAUTOCOMPLETE_KEY_COMPONENT as R,
|
|
7
|
+
rhfAutocompleteClasses as r
|
|
4
8
|
};
|
|
@@ -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
|
*/
|
|
@@ -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 {
|