@bolttech/form-engine-core 1.0.4 → 1.0.5

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 (3) hide show
  1. package/index.d.ts +5 -21
  2. package/index.esm.js +4 -15
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -226,21 +226,12 @@ interface IFormSchema {
226
226
  stopEventsOnSubmit?: boolean;
227
227
  }
228
228
 
229
- /**
230
- * @type TFieldBinding
231
- * settings from the field's location and value when valid.
232
- */
233
- type TFieldBinding = {
234
- path?: string;
235
- value?: unknown;
236
- };
237
229
  /**
238
230
  * @type TFormValues<T>
239
231
  * Represents the values and state of a form. It has a generic type that allows the importer to determine which type values key will return.
240
232
  *
241
233
  * @property {Generic Type} values - The current values of the form fields.
242
234
  * @property {string[]} erroredFields - A list of field names that have errors.
243
- * @property {TFieldBinding} bindFields - A list of field names that have bind values with their path to submit.
244
235
  * @property {boolean} isValid - Indicates whether the form is valid.
245
236
  *
246
237
  * @example
@@ -248,7 +239,6 @@ type TFieldBinding = {
248
239
  * const formValues: TFormValues = {
249
240
  * values: { name: 'John', age: 30 },
250
241
  * erroredFields: ['email'],
251
- * bindFields: { path: 'field/name', value: 'John' },
252
242
  * isValid: false
253
243
  * };
254
244
  * ```
@@ -257,7 +247,6 @@ type TFormValues<T> = {
257
247
  values: T;
258
248
  metadata: unknown;
259
249
  erroredFields: string[];
260
- bindFields?: TFieldBinding;
261
250
  isValid: boolean;
262
251
  };
263
252
  /**
@@ -2030,7 +2019,10 @@ declare class FormCore {
2030
2019
  *
2031
2020
  * @param {(payload: { field: string; data: TFormValues }) => void} callback callback function to call onData
2032
2021
  */
2033
- subscribeData<T>(callback: (payload: TFormOnDataEventPayload<T>) => void): Subscription;
2022
+ subscribeData<T>(callback: (payload: {
2023
+ field: string;
2024
+ data: TFormValues<T>;
2025
+ }) => void): Subscription;
2034
2026
  /**
2035
2027
  * method to register a callback function to be called when the form is valid
2036
2028
  *
@@ -2317,14 +2309,6 @@ type TFormDataValues<T> = {
2317
2309
  * Form Group onData event emitted payload on callback function parameter
2318
2310
  */
2319
2311
  type TFormGroupOnDataEventPayload<T> = Record<string, TFormDataValues<T>>;
2320
- /**
2321
- * @type TFormOnDataEventPayload
2322
- * Form onData event emitted payload on callback function parameter
2323
- */
2324
- type TFormOnDataEventPayload<T> = {
2325
- field: string;
2326
- data: TFormValues<T>;
2327
- };
2328
2312
  /**
2329
2313
  * @type TFormGroupOnValidEventPayload
2330
2314
  * Form Group onValid event emitted payload on callback function parameter
@@ -2340,4 +2324,4 @@ type TFormGroupOnValidEventPayload = {
2340
2324
  type TFormGroupOnSubmitEventPayload<T> = Record<string, TFormValues<T> | undefined>;
2341
2325
 
2342
2326
  export { FormCore, FormField, FormGroup, TMutationEnum };
2343
- export type { AllowOnly, IComponentSchema, IComponentSchemaAsFormField, IFormField, IFormSchema, IState, OneOf, TAllowedResetPropsMutationsEnum, TApiConfig, TApiEvent, TApiResponse, TApiResponsePayload, TAvailableValidations, TBetweenDatesValidation, TBetweenValidation, TCallbackValidation, TComponentPropsMapping, TConditionsValidation, TConditionsValidationSet, TCreditCardMatch, TCurrencyMask, TDateFormatsValidation, TDateInterval, TDateOperatorsValidation, TDateValidation, TDocumentValidation, TErrorMessages, TEvent, TEventDataProps, TEventDataPropsEnum, TEventEnum, TEventMessages, TEventMessagesValidationMethods, TEventProps, TEventPropsEnum, TEvents, TFieldEvent, TFieldValidationPayload, TFormCore, TFormDataPayload, TFormDataValues, TFormEntry, TFormGroup, TFormGroupOnDataEventPayload, TFormGroupOnSubmitEventPayload, TFormGroupOnValidEventPayload, TFormOnDataEventPayload, TFormSubmitPayload, TFormValidationPayload, TFormValues, TFormatters, TGenericValidationRule, TLengthValidation, TMapper, TMaskGeneric, TMasks, TMultipleValidation, TMutationEvents, TProps, TResetPathMethods, TResetValueMethods, TSchemaFormConfig, TSchemaValidation, TSplitterFormatterValue, TSubscribedTemplates, TTemplateAvaliableScopes, TTemplateAvaliableScopesEnum, TTemplateEvent, TValidationHandler, TValidationMethods, TValidations, TValueChangeEvent, TVisibility };
2327
+ export type { AllowOnly, IComponentSchema, IComponentSchemaAsFormField, IFormField, IFormSchema, IState, OneOf, TAllowedResetPropsMutationsEnum, TApiConfig, TApiEvent, TApiResponse, TApiResponsePayload, TAvailableValidations, TBetweenDatesValidation, TBetweenValidation, TCallbackValidation, TComponentPropsMapping, TConditionsValidation, TConditionsValidationSet, TCreditCardMatch, TCurrencyMask, TDateFormatsValidation, TDateInterval, TDateOperatorsValidation, TDateValidation, TDocumentValidation, TErrorMessages, TEvent, TEventDataProps, TEventDataPropsEnum, TEventEnum, TEventMessages, TEventMessagesValidationMethods, TEventProps, TEventPropsEnum, TEvents, TFieldEvent, TFieldValidationPayload, TFormCore, TFormDataPayload, TFormDataValues, TFormEntry, TFormGroup, TFormGroupOnDataEventPayload, TFormGroupOnSubmitEventPayload, TFormGroupOnValidEventPayload, TFormSubmitPayload, TFormValidationPayload, TFormValues, TFormatters, TGenericValidationRule, TLengthValidation, TMapper, TMaskGeneric, TMasks, TMultipleValidation, TMutationEvents, TProps, TResetPathMethods, TResetValueMethods, TSchemaFormConfig, TSchemaValidation, TSplitterFormatterValue, TSubscribedTemplates, TTemplateAvaliableScopes, TTemplateAvaliableScopesEnum, TTemplateEvent, TValidationHandler, TValidationMethods, TValidations, TValueChangeEvent, TVisibility };
package/index.esm.js CHANGED
@@ -4110,9 +4110,7 @@ class FormCore {
4110
4110
  const values = {};
4111
4111
  const metadata = {};
4112
4112
  const erroredFields = [];
4113
- const bindFields = {};
4114
4113
  this.fields.forEach((val, key) => {
4115
- var _a;
4116
4114
  if (!(typeof val.value === 'string' && val.value.length === 0) && typeof val.value !== 'undefined' && val.value !== null) {
4117
4115
  set(values, val.nameToSubmit || key, val.value);
4118
4116
  metadata[key] = val.metadata;
@@ -4120,18 +4118,11 @@ class FormCore {
4120
4118
  if (!val.valid) {
4121
4119
  erroredFields.push(key);
4122
4120
  }
4123
- if (val.nameToSubmit) {
4124
- bindFields[key] = {
4125
- path: (_a = val.nameToSubmit) === null || _a === void 0 ? void 0 : _a.replace('.', '/'),
4126
- value: val.value
4127
- };
4128
- }
4129
4121
  });
4130
4122
  return {
4131
4123
  values,
4132
4124
  metadata,
4133
4125
  erroredFields,
4134
- bindFields,
4135
4126
  isValid: this.valid
4136
4127
  };
4137
4128
  }
@@ -4170,12 +4161,10 @@ class FormCore {
4170
4161
  formIndex
4171
4162
  }) => this.index === formIndex && this.submitChecker()), groupBy(payload => payload.event), mergeMap(group$ => group$.pipe(debounceTime(this.config.defaultStateRefreshTimeMS))), map(({
4172
4163
  fieldIndex
4173
- }) => {
4174
- return {
4175
- field: fieldIndex,
4176
- data: this.getFormValues()
4177
- };
4178
- })).subscribe({
4164
+ }) => ({
4165
+ field: fieldIndex,
4166
+ data: this.getFormValues()
4167
+ }))).subscribe({
4179
4168
  next: callback
4180
4169
  });
4181
4170
  return sub;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "dependencies": {
5
5
  "@gaignoux/currency": "^1.1.0",
6
6
  "credit-card-type": "^10.0.0",
7
- "lodash": "^4.17.21",
7
+ "lodash": "4.17.23",
8
8
  "rxjs": "^7.8.1"
9
9
  },
10
10
  "module": "./index.esm.js",