@bolttech/form-engine-core 1.0.2 → 1.0.3

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 +14 -1
  2. package/index.esm.js +23 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1396,6 +1396,7 @@ declare class FormField {
1396
1396
  errorsString: string;
1397
1397
  errorsList: string[];
1398
1398
  private _props;
1399
+ private _adapterProps;
1399
1400
  private _value;
1400
1401
  private _stateValue;
1401
1402
  private _metadata;
@@ -1455,7 +1456,7 @@ declare class FormField {
1455
1456
  * @param {TMapper<unknown>} options.mapper, - component generic mapper containing render parameters for adapters
1456
1457
  * @param {() => TFormValues<unknown>} options.getFormValues, - form instance function that builds onData parameter payload from fields
1457
1458
  */
1458
- constructor({ formIndex, schemaComponent, config, path, children, validateVisibility, resetValue, resetProperty, templateSubject$, fieldEventSubject$, dataSubject$, fieldValidNotification$, mountSubject$, mapper, getFormValues, submitEvent, visibility, persistValue, }: {
1459
+ constructor({ formIndex, schemaComponent, config, children, validateVisibility, resetValue, resetProperty, templateSubject$, fieldEventSubject$, dataSubject$, fieldValidNotification$, mountSubject$, mapper, getFormValues, submitEvent, visibility, persistValue, }: {
1459
1460
  formIndex: string;
1460
1461
  schemaComponent: IComponentSchema;
1461
1462
  config?: TSchemaFormConfig;
@@ -1493,6 +1494,18 @@ declare class FormField {
1493
1494
  * emissions to unsubscribed fields
1494
1495
  */
1495
1496
  initializeObservers(): void;
1497
+ /**
1498
+ * Retrieves the raw props sent from the adapter.
1499
+ *
1500
+ * @returns {string} - raw props from the adapter
1501
+ */
1502
+ get adapterProps(): string;
1503
+ /**
1504
+ * compares adapter props changes and emits the change if they effectively changed
1505
+ * preventing an emission from the adapter of the same props that can overwrite other prop
1506
+ * changes via templating
1507
+ */
1508
+ set adapterProps(props: Record<string, unknown>);
1496
1509
  /**
1497
1510
  * Retrieves the properties associated with the form field.
1498
1511
  *
package/index.esm.js CHANGED
@@ -2505,7 +2505,6 @@ class FormField {
2505
2505
  formIndex,
2506
2506
  schemaComponent,
2507
2507
  config,
2508
- path,
2509
2508
  children,
2510
2509
  validateVisibility,
2511
2510
  resetValue,
@@ -2556,6 +2555,7 @@ class FormField {
2556
2555
  this.fieldValidNotification$ = fieldValidNotification$;
2557
2556
  this.mountSubject$ = mountSubject$;
2558
2557
  this._props = FormField.filterProps(cloneDeep(schemaComponent.props || {}));
2558
+ this._adapterProps = JSON.stringify(schemaComponent.props || {});
2559
2559
  this._metadata = '';
2560
2560
  this.errorsString = '';
2561
2561
  this.errorsList = [];
@@ -2615,6 +2615,28 @@ class FormField {
2615
2615
  });
2616
2616
  }
2617
2617
  }
2618
+ /**
2619
+ * Retrieves the raw props sent from the adapter.
2620
+ *
2621
+ * @returns {string} - raw props from the adapter
2622
+ */
2623
+ get adapterProps() {
2624
+ return this._adapterProps;
2625
+ }
2626
+ /**
2627
+ * compares adapter props changes and emits the change if they effectively changed
2628
+ * preventing an emission from the adapter of the same props that can overwrite other prop
2629
+ * changes via templating
2630
+ */
2631
+ set adapterProps(props) {
2632
+ const currentProps = JSON.stringify(props || {});
2633
+ // it's a very basic comparison to determine if props changed,
2634
+ // will need review if we need complex comparisons
2635
+ if (currentProps !== this.adapterProps) {
2636
+ this.props = FormField.filterProps(props);
2637
+ this._adapterProps = currentProps;
2638
+ }
2639
+ }
2618
2640
  /**
2619
2641
  * Retrieves the properties associated with the form field.
2620
2642
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/form-engine-core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "dependencies": {
5
5
  "@gaignoux/currency": "^1.1.0",
6
6
  "credit-card-type": "^10.0.0",