@bolttech/form-engine 3.0.0-beta.55 → 3.0.0-beta.57
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 +20 -3
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -2860,6 +2860,7 @@ $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
|
|
|
2860
2860
|
* @returns {ReactElement}
|
|
2861
2861
|
*/
|
|
2862
2862
|
const AsFormFieldBuilder = props => {
|
|
2863
|
+
var _a, _b;
|
|
2863
2864
|
const context = useFormGroupContext({});
|
|
2864
2865
|
/**
|
|
2865
2866
|
* state to track the field instance creation process
|
|
@@ -2924,16 +2925,18 @@ const AsFormFieldBuilder = props => {
|
|
|
2924
2925
|
}
|
|
2925
2926
|
field === null || field === void 0 ? void 0 : field.propsSubject$.next(Object.assign(Object.assign({}, fieldProps), props.props));
|
|
2926
2927
|
}, [props.props]);
|
|
2928
|
+
/**
|
|
2929
|
+
* allows to control field selected value on each event
|
|
2930
|
+
*/
|
|
2927
2931
|
useEffect(() => {
|
|
2928
|
-
var _a
|
|
2932
|
+
var _a;
|
|
2929
2933
|
if (!props.onSelected) return;
|
|
2930
|
-
(_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2931
2934
|
const callback = payload => {
|
|
2932
2935
|
if (props.onSelected) {
|
|
2933
2936
|
props.onSelected(payload);
|
|
2934
2937
|
}
|
|
2935
2938
|
};
|
|
2936
|
-
const sub = (
|
|
2939
|
+
const sub = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.subscribeFieldEvent({
|
|
2937
2940
|
callback
|
|
2938
2941
|
});
|
|
2939
2942
|
return () => sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
|
|
@@ -2949,6 +2952,20 @@ const AsFormFieldBuilder = props => {
|
|
|
2949
2952
|
field.visibility = props.visibility;
|
|
2950
2953
|
}
|
|
2951
2954
|
}, [mounted, props.visibility]);
|
|
2955
|
+
/**
|
|
2956
|
+
* allows to control field value as a controlled component
|
|
2957
|
+
*/
|
|
2958
|
+
useEffect(() => {
|
|
2959
|
+
var _a, _b;
|
|
2960
|
+
if (!mounted) return;
|
|
2961
|
+
const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2962
|
+
if (((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) && props.props && field) {
|
|
2963
|
+
field === null || field === void 0 ? void 0 : field.emitValue({
|
|
2964
|
+
value: props.props[props.mapper.events.setValue],
|
|
2965
|
+
event: 'ON_FIELD_CHANGE'
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2968
|
+
}, [mounted, (_a = props.props) === null || _a === void 0 ? void 0 : _a[((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) || 'value']]);
|
|
2952
2969
|
return mounted ? jsx(FieldWrapper, {
|
|
2953
2970
|
formIndex: props.formIndex,
|
|
2954
2971
|
name: props.name,
|
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.57",
|
|
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.42",
|
|
10
10
|
"react": "18.2.0",
|
|
11
11
|
"rxjs": "7.8.1"
|
|
12
12
|
},
|