@m4l/components 9.3.28 → 9.3.30-JA.beta-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.
- package/components/Color/Color.js +32 -131
- package/components/Color/Color.styles.js +6 -124
- package/components/Color/slots/ColorEnum.d.ts +1 -3
- package/components/Color/slots/ColorEnum.js +1 -3
- package/components/Color/slots/ColorSlots.d.ts +3 -18
- package/components/Color/slots/ColorSlots.js +6 -19
- package/components/Color/types.d.ts +6 -7
- package/components/DataGrid/DataGrid.js +1 -1
- package/components/DataGrid/formatters/ColumnColorFormatter/formatter.d.ts +6 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/formatter.js +19 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/index.js +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/types.d.ts +12 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/types.js +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.d.ts +14 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.js +22 -0
- package/components/DataGrid/formatters/index.d.ts +1 -0
- package/components/DataGrid/tests/helpers/generators.d.ts +26 -0
- package/components/DataGrid/tests/helpers/types.d.ts +2 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +1 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.d.ts +3 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.d.ts +3 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +3 -2
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +1 -7
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +1 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +1 -1
- package/components/DynamicSort/subcomponents/FieldTypes/FieldTypeInterface.d.ts +2 -3
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.d.ts +3 -2
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.js +3 -2
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
- package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +1 -7
- package/components/Icon/Icon.js +1 -1
- package/components/Image/Image.js +1 -1
- package/components/Image/subcomponents/IntersectComponent/index.js +1 -1
- package/components/ImageText/ImageText.js +1 -1
- package/components/LanguagePopover/LanguagePopover.js +1 -1
- package/components/LinearProgressIndeterminate/LinearProgressIndeterminate.js +1 -1
- package/components/LoadingError/LoadingError.js +1 -1
- package/components/NumberInput/NumberInput.js +1 -1
- package/components/ObjectLogs/subcomponents/ObjectLogsByM4L/ObjectLogsByM4L.js +1 -1
- package/components/ObjectLogs/subcomponents/ObjectLogsByOthers/ObjectLogsByOthers.js +1 -1
- package/components/PDFViewer/PDFViewer.js +1 -1
- package/components/PrintingSystem/PrintingSystem.js +1 -1
- package/components/PropertyValue/PropertyValue.js +1 -1
- package/components/ToastContainer/ToastContainer.js +1 -1
- package/components/WindowBase/WindowBase.js +1 -1
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasAdmin/AreasAdmin.js +1 -1
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/AreaChip.js +4 -3
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +4 -3
- package/components/areas/components/AreasViewer/AreasViewer.js +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -1
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/commercial/TopBar/TopBar.js +1 -1
- package/components/commercial/TopBar/component/ConteinItem/index.js +1 -1
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +1 -1
- package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.js +1 -1
- package/components/extended/React-resizable-panels/SplitLayout.js +1 -1
- package/components/formatters/BooleanFormatter/BooleanFormatter.js +1 -1
- package/components/formatters/ColorFormatter/ColorFormatter.d.ts +18 -0
- package/components/formatters/ColorFormatter/ColorFormatter.js +35 -0
- package/components/formatters/ColorFormatter/ColorFormatter.styles.d.ts +2 -0
- package/components/formatters/ColorFormatter/ColorFormatter.styles.js +15 -0
- package/components/formatters/ColorFormatter/constants.d.ts +1 -0
- package/components/formatters/ColorFormatter/constants.js +4 -0
- package/components/formatters/ColorFormatter/index.d.ts +3 -0
- package/components/formatters/ColorFormatter/index.js +1 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.d.ts +3 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.js +7 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.d.ts +4 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.js +11 -0
- package/components/formatters/ColorFormatter/types.d.ts +24 -0
- package/components/formatters/ColorFormatter/types.js +1 -0
- package/components/formatters/ConcatenatedFormatter/ConcatenatedFormatter.js +1 -1
- package/components/formatters/DateFormatter/DateFormatter.js +1 -1
- package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +1 -1
- package/components/formatters/PeriodFormatter/PeriodFormatter.js +1 -1
- package/components/formatters/PointsFormatter/PointsFormatter.js +1 -1
- package/components/formatters/PriceFormatter/PriceFormatter.js +1 -1
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.js +1 -1
- package/components/formatters/index.d.ts +1 -0
- package/components/hook-form/RHFColorPicker/RFHColorPicker.js +28 -36
- package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.js +156 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/types.d.ts +9 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +41 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.js +50 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.d.ts +4 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.js +3 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +21 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +19 -1
- package/components/hook-form/RHFColorPicker/slots/index.js +1 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.d.ts +33 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.js +147 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.js +1 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.d.ts +20 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.js +1 -0
- package/components/hook-form/RHFDateTime/RHFDateTime.js +1 -1
- package/components/hook-form/RHFNumberInput/RHFNumberInput.js +1 -1
- package/components/hook-form/RHFPeriod/RHFPeriod.js +1 -1
- package/components/hook-form/RHFSelect/RHFSelect.js +1 -1
- package/components/hook-form/RHFTextField/RHFTextField.js +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +1 -1
- package/components/hook-form/RHFormProvider/RHFormProvider.d.ts +31 -0
- package/components/hook-form/RHFormProvider/RHFormProvider.js +93 -0
- package/components/hook-form/RHFormProvider/index.d.ts +4 -0
- package/components/hook-form/RHFormProvider/index.js +1 -0
- package/components/hook-form/RHFormProvider/schema.d.ts +17 -0
- package/components/hook-form/RHFormProvider/schema.js +29 -0
- package/components/hook-form/RHFormProvider/types.d.ts +129 -0
- package/components/hook-form/RHFormProvider/types.js +8 -0
- package/components/hook-form/index.d.ts +1 -0
- package/components/mui_extended/Accordion/Accordion.js +1 -1
- package/components/mui_extended/Avatar/Avatar.js +1 -1
- package/components/mui_extended/Avatar/subcomponents/SkeletonAvatar/index.js +1 -1
- package/components/mui_extended/Badge/Badge.js +1 -1
- package/components/mui_extended/CircularProgress/CircularProgress.js +1 -1
- package/components/mui_extended/DateTimePicker/DateTimePicker.js +1 -1
- package/components/mui_extended/Dialog/Dialog.js +1 -1
- package/components/mui_extended/ImageButton/ImageButton.js +1 -1
- package/components/mui_extended/MenuDivider/MenuDivider.js +1 -1
- package/components/mui_extended/NavLink/NavLink.js +1 -1
- package/components/mui_extended/Popover/Popover.js +1 -1
- package/components/mui_extended/Select/Select.js +1 -1
- package/components/mui_extended/Stack/Stack.js +1 -1
- package/components/mui_extended/TextField/TextField.js +1 -1
- package/components/mui_extended/ToggleButton/ToggleButton.js +1 -1
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +1 -1
- package/components/mui_extended/Typography/Typography.js +1 -1
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +1 -1
- package/contexts/index.d.ts +3 -3
- package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +3 -3
- package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.js +3 -3
- package/helpers/getStepsAndValidationSchema/types.d.ts +5 -4
- package/hooks/index.d.ts +1 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +1 -1
- package/hooks/useFormAddEdit/index.d.ts +1 -1
- package/hooks/useWatchTyped/index.d.ts +1 -0
- package/hooks/useWatchTyped/index.js +1 -0
- package/hooks/useWatchTyped/types.d.ts +11 -0
- package/hooks/useWatchTyped/useTypedWatch.d.ts +9 -0
- package/hooks/useWatchTyped/useTypedWatch.js +30 -0
- package/index.js +94 -77
- package/package.json +2 -2
- package/test/getNameDataTestId.js +2 -2
- package/components/hook-form/RHFormContext/index.d.ts +0 -120
- package/components/hook-form/RHFormContext/index.js +0 -91
- package/components/hook-form/RHFormContext/types.d.ts +0 -83
- package/hooks/useFormReadyForUpdate/types.d.ts +0 -8
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/constants.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/constants.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/index.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/index.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/types.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/dictionary.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/dictionary.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/styles.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/styles.js +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/index.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/skeleton.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/styles.d.ts +0 -0
- /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/types.d.ts +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactElement, RefAttributes } from 'react';
|
|
2
|
+
import { CustomFormArguments, FormProviderCustomProps, RHFormProviderProps, RHFormProviderRef, RHFormValues } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* useCustomForm se encarga de crear los metodos del formulario y validar el statusLoad para recargar los valores del formulario nuevamente.
|
|
5
|
+
* Cuando statusLoad es 'reload_values_provider' se actualizan los valores del formulario, debido a que se cargaron del backend.
|
|
6
|
+
* Cuando statusLoad es 'ready' se actualiza el statusLoad del formulario a 'ready', para que los que useWatch puedan ser efectivos despues de la carga de los datos.
|
|
7
|
+
* Se recomienda usar useFormReadyForUpdate que se nutre de statusLoad e indica que el formulario esta listo para ser usado.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCustomForm<T extends RHFormValues>({ validationSchema, values, statusLoad, mode, }: CustomFormArguments<T>): import('react-hook-form').UseFormReturn<T, any, undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Componente que extiende FormProviderCustomBase para poder ser usado dentro del forwardRef garantizando el tipado.
|
|
12
|
+
*/
|
|
13
|
+
export declare const FormProviderCustom: <T extends RHFormValues>(props: FormProviderCustomProps<T> & RefAttributes<RHFormProviderRef<T>>) => ReactElement;
|
|
14
|
+
/**
|
|
15
|
+
* Componente principal que gestiona el `Provider` de `react-hook-form` y encapsula el formulario para la creación de formularios personalizados.
|
|
16
|
+
*
|
|
17
|
+
* Este componente utiliza internamente `useCustomForm` para inicializar todos los métodos necesarios para la manipulación del formulario,
|
|
18
|
+
* incluyendo validación con Yup, protegida con ValidationSchema<T> para garantizar que solo se usen claves declaradas en el tipo del formulario sean las que participen
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* **Características principales:**
|
|
22
|
+
* - Integración completa con React Hook Form
|
|
23
|
+
* - Validación automática usando esquemas de Yup
|
|
24
|
+
* - Gestión de estados de carga para actualización de valores
|
|
25
|
+
* - Exposición de métodos del formulario a través de refs
|
|
26
|
+
* - Soporte para diferentes modos de validación
|
|
27
|
+
*
|
|
28
|
+
* Si necesitas acceso directo a los métodos de `useForm`, puedes utilizar el `Provider` y el hook por separado mediante
|
|
29
|
+
* `FormProviderCustom` y `useCustomForm`, respectivamente.
|
|
30
|
+
*/
|
|
31
|
+
export declare const RHFormProvider: import('react').ForwardRefExoticComponent<RHFormProviderProps<RHFormValues> & RefAttributes<RHFormProviderRef<RHFormValues>>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
5
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
6
|
+
import { F as FormProviderRoot } from "./styles.js";
|
|
7
|
+
import { R as RHFormProviderUtilityClasses } from "./classes/index.js";
|
|
8
|
+
const classes = RHFormProviderUtilityClasses();
|
|
9
|
+
function useCustomForm({
|
|
10
|
+
validationSchema,
|
|
11
|
+
values,
|
|
12
|
+
statusLoad,
|
|
13
|
+
mode
|
|
14
|
+
}) {
|
|
15
|
+
const formMethods = useForm({
|
|
16
|
+
resolver: yupResolver(validationSchema),
|
|
17
|
+
defaultValues: values,
|
|
18
|
+
...mode && { mode }
|
|
19
|
+
});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (statusLoad === "reload_values_provider") {
|
|
22
|
+
const keys = Object.keys(values);
|
|
23
|
+
keys.forEach((key) => {
|
|
24
|
+
const fieldName = key;
|
|
25
|
+
const fieldValue = values[key];
|
|
26
|
+
formMethods.setValue(fieldName, fieldValue, {
|
|
27
|
+
shouldValidate: false,
|
|
28
|
+
shouldDirty: false,
|
|
29
|
+
shouldTouch: false
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
formMethods.clearErrors();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}, [formMethods, statusLoad, values]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (statusLoad === "ready") {
|
|
38
|
+
formMethods.setValue("statusLoad", "ready", {
|
|
39
|
+
shouldValidate: false,
|
|
40
|
+
shouldDirty: false,
|
|
41
|
+
shouldTouch: false
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, [statusLoad]);
|
|
45
|
+
return formMethods;
|
|
46
|
+
}
|
|
47
|
+
const FormProviderCustomBase = (props, ref) => {
|
|
48
|
+
const { children, onSubmit, className, formMethods } = props;
|
|
49
|
+
useImperativeHandle(
|
|
50
|
+
ref,
|
|
51
|
+
() => ({
|
|
52
|
+
formMethods,
|
|
53
|
+
onSubmit
|
|
54
|
+
}),
|
|
55
|
+
[formMethods, onSubmit]
|
|
56
|
+
);
|
|
57
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...formMethods, children: /* @__PURE__ */ jsx(
|
|
58
|
+
FormProviderRoot,
|
|
59
|
+
{
|
|
60
|
+
className: clsx(classes.root, className),
|
|
61
|
+
onSubmit: formMethods.handleSubmit(onSubmit),
|
|
62
|
+
children
|
|
63
|
+
}
|
|
64
|
+
) });
|
|
65
|
+
};
|
|
66
|
+
const FormProviderCustomForward = forwardRef(FormProviderCustomBase);
|
|
67
|
+
FormProviderCustomForward.displayName = "FormProviderCustom";
|
|
68
|
+
const FormProviderCustom = FormProviderCustomForward;
|
|
69
|
+
const RHFormProvider = forwardRef(
|
|
70
|
+
(props, ref) => {
|
|
71
|
+
const { children, onSubmit, values, validationSchema, statusLoad = "ready", className, mode } = props;
|
|
72
|
+
const formMethods = useCustomForm({ validationSchema, statusLoad, values, mode });
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
FormProviderCustom,
|
|
75
|
+
{
|
|
76
|
+
ref,
|
|
77
|
+
className,
|
|
78
|
+
values,
|
|
79
|
+
validationSchema,
|
|
80
|
+
statusLoad,
|
|
81
|
+
onSubmit,
|
|
82
|
+
formMethods,
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
RHFormProvider.displayName = "RHFormProvider";
|
|
89
|
+
export {
|
|
90
|
+
FormProviderCustom as F,
|
|
91
|
+
RHFormProvider as R,
|
|
92
|
+
useCustomForm as u
|
|
93
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './RHFormProvider';
|
|
2
|
+
export type { ValidationSchema, ValidationShape, ValidationFullObject as ValidationObject, ValidationPartialObject, RHFormInitialValues, RHFormValues, } from './types';
|
|
3
|
+
export { VALIDATION_SCHEMA_BRAND, VALIDATION_PARTIAL_OBJECT_BRAND, VALIDATION_OBJECT_BRAND, } from './types';
|
|
4
|
+
export * from './schema';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RHFormValues, ValidationFullObject, ValidationSchema, ValidationShape, ValidationPartialObject } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Crea un esquema de Yup a partir de un shape tipado y mantiene la asociación con el tipo del formulario.
|
|
4
|
+
*/
|
|
5
|
+
export declare const createValidationSchema: <T extends RHFormValues>(valitionFullObject: ValidationFullObject<T>) => ValidationSchema<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Crea un esquema de Yup a partir de un shape tipado y mantiene la asociación con el tipo del formulario.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createValidationPartialObject: <T extends RHFormValues>(partialObjectShape: ValidationShape<T>) => ValidationPartialObject<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Marca un ObjectShape para garantizar que fue construido mediante createValidationObject.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createValidationFullObject: <T extends RHFormValues>(...partialObjectShape: Array<ValidationPartialObject<T>>) => ValidationFullObject<T>;
|
|
14
|
+
/**
|
|
15
|
+
* crea un squema de validación vacío, para los testing
|
|
16
|
+
*/
|
|
17
|
+
export declare const createEmptyValidationSchema: <T extends RHFormValues>() => ValidationSchema<T>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Yup from "yup";
|
|
2
|
+
import { V as VALIDATION_OBJECT_BRAND } from "./types.js";
|
|
3
|
+
const createValidationSchema = (valitionFullObject) => {
|
|
4
|
+
const schema = Yup.object().shape(valitionFullObject);
|
|
5
|
+
return schema;
|
|
6
|
+
};
|
|
7
|
+
const createValidationPartialObject = (partialObjectShape) => {
|
|
8
|
+
const validationPartialObject = { ...partialObjectShape };
|
|
9
|
+
return validationPartialObject;
|
|
10
|
+
};
|
|
11
|
+
const createValidationFullObject = (...partialObjectShape) => {
|
|
12
|
+
const mergedShape = Object.assign({}, ...partialObjectShape);
|
|
13
|
+
Object.defineProperty(mergedShape, VALIDATION_OBJECT_BRAND, {
|
|
14
|
+
configurable: false,
|
|
15
|
+
enumerable: false,
|
|
16
|
+
writable: false,
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
return mergedShape;
|
|
20
|
+
};
|
|
21
|
+
const createEmptyValidationSchema = () => {
|
|
22
|
+
return createValidationSchema(createValidationFullObject(createValidationPartialObject({})));
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
createValidationFullObject as a,
|
|
26
|
+
createValidationPartialObject as b,
|
|
27
|
+
createValidationSchema as c,
|
|
28
|
+
createEmptyValidationSchema as d
|
|
29
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Mode, UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import { ObjectSchema } from 'yup';
|
|
4
|
+
import { ObjectShape } from 'yup/lib/object';
|
|
5
|
+
/**
|
|
6
|
+
* Estados de carga del formulario que determinan cuándo y cómo actualizar los valores.
|
|
7
|
+
*
|
|
8
|
+
* - `initial`: Estado inicial del formulario
|
|
9
|
+
* - `new`: Formulario para crear un nuevo elemento
|
|
10
|
+
* - `edit`: Formulario para editar un elemento existente
|
|
11
|
+
* - `reload_values_provider`: Estado que indica que se deben recargar los valores del proveedor
|
|
12
|
+
* - `ready`: Formulario listo para ser usado
|
|
13
|
+
* - `error`: Estado de error en el formulario
|
|
14
|
+
*/
|
|
15
|
+
export type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
|
|
16
|
+
export type RHFormValues = {};
|
|
17
|
+
/**
|
|
18
|
+
* Tipo que define los valores iniciales del formulario.
|
|
19
|
+
* Extiende FieldValues de React Hook Form para mayor flexibilidad.
|
|
20
|
+
*/
|
|
21
|
+
export type RHFormInitialValues<T extends RHFormValues> = Partial<T>;
|
|
22
|
+
/**
|
|
23
|
+
* LiteralKeys es un tipo que define las claves literales del formulario. excepto statusLoad, que no es necesario que el usuario la aporte.
|
|
24
|
+
*/
|
|
25
|
+
export type LiteralKeys<T> = Exclude<Extract<keyof T, string>, 'statusLoad'>;
|
|
26
|
+
/**
|
|
27
|
+
* StrictFormValues es un tipo que define los valores del formulario explicitamente.
|
|
28
|
+
*/
|
|
29
|
+
export type StrictFormValues<T extends RHFormValues> = Pick<RHFormInitialValues<T>, LiteralKeys<RHFormInitialValues<T>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Garantiza que el shape sólo contenga claves declaradas en el tipo del formulario.
|
|
32
|
+
* Si usa un key que no está en el tipo del formulario, se devuelve never. Protegiendo el ingreso de claves diferentes.
|
|
33
|
+
*/
|
|
34
|
+
export type EnsureAllowedKeys<Shape, Allowed extends string> = Exclude<keyof Shape, Allowed> extends never ? Shape : never;
|
|
35
|
+
/**
|
|
36
|
+
* YupShapeEntry es un tipo que define la entrada de un shape de Yup.
|
|
37
|
+
*/
|
|
38
|
+
type YupShapeEntry = ObjectShape[string];
|
|
39
|
+
/**
|
|
40
|
+
* ValidationShape veririca que solo YupShapeEntry puedan ser usados en algunos campos de RHFormValues.
|
|
41
|
+
*/
|
|
42
|
+
export type ValidationShape<T extends RHFormValues> = Partial<Record<LiteralKeys<T>, YupShapeEntry>>;
|
|
43
|
+
/**
|
|
44
|
+
* Symbol que contiene el ValidationSchema que lo hace diferente a ObjectSchema normal de Yup.
|
|
45
|
+
*/
|
|
46
|
+
export declare const VALIDATION_SCHEMA_BRAND: unique symbol;
|
|
47
|
+
/**
|
|
48
|
+
* Symbol que identifica que un ValidationShape fue construido mediante createValidationObject.
|
|
49
|
+
*/
|
|
50
|
+
export declare const VALIDATION_OBJECT_BRAND: unique symbol;
|
|
51
|
+
/**
|
|
52
|
+
* Symbol que identifica que un ValidationShape parcial fue construido mediante createValidationPartialObject.
|
|
53
|
+
*/
|
|
54
|
+
export declare const VALIDATION_PARTIAL_OBJECT_BRAND: unique symbol;
|
|
55
|
+
/**
|
|
56
|
+
* ValidationSchema es un tipo que define el schema de validación del formulario. Aporta el brand VALIDATION_SCHEMA_BRAND para hacer diferentes a ObjectSchema normal de Yup.
|
|
57
|
+
* y asi poder garantizar que se use la función createValidationSchema para crear la schema.
|
|
58
|
+
*/
|
|
59
|
+
export type ValidationSchema<T extends RHFormValues> = ObjectSchema<any> & {
|
|
60
|
+
/**
|
|
61
|
+
* Aunque no se use en el codigo a nivel de javascript, es necesario para que el tipo de la schema para hacerlos diferente a ObjectSchema. y obliga
|
|
62
|
+
* a que se use la función createValidationSchema para crear la schema.
|
|
63
|
+
*/
|
|
64
|
+
readonly [VALIDATION_SCHEMA_BRAND]: ValidationShape<T>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* ValidationFullObject garantiza que el shape sea construido mediante createValidationObject.
|
|
68
|
+
* con base en los partialObjectShape que se le pasan a createValidationObject.
|
|
69
|
+
*/
|
|
70
|
+
export type ValidationFullObject<T extends RHFormValues> = ValidationShape<T> & {
|
|
71
|
+
readonly [VALIDATION_OBJECT_BRAND]: true;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* ValidationPartialObject garantiza que el shape parcial sea construido mediante createValidationPartialObject.
|
|
75
|
+
*/
|
|
76
|
+
export type ValidationPartialObject<T extends RHFormValues> = ValidationShape<T> & {
|
|
77
|
+
readonly [VALIDATION_PARTIAL_OBJECT_BRAND]: true;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Propiedades del componente principal RHFormProvider.
|
|
81
|
+
* Define la interfaz para crear formularios con React Hook Form y validación Yup.
|
|
82
|
+
*/
|
|
83
|
+
export interface RHFormProviderProps<T extends RHFormValues> {
|
|
84
|
+
/** Elementos hijos del formulario */
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
/** Función que se ejecuta al enviar el formulario con los datos validados */
|
|
87
|
+
onSubmit: (data: T) => void;
|
|
88
|
+
/** Valores iniciales del formulario si es un new o cargados del backend si son edit */
|
|
89
|
+
values: RHFormInitialValues<T>;
|
|
90
|
+
/** Esquema de validación de Yup */
|
|
91
|
+
validationSchema: ValidationSchema<T>;
|
|
92
|
+
/** Estado de carga del formulario (opcional, por defecto 'ready') */
|
|
93
|
+
statusLoad?: FormStatusLoad;
|
|
94
|
+
/** Clases CSS adicionales (opcional) */
|
|
95
|
+
className?: string;
|
|
96
|
+
/** Modo de validación del formulario (opcional) */
|
|
97
|
+
mode?: Mode;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Propiedades del componente FormProviderCustom.
|
|
101
|
+
* Combina las propiedades de React Hook Form con las propiedades personalizadas del formulario.
|
|
102
|
+
*/
|
|
103
|
+
export interface FormProviderCustomProps<T extends RHFormValues> extends RHFormProviderProps<T> {
|
|
104
|
+
formMethods: UseFormReturn<T, any, undefined>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Argumentos para el hook useCustomForm.
|
|
108
|
+
* Define los parámetros necesarios para configurar un formulario personalizado.
|
|
109
|
+
*/
|
|
110
|
+
export interface CustomFormArguments<T extends RHFormValues> {
|
|
111
|
+
/** Valores iniciales del formulario */
|
|
112
|
+
values: RHFormInitialValues<T>;
|
|
113
|
+
/** Esquema de validación de Yup */
|
|
114
|
+
validationSchema: ValidationSchema<T>;
|
|
115
|
+
/** Estado de carga del formulario (opcional) */
|
|
116
|
+
statusLoad?: FormStatusLoad;
|
|
117
|
+
/** Modo de validación del formulario (opcional) */
|
|
118
|
+
mode?: Mode;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Interfaz que define los métodos expuestos a través de la ref del RHFormProvider.
|
|
122
|
+
* Permite acceso programático a los métodos de React Hook Form desde componentes padre.
|
|
123
|
+
*/
|
|
124
|
+
export interface RHFormProviderRef<T extends RHFormValues> {
|
|
125
|
+
/** Objeto completo con todos los métodos de React Hook Form */
|
|
126
|
+
formMethods: UseFormReturn<T, any, undefined>;
|
|
127
|
+
onSubmit: (data: T) => void;
|
|
128
|
+
}
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const VALIDATION_SCHEMA_BRAND = Symbol("VALIDATION_SCHEMA_BRAND");
|
|
2
|
+
const VALIDATION_OBJECT_BRAND = Symbol("VALIDATION_OBJECT_BRAND");
|
|
3
|
+
const VALIDATION_PARTIAL_OBJECT_BRAND = Symbol("VALIDATION_PARTIAL_OBJECT_BRAND");
|
|
4
|
+
export {
|
|
5
|
+
VALIDATION_OBJECT_BRAND as V,
|
|
6
|
+
VALIDATION_SCHEMA_BRAND as a,
|
|
7
|
+
VALIDATION_PARTIAL_OBJECT_BRAND as b
|
|
8
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.js";
|
|
3
|
-
import {
|
|
3
|
+
import { g as getNameDataTestId } from "../../../test/getNameDataTestId.js";
|
|
4
4
|
import { P as PATH_EXPANDED_ICON, A as ACCORDION_KEY } from "./constants.js";
|
|
5
5
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
6
6
|
import { A as AccordionRootStyled, a as AccordionSummaryStyled, I as IconLabelStyled, L as LabelStyled, b as IconExpandedStyled, c as AccordionDetailsStyled } from "./slots/AccordionSlots.js";
|
|
@@ -3,7 +3,7 @@ import { forwardRef } from "react";
|
|
|
3
3
|
import { useModuleSkeleton } from "@m4l/core";
|
|
4
4
|
import { S as SkeletonAvatar } from "./subcomponents/SkeletonAvatar/index.js";
|
|
5
5
|
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.js";
|
|
6
|
-
import {
|
|
6
|
+
import { g as getNameDataTestId } from "../../../test/getNameDataTestId.js";
|
|
7
7
|
import { A as AvatarRootStyled } from "./slots/AvatarSlots.js";
|
|
8
8
|
import { A as AVATAR_KEY } from "./constants.js";
|
|
9
9
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { T as TEST_PROP_ID } from "../../../../../test/constants_no_mock.js";
|
|
3
|
-
import {
|
|
3
|
+
import { g as getNameDataTestId } from "../../../../../test/getNameDataTestId.js";
|
|
4
4
|
import { A as AVATAR_KEY } from "../../constants.js";
|
|
5
5
|
import { S as Skeleton } from "../../../Skeleton/Skeleton.js";
|
|
6
6
|
const SkeletonAvatar = (props) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
3
3
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
4
4
|
import { B as BADGE_LABEL_KEY_COMPONENT } from "./constants.js";
|
|
5
5
|
import { B as BadgeRootStyled } from "./slots/BadgeSlots.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useModuleSkeleton } from "@m4l/core";
|
|
3
|
-
import {
|
|
3
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
4
4
|
import { S as SkeletonStyled, R as RootStyled } from "./slots/CircularProgressSlots.js";
|
|
5
5
|
import { C as CircularProgressSlots } from "./slots/CircularProgressEnum.js";
|
|
6
6
|
import { C as CIRCULAR_PROGRESS_PREFIX } from "./constants.js";
|
|
@@ -3,7 +3,7 @@ import clsx from "clsx";
|
|
|
3
3
|
import { useMemo, useCallback } from "react";
|
|
4
4
|
import { useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
5
5
|
import { useIsMobile } from "@m4l/graphics";
|
|
6
|
-
import {
|
|
6
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
7
7
|
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
8
8
|
import { P as PopperStyled, a as PickersCalendarHeaderStyled, I as IconButtonStyled, b as PickersDayStyled, c as PaperStyled, S as SkeletonStyled, M as MobileDateTimePickerRootStyled, D as DesktopDateTimePickerRootStyled } from "./slots/DateTimePickerSlots.js";
|
|
9
9
|
import { d as date, c as chevron_right, a as chevron_left, b as chevron_down } from "./icons.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
4
4
|
import { D as DIALOG_KEY_COMPONENT } from "./constants.js";
|
|
5
5
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
6
6
|
import clsx from "clsx";
|
|
@@ -6,7 +6,7 @@ import { I as Image } from "../../Image/Image.js";
|
|
|
6
6
|
import { W as WrapperImageButton } from "./styles.js";
|
|
7
7
|
import { u as useUtilityClasses } from "./utils/Clases/index.js";
|
|
8
8
|
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.js";
|
|
9
|
-
import {
|
|
9
|
+
import { g as getNameDataTestId } from "../../../test/getNameDataTestId.js";
|
|
10
10
|
import { I as IMAGE_BUTTON_KEY_COMPONENT } from "./tests/constants.js";
|
|
11
11
|
function ImageButton({
|
|
12
12
|
src,
|
|
@@ -4,7 +4,7 @@ import { M as MENU_DIVIDER_KEY_COMPONENT } from "./constants.js";
|
|
|
4
4
|
import { M as MenuDividerRootStyled, D as DividerStyled } from "./slots/MenuDividerSlots.js";
|
|
5
5
|
import { M as MenuDividerSlots } from "./slots/MenuDividerEnum.js";
|
|
6
6
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
7
|
-
import {
|
|
7
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
8
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
9
9
|
const MenuDivider = (props) => {
|
|
10
10
|
const {
|
|
@@ -4,7 +4,7 @@ import { useModuleSkeleton } from "@m4l/core";
|
|
|
4
4
|
import { c as classNavLinkRoot, N as NAV_LINK_SPECIFY, a as NAV_LINK_KEY_COMPONENT } from "./constants.js";
|
|
5
5
|
import { N as NavLinkSlots } from "./slots/NavLinkEnum.js";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
|
-
import {
|
|
7
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
8
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
9
9
|
const NavLink = (props) => {
|
|
10
10
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
3
3
|
import { P as POPOVER_PREFIX, a as POPOVER_CLASS_NAME_SPECIFY } from "./constants.js";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { P as PopoverRootStyled } from "./slots/PopoverSlots.js";
|
|
@@ -7,7 +7,7 @@ import { forwardRef, useMemo, useState, useRef, useCallback, useEffect } from "r
|
|
|
7
7
|
import { A as ArrowDownStyled, a as AdormentStyled, S as SelectRootStyled, b as SkeletonSelectStyled, M as MenuItemListStyled, c as MenuItemNoOptionStyled, L as LabelPlaceholerStyled, R as RenderValueContainerStyled, d as RenderValueTypography } from "./slots/SelectSlots.js";
|
|
8
8
|
import { I as ICON_ARROW_DOWN, S as SELECT_CLASSES, a as SELECT_KEY_COMPONENT } from "./constants.js";
|
|
9
9
|
import { S as SELECT_DICTIONARY } from "./dictionary.js";
|
|
10
|
-
import {
|
|
10
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
11
11
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
12
12
|
import { C as Chip } from "../../Chip/Chip.js";
|
|
13
13
|
import { S as SelectSlots } from "./slots/SelectEnum.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
3
3
|
import { S as STACK_KEY_COMPONENT } from "./constant.js";
|
|
4
4
|
import { M as MUISTackRootStyled } from "./slots/StackSlot.js";
|
|
5
5
|
import { S as StackSlots } from "./slots/StackEnum.js";
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useModuleSkeleton } from "@m4l/core";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { S as SkeletonStyled, T as TextFieldRootStyled, L as LimitContainerStyled, a as LimitTextFirstStyled, b as LimitTextSeparatorStyled, c as LimitTextSecondStyled } from "./slots/TextFieldSlots.js";
|
|
5
|
-
import {
|
|
5
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
6
6
|
import { T as TEXT_FIELD_CLASSES, a as TEXT_FIELD_KEY_COMPONENT } from "./constants.js";
|
|
7
7
|
import { T as TextFieldSlots } from "./slots/TextFieldEnum.js";
|
|
8
8
|
import { useTheme } from "@mui/material";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { w as withToggle } from "../../../hocs/withToggle/index.js";
|
|
3
3
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
4
|
-
import {
|
|
4
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { T as TOGGLE_BUTTON_KEY_COMPONENT } from "./constants.js";
|
|
7
7
|
import { T as ToggleButtonRootStyled } from "./slots/ToggleButtonSlots.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import {
|
|
3
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
4
4
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
5
5
|
import { T as TOGGLE_ICON_BUTTON_KEY_COMPONENT, a as TOGGLE_ICON_BUTTON_CLASS_NAME_SPECIFY } from "./constants.js";
|
|
6
6
|
import { w as withToggle } from "../../../hocs/withToggle/index.js";
|
|
@@ -4,7 +4,7 @@ import { useModuleSkeleton } from "@m4l/core";
|
|
|
4
4
|
import { T as TYPOGRAPHY_CLASSES, a as TYPOGRAPHY_KEY_COMPONENT, b as TYPOGRAPHY_CLASS_NAME_SPECIFY } from "./constants.js";
|
|
5
5
|
import { T as TypographySlots } from "./slots/typographyEnum.js";
|
|
6
6
|
import { S as StyledMUITypography, a as StyledSkeleton } from "./slots/typographySlots.js";
|
|
7
|
-
import {
|
|
7
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
8
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
9
9
|
function Typography(props) {
|
|
10
10
|
const {
|
|
@@ -6,7 +6,7 @@ import { P as PopupDragWindowRootStyled } from "../../slots/popupsViewerSlots.js
|
|
|
6
6
|
import { u as usePopups } from "../../../PopupsProvider/hooks/usePopups.js";
|
|
7
7
|
import { T as TEST_PROP_ID } from "../../../../../../test/constants_no_mock.js";
|
|
8
8
|
import { a as POPUPS_VIEWER_CLASS_NAME } from "../../constants.js";
|
|
9
|
-
import {
|
|
9
|
+
import { g as getNameDataTestId } from "../../../../../../test/getNameDataTestId.js";
|
|
10
10
|
import { M as MemonizedWindowBaseMicroFrontend } from "../../../../../WindowBase/subcomponents/MicroFrontend/MicroFrontend.js";
|
|
11
11
|
import { W as WindowBaseComponent } from "../../../../../WindowBase/subcomponents/Component/index.js";
|
|
12
12
|
import { d as deepShallow } from "../../../../../../utils/deepShallow.js";
|
package/contexts/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { DynamicMFParmsProvider, DynamicMFParmsContext, MemonizedDynamicMFParmsProvider, } from '../components/WindowBase/contexts/DynamicMFParmsContext';
|
|
2
2
|
export * from './ModalContext/index';
|
|
3
3
|
export * from './ModalContext/types';
|
|
4
|
-
export type { FormInitialValues, FormStatusLoad, } from '../components/hook-form/
|
|
5
|
-
export { RHFormProvider, FormProviderCustom, useCustomForm, } from '../components/hook-form/
|
|
6
|
-
export { getFormComponentsDictionary } from '../components/hook-form/
|
|
4
|
+
export type { RHFormInitialValues as FormInitialValues, FormStatusLoad, } from '../components/hook-form/RHFormProvider/types';
|
|
5
|
+
export { RHFormProvider, FormProviderCustom, useCustomForm, } from '../components/hook-form/RHFormProvider/RHFormProvider';
|
|
6
|
+
export { getFormComponentsDictionary } from '../components/hook-form/RHFormProvider/dictionary';
|
|
7
7
|
export { useAppearanceComponentStore, AppearanceComponentProvider, } from './AppearanceComponentContext';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Step } from '../../components/Stepper/types';
|
|
2
2
|
import { GetStepsAndValidationSchemaProps } from './types';
|
|
3
|
-
import
|
|
3
|
+
import { RHFormValues } from '../../components/hook-form/RHFormProvider/types';
|
|
4
4
|
/**
|
|
5
5
|
* Hook personalizado que recibe un array de steps con validaciones y regresa todo listo para el Stepper
|
|
6
6
|
* Una sola configuración genera: validationSchema + steps + validationFields automáticamente
|
|
7
7
|
*/
|
|
8
|
-
export declare function getStepsAndValidationSchema({ steps, visibilityData, }: GetStepsAndValidationSchemaProps): {
|
|
9
|
-
validationSchema:
|
|
8
|
+
export declare function getStepsAndValidationSchema<T extends RHFormValues>({ steps, visibilityData, }: GetStepsAndValidationSchemaProps<T>): {
|
|
9
|
+
validationSchema: import('../../components/hook-form/RHFormProvider/types').ValidationSchema<T>;
|
|
10
10
|
steps: Step[];
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { b as createValidationPartialObject, c as createValidationSchema, a as createValidationFullObject } from "../../components/hook-form/RHFormProvider/schema.js";
|
|
2
2
|
import { e as evaluateVisibilityStepCondition } from "../../components/Stepper/helpers/evaluateVisibilityStepCondition/index.js";
|
|
3
3
|
function getStepsAndValidationSchema({
|
|
4
4
|
steps,
|
|
5
5
|
visibilityData
|
|
6
6
|
}) {
|
|
7
7
|
const validationSchema = (() => {
|
|
8
|
-
const combinedValidations = {};
|
|
8
|
+
const combinedValidations = createValidationPartialObject({});
|
|
9
9
|
const visibleSteps = steps.filter((step) => {
|
|
10
10
|
if (!step.visibilityCondition) {
|
|
11
11
|
return true;
|
|
@@ -18,7 +18,7 @@ function getStepsAndValidationSchema({
|
|
|
18
18
|
Object.assign(combinedValidations, validationResult);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
return
|
|
21
|
+
return createValidationSchema(createValidationFullObject(combinedValidations));
|
|
22
22
|
})();
|
|
23
23
|
const processedSteps = steps.map((step) => {
|
|
24
24
|
let validationFields = [];
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { RHFormValues, ValidationPartialObject } from '../../components/hook-form/RHFormProvider/types';
|
|
1
2
|
import { Step } from '../../components/Stepper/types';
|
|
2
3
|
/**
|
|
3
4
|
* Configuración completa de un step con validaciones incluidas
|
|
4
5
|
*/
|
|
5
|
-
export interface StepWithValidation extends Omit<Step, 'validationFields'> {
|
|
6
|
+
export interface StepWithValidation<T extends RHFormValues> extends Omit<Step, 'validationFields'> {
|
|
6
7
|
/**
|
|
7
8
|
* Función de validación que retorna un objeto con esquemas Yup
|
|
8
9
|
* Ejemplo: ContactDataValidation
|
|
9
10
|
*/
|
|
10
|
-
validationFunction?: () =>
|
|
11
|
+
validationFunction?: () => ValidationPartialObject<T>;
|
|
11
12
|
}
|
|
12
|
-
export interface GetStepsAndValidationSchemaProps {
|
|
13
|
+
export interface GetStepsAndValidationSchemaProps<T extends RHFormValues> {
|
|
13
14
|
/**
|
|
14
15
|
* Array de steps con sus validaciones incluidas
|
|
15
16
|
*/
|
|
16
|
-
steps: StepWithValidation[];
|
|
17
|
+
steps: StepWithValidation<T>[];
|
|
17
18
|
/**
|
|
18
19
|
* Datos adicionales para visibilityCondition (ej: objectId)
|
|
19
20
|
*/
|
package/hooks/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { D as DynamicFilter } from "../../components/DynamicFilter/DynamicFilter
|
|
|
5
5
|
import { D as DynamicSort } from "../../components/DynamicSort/DynamicSort.js";
|
|
6
6
|
import { I as IconButton } from "../../components/mui_extended/IconButton/IconButton.js";
|
|
7
7
|
import { T as ToggleIconButton } from "../../components/mui_extended/ToggleIconButton/ToggleIconButton.js";
|
|
8
|
-
import {
|
|
8
|
+
import { a as getPropDataTestId } from "../../test/getNameDataTestId.js";
|
|
9
9
|
import { C as COOKIE_APPLIED_FILTERS, a as COOKIE_APPLIED_SORTS, M as M4LDYNAMIC_KEY_FILTER_AND_SORT } from "./constants.js";
|
|
10
10
|
import { I as ICON_PATH_FILTER, a as ICON_PATH_SORT, A as ASSETS } from "./icons.js";
|
|
11
11
|
import { D as DynamicFilterAndSortSlots } from "./slots/DynamicFilterAndSortEnum.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useTypedWatch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|