@bolttech/form-engine-core 1.0.0-beta.12 → 1.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 CHANGED
@@ -2733,9 +2733,7 @@ class FormField {
2733
2733
  set valid(valid) {
2734
2734
  if (typeof valid !== 'boolean' && this.valid === valid) return;
2735
2735
  this._valid = valid;
2736
- this.fieldValidNotification$.next({
2737
- fieldTrigger: this.name
2738
- });
2736
+ this.triggerFieldValidNotification();
2739
2737
  }
2740
2738
  /**
2741
2739
  * Retrieves the validity status of the form field.
@@ -2745,6 +2743,18 @@ class FormField {
2745
2743
  get valid() {
2746
2744
  return this._valid;
2747
2745
  }
2746
+ /**
2747
+ * triggers field valid notification to handle the form instance valid notification
2748
+ *
2749
+ * Note: since form unmount can occur before field unmount, this subject might already be closed by form instance
2750
+ * quick workaround is to check if the subject is already closed before emitting
2751
+ * if form instance onValid or template form.valid doesn't work properly, might be due to this workaround
2752
+ */
2753
+ triggerFieldValidNotification() {
2754
+ !this.fieldValidNotification$.closed && this.fieldValidNotification$.next({
2755
+ fieldTrigger: this.name
2756
+ });
2757
+ }
2748
2758
  /**
2749
2759
  * Retrieves the error messages associated with the form field.
2750
2760
  *
@@ -3113,9 +3123,7 @@ class FormField {
3113
3123
  this.propsSubject$.unsubscribe();
3114
3124
  this.errorSubject$.unsubscribe();
3115
3125
  this.apiEventQueueSubject$.unsubscribe();
3116
- !this.fieldValidNotification$.closed && this.fieldValidNotification$.next({
3117
- fieldTrigger: this.name
3118
- });
3126
+ this.triggerFieldValidNotification();
3119
3127
  }
3120
3128
  /**
3121
3129
  * Subscribes to changes in the field state and executes the provided callback function.
@@ -4123,6 +4131,7 @@ class FormCore {
4123
4131
  this.templateSubscription$.unsubscribe();
4124
4132
  this.fieldEventSubject$.unsubscribe();
4125
4133
  this.dataSubject$.unsubscribe();
4134
+ this.formValidNotification$.unsubscribe();
4126
4135
  this.fieldValidNotification$.unsubscribe();
4127
4136
  this.fields.forEach(field => field.destroyField());
4128
4137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.13",
4
4
  "module": "./index.esm.js",
5
5
  "type": "module",
6
6
  "main": "./index.esm.js",
@@ -191,6 +191,14 @@ declare class FormField {
191
191
  * @returns {boolean} - The validity status of the form field.
192
192
  */
193
193
  get valid(): boolean;
194
+ /**
195
+ * triggers field valid notification to handle the form instance valid notification
196
+ *
197
+ * Note: since form unmount can occur before field unmount, this subject might already be closed by form instance
198
+ * quick workaround is to check if the subject is already closed before emitting
199
+ * if form instance onValid or template form.valid doesn't work properly, might be due to this workaround
200
+ */
201
+ triggerFieldValidNotification(): void;
194
202
  /**
195
203
  * Retrieves the error messages associated with the form field.
196
204
  *