@aemforms/af-core 0.22.94 → 0.22.95

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.
@@ -132,6 +132,11 @@ class Change extends ActionImpl {
132
132
  return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
133
133
  }
134
134
  }
135
+ class UIChange extends ActionImpl {
136
+ constructor(payload, dispatch = false) {
137
+ super(payload, 'uiChange', { dispatch });
138
+ }
139
+ }
135
140
  class Invalid extends ActionImpl {
136
141
  constructor(payload = {}) {
137
142
  super(payload, 'invalid', {});
@@ -256,4 +261,4 @@ class RemoveInstance extends ActionImpl {
256
261
  }
257
262
  }
258
263
 
259
- export { AddInstance as A, Blur as B, CustomEvent as C, EventSource as E, FormLoad as F, Initialize as I, RemoveItem as R, SubmitSuccess as S, ValidationComplete as V, ExecuteRule as a, SubmitError as b, SubmitFailure as c, CaptchaDisplayMode as d, Submit as e, Save as f, RemoveInstance as g, Reset as h, AddItem as i, Click as j, Change as k, FocusOption as l, FieldChanged as m, constraintKeys as n, getConstraintTypeMessages as o, propertyChange as p, Valid as q, Invalid as r, ValidationError as s, Focus as t };
264
+ export { AddInstance as A, Blur as B, CustomEvent as C, EventSource as E, FormLoad as F, Initialize as I, RemoveItem as R, SubmitSuccess as S, UIChange as U, ValidationComplete as V, ExecuteRule as a, SubmitError as b, SubmitFailure as c, CaptchaDisplayMode as d, Submit as e, Save as f, RemoveInstance as g, Reset as h, AddItem as i, Click as j, Change as k, FocusOption as l, FieldChanged as m, constraintKeys as n, getConstraintTypeMessages as o, propertyChange as p, Valid as q, Invalid as r, ValidationError as s, Focus as t };
package/esm/afb-events.js CHANGED
@@ -1 +1 @@
1
- export { A as AddInstance, i as AddItem, B as Blur, k as Change, j as Click, C as CustomEvent, a as ExecuteRule, m as FieldChanged, t as Focus, F as FormLoad, I as Initialize, r as Invalid, g as RemoveInstance, R as RemoveItem, h as Reset, f as Save, e as Submit, b as SubmitError, c as SubmitFailure, S as SubmitSuccess, q as Valid, V as ValidationComplete, p as propertyChange } from './Events-a66f7a2c.js';
1
+ export { A as AddInstance, i as AddItem, B as Blur, k as Change, j as Click, C as CustomEvent, a as ExecuteRule, m as FieldChanged, t as Focus, F as FormLoad, I as Initialize, r as Invalid, g as RemoveInstance, R as RemoveItem, h as Reset, f as Save, e as Submit, b as SubmitError, c as SubmitFailure, S as SubmitSuccess, U as UIChange, q as Valid, V as ValidationComplete, p as propertyChange } from './Events-536ca954.js';
@@ -1,4 +1,4 @@
1
- import { E as EventSource, p as propertyChange, a as ExecuteRule, I as Initialize, R as RemoveItem, S as SubmitSuccess, C as CustomEvent, b as SubmitError, c as SubmitFailure, d as CaptchaDisplayMode, e as Submit, f as Save, g as RemoveInstance, A as AddInstance, h as Reset, i as AddItem, j as Click, k as Change, F as FormLoad, l as FocusOption, m as FieldChanged, V as ValidationComplete, n as constraintKeys, o as getConstraintTypeMessages, q as Valid, r as Invalid, s as ValidationError } from './Events-a66f7a2c.js';
1
+ import { E as EventSource, p as propertyChange, a as ExecuteRule, I as Initialize, R as RemoveItem, S as SubmitSuccess, C as CustomEvent, b as SubmitError, c as SubmitFailure, d as CaptchaDisplayMode, e as Submit, f as Save, g as RemoveInstance, A as AddInstance, h as Reset, i as AddItem, j as Click, k as Change, F as FormLoad, l as FocusOption, m as FieldChanged, V as ValidationComplete, n as constraintKeys, o as getConstraintTypeMessages, q as Valid, r as Invalid, s as ValidationError } from './Events-536ca954.js';
2
2
  import Formula from '@adobe/json-formula';
3
3
  import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime, parseDate } from '@aemforms/af-formatters';
4
4
 
@@ -3791,6 +3791,16 @@ class Field extends Scriptable {
3791
3791
  this.dispatch(changeAction);
3792
3792
  }
3793
3793
  }
3794
+ uiChange(action) {
3795
+ this._eventSource = EventSource.UI;
3796
+ if ('value' in action.payload) {
3797
+ this.value = action.payload.value;
3798
+ }
3799
+ else if ('checked' in action.payload) {
3800
+ this.checked = action.payload.checked;
3801
+ }
3802
+ this._eventSource = EventSource.CODE;
3803
+ }
3794
3804
  reset() {
3795
3805
  const changes = this.updateDataNodeAndTypedValue(this.default);
3796
3806
  if (!changes) {
@@ -1,4 +1,4 @@
1
- import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
1
+ import { Action, ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
2
2
  import Scriptable from './Scriptable';
3
3
  import DataValue from './data/DataValue';
4
4
  import DataGroup from './data/DataGroup';
@@ -56,6 +56,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
56
56
  protected updateDataNodeAndTypedValue(val: any): any;
57
57
  get value(): any;
58
58
  set value(v: any);
59
+ uiChange(action: Action): void;
59
60
  reset(): void;
60
61
  protected _updateRuleNodeReference(value: any): void;
61
62
  protected getInternalType(): string | undefined;
@@ -28,10 +28,17 @@ export type ChangePayload = {
28
28
  }>;
29
29
  eventSource?: EventSource;
30
30
  };
31
+ export type UIChangePayload = {
32
+ value?: any;
33
+ checked?: boolean;
34
+ };
31
35
  export declare class Change extends ActionImpl {
32
36
  constructor(payload: ChangePayload, dispatch?: boolean);
33
37
  withAdditionalChange(change: Change): Change;
34
38
  }
39
+ export declare class UIChange extends ActionImpl {
40
+ constructor(payload: UIChangePayload, dispatch?: boolean);
41
+ }
35
42
  export declare class Invalid extends ActionImpl {
36
43
  constructor(payload?: any);
37
44
  }
package/lib/Field.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
1
+ import { Action, ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
2
2
  import Scriptable from './Scriptable';
3
3
  import DataValue from './data/DataValue';
4
4
  import DataGroup from './data/DataGroup';
@@ -56,6 +56,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
56
56
  protected updateDataNodeAndTypedValue(val: any): any;
57
57
  get value(): any;
58
58
  set value(v: any);
59
+ uiChange(action: Action): void;
59
60
  reset(): void;
60
61
  protected _updateRuleNodeReference(value: any): void;
61
62
  protected getInternalType(): string | undefined;
package/lib/Field.js CHANGED
@@ -386,6 +386,16 @@ class Field extends Scriptable_1.default {
386
386
  this.dispatch(changeAction);
387
387
  }
388
388
  }
389
+ uiChange(action) {
390
+ this._eventSource = types_1.EventSource.UI;
391
+ if ('value' in action.payload) {
392
+ this.value = action.payload.value;
393
+ }
394
+ else if ('checked' in action.payload) {
395
+ this.checked = action.payload.checked;
396
+ }
397
+ this._eventSource = types_1.EventSource.CODE;
398
+ }
389
399
  reset() {
390
400
  const changes = this.updateDataNodeAndTypedValue(this.default);
391
401
  if (!changes) {
@@ -28,10 +28,17 @@ export declare type ChangePayload = {
28
28
  }>;
29
29
  eventSource?: EventSource;
30
30
  };
31
+ export declare type UIChangePayload = {
32
+ value?: any;
33
+ checked?: boolean;
34
+ };
31
35
  export declare class Change extends ActionImpl {
32
36
  constructor(payload: ChangePayload, dispatch?: boolean);
33
37
  withAdditionalChange(change: Change): Change;
34
38
  }
39
+ export declare class UIChange extends ActionImpl {
40
+ constructor(payload: UIChangePayload, dispatch?: boolean);
41
+ }
35
42
  export declare class Invalid extends ActionImpl {
36
43
  constructor(payload?: any);
37
44
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.SubmitError = exports.SubmitFailure = exports.SubmitSuccess = exports.Save = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.Change = void 0;
3
+ exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.SubmitError = exports.SubmitFailure = exports.SubmitSuccess = exports.Save = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.UIChange = exports.Change = void 0;
4
4
  const index_1 = require("../types/index");
5
5
  class ActionImpl {
6
6
  constructor(payload, type, _metadata) {
@@ -49,6 +49,12 @@ class Change extends ActionImpl {
49
49
  }
50
50
  }
51
51
  exports.Change = Change;
52
+ class UIChange extends ActionImpl {
53
+ constructor(payload, dispatch = false) {
54
+ super(payload, 'uiChange', { dispatch });
55
+ }
56
+ }
57
+ exports.UIChange = UIChange;
52
58
  class Invalid extends ActionImpl {
53
59
  constructor(payload = {}) {
54
60
  super(payload, 'invalid', {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.94",
3
+ "version": "0.22.95",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.94"
40
+ "@aemforms/af-formatters": "^0.22.95"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",