@bolttech/form-engine 0.14.3 → 3.0.0-beta.2
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/README.md +2 -1628
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1683 -0
- package/package.json +15 -16
- package/src/components/AsFormField/AsFormField.d.ts +4 -0
- package/src/components/FieldWrapper/FieldWrapper.d.ts +4 -0
- package/src/components/Form/Form.d.ts +4 -0
- package/src/components/index.d.ts +2 -0
- package/src/context/FormGroupContext.d.ts +27 -0
- package/src/generators/formBuilder.d.ts +11 -0
- package/src/index.d.ts +3 -3
- package/src/types/index.d.ts +47 -0
- package/CHANGELOG.md +0 -529
- package/asFormField-3108e669.js +0 -2
- package/asFormField-3108e669.js.map +0 -1
- package/index.js +0 -2
- package/index.js.map +0 -1
- package/react.js +0 -2
- package/react.js.map +0 -1
- package/src/adapters/react/Field.d.ts +0 -4
- package/src/adapters/react/Form.d.ts +0 -5
- package/src/adapters/react/Submit.d.ts +0 -3
- package/src/adapters/react/asFormField.d.ts +0 -4
- package/src/adapters/react/context.d.ts +0 -5
- package/src/adapters/react/index.d.ts +0 -7
- package/src/adapters/react/types.d.ts +0 -326
- package/src/adapters/react/useForceUpdate.d.ts +0 -3
- package/src/adapters/react/useForm.d.ts +0 -12
- package/src/adapters/react/useFormGroup.d.ts +0 -3
- package/src/core/apis/formatters.d.ts +0 -16
- package/src/core/apis/index.d.ts +0 -4
- package/src/core/apis/masks.d.ts +0 -3
- package/src/core/apis/validations.d.ts +0 -11
- package/src/core/apis/varOps.d.ts +0 -4
- package/src/core/constants/events.d.ts +0 -32
- package/src/core/constants/index.d.ts +0 -5
- package/src/core/constants/observer.d.ts +0 -7
- package/src/core/events/ObserverError.d.ts +0 -7
- package/src/core/events/events.types.d.ts +0 -27
- package/src/core/events/index.d.ts +0 -2
- package/src/core/handlers/common/templating.d.ts +0 -2
- package/src/core/handlers/field/api.d.ts +0 -4
- package/src/core/handlers/field/blur.d.ts +0 -2
- package/src/core/handlers/field/change.d.ts +0 -2
- package/src/core/handlers/field/clearFields.d.ts +0 -4
- package/src/core/handlers/field/data.d.ts +0 -3
- package/src/core/handlers/field/filter.d.ts +0 -2
- package/src/core/handlers/field/focus.d.ts +0 -2
- package/src/core/handlers/field/formatters.d.ts +0 -4
- package/src/core/handlers/field/htmlEventParser.d.ts +0 -6
- package/src/core/handlers/field/keydown.d.ts +0 -2
- package/src/core/handlers/field/keyup.d.ts +0 -2
- package/src/core/handlers/field/masks.d.ts +0 -4
- package/src/core/handlers/field/mount.d.ts +0 -2
- package/src/core/handlers/field/validations.d.ts +0 -4
- package/src/core/handlers/field/visibilityConditions.d.ts +0 -4
- package/src/core/handlers/flows.d.ts +0 -47
- package/src/core/handlers/form/bindFields.d.ts +0 -3
- package/src/core/handlers/form/hooks.d.ts +0 -3
- package/src/core/handlers/form/steps.d.ts +0 -2
- package/src/core/handlers/form/templating.d.ts +0 -2
- package/src/core/handlers/form/validate.d.ts +0 -2
- package/src/core/handlers/form/visibilityConditions.d.ts +0 -4
- package/src/core/index.d.ts +0 -3
- package/src/core/managers/Base.d.ts +0 -19
- package/src/core/managers/Factory.d.ts +0 -52
- package/src/core/managers/Field.d.ts +0 -33
- package/src/core/managers/Form.d.ts +0 -28
- package/src/core/managers/Scope.d.ts +0 -12
- package/src/core/managers/index.d.ts +0 -1
- package/src/core/types/index.d.ts +0 -937
- package/src/core/utils/common.d.ts +0 -9
- package/src/core/utils/credit-card.d.ts +0 -16
- package/src/core/utils/index.d.ts +0 -6
- package/src/core/utils/object.d.ts +0 -27
- package/src/core/utils/string.d.ts +0 -3
- package/src/core/utils/value.d.ts +0 -2
- package/types.js +0 -2
- package/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/form-engine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A
|
|
5
|
-
"type": "
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
|
+
"description": "A react adapter for bolttech form engine",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"types": "./src/index.d.ts",
|
|
9
|
-
"import": "./index.js",
|
|
10
|
-
"require": "./index.js",
|
|
11
|
-
"default": "./index.js"
|
|
8
|
+
"types": "./src/index.esm.d.ts",
|
|
9
|
+
"import": "./index.esm.js",
|
|
10
|
+
"require": "./index.esm.js",
|
|
11
|
+
"default": "./index.esm.js"
|
|
12
12
|
},
|
|
13
|
-
"./
|
|
14
|
-
"./src/adapters/react": "./react.js"
|
|
13
|
+
"./types": "./types.js"
|
|
15
14
|
},
|
|
16
15
|
"typesVersions": {
|
|
17
16
|
"*": {
|
|
@@ -20,19 +19,19 @@
|
|
|
20
19
|
]
|
|
21
20
|
}
|
|
22
21
|
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@exchange-portal/form-engine-core": "dist/libs/form-engine-core/index.cjs.js"
|
|
24
|
+
},
|
|
23
25
|
"keywords": [
|
|
24
26
|
"bolttech",
|
|
25
27
|
"edirect",
|
|
26
|
-
"form-
|
|
28
|
+
"form-builder",
|
|
29
|
+
"react",
|
|
27
30
|
"forms",
|
|
28
|
-
"reactjs",
|
|
29
31
|
"low-code"
|
|
30
32
|
],
|
|
31
33
|
"author": "bolttech",
|
|
32
34
|
"license": "ISC",
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
"main": "./index.cjs",
|
|
37
|
-
"types": "./src/index.d.ts"
|
|
35
|
+
"module": "./index.esm.js",
|
|
36
|
+
"main": "./index.esm.js"
|
|
38
37
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TFormEntry } from '@exchange-portal/form-engine-core';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
declare const Form: ({ schema, index, initialValues, iVars, action, method, onSubmit, onData, children, }: PropsWithChildren<Omit<TFormEntry, 'mappers'>>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default Form;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FormCore, TFormCore, TFormGroup, TFormValues, TMapper } from '@exchange-portal/form-engine-core';
|
|
2
|
+
import { ElementType, PropsWithChildren, ReactElement } from 'react';
|
|
3
|
+
type TFormContext = {
|
|
4
|
+
addForm: (payload: {
|
|
5
|
+
key: string;
|
|
6
|
+
formInstance: TFormCore;
|
|
7
|
+
}) => void;
|
|
8
|
+
getForm: (payload: {
|
|
9
|
+
key: string;
|
|
10
|
+
}) => FormCore | undefined;
|
|
11
|
+
removeForm: (payload: {
|
|
12
|
+
key: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
formGroupInstance: TFormGroup;
|
|
15
|
+
mappers: TMapper<ElementType>[];
|
|
16
|
+
printFormGroupInstance: () => void;
|
|
17
|
+
submitMultipleFormsByIndex: (indexes: string[]) => TFormValues;
|
|
18
|
+
debugMode: boolean;
|
|
19
|
+
};
|
|
20
|
+
type TFormContextProvider = {
|
|
21
|
+
mappers: TMapper<ElementType>[];
|
|
22
|
+
debugMode?: boolean;
|
|
23
|
+
};
|
|
24
|
+
declare const FormGroupContext: import("react").Context<TFormContext>;
|
|
25
|
+
declare const FormGroupContextProvider: ({ children, mappers, debugMode, }: PropsWithChildren<TFormContextProvider>) => ReactElement;
|
|
26
|
+
declare const useFormGroupContext: () => TFormContext;
|
|
27
|
+
export { FormGroupContext, FormGroupContextProvider, useFormGroupContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { IFormField, IComponentSchema } from '@exchange-portal/form-engine-core';
|
|
3
|
+
declare const BuildTree: ({ fields, prevPath, formKey, }: {
|
|
4
|
+
fields: Map<string, IFormField>;
|
|
5
|
+
prevPath?: string | undefined;
|
|
6
|
+
formKey: string;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
declare const BuildAsFormFieldTree: ({ children, }: {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}) => IComponentSchema[] | null | undefined;
|
|
11
|
+
export { BuildTree, BuildAsFormFieldTree };
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './context/FormGroupContext';
|
|
3
|
+
export * from './types';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TComponentPropsMapping } from '@exchange-portal/form-engine-core';
|
|
2
|
+
import { ElementType } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* @type TFieldWrapper
|
|
5
|
+
* Represents the wrapper for a form field, including the component,
|
|
6
|
+
* event handlers, and other properties related to form management.
|
|
7
|
+
*
|
|
8
|
+
* @property {string} index - The index of the field in the form.
|
|
9
|
+
* @property {ElementType} Component - The component to be rendered.
|
|
10
|
+
* @property {(event: unknown) => unknown} [valueChangeEvent] - Function to handle value change events.
|
|
11
|
+
* @property {string} formKey - The key of the form.
|
|
12
|
+
* @property {string} [onBlur] - Function to handle the blur event.
|
|
13
|
+
* @property {string} [onChange] - Function to handle the change event.
|
|
14
|
+
* @property {string} [onFocus] - Function to handle the focus event.
|
|
15
|
+
* @property {string} [onClick] - Function to handle the click event.
|
|
16
|
+
* @property {string} [onKeyUp] - Function to handle the keyup event.
|
|
17
|
+
* @property {string} [onKeyDown] - Function to handle the keydown event.
|
|
18
|
+
* @property {unknown} [onValue] - The current value of the field.
|
|
19
|
+
* @property {string} [onErrorMessage] - error message prop name to set message string
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const fieldWrapper: TFieldWrapper = {
|
|
24
|
+
* index: '1',
|
|
25
|
+
* Component: MyComponent,
|
|
26
|
+
* valueChangeEvent: (event) => {
|
|
27
|
+
* const newValue = (event as React.ChangeEvent<HTMLInputElement>).target.value;
|
|
28
|
+
* return newValue;
|
|
29
|
+
* },
|
|
30
|
+
* formKey: 'myForm',
|
|
31
|
+
* onBlur: 'handleBlur',
|
|
32
|
+
* onChange: 'handleChange',
|
|
33
|
+
* onFocus: 'handleFocus',
|
|
34
|
+
* onClick: 'handleClick',
|
|
35
|
+
* onKeyUp: 'handleKeyUp',
|
|
36
|
+
* onKeyDown: 'handleKeyDown',
|
|
37
|
+
* onValue: 'value'
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
type TFieldWrapper = {
|
|
42
|
+
index: string;
|
|
43
|
+
Component: ElementType;
|
|
44
|
+
formKey: string;
|
|
45
|
+
events?: TComponentPropsMapping;
|
|
46
|
+
};
|
|
47
|
+
export { TFieldWrapper };
|