@bolttech/form-engine 3.0.0-beta.12 → 3.0.0-beta.13
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 +31 -1
- package/package.json +2 -2
- package/src/components/index.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -1959,4 +1959,34 @@ const AsFormField = props => {
|
|
|
1959
1959
|
});
|
|
1960
1960
|
};
|
|
1961
1961
|
|
|
1962
|
-
|
|
1962
|
+
const AsFormFieldBuilder = props => {
|
|
1963
|
+
const {
|
|
1964
|
+
formGroupInstance,
|
|
1965
|
+
addFormWithIndex,
|
|
1966
|
+
removeField
|
|
1967
|
+
} = useFormGroupContext();
|
|
1968
|
+
const [field, setField] = useState(jsx(Fragment, {}));
|
|
1969
|
+
useEffect(() => {
|
|
1970
|
+
var _a;
|
|
1971
|
+
if (!formGroupInstance.forms.has(props.formIndex)) {
|
|
1972
|
+
addFormWithIndex(props.formIndex);
|
|
1973
|
+
}
|
|
1974
|
+
const fieldInstanceProps = Object.assign(Object.assign({}, props), {
|
|
1975
|
+
children: undefined
|
|
1976
|
+
});
|
|
1977
|
+
(_a = formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.addField(fieldInstanceProps);
|
|
1978
|
+
const field = jsx(FieldWrapper, {
|
|
1979
|
+
formKey: props.formIndex,
|
|
1980
|
+
index: props.name,
|
|
1981
|
+
children: props.children && props.children
|
|
1982
|
+
});
|
|
1983
|
+
setField(field);
|
|
1984
|
+
return () => removeField({
|
|
1985
|
+
formIndex: props.formIndex,
|
|
1986
|
+
fieldIndex: props.name
|
|
1987
|
+
});
|
|
1988
|
+
}, []);
|
|
1989
|
+
return field;
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
export { AsFormField, AsFormFieldBuilder, Form, FormGroupContext, FormGroupContextProvider, useFormGroupContext };
|
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.13",
|
|
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.4",
|
|
10
10
|
"react": "18.2.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {}
|