@bolttech/form-engine 3.0.0-beta.49 → 3.0.0-beta.50
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
|
@@ -2871,7 +2871,7 @@ const AsFormFieldBuilder = props => {
|
|
|
2871
2871
|
* Also has the logic to remove it once this element is removed
|
|
2872
2872
|
*/
|
|
2873
2873
|
useEffect(() => {
|
|
2874
|
-
var _a, _b
|
|
2874
|
+
var _a, _b;
|
|
2875
2875
|
if (!((_a = context.formGroupInstance) === null || _a === void 0 ? void 0 : _a.forms.has(props.formIndex))) {
|
|
2876
2876
|
context.addFormWithIndex(props.formIndex);
|
|
2877
2877
|
}
|
|
@@ -2884,14 +2884,18 @@ const AsFormFieldBuilder = props => {
|
|
|
2884
2884
|
fieldSchema,
|
|
2885
2885
|
mapperElement: props.mapper
|
|
2886
2886
|
});
|
|
2887
|
+
const field = formInstance === null || formInstance === void 0 ? void 0 : formInstance.getField({
|
|
2888
|
+
key: props.name
|
|
2889
|
+
});
|
|
2887
2890
|
if (((_b = props.mapper.events) === null || _b === void 0 ? void 0 : _b.setValue) && props.props) {
|
|
2888
|
-
|
|
2889
|
-
key: props.name
|
|
2890
|
-
})) === null || _c === void 0 ? void 0 : _c.emitValue({
|
|
2891
|
+
field === null || field === void 0 ? void 0 : field.emitValue({
|
|
2891
2892
|
value: props.props[props.mapper.events.setValue],
|
|
2892
2893
|
event: 'ON_FIELD_MOUNT'
|
|
2893
2894
|
});
|
|
2894
2895
|
}
|
|
2896
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.visibility) !== 'undefined' && field) {
|
|
2897
|
+
field.visibility = props.visibility;
|
|
2898
|
+
}
|
|
2895
2899
|
setMounted(true);
|
|
2896
2900
|
return () => formInstance === null || formInstance === void 0 ? void 0 : formInstance.removeField({
|
|
2897
2901
|
key: props.name
|
|
@@ -2920,6 +2924,18 @@ const AsFormFieldBuilder = props => {
|
|
|
2920
2924
|
}
|
|
2921
2925
|
field === null || field === void 0 ? void 0 : field.propsSubject$.next(Object.assign(Object.assign({}, fieldProps), props.props));
|
|
2922
2926
|
}, [props.props]);
|
|
2927
|
+
/**
|
|
2928
|
+
* allows to control field visibility as a controlled component
|
|
2929
|
+
*/
|
|
2930
|
+
useEffect(() => {
|
|
2931
|
+
var _a;
|
|
2932
|
+
if (!mounted) return;
|
|
2933
|
+
const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
|
|
2934
|
+
console.log('entrou 1', field);
|
|
2935
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.visibility) !== 'undefined' && field) {
|
|
2936
|
+
field.visibility = props.visibility;
|
|
2937
|
+
}
|
|
2938
|
+
}, [mounted, props.visibility]);
|
|
2923
2939
|
return mounted ? jsx(FieldWrapper, {
|
|
2924
2940
|
formIndex: props.formIndex,
|
|
2925
2941
|
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.50",
|
|
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.35",
|
|
10
10
|
"react": "18.2.0",
|
|
11
11
|
"rxjs": "7.8.1"
|
|
12
12
|
},
|
|
@@ -6,11 +6,13 @@ import { TFieldWrapper } from '../../types';
|
|
|
6
6
|
* property, that will be a ReactNode
|
|
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
|
+
* @property {boolean} visibility element controlled visibility
|
|
9
10
|
* @see {@link TMapper}
|
|
10
11
|
* @see {@link IComponentSchema}
|
|
11
12
|
* @see {@link TFieldWrapper}
|
|
12
13
|
*/
|
|
13
14
|
type TAsFormFieldBuilderProps = PropsWithChildren<Omit<IComponentSchema, 'children' | 'component' | 'name'> & Required<TFieldWrapper> & {
|
|
14
15
|
mapper: TMapper<ElementType>;
|
|
16
|
+
visibility?: boolean;
|
|
15
17
|
}>;
|
|
16
18
|
export type { TAsFormFieldBuilderProps };
|