@bolttech/form-engine-core 1.0.0-beta.8 → 1.0.0-beta.9
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 +16 -8
- package/package.json +1 -1
- package/src/managers/field.d.ts +5 -5
package/index.esm.js
CHANGED
|
@@ -2627,11 +2627,11 @@ class FormField {
|
|
|
2627
2627
|
});
|
|
2628
2628
|
}
|
|
2629
2629
|
/**
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2630
|
+
* Static function to remove templates form the component props that will be shown when
|
|
2631
|
+
* the field mounts and the template routine executes, to be used on the adapter
|
|
2632
|
+
*
|
|
2633
|
+
* @param {unknown} props - the properties from the adapter components.
|
|
2634
|
+
*/
|
|
2635
2635
|
static filterProps(props) {
|
|
2636
2636
|
if (Array.isArray(props)) {
|
|
2637
2637
|
return props.filter(el => typeof el === 'string' && el.includes('${') ? false : true).map(el => FormField.filterProps(el));
|
|
@@ -2829,6 +2829,7 @@ class FormField {
|
|
|
2829
2829
|
set mounted(mountedStatus) {
|
|
2830
2830
|
if (typeof mountedStatus === 'undefined' || mountedStatus === this.mounted) return;
|
|
2831
2831
|
this._mounted = mountedStatus;
|
|
2832
|
+
this.initializeObservers();
|
|
2832
2833
|
this.mountSubject$.next({
|
|
2833
2834
|
key: this.name,
|
|
2834
2835
|
status: this.mounted
|
|
@@ -2846,9 +2847,9 @@ class FormField {
|
|
|
2846
2847
|
valueSubscription,
|
|
2847
2848
|
propsSubscription
|
|
2848
2849
|
}) {
|
|
2850
|
+
this.mounted = true;
|
|
2849
2851
|
this.subscribeValue(valueSubscription);
|
|
2850
2852
|
this.subscribeState(propsSubscription);
|
|
2851
|
-
this.mounted = true;
|
|
2852
2853
|
this.valueSubject$.next(this.stateValue);
|
|
2853
2854
|
this.propsSubject$.next(this.props);
|
|
2854
2855
|
this.visibilitySubject$.next(this.visibility);
|
|
@@ -3202,6 +3203,15 @@ class FormCore {
|
|
|
3202
3203
|
}) {
|
|
3203
3204
|
var _a;
|
|
3204
3205
|
if (status) {
|
|
3206
|
+
const field = this.fields.get(key);
|
|
3207
|
+
if (!field) {
|
|
3208
|
+
/*
|
|
3209
|
+
@TODO check a better way to handle nested fields unmounted by visiblity conditions from a parent
|
|
3210
|
+
since they are dependent on adapter field recycling runtimes
|
|
3211
|
+
*/
|
|
3212
|
+
this.config.defaultLogVerbose && console.log(`field ${key} was mounted but since it's parent has some visibility condition the field was already removed`);
|
|
3213
|
+
return;
|
|
3214
|
+
}
|
|
3205
3215
|
this.subscribeTemplates();
|
|
3206
3216
|
this.refreshTemplates({
|
|
3207
3217
|
scope: 'fields',
|
|
@@ -3212,7 +3222,6 @@ class FormCore {
|
|
|
3212
3222
|
event: 'ON_IVARS'
|
|
3213
3223
|
});
|
|
3214
3224
|
if (!this.queuedInitialValues.has(key)) {
|
|
3215
|
-
const field = this.fields.get(key);
|
|
3216
3225
|
const propValue = (_a = field === null || field === void 0 ? void 0 : field.props) === null || _a === void 0 ? void 0 : _a[(field === null || field === void 0 ? void 0 : field.valuePropName) || ''];
|
|
3217
3226
|
!(field === null || field === void 0 ? void 0 : field.value) ? field.emitValue({
|
|
3218
3227
|
value: typeof propValue === 'string' && !propValue.includes('${') ? propValue : '',
|
|
@@ -4059,7 +4068,6 @@ class FormCore {
|
|
|
4059
4068
|
field.emitEvents({
|
|
4060
4069
|
event: 'ON_FIELD_VALIDATION'
|
|
4061
4070
|
});
|
|
4062
|
-
console.log(`${field.name} is ${field.valid}`);
|
|
4063
4071
|
});
|
|
4064
4072
|
if (!this.isValid) return;
|
|
4065
4073
|
const values = this.getFormValues();
|
package/package.json
CHANGED
package/src/managers/field.d.ts
CHANGED
|
@@ -146,11 +146,11 @@ declare class FormField {
|
|
|
146
146
|
*/
|
|
147
147
|
set props(props: Record<string, unknown>);
|
|
148
148
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
* Static function to remove templates form the component props that will be shown when
|
|
150
|
+
* the field mounts and the template routine executes, to be used on the adapter
|
|
151
|
+
*
|
|
152
|
+
* @param {unknown} props - the properties from the adapter components.
|
|
153
|
+
*/
|
|
154
154
|
static filterProps(props: unknown): unknown;
|
|
155
155
|
/**
|
|
156
156
|
* Retrieves the current state value of the form field.
|