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

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
@@ -673,12 +673,14 @@ const replaceAll = (value, masks) => {
673
673
  *
674
674
  * const formattedValue = currency(config.value, config.masks);
675
675
  * console.log(formattedValue); // Output: '9.876,54 €'
676
+ *
677
+ * PS: To unCurrency this value, usage onlyFloatNumber formatter
676
678
  * ```
677
679
  */
678
680
  const currency = (value, masks) => {
679
681
  if (!(masks === null || masks === void 0 ? void 0 : masks.currency)) return value;
680
682
  const {
681
- align = 'right',
683
+ align = '',
682
684
  decimal = '.',
683
685
  precision = 2,
684
686
  prefix = 'BBD',
@@ -702,6 +704,9 @@ const currency = (value, masks) => {
702
704
  decimalPart = '0'.repeat(precision - decimalPart.length) + decimalPart;
703
705
  newRawValue += decimal + decimalPart;
704
706
  }
707
+ if (!align) {
708
+ return newRawValue;
709
+ }
705
710
  const symbol = getCurrencySymbol(prefix);
706
711
  return align === 'left' ? `${symbol} ${newRawValue}` : `${newRawValue} ${symbol}`;
707
712
  };
@@ -4208,6 +4213,7 @@ class FormGroup {
4208
4213
  this.dataSubject$ = new Subject();
4209
4214
  this.formValidSubject$ = new Subject();
4210
4215
  this.submitSubject$ = new Subject();
4216
+ this.mappers = entry === null || entry === void 0 ? void 0 : entry.mappers;
4211
4217
  }
4212
4218
  /**
4213
4219
  * Creates an empty form with given index
@@ -4353,9 +4359,8 @@ class FormGroup {
4353
4359
  formIndex
4354
4360
  }) => ids.includes(formIndex)), groupBy(({
4355
4361
  event,
4356
- formIndex,
4357
- fieldIndex
4358
- }) => `${event}.${formIndex}.${fieldIndex}`), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS))), map(({
4362
+ formIndex
4363
+ }) => `${event}.${formIndex}`), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS))), map(({
4359
4364
  fieldIndex,
4360
4365
  formIndex
4361
4366
  }) => 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.2",
3
+ "version": "1.0.2-beta.0",
4
4
  "module": "./index.esm.js",
5
5
  "type": "module",
6
6
  "main": "./index.esm.js",
@@ -8,6 +8,7 @@
8
8
  "@gaignoux/currency": "1.1.0",
9
9
  "credit-card-type": "10.0.1",
10
10
  "lodash": "4.17.21",
11
+ "react": "18.2.0",
11
12
  "rxjs": "7.8.1"
12
13
  },
13
14
  "peerDependencies": {}
@@ -7,16 +7,18 @@ import { TFormDataPayload, TFormGroupOnDataEventPayload, TFormGroupOnSubmitEvent
7
7
  /**
8
8
  * Represents a group that manages multiple forms.
9
9
  */
10
- declare class FormGroup {
10
+ declare class FormGroup<ComponentElementType> {
11
11
  forms: Map<string, TFormCore>;
12
12
  config: Required<TSchemaFormConfig>;
13
13
  dataSubject$: Subject<TFormDataPayload>;
14
14
  formValidSubject$: Subject<TFormValidationPayload>;
15
15
  submitSubject$: Subject<TFormSubmitPayload<unknown>>;
16
+ mappers?: TMapper<ComponentElementType>[];
16
17
  /**
17
18
  * Creates an instance of FormGroup.
18
19
  */
19
20
  constructor(entry?: {
21
+ mappers?: TMapper<ComponentElementType>[];
20
22
  config?: TSchemaFormConfig;
21
23
  });
22
24
  /**
@@ -104,5 +106,5 @@ declare class FormGroup {
104
106
  }): import("rxjs").Subscription;
105
107
  destroy: () => void;
106
108
  }
107
- type TFormGroup = FormGroup;
109
+ type TFormGroup<T> = FormGroup<T>;
108
110
  export { TFormGroup, FormGroup };
@@ -66,6 +66,8 @@ export declare const replaceAll: (value: string | number, masks: TMasks) => unkn
66
66
  *
67
67
  * const formattedValue = currency(config.value, config.masks);
68
68
  * console.log(formattedValue); // Output: '9.876,54 €'
69
+ *
70
+ * PS: To unCurrency this value, usage onlyFloatNumber formatter
69
71
  * ```
70
72
  */
71
73
  export declare const currency: (value: string | number, masks: TMasks) => unknown;
@@ -83,15 +83,16 @@ type TFormValidationPayload = {
83
83
  type TFieldValidationPayload = {
84
84
  fieldTrigger: string;
85
85
  };
86
+ type TFormDataValues<T> = {
87
+ formId: string;
88
+ formField: string;
89
+ values?: TFormValues<T>;
90
+ };
86
91
  /**
87
92
  * @type TFormGroupOnDataEventPayload
88
93
  * Form Group onData event emitted payload on callback function parameter
89
94
  */
90
- type TFormGroupOnDataEventPayload<T> = Record<string, {
91
- formId: string;
92
- formField: string;
93
- values?: TFormValues<T>;
94
- }>;
95
+ type TFormGroupOnDataEventPayload<T> = Record<string, TFormDataValues<T>>;
95
96
  /**
96
97
  * @type TFormGroupOnValidEventPayload
97
98
  * Form Group onValid event emitted payload on callback function parameter
@@ -105,4 +106,4 @@ type TFormGroupOnValidEventPayload = {
105
106
  * Form Group onSubmit event emitted payload on callback function parameter
106
107
  */
107
108
  type TFormGroupOnSubmitEventPayload<T> = Record<string, TFormValues<T> | undefined>;
108
- export { TEvents, TMutationEvents, TMutationEnum, TValueChangeEvent, TFieldEvent, TFormDataPayload, TFormSubmitPayload, TFormGroupOnDataEventPayload, TFormGroupOnValidEventPayload, TFormGroupOnSubmitEventPayload, TFormValidationPayload, TFieldValidationPayload, };
109
+ export { TEvents, TMutationEvents, TMutationEnum, TValueChangeEvent, TFieldEvent, TFormDataPayload, TFormDataValues, TFormSubmitPayload, TFormGroupOnDataEventPayload, TFormGroupOnValidEventPayload, TFormGroupOnSubmitEventPayload, TFormValidationPayload, TFieldValidationPayload, };