@m4l/components 9.3.10 → 9.3.12-JT270825.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/@types/types.d.ts +207 -61
- package/components/DataGrid/contexts/DataGridContext/index.js +3 -3
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +0 -2
- package/components/DataGrid/types.d.ts +1 -2
- package/components/DynamicFilter/types.d.ts +1 -0
- package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +0 -2
- package/components/Stepper/Stepper.d.ts +8 -0
- package/components/Stepper/Stepper.styles.d.ts +2 -0
- package/components/Stepper/constants.d.ts +2 -0
- package/components/Stepper/dictionary.d.ts +8 -0
- package/components/Stepper/helpers/evaluateVisibilityStepCondition/index.d.ts +9 -0
- package/components/Stepper/helpers/findNextVisibleValidStep/index.d.ts +10 -0
- package/components/Stepper/helpers/findPrevVisibleValidStep/index.d.ts +10 -0
- package/components/Stepper/helpers/index.d.ts +4 -0
- package/components/Stepper/helpers/isLastVisibleValidStep/index.d.ts +10 -0
- package/components/Stepper/hooks/useIsLastVisibleValidStep/index.d.ts +6 -0
- package/components/Stepper/hooks/useStepper/index.d.ts +5 -0
- package/components/Stepper/hooks/useStepperActions/index.d.ts +1 -0
- package/components/Stepper/hooks/useStepperActions/useStepperActions.d.ts +8 -0
- package/components/Stepper/icons.d.ts +9 -0
- package/components/Stepper/index.d.ts +9 -0
- package/components/Stepper/slots/StepperEnum.d.ts +26 -0
- package/components/Stepper/slots/StepperSlot.d.ts +57 -0
- package/components/Stepper/store/StepperContext/index.d.ts +12 -0
- package/components/Stepper/store/StepperStore/index.d.ts +16 -0
- package/components/Stepper/store/types.d.ts +78 -0
- package/components/Stepper/subcomponents/ContentArea/index.d.ts +6 -0
- package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperIcon/index.d.ts +4 -0
- package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperTitle/index.d.ts +4 -0
- package/components/Stepper/subcomponents/StepArea/index.d.ts +6 -0
- package/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.d.ts +5 -0
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +4 -0
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.d.ts +4 -0
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.d.ts +4 -0
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.d.ts +4 -0
- package/components/Stepper/subcomponents/StepperButtons/index.d.ts +4 -0
- package/components/Stepper/subcomponents/StepperContent/index.d.ts +7 -0
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.d.ts +6 -0
- package/components/Stepper/subcomponents/StepperFooter/index.d.ts +6 -0
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterLeftActions/index.d.ts +6 -0
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.d.ts +6 -0
- package/components/Stepper/types.d.ts +156 -0
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +0 -5
- package/components/hook-form/RHFormContext/index.d.ts +1 -1
- package/components/hook-form/RHFormContext/index.js +5 -4
- package/components/hook-form/RHFormContext/types.d.ts +3 -1
- package/components/mui_extended/Select/Select.js +1 -0
- package/components/mui_extended/Select/Select.styles.js +11 -3
- package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +11 -0
- package/helpers/getStepsAndValidationSchema/index.d.ts +1 -0
- package/helpers/getStepsAndValidationSchema/types.d.ts +21 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +2 -1
- package/package.json +1 -1
- package/storybook/components/DataGrid/subcomponents/DataGridRender.d.ts +0 -2
- package/storybook/components/Stepper/Stepper.stories.d.ts +28 -0
- package/storybook/components/Stepper/api/userApi.d.ts +6 -0
- package/storybook/components/Stepper/components/AdminPermissionsStep.d.ts +4 -0
- package/storybook/components/Stepper/components/CompanySocialMediaStep.d.ts +4 -0
- package/storybook/components/Stepper/components/CompanyStep.d.ts +4 -0
- package/storybook/components/Stepper/components/ContactStep.d.ts +4 -0
- package/storybook/components/Stepper/components/ExtraInformationStep.d.ts +4 -0
- package/storybook/components/Stepper/components/ModulePermissionsStep.d.ts +4 -0
- package/storybook/components/Stepper/components/PrivilegesStep.d.ts +4 -0
- package/storybook/components/Stepper/helpers/useSteps.d.ts +43 -0
- package/storybook/components/Stepper/subcomponents/StepperDecorator.d.ts +9 -0
- package/storybook/components/Stepper/validations/CompanyData.d.ts +18 -0
- package/storybook/components/Stepper/validations/ContactData.d.ts +11 -0
- package/storybook/components/Stepper/validations/ExtraInformationData.d.ts +9 -0
- package/storybook/components/Stepper/validations/PrivilegesData.d.ts +14 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slots Stepper
|
|
3
|
+
*/
|
|
4
|
+
export declare const StepperRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
5
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
6
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
7
|
+
export declare const ContentSectionStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
8
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
9
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, keyof import('react').HTMLAttributes<HTMLElement> | keyof import('react').ClassAttributes<HTMLElement>>, {}>;
|
|
10
|
+
export declare const StepAreaStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
11
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
12
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
13
|
+
export declare const ContentAreaStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
14
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
15
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
16
|
+
export declare const StepStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
17
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
18
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
19
|
+
export declare const StepNameStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
20
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
export declare const IndicatorStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
23
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
24
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
25
|
+
export declare const TextNumberStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
26
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
27
|
+
}, {}, {}>;
|
|
28
|
+
export declare const ContentAreaHeaderStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
29
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
30
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
31
|
+
export declare const WrapperIconStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
32
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
33
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
34
|
+
export declare const WrapperTitleStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
35
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
36
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
37
|
+
export declare const IconStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Icon/types').IconProps, keyof import('../../Icon/types').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
38
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
export declare const TitleStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
41
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
42
|
+
}, {}, {}>;
|
|
43
|
+
export declare const DescriptionStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
44
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
45
|
+
}, {}, {}>;
|
|
46
|
+
export declare const StepperFooterSectionStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
47
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
48
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, keyof import('react').HTMLAttributes<HTMLElement> | keyof import('react').ClassAttributes<HTMLElement>>, {}>;
|
|
49
|
+
export declare const StepperFooterLeftActionsStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
50
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
51
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
52
|
+
export declare const StepperFooterRightActionsStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
53
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
54
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
55
|
+
export declare const WrapperButtonsStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
56
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
57
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StepperContextProps } from '../types';
|
|
2
|
+
import { StepperStore } from '../StepperStore';
|
|
3
|
+
declare const StepperContext: import('react').Context<{
|
|
4
|
+
store: StepperStore;
|
|
5
|
+
} | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Contexto que crea y da alcance al Store (Zustand) para ser usado desde cualquier parte del componente.
|
|
8
|
+
* @param props StepperProps
|
|
9
|
+
* @returns Proveedor de contexto, y el contexto
|
|
10
|
+
*/
|
|
11
|
+
declare const StepperProvider: (props: StepperContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { StepperProvider, StepperContext };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InitialStoreProps, StepperStateWithActions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Crea el store de zustand para el componente Stepper
|
|
4
|
+
* @param initProps Variables iniciales que necesita store para poder inicializarlo
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare const createStepperStore: (initProps: InitialStoreProps, storeDevtoolsEnabled?: boolean) => Omit<Omit<import('zustand').StoreApi<StepperStateWithActions>, "setState"> & {
|
|
8
|
+
setState<A extends string | {
|
|
9
|
+
type: unknown;
|
|
10
|
+
}>(partial: StepperStateWithActions | Partial<StepperStateWithActions> | ((state: StepperStateWithActions) => StepperStateWithActions | Partial<StepperStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
11
|
+
}, "setState"> & {
|
|
12
|
+
setState(nextStateOrUpdater: StepperStateWithActions | Partial<StepperStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<StepperStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
13
|
+
type: unknown;
|
|
14
|
+
} | undefined): void;
|
|
15
|
+
};
|
|
16
|
+
export type StepperStore = ReturnType<typeof createStepperStore>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Step, StepperOwnerState, StepperProps } from '../types';
|
|
3
|
+
export interface StepperState extends Pick<StepperProps, 'storeId' | 'visibleTitle' | 'steps' | 'indicatorType' | 'orientation' | 'size' | 'visibilityData'> {
|
|
4
|
+
/**
|
|
5
|
+
* "ownerState" estado a nivel de clases del componente
|
|
6
|
+
*/
|
|
7
|
+
ownerState: StepperOwnerState;
|
|
8
|
+
/**
|
|
9
|
+
* "currentStep" step actual
|
|
10
|
+
*/
|
|
11
|
+
currentStep: number;
|
|
12
|
+
/**
|
|
13
|
+
* "host_static_assets" ruta base de los assets estáticos
|
|
14
|
+
*/
|
|
15
|
+
host_static_assets: string;
|
|
16
|
+
/**
|
|
17
|
+
* "environment_assets" ruta del entorno de assets
|
|
18
|
+
*/
|
|
19
|
+
environment_assets: string;
|
|
20
|
+
/**
|
|
21
|
+
* "completedSteps" pasos completados
|
|
22
|
+
*/
|
|
23
|
+
completedSteps: number[];
|
|
24
|
+
/**
|
|
25
|
+
* "stepValidationStatus" estado de validación por cada step
|
|
26
|
+
* - true: el paso es válido
|
|
27
|
+
*/
|
|
28
|
+
stepValidationStatus: Record<number, boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* "isValidating" indica si el stepper está en proceso de validación
|
|
31
|
+
*/
|
|
32
|
+
isValidating: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface StepperStateWithActions extends StepperState {
|
|
35
|
+
actions: {
|
|
36
|
+
/**
|
|
37
|
+
* inicializa el estado del componente con los steps que provienen desde afuera
|
|
38
|
+
*/
|
|
39
|
+
init: (steps: Array<Step>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Establece el paso actual
|
|
42
|
+
* @param currentStep - Índice del paso actual
|
|
43
|
+
*/
|
|
44
|
+
setCurrentStep: (currentStep: number) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Marca un paso como completado
|
|
47
|
+
* @param stepIndex - Índice del paso
|
|
48
|
+
*/
|
|
49
|
+
setCompletedStep: (stepIndex: number) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Establece el estado de validación de un paso
|
|
52
|
+
* @param stepIndex - Índice del paso
|
|
53
|
+
* @param isValid - Estado de validación del paso
|
|
54
|
+
*/
|
|
55
|
+
setStepValidationStatus: (stepIndex: number, isValid: boolean) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Retrocede al paso anterior válido
|
|
58
|
+
* @param formData - Datos del formulario para evaluar conditions
|
|
59
|
+
* @param visibilityData - Datos adicionales para evaluar conditions
|
|
60
|
+
*/
|
|
61
|
+
prevStep: (formData?: Record<string, any>, visibilityData?: any) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Valida el paso actual y avanza al siguiente si es válido
|
|
64
|
+
* @param validateFn - Función de validación
|
|
65
|
+
* @param formData - Datos del formulario para evaluar conditions
|
|
66
|
+
* @param visibilityData - Datos adicionales para evaluar conditions
|
|
67
|
+
*/
|
|
68
|
+
nextStep: (validateFn: () => Promise<boolean>, formData?: Record<string, any>, visibilityData?: any) => Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* resetStepper - Resetea el Stepper a su estado inicial
|
|
71
|
+
*/
|
|
72
|
+
resetStepper: () => void;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface StepperContextProps extends StepperProps {
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
}
|
|
78
|
+
export type InitialStoreProps = Pick<StepperState, 'ownerState' | 'storeId' | 'steps' | 'visibleTitle' | 'host_static_assets' | 'environment_assets' | 'indicatorType' | 'orientation' | 'visibilityData'>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContentAreaProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* El componente ContentArea renderiza el área de contenido del Stepper.
|
|
4
|
+
* Contiene el encabezado con un icono, titulo y descripción, y el contenido del step actual.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ContentArea(props: ContentAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* El componente StepArea renderiza el área de pasos del Stepper.
|
|
3
|
+
* Muestra solo los pasos que cumplen su condition según los datos del formulario.
|
|
4
|
+
* Utiliza el hook useStepper para obtener el estado actual y los pasos definidos.
|
|
5
|
+
*/
|
|
6
|
+
export declare function StepArea(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StepperContentProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente StepperContent - Contenedor que renderiza todos los Steps
|
|
4
|
+
* Cada Step maneja su propia lógica de renderizado condicional
|
|
5
|
+
* SOLO acepta componentes Step como hijos.
|
|
6
|
+
*/
|
|
7
|
+
export declare function StepperContent(props: StepperContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StepProps } from '../../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente Step - Representa un paso individual en el Stepper
|
|
4
|
+
* Solo se renderiza cuando el step actual coincide con stepKey Y la condition es true
|
|
5
|
+
*/
|
|
6
|
+
export declare function Step(props: StepProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StepperFooterProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* StepperFooter es el componente footer del Stepper que contiene las acciones de navegación.
|
|
4
|
+
* Puede incluir LeftActions y RightActions como children.
|
|
5
|
+
*/
|
|
6
|
+
export declare function StepperFooter(props: StepperFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StepperFooterLeftActionsProps } from '../../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* StepperFooterLeftActions es un componente de guía de estilos para acciones del lado izquierdo del footer del Stepper.
|
|
4
|
+
* Puede recibir children para renderizar contenido personalizado.
|
|
5
|
+
*/
|
|
6
|
+
export declare function StepperFooterLeftActions(props: StepperFooterLeftActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StepperFooterRightActionsProps } from '../../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* StepperFooterRightActions es un componente de guía de estilos para acciones del lado derecho del footer del Stepper.
|
|
4
|
+
* Puede recibir children para renderizar contenido personalizado.
|
|
5
|
+
*/
|
|
6
|
+
export declare function StepperFooterRightActions(props: StepperFooterRightActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { Sizes } from '@m4l/styles';
|
|
4
|
+
import { ContentAreaSlots, ContentSlots, StepperFooterSlots, StepperSlots } from './slots/StepperEnum';
|
|
5
|
+
import { STEPPER_PREFIX_NAME } from './constants';
|
|
6
|
+
import { M4LOverridesStyleRules } from '../../@types/augmentations';
|
|
7
|
+
import { Step as StepComponent } from './subcomponents/StepperContent/subcomponents/Step';
|
|
8
|
+
export type Orientation = 'horizontal' | 'vertical';
|
|
9
|
+
export type IndicatorType = 'number' | 'dot';
|
|
10
|
+
export type FormData = Record<string, string | number | boolean | null | undefined>;
|
|
11
|
+
export type VisibilityData = Record<string, string | number | boolean | null | undefined>;
|
|
12
|
+
export type Step = {
|
|
13
|
+
/**
|
|
14
|
+
* Clave única que identifica el step.
|
|
15
|
+
*/
|
|
16
|
+
key: string;
|
|
17
|
+
/**
|
|
18
|
+
* Título del step.
|
|
19
|
+
*/
|
|
20
|
+
title: string;
|
|
21
|
+
/**
|
|
22
|
+
* Descripción del step.
|
|
23
|
+
*/
|
|
24
|
+
description?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Array con los campos que se deben validar en el step.
|
|
27
|
+
*/
|
|
28
|
+
validationFields?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Función que determina si el step se debe mostrar.
|
|
31
|
+
* @param formData - Datos del formulario.
|
|
32
|
+
* @param visibilityData - Datos adicionales para evaluar visibilidad (ej: objectId).
|
|
33
|
+
* @returns true si el step se debe mostrar, false en caso contrario.
|
|
34
|
+
* Si no se proporciona, el step siempre se muestra.
|
|
35
|
+
*/
|
|
36
|
+
visibilityCondition?: (formData?: FormData, visibilityData?: VisibilityData) => boolean;
|
|
37
|
+
};
|
|
38
|
+
export interface StepperProps {
|
|
39
|
+
/**
|
|
40
|
+
* Children opcional para inyectar componentes adicionales
|
|
41
|
+
*/
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* "storeId" identificador del store
|
|
45
|
+
*/
|
|
46
|
+
storeId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* "storeDevtoolsEnabled" determina si se debe usar devtools para el store
|
|
49
|
+
*/
|
|
50
|
+
storeDevtoolsEnabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* "visibleTitle": Propiedad que ejecuta condición para visualizar los titulos en el SteppArea
|
|
53
|
+
*/
|
|
54
|
+
visibleTitle?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Array con la configuración de cada step.
|
|
57
|
+
*/
|
|
58
|
+
steps: Step[];
|
|
59
|
+
/**
|
|
60
|
+
* Datos adicionales para evaluar visibilityCondition de los steps.
|
|
61
|
+
* Por ejemplo, objectId para determinar si mostrar steps después del submit inicial.
|
|
62
|
+
*/
|
|
63
|
+
visibilityData?: VisibilityData;
|
|
64
|
+
/**
|
|
65
|
+
* Indica que tipo de indicador se usará en el Stepper.
|
|
66
|
+
* Puede ser 'number' para números o 'dot' para puntos.
|
|
67
|
+
*/
|
|
68
|
+
indicatorType?: IndicatorType;
|
|
69
|
+
/**
|
|
70
|
+
* "orientation" define la orientación del Stepper.
|
|
71
|
+
*/
|
|
72
|
+
orientation?: Orientation;
|
|
73
|
+
/**
|
|
74
|
+
* Tamaño del componente, puede ser uno de los valores definidos en 'small' , 'medium'
|
|
75
|
+
*/
|
|
76
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Props del StepperContent
|
|
80
|
+
*/
|
|
81
|
+
export interface StepperContentProps {
|
|
82
|
+
/**
|
|
83
|
+
* Array de componentes Step
|
|
84
|
+
*/
|
|
85
|
+
children: ReactElement<typeof StepComponent>[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Props del Step
|
|
89
|
+
*/
|
|
90
|
+
export interface StepProps {
|
|
91
|
+
/**
|
|
92
|
+
* Clave única del step que determina cuándo se renderiza
|
|
93
|
+
*/
|
|
94
|
+
stepKey: string;
|
|
95
|
+
/**
|
|
96
|
+
* Contenido del step
|
|
97
|
+
*/
|
|
98
|
+
children: ReactNode;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Props del ContentArea
|
|
102
|
+
*/
|
|
103
|
+
export interface ContentAreaProps {
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Props del Indicator
|
|
108
|
+
*/
|
|
109
|
+
export interface IndicatorProps {
|
|
110
|
+
/**
|
|
111
|
+
* El número del paso actual.
|
|
112
|
+
*/
|
|
113
|
+
step: number;
|
|
114
|
+
/**
|
|
115
|
+
* Indica si el paso es el actual.
|
|
116
|
+
*/
|
|
117
|
+
currentStep: number;
|
|
118
|
+
/**
|
|
119
|
+
* El número total de pasos.
|
|
120
|
+
*/
|
|
121
|
+
totalSteps: number;
|
|
122
|
+
/**
|
|
123
|
+
* El índice original del paso en el array completo de pasos.
|
|
124
|
+
* Se usa para buscar el estado de validación en stepValidationStatus.
|
|
125
|
+
*/
|
|
126
|
+
originalStepIndex: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Props del StepperFooter
|
|
130
|
+
*/
|
|
131
|
+
export interface StepperFooterProps {
|
|
132
|
+
children?: ReactNode;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Props del StepperFooterLeftActions
|
|
136
|
+
*/
|
|
137
|
+
export interface StepperFooterLeftActionsProps {
|
|
138
|
+
children?: ReactNode;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Props del StepperFooterRightActions
|
|
142
|
+
*/
|
|
143
|
+
export interface StepperFooterRightActionsProps {
|
|
144
|
+
children?: ReactNode;
|
|
145
|
+
}
|
|
146
|
+
export interface StepperOwnerState extends Pick<StepperProps, 'visibleTitle'> {
|
|
147
|
+
step?: number;
|
|
148
|
+
currentStep?: number;
|
|
149
|
+
totalSteps?: number;
|
|
150
|
+
orientation?: Orientation;
|
|
151
|
+
indicatorType?: IndicatorType;
|
|
152
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
153
|
+
stepValidationStatus?: Record<number, boolean>;
|
|
154
|
+
}
|
|
155
|
+
export type StepperSlotsType = StepperSlots | ContentSlots | ContentAreaSlots | StepperFooterSlots;
|
|
156
|
+
export type StepperStyles = M4LOverridesStyleRules<StepperSlotsType, typeof STEPPER_PREFIX_NAME, Theme>;
|
|
@@ -441,8 +441,8 @@ const createAreasStore = (initProps, storeDevtoolsEnabled = false) => {
|
|
|
441
441
|
bounds: {
|
|
442
442
|
left: MARGIN_GRIDLAYOUT,
|
|
443
443
|
top: MARGIN_GRIDLAYOUT,
|
|
444
|
-
right: -
|
|
445
|
-
bottom: -
|
|
444
|
+
right: -10,
|
|
445
|
+
bottom: -10
|
|
446
446
|
}
|
|
447
447
|
});
|
|
448
448
|
}
|
|
@@ -65,11 +65,6 @@ const RHFAutocompleteAsyncReducer = (onChangeFilterParms) => (state, action) =>
|
|
|
65
65
|
...state,
|
|
66
66
|
isOpen: false
|
|
67
67
|
};
|
|
68
|
-
// case actionsType.SET_SELECTED_OPTIONS_TO_AUTOCOMPLETE:
|
|
69
|
-
// return {
|
|
70
|
-
// ...state,
|
|
71
|
-
// selectedOptions: action.payload,
|
|
72
|
-
// };
|
|
73
68
|
default:
|
|
74
69
|
return state;
|
|
75
70
|
}
|
|
@@ -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 }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues>;
|
|
6
|
+
export declare function useCustomForm({ validationSchema, values, statusLoad, mode }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues>;
|
|
7
7
|
/**
|
|
8
8
|
* TODO: Documentar
|
|
9
9
|
*/
|
|
@@ -6,10 +6,11 @@ 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({ validationSchema, values, statusLoad }) {
|
|
9
|
+
function useCustomForm({ validationSchema, values, statusLoad, mode }) {
|
|
10
10
|
const formMethods = useForm({
|
|
11
11
|
resolver: yupResolver(validationSchema),
|
|
12
|
-
defaultValues: values
|
|
12
|
+
defaultValues: values,
|
|
13
|
+
...mode && { mode }
|
|
13
14
|
});
|
|
14
15
|
useEffect(() => {
|
|
15
16
|
if (statusLoad === "reload_values_provider") {
|
|
@@ -41,8 +42,8 @@ function FormProviderCustom(props) {
|
|
|
41
42
|
return /* @__PURE__ */ jsx(FormProvider, { ...props, children: /* @__PURE__ */ jsx(FormProviderRoot, { className: clsx(classes.root, className), onSubmit: handleSubmit(onSubmit), children }) });
|
|
42
43
|
}
|
|
43
44
|
function RHFormProvider(props) {
|
|
44
|
-
const { children, onSubmit, values, validationSchema, statusLoad = "ready", className } = props;
|
|
45
|
-
const formMethods = useCustomForm({ validationSchema, statusLoad, values });
|
|
45
|
+
const { children, onSubmit, values, validationSchema, statusLoad = "ready", className, mode } = props;
|
|
46
|
+
const formMethods = useCustomForm({ validationSchema, statusLoad, values, mode });
|
|
46
47
|
return /* @__PURE__ */ jsx(
|
|
47
48
|
FormProviderCustom,
|
|
48
49
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { FieldValues, FormProviderProps as RHFormProviderProps } from 'react-hook-form';
|
|
2
|
+
import { FieldValues, FormProviderProps as RHFormProviderProps, Mode } from 'react-hook-form';
|
|
3
3
|
export type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
|
|
4
4
|
export type FormInitialValues = FieldValues;
|
|
5
5
|
export interface FormProviderProps {
|
|
@@ -9,10 +9,12 @@ export interface FormProviderProps {
|
|
|
9
9
|
validationSchema: any;
|
|
10
10
|
statusLoad?: FormStatusLoad;
|
|
11
11
|
className?: string;
|
|
12
|
+
mode?: Mode;
|
|
12
13
|
}
|
|
13
14
|
export type FormProviderCustomProps = RHFormProviderProps & FormProviderProps;
|
|
14
15
|
export interface CustomFormArguments {
|
|
15
16
|
values: FormInitialValues;
|
|
16
17
|
validationSchema: any;
|
|
17
18
|
statusLoad?: FormStatusLoad;
|
|
19
|
+
mode?: Mode;
|
|
18
20
|
}
|
|
@@ -35,7 +35,12 @@ const selectStyles = {
|
|
|
35
35
|
},
|
|
36
36
|
"& .MuiSelect-select": {
|
|
37
37
|
padding: `${theme.vars.size.baseSpacings.sp1}!important`,
|
|
38
|
-
minHeight: "unset"
|
|
38
|
+
minHeight: "unset",
|
|
39
|
+
maxHeight: "80px",
|
|
40
|
+
overflow: "auto",
|
|
41
|
+
boxSizing: "border-box",
|
|
42
|
+
display: "flex",
|
|
43
|
+
flexDirection: "column"
|
|
39
44
|
},
|
|
40
45
|
// Estilos para la variante text
|
|
41
46
|
[`&.${SELECT_CLASSES.text}`]: {
|
|
@@ -69,7 +74,8 @@ const selectStyles = {
|
|
|
69
74
|
(height) => {
|
|
70
75
|
return {
|
|
71
76
|
minHeight: height,
|
|
72
|
-
|
|
77
|
+
height: "fit-content",
|
|
78
|
+
maxHeight: "80px"
|
|
73
79
|
};
|
|
74
80
|
}
|
|
75
81
|
)
|
|
@@ -88,7 +94,9 @@ const selectStyles = {
|
|
|
88
94
|
display: "flex",
|
|
89
95
|
alignItems: "center",
|
|
90
96
|
gap: theme.vars.size.baseSpacings.sp1,
|
|
91
|
-
flexWrap: "wrap"
|
|
97
|
+
flexWrap: "wrap",
|
|
98
|
+
overflow: "auto",
|
|
99
|
+
flexShrink: 1
|
|
92
100
|
}),
|
|
93
101
|
arrowDown: {},
|
|
94
102
|
renderValueTypography: () => ({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Step } from '../../components/Stepper/types';
|
|
2
|
+
import { GetStepsAndValidationSchemaProps } from './types';
|
|
3
|
+
import * as Yup from 'yup';
|
|
4
|
+
/**
|
|
5
|
+
* Hook personalizado que recibe un array de steps con validaciones y regresa todo listo para el Stepper
|
|
6
|
+
* Una sola configuración genera: validationSchema + steps + validationFields automáticamente
|
|
7
|
+
*/
|
|
8
|
+
export declare function getStepsAndValidationSchema({ steps, visibilityData, }: GetStepsAndValidationSchemaProps): {
|
|
9
|
+
validationSchema: Yup.ObjectSchema<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, Record<string, any>>, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, Record<string, any>>>, import('yup/lib/object').AssertsShape<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, Record<string, any>>>>;
|
|
10
|
+
steps: Step[];
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getStepsAndValidationSchema } from './getStepsAndValidationSchema';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Step } from '../../components/Stepper/types';
|
|
2
|
+
/**
|
|
3
|
+
* Configuración completa de un step con validaciones incluidas
|
|
4
|
+
*/
|
|
5
|
+
export interface StepWithValidation extends Omit<Step, 'validationFields'> {
|
|
6
|
+
/**
|
|
7
|
+
* Función de validación que retorna un objeto con esquemas Yup
|
|
8
|
+
* Ejemplo: ContactDataValidation
|
|
9
|
+
*/
|
|
10
|
+
validationFunction?: () => Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
export interface GetStepsAndValidationSchemaProps {
|
|
13
|
+
/**
|
|
14
|
+
* Array de steps con sus validaciones incluidas
|
|
15
|
+
*/
|
|
16
|
+
steps: StepWithValidation[];
|
|
17
|
+
/**
|
|
18
|
+
* Datos adicionales para visibilityCondition (ej: objectId)
|
|
19
|
+
*/
|
|
20
|
+
visibilityData?: any;
|
|
21
|
+
}
|
|
@@ -389,7 +389,8 @@ const useDynamicFilterAndSort = (props) => {
|
|
|
389
389
|
return {
|
|
390
390
|
filterColumns: fields.map((filter) => ({
|
|
391
391
|
name: filter.name,
|
|
392
|
-
multiple: filter.multiple || false
|
|
392
|
+
multiple: filter.multiple || false,
|
|
393
|
+
skipColumnValidation: filter.skipColumnValidation || false
|
|
393
394
|
})),
|
|
394
395
|
filtersApplied: getCurrentFilters().map((filter) => ({
|
|
395
396
|
columnKey: filter.field.name,
|
package/package.json
CHANGED
|
@@ -10,8 +10,6 @@ interface DataGridRenderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> {
|
|
|
10
10
|
visibleRefreshFilterSort?: boolean;
|
|
11
11
|
withExternalSortSettings?: boolean;
|
|
12
12
|
withExternalFilterSettings?: boolean;
|
|
13
|
-
skipSortValidation?: boolean;
|
|
14
|
-
skipFilterValidation?: boolean;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* Componente que renderiza el DataGrid para el storybook
|