@bolttech/form-engine 3.0.0-beta.21 → 3.0.0-beta.23
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 +27 -2
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -2485,7 +2485,7 @@ const Form = ({
|
|
|
2485
2485
|
*/
|
|
2486
2486
|
return () => {
|
|
2487
2487
|
removeForm({
|
|
2488
|
-
key:
|
|
2488
|
+
key: schemaIndex
|
|
2489
2489
|
});
|
|
2490
2490
|
};
|
|
2491
2491
|
}, []);
|
|
@@ -2518,9 +2518,26 @@ const Form = ({
|
|
|
2518
2518
|
*/
|
|
2519
2519
|
useEffect(() => {
|
|
2520
2520
|
if (iVars) getForm({
|
|
2521
|
-
key:
|
|
2521
|
+
key: schemaIndex
|
|
2522
2522
|
}).iVars = iVars;
|
|
2523
2523
|
}, [iVars]);
|
|
2524
|
+
/**
|
|
2525
|
+
* initialValues setter for async initialValues
|
|
2526
|
+
*/
|
|
2527
|
+
useEffect(() => {
|
|
2528
|
+
const form = getForm({
|
|
2529
|
+
key: schemaIndex
|
|
2530
|
+
});
|
|
2531
|
+
if (initialValues && form) {
|
|
2532
|
+
Object.keys(initialValues).forEach(fieldName => {
|
|
2533
|
+
var _a;
|
|
2534
|
+
(_a = form.fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.emitValue({
|
|
2535
|
+
event: 'ON_FORM_SUBMIT',
|
|
2536
|
+
value: initialValues[fieldName]
|
|
2537
|
+
});
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
}, [initialValues]);
|
|
2524
2541
|
/**
|
|
2525
2542
|
* hook usage to keep event bindings updated on callback functions passed as props
|
|
2526
2543
|
*/
|
|
@@ -2570,6 +2587,14 @@ const Form = ({
|
|
|
2570
2587
|
})) === null || _a === void 0 ? void 0 : _a.printValues();
|
|
2571
2588
|
},
|
|
2572
2589
|
children: "print values"
|
|
2590
|
+
}), jsx("button", {
|
|
2591
|
+
onClick: () => {
|
|
2592
|
+
var _a;
|
|
2593
|
+
return (_a = getForm({
|
|
2594
|
+
key: schemaIndex
|
|
2595
|
+
})) === null || _a === void 0 ? void 0 : _a.submit();
|
|
2596
|
+
},
|
|
2597
|
+
children: "try submit"
|
|
2573
2598
|
}), jsx("br", {}), jsx("hr", {})]
|
|
2574
2599
|
}), jsx("form", {
|
|
2575
2600
|
onSubmit: handleSubmit,
|
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.23",
|
|
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.14",
|
|
10
10
|
"react": "18.2.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {}
|