@bolttech/form-engine 3.0.0-beta.52 → 3.0.0-beta.54
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
|
@@ -2924,6 +2924,20 @@ const AsFormFieldBuilder = props => {
|
|
|
2924
2924
|
}
|
|
2925
2925
|
field === null || field === void 0 ? void 0 : field.propsSubject$.next(Object.assign(Object.assign({}, fieldProps), props.props));
|
|
2926
2926
|
}, [props.props]);
|
|
2927
|
+
useEffect(() => {
|
|
2928
|
+
var _a, _b;
|
|
2929
|
+
if (!props.onSelected) return;
|
|
2930
|
+
(_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2931
|
+
const callback = payload => {
|
|
2932
|
+
if (props.onSelected) {
|
|
2933
|
+
props.onSelected(payload);
|
|
2934
|
+
}
|
|
2935
|
+
};
|
|
2936
|
+
const sub = (_b = context.formGroupInstance.forms.get(props.formIndex)) === null || _b === void 0 ? void 0 : _b.subscribeFieldEvent({
|
|
2937
|
+
callback
|
|
2938
|
+
});
|
|
2939
|
+
return () => sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
|
|
2940
|
+
}, [props.onSelected]);
|
|
2927
2941
|
/**
|
|
2928
2942
|
* allows to control field visibility as a controlled component
|
|
2929
2943
|
*/
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/form-engine",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.54",
|
|
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": "0.0.1-beta.
|
|
9
|
+
"@bolttech/form-engine-core": "0.0.1-beta.39",
|
|
10
10
|
"react": "18.2.0",
|
|
11
11
|
"rxjs": "7.8.1"
|
|
12
12
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IComponentSchema, TMapper } from '@bolttech/form-engine-core';
|
|
1
|
+
import { IComponentSchema, TFieldEvent, TMapper } from '@bolttech/form-engine-core';
|
|
2
2
|
import { ElementType, PropsWithChildren } from 'react';
|
|
3
3
|
import { TFieldWrapper } from '../../types';
|
|
4
4
|
/**
|
|
@@ -7,6 +7,7 @@ import { TFieldWrapper } from '../../types';
|
|
|
7
7
|
* also gets the formIndex for form identification and the mapper to build the component
|
|
8
8
|
* @property {TMapper} mapper element mapper to use
|
|
9
9
|
* @property {boolean} visibility element controlled visibility
|
|
10
|
+
* @property {(data: TFieldEvent) => void} onSelected element callback on selected option
|
|
10
11
|
* @see {@link TMapper}
|
|
11
12
|
* @see {@link IComponentSchema}
|
|
12
13
|
* @see {@link TFieldWrapper}
|
|
@@ -14,5 +15,6 @@ import { TFieldWrapper } from '../../types';
|
|
|
14
15
|
type TAsFormFieldBuilderProps = PropsWithChildren<Omit<IComponentSchema, 'children' | 'component' | 'name'> & Required<TFieldWrapper> & {
|
|
15
16
|
mapper: TMapper<ElementType>;
|
|
16
17
|
visibility?: boolean;
|
|
18
|
+
onSelected?: (data: TFieldEvent) => void;
|
|
17
19
|
}>;
|
|
18
20
|
export type { TAsFormFieldBuilderProps };
|