@bolttech/form-engine 3.0.0-beta.55 → 3.0.0-beta.56

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.
Files changed (2) hide show
  1. package/index.esm.js +18 -0
  2. 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,6 +2925,9 @@ 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
2932
  var _a, _b;
2929
2933
  if (!props.onSelected) return;
@@ -2949,6 +2953,20 @@ const AsFormFieldBuilder = props => {
2949
2953
  field.visibility = props.visibility;
2950
2954
  }
2951
2955
  }, [mounted, props.visibility]);
2956
+ /**
2957
+ * allows to control field value as a controlled component
2958
+ */
2959
+ useEffect(() => {
2960
+ var _a, _b;
2961
+ if (!mounted) return;
2962
+ const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
2963
+ if (((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) && props.props && field) {
2964
+ field === null || field === void 0 ? void 0 : field.emitValue({
2965
+ value: props.props[props.mapper.events.setValue],
2966
+ event: 'ON_FIELD_CHANGE'
2967
+ });
2968
+ }
2969
+ }, [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
2970
  return mounted ? jsx(FieldWrapper, {
2953
2971
  formIndex: props.formIndex,
2954
2972
  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.55",
3
+ "version": "3.0.0-beta.56",
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.40",
9
+ "@bolttech/form-engine-core": "0.0.1-beta.41",
10
10
  "react": "18.2.0",
11
11
  "rxjs": "7.8.1"
12
12
  },