@bolttech/form-engine-core 1.0.1-beta.0 → 1.0.1-beta.2

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 +12 -8
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -735,18 +735,21 @@ const custom = (value, masks) => {
735
735
  let mask = '';
736
736
  let index = 0;
737
737
  const convertedValue = value.replace(/[^\w\s]/gi, '');
738
- for (let i = 0; i < masks.custom.length; i++) {
739
- if (masks.custom[i] === '#') {
738
+ for (const char of masks.custom) {
739
+ if (char === '#') {
740
740
  if (index < convertedValue.length) {
741
741
  mask += convertedValue[index];
742
742
  index++;
743
743
  } else {
744
744
  break;
745
745
  }
746
- } else {
747
- mask += masks.custom[i];
746
+ } else if (index <= convertedValue.length) {
747
+ mask += char;
748
748
  }
749
749
  }
750
+ if (value.length < mask.length) {
751
+ mask = mask.replace(/[^\w]+$/, '');
752
+ }
750
753
  return mask;
751
754
  };
752
755
 
@@ -3129,7 +3132,6 @@ class FormField {
3129
3132
  this.propsSubject$.unsubscribe();
3130
3133
  this.errorSubject$.unsubscribe();
3131
3134
  this.apiEventQueueSubject$.unsubscribe();
3132
- this.triggerFieldValidNotification();
3133
3135
  this.dataSubject$.next({
3134
3136
  event: 'ON_FIELD_UNMOUNT',
3135
3137
  fieldIndex: this.name,
@@ -3942,6 +3944,7 @@ class FormCore {
3942
3944
  key,
3943
3945
  event: 'ON_FIELDS'
3944
3946
  });
3947
+ this.validateForm();
3945
3948
  }
3946
3949
  /**
3947
3950
  * Serializes the schema structure to create form fields.
@@ -4059,7 +4062,7 @@ class FormCore {
4059
4062
  subscribeFieldEvent({
4060
4063
  callback
4061
4064
  }) {
4062
- const sub = this.fieldEventSubject$.pipe(groupBy(payload => payload.event), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS)))).subscribe({
4065
+ const sub = this.fieldEventSubject$.pipe(groupBy(payload => `${payload.event}|${payload.fieldName}`), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS)))).subscribe({
4063
4066
  next: callback
4064
4067
  });
4065
4068
  return sub;
@@ -4350,8 +4353,9 @@ class FormGroup {
4350
4353
  formIndex
4351
4354
  }) => ids.includes(formIndex)), groupBy(({
4352
4355
  event,
4353
- formIndex
4354
- }) => `${event}.${formIndex}`), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS))), map(({
4356
+ formIndex,
4357
+ fieldIndex
4358
+ }) => `${event}.${formIndex}.${fieldIndex}`), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS))), map(({
4355
4359
  fieldIndex,
4356
4360
  formIndex
4357
4361
  }) => ids.reduce((acc, curr) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "1.0.1-beta.0",
3
+ "version": "1.0.1-beta.2",
4
4
  "module": "./index.esm.js",
5
5
  "type": "module",
6
6
  "main": "./index.esm.js",