@bolttech/form-engine 3.1.0-beta.2 → 3.1.0-beta.20
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 +671 -1278
- package/package.json +3 -4
- package/src/components/AsFormFieldBuilder/AsFormFieldBuilder.type.d.ts +1 -0
- package/src/components/FieldWrapper/FieldWrapper.d.ts +1 -1
- package/src/components/FieldWrapper/FieldWrapper.type.d.ts +6 -2
- package/src/context/FormGroupContext.type.d.ts +3 -3
- package/src/generators/formBuilder.d.ts +8 -25
- package/src/helpers/mapper.d.ts +2 -1
- package/src/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/form-engine",
|
|
3
|
-
"version": "3.1.0-beta.
|
|
3
|
+
"version": "3.1.0-beta.20",
|
|
4
4
|
"description": "A react adapter for bolttech form engine",
|
|
5
5
|
"module": "./index.esm.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.esm.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@bolttech/form-engine-core": "1.0.0-beta.
|
|
10
|
-
"react": "18.2.0"
|
|
11
|
-
"rxjs": "7.8.1"
|
|
9
|
+
"@bolttech/form-engine-core": "1.0.0-beta.20",
|
|
10
|
+
"react": "18.2.0"
|
|
12
11
|
},
|
|
13
12
|
"peerDependencies": {}
|
|
14
13
|
}
|
|
@@ -7,5 +7,5 @@ import { TFieldWrapperProps } from './FieldWrapper.type';
|
|
|
7
7
|
* @param {TFieldWrapperProps} param FieldWrapper params
|
|
8
8
|
* @returns {ReactElement}
|
|
9
9
|
*/
|
|
10
|
-
declare const FieldWrapper: ({ name, formIndex, children, props, context, }: TFieldWrapperProps) => ReactElement;
|
|
10
|
+
declare const FieldWrapper: ({ name, formIndex, children, props, context, mounted, mapper, visibility, }: TFieldWrapperProps) => ReactElement;
|
|
11
11
|
export default FieldWrapper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { ElementType, PropsWithChildren } from 'react';
|
|
2
2
|
import { TFieldWrapper } from '../../types';
|
|
3
3
|
import { TFormContext } from '../../context/FormGroupContext';
|
|
4
|
-
import { FormField } from '@bolttech/form-engine-core';
|
|
4
|
+
import { FormField, TMapper } from '@bolttech/form-engine-core';
|
|
5
5
|
/**
|
|
6
6
|
* Represents the props for a field wrapper component, including children.
|
|
7
7
|
*
|
|
@@ -13,6 +13,9 @@ import { FormField } from '@bolttech/form-engine-core';
|
|
|
13
13
|
type TFieldWrapperProps = PropsWithChildren<TFieldWrapper & {
|
|
14
14
|
props?: Record<string, unknown>;
|
|
15
15
|
context?: TFormContext | null;
|
|
16
|
+
mounted?: boolean;
|
|
17
|
+
mapper?: TMapper<ElementType>;
|
|
18
|
+
visibility?: boolean;
|
|
16
19
|
}>;
|
|
17
20
|
/**
|
|
18
21
|
* Represents the props for rendering a field wrapper component, including children.
|
|
@@ -24,5 +27,6 @@ type TFieldWrapperProps = PropsWithChildren<TFieldWrapper & {
|
|
|
24
27
|
type TFieldWrapperComponentRenderProps = PropsWithChildren<{
|
|
25
28
|
props: Record<string, unknown>;
|
|
26
29
|
fieldInstance?: FormField;
|
|
30
|
+
mapper?: TMapper<ElementType>;
|
|
27
31
|
}>;
|
|
28
32
|
export type { TFieldWrapperProps, TFieldWrapperComponentRenderProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormCore,
|
|
1
|
+
import { FormCore, TFormEntry, TFormGroup, TFormValues, TMapper, TSchemaFormConfig } from '@bolttech/form-engine-core';
|
|
2
2
|
import { ElementType } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Represents the context for managing forms within a form group.
|
|
@@ -18,7 +18,7 @@ type TFormContext = {
|
|
|
18
18
|
addFormWithIndex: (index: string) => void;
|
|
19
19
|
addForm: (payload: {
|
|
20
20
|
key: string;
|
|
21
|
-
|
|
21
|
+
params: TFormEntry;
|
|
22
22
|
}) => void;
|
|
23
23
|
getForm: (payload: {
|
|
24
24
|
key: string;
|
|
@@ -29,7 +29,7 @@ type TFormContext = {
|
|
|
29
29
|
formGroupInstance: TFormGroup;
|
|
30
30
|
mappers?: TMapper<ElementType>[];
|
|
31
31
|
printFormGroupInstance: () => void;
|
|
32
|
-
submitMultipleFormsByIndex: (indexes: string[]) => void;
|
|
32
|
+
submitMultipleFormsByIndex: <T>(indexes: string[], callback?: (payload: TFormValues<T>) => void) => void;
|
|
33
33
|
debugMode: boolean;
|
|
34
34
|
active: boolean;
|
|
35
35
|
config?: TSchemaFormConfig;
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import { ElementType
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* @param {Map<string,IFormField>} param.fields form instance field Map
|
|
8
|
-
* @param {string} param.prevPath previous field path to track the tree branch creation
|
|
9
|
-
* @param {string} param.formIndex form index to aid field identification onto the FieldWrapper
|
|
10
|
-
* @returns {ReactNode}
|
|
11
|
-
*/
|
|
12
|
-
declare const BuildTree: ({ fields, prevPath, formIndex, }: {
|
|
13
|
-
fields: Map<string, IFormField>;
|
|
14
|
-
prevPath?: string | undefined;
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { TMapper, IComponentSchema } from '@bolttech/form-engine-core';
|
|
3
|
+
declare const BuildSchemaAsFields: ({ components, mappers, formIndex, mountedForm, }: {
|
|
4
|
+
components?: IComponentSchema[] | undefined;
|
|
5
|
+
mappers?: TMapper<ElementType>[] | undefined;
|
|
15
6
|
formIndex: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* @param param.children ReactNode children elements
|
|
21
|
-
* @returns {IComponentSchema[] | null | undefined}
|
|
22
|
-
*/
|
|
23
|
-
declare const BuildAsFormFieldTree: ({ children, }: {
|
|
24
|
-
children?: ReactNode;
|
|
25
|
-
}) => IComponentSchemaAsFormField<ElementType>[] | null | undefined;
|
|
26
|
-
export { BuildTree, BuildAsFormFieldTree };
|
|
7
|
+
mountedForm: boolean;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element[] | undefined;
|
|
9
|
+
export { BuildSchemaAsFields };
|
package/src/helpers/mapper.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { TValueChangeEvent } from '@bolttech/form-engine-core';
|
|
|
2
2
|
declare const defaultChangeEvent: TValueChangeEvent;
|
|
3
3
|
declare const checkedChangeEvent: TValueChangeEvent;
|
|
4
4
|
declare const valueChangeEvent: TValueChangeEvent;
|
|
5
|
+
declare const numberInputChangeEvent: TValueChangeEvent;
|
|
5
6
|
declare const datepickerChangeEvent: TValueChangeEvent;
|
|
6
7
|
declare const dropdownChangeEvent: TValueChangeEvent;
|
|
7
|
-
export { defaultChangeEvent, checkedChangeEvent, valueChangeEvent, datepickerChangeEvent, dropdownChangeEvent, };
|
|
8
|
+
export { defaultChangeEvent, checkedChangeEvent, valueChangeEvent, numberInputChangeEvent, datepickerChangeEvent, dropdownChangeEvent, };
|
package/src/types/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type TFieldWrapper = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents the possible event properties for form fields callbacks.
|
|
14
14
|
*/
|
|
15
|
-
type TEventProps = 'onChange' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onMount' | 'onApiResponse' | 'onClick';
|
|
15
|
+
type TEventProps = 'onChange' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onMount' | 'onApiResponse' | 'onApiRequest' | 'onClick' | 'onFieldCleared';
|
|
16
16
|
/**
|
|
17
17
|
* Represents the content inside onData payload action.
|
|
18
18
|
*/
|