@bolttech/form-engine 3.0.0-beta.47 → 3.0.0-beta.49
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/index.esm.js
CHANGED
|
@@ -2388,9 +2388,9 @@ function useForm(_a) {
|
|
|
2388
2388
|
id,
|
|
2389
2389
|
onData,
|
|
2390
2390
|
onSubmit,
|
|
2391
|
-
|
|
2391
|
+
onFormMount
|
|
2392
2392
|
} = _a,
|
|
2393
|
-
rest = __rest(_a, ["id", "onData", "onSubmit", "
|
|
2393
|
+
rest = __rest(_a, ["id", "onData", "onSubmit", "onFormMount"]);
|
|
2394
2394
|
const {
|
|
2395
2395
|
formGroupInstance
|
|
2396
2396
|
} = useFormGroupContext({});
|
|
@@ -2404,15 +2404,15 @@ function useForm(_a) {
|
|
|
2404
2404
|
const formValuesCallbackRefs = useRef({
|
|
2405
2405
|
onData,
|
|
2406
2406
|
onSubmit,
|
|
2407
|
-
|
|
2407
|
+
onFormMount
|
|
2408
2408
|
});
|
|
2409
2409
|
useEffect(() => {
|
|
2410
2410
|
formValuesCallbackRefs.current = {
|
|
2411
2411
|
onData,
|
|
2412
2412
|
onSubmit,
|
|
2413
|
-
|
|
2413
|
+
onFormMount
|
|
2414
2414
|
};
|
|
2415
|
-
}, [onData, onSubmit,
|
|
2415
|
+
}, [onData, onSubmit, onFormMount]);
|
|
2416
2416
|
/**
|
|
2417
2417
|
* handle function call after the debounce occurs on the form instance field event
|
|
2418
2418
|
* subject in order to call the most updated function with the updated function
|
|
@@ -2439,7 +2439,7 @@ function useForm(_a) {
|
|
|
2439
2439
|
const mountCallback = payload => {
|
|
2440
2440
|
var _a, _b;
|
|
2441
2441
|
if (formValuesCallbackRefs.current.onMount) {
|
|
2442
|
-
(_b = (_a = formValuesCallbackRefs.current).
|
|
2442
|
+
(_b = (_a = formValuesCallbackRefs.current).onFormMount) === null || _b === void 0 ? void 0 : _b.call(_a, payload);
|
|
2443
2443
|
}
|
|
2444
2444
|
};
|
|
2445
2445
|
const mountSub = (_a = formGroupInstance.getForm({
|
|
@@ -2485,6 +2485,7 @@ function Form({
|
|
|
2485
2485
|
action,
|
|
2486
2486
|
method,
|
|
2487
2487
|
onSubmit,
|
|
2488
|
+
onFormMount,
|
|
2488
2489
|
onData,
|
|
2489
2490
|
onBlur,
|
|
2490
2491
|
onChange,
|
|
@@ -2526,8 +2527,8 @@ function Form({
|
|
|
2526
2527
|
formInstance
|
|
2527
2528
|
});
|
|
2528
2529
|
let subMounted;
|
|
2529
|
-
if (
|
|
2530
|
-
subMounted = formInstance.subscribeOnMount(
|
|
2530
|
+
if (onFormMount) {
|
|
2531
|
+
subMounted = formInstance.subscribeOnMount(onFormMount);
|
|
2531
2532
|
}
|
|
2532
2533
|
formInstance === null || formInstance === void 0 ? void 0 : formInstance.mounted();
|
|
2533
2534
|
/*
|
|
@@ -2604,6 +2605,7 @@ function Form({
|
|
|
2604
2605
|
onKeyUp,
|
|
2605
2606
|
onMount,
|
|
2606
2607
|
onSubmit,
|
|
2608
|
+
onFormMount,
|
|
2607
2609
|
onData
|
|
2608
2610
|
});
|
|
2609
2611
|
/*
|
package/package.json
CHANGED
|
@@ -5,5 +5,5 @@ import { TFormProps } from './Form.type';
|
|
|
5
5
|
* @param {TFormProps} param form properties initializor
|
|
6
6
|
* @returns {ReactElement}
|
|
7
7
|
*/
|
|
8
|
-
declare function Form<T>({ schema, index, initialValues, iVars, action, method, onSubmit, onData, onBlur, onChange, onApiResponse, onClick, onFocus, onKeyDown, onKeyUp, onMount, children, }: TFormProps<T>): ReactElement;
|
|
8
|
+
declare function Form<T>({ schema, index, initialValues, iVars, action, method, onSubmit, onFormMount, onData, onBlur, onChange, onApiResponse, onClick, onFocus, onKeyDown, onKeyUp, onMount, children, }: TFormProps<T>): ReactElement;
|
|
9
9
|
export default Form;
|
|
@@ -2,5 +2,5 @@ import { TUseFormProps } from './useForm.type';
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook to register events callback functions
|
|
4
4
|
*/
|
|
5
|
-
declare function useForm<T>({ id, onData, onSubmit,
|
|
5
|
+
declare function useForm<T>({ id, onData, onSubmit, onFormMount, ...rest }: TUseFormProps<T>): void;
|
|
6
6
|
export default useForm;
|
package/src/types/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ type TFormData<T> = {
|
|
|
24
24
|
* Represents a mapping of event properties to their corresponding callback functions.
|
|
25
25
|
*/
|
|
26
26
|
type TEventsCallbackProps<T> = Partial<Record<TEventProps, ((payload: TFieldEvent) => void) | null | undefined>> & {
|
|
27
|
-
|
|
27
|
+
onFormMount?: (payload: TFormValues<T>) => void;
|
|
28
28
|
onData?: (payload: TFormData<T>) => void;
|
|
29
29
|
onSubmit?: (payload: TFormValues<T>) => void;
|
|
30
30
|
};
|