@arquimedes.co/eureka-forms 2.0.0-test → 2.0.2-test
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.
|
@@ -13,4 +13,5 @@ export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<str
|
|
|
13
13
|
steps: Record<string, FormStep>;
|
|
14
14
|
};
|
|
15
15
|
export declare function calcRecursiveData<Type>(element: Readonly<MapperElement<Type>>, newSteps: Record<string, FormStep>, customSteps: Record<string, CustomStep>): void;
|
|
16
|
+
export declare const mapOriginalValue: (step: FormStep, value: any, values: ValuesStore, form?: Form) => any;
|
|
16
17
|
export declare const calcInitialSections: (form: Form) => Pick<SiteState, 'previousSections' | 'idCurrentSection' | 'nextSections'>;
|
package/dist/App/AppFunctions.js
CHANGED
|
@@ -103,7 +103,7 @@ export function calcRecursiveData(element, newSteps, customSteps) {
|
|
|
103
103
|
calcSubSteps(step, function (idStep) { var _a; return (_a = element.ids[idStep]) !== null && _a !== void 0 ? _a : idStep; });
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
var mapOriginalValue = function (step, value, values, form) {
|
|
106
|
+
export var mapOriginalValue = function (step, value, values, form) {
|
|
107
107
|
var _a, _b, _c, _d, _e, _f;
|
|
108
108
|
if (!value)
|
|
109
109
|
return value;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
3
2
|
import { StepProps } from './Step';
|
|
4
3
|
import { Form } from '../@Types';
|
|
5
4
|
import { GlobalState } from '../States/GlobalStateReducer';
|
|
6
|
-
|
|
5
|
+
import { WidthStats } from '../Form/Form';
|
|
6
|
+
export interface CustomStepProps extends StepProps, GlobalState {
|
|
7
7
|
form: Form;
|
|
8
8
|
customStepProps: Record<string, any>;
|
|
9
|
+
widthStats: WidthStats;
|
|
9
10
|
}
|
|
10
11
|
export interface CustomStep {
|
|
11
12
|
componentProps?: Record<string, any>;
|
|
12
|
-
originalValues: Record<string, any>;
|
|
13
13
|
component: (props: CustomStepProps) => JSX.Element;
|
|
14
14
|
calcValue?: (step: any, value: any) => any;
|
|
15
15
|
/** Function to change custom steps nested step ids to the generated ones. */
|
|
@@ -20,7 +20,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import { useFormContext } from 'react-hook-form';
|
|
24
23
|
import FormContext from '../Contexts/FormContext';
|
|
25
24
|
import { useAppSelector } from '../hooks';
|
|
26
25
|
import CustomStepPropsContext from '../Contexts/CustomContext';
|
|
@@ -31,7 +30,7 @@ function CustomStepComponent(_a) {
|
|
|
31
30
|
var form = useContext(FormContext);
|
|
32
31
|
var global = useAppSelector(function (state) { return state.global; });
|
|
33
32
|
var customStepProps = useContext(CustomStepPropsContext);
|
|
34
|
-
var
|
|
35
|
-
return customStep.component(__assign(__assign(__assign(__assign(
|
|
33
|
+
var widthStats = useAppSelector(function (state) { return state.widthStats; });
|
|
34
|
+
return customStep.component(__assign(__assign(__assign(__assign({}, props), { widthStats: widthStats, form: form, customStepProps: customStepProps }), global), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
|
|
36
35
|
}
|
|
37
36
|
export default CustomStepComponent;
|
package/package.json
CHANGED