@aemforms/af-core 0.22.68 → 0.22.69

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 (58) hide show
  1. package/esm/afb-events.js +161 -0
  2. package/esm/afb-runtime.js +4304 -0
  3. package/esm/types/src/BaseNode.d.ts +99 -0
  4. package/esm/types/src/Captcha.d.ts +5 -0
  5. package/esm/types/src/Checkbox.d.ts +84 -0
  6. package/esm/types/src/CheckboxGroup.d.ts +23 -0
  7. package/esm/types/src/Container.d.ts +75 -0
  8. package/esm/types/src/DateField.d.ts +9 -0
  9. package/esm/types/src/EmailInput.d.ts +16 -0
  10. package/esm/types/src/Field.d.ts +223 -0
  11. package/esm/types/src/Fieldset.d.ts +16 -0
  12. package/esm/types/src/FileObject.d.ts +16 -0
  13. package/esm/types/src/FileUpload.d.ts +27 -0
  14. package/esm/types/src/Form.d.ts +125 -0
  15. package/esm/types/src/FormInstance.d.ts +16 -0
  16. package/esm/types/src/FormMetaData.d.ts +7 -0
  17. package/esm/types/src/InstanceManager.d.ts +9 -0
  18. package/esm/types/src/Node.d.ts +7 -0
  19. package/esm/types/src/Scriptable.d.ts +17 -0
  20. package/esm/types/src/SubmitMetaData.d.ts +7 -0
  21. package/esm/types/src/controller/EventQueue.d.ts +18 -0
  22. package/esm/types/src/controller/Events.d.ts +91 -0
  23. package/esm/types/src/controller/Logger.d.ts +11 -0
  24. package/esm/types/src/data/DataGroup.d.ts +20 -0
  25. package/esm/types/src/data/DataValue.d.ts +16 -0
  26. package/esm/types/src/data/EmptyDataValue.d.ts +14 -0
  27. package/esm/types/src/index.d.ts +24 -0
  28. package/esm/types/src/rules/FunctionRuntime.d.ts +62 -0
  29. package/esm/types/src/rules/RuleEngine.d.ts +16 -0
  30. package/esm/types/src/types/Json.d.ts +180 -0
  31. package/esm/types/src/types/Model.d.ts +141 -0
  32. package/esm/types/src/types/index.d.ts +2 -0
  33. package/esm/types/src/utils/CoercionUtils.d.ts +1 -0
  34. package/esm/types/src/utils/DataRefParser.d.ts +33 -0
  35. package/esm/types/src/utils/Fetch.d.ts +8 -0
  36. package/esm/types/src/utils/FormCreationUtils.d.ts +10 -0
  37. package/esm/types/src/utils/FormUtils.d.ts +14 -0
  38. package/esm/types/src/utils/JsonUtils.d.ts +13 -0
  39. package/esm/types/src/utils/LogUtils.d.ts +4 -0
  40. package/esm/types/src/utils/SchemaUtils.d.ts +3 -0
  41. package/esm/types/src/utils/TranslationUtils.d.ts +11 -0
  42. package/esm/types/src/utils/ValidationUtils.d.ts +20 -0
  43. package/lib/BaseNode.d.ts +8 -5
  44. package/lib/BaseNode.js +19 -3
  45. package/lib/Container.d.ts +12 -5
  46. package/lib/Container.js +43 -19
  47. package/lib/Field.d.ts +8 -3
  48. package/lib/Field.js +12 -12
  49. package/lib/Fieldset.d.ts +2 -1
  50. package/lib/Form.d.ts +10 -6
  51. package/lib/Form.js +15 -11
  52. package/lib/FormInstance.d.ts +3 -0
  53. package/lib/FormInstance.js +16 -1
  54. package/lib/controller/EventQueue.d.ts +1 -0
  55. package/lib/controller/EventQueue.js +3 -0
  56. package/lib/types/Model.d.ts +2 -1
  57. package/lib/utils/FormCreationUtils.d.ts +2 -1
  58. package/package.json +5 -3
@@ -0,0 +1,161 @@
1
+ class ActionImpl {
2
+ _metadata;
3
+ _type;
4
+ _payload;
5
+ _target;
6
+ constructor(payload, type, _metadata) {
7
+ this._metadata = _metadata;
8
+ this._payload = payload;
9
+ this._type = type;
10
+ }
11
+ get type() {
12
+ return this._type;
13
+ }
14
+ get payload() {
15
+ return this._payload;
16
+ }
17
+ get metadata() {
18
+ return this._metadata;
19
+ }
20
+ get target() {
21
+ return this._target;
22
+ }
23
+ get isCustomEvent() {
24
+ return false;
25
+ }
26
+ payloadToJson() {
27
+ return this.payload;
28
+ }
29
+ toJson() {
30
+ return {
31
+ payload: this.payloadToJson(),
32
+ type: this.type,
33
+ isCustomEvent: this.isCustomEvent
34
+ };
35
+ }
36
+ toString() {
37
+ return JSON.stringify(this.toJson());
38
+ }
39
+ }
40
+ class Change extends ActionImpl {
41
+ constructor(payload, dispatch = false) {
42
+ super(payload, 'change', { dispatch });
43
+ }
44
+ withAdditionalChange(change) {
45
+ return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
46
+ }
47
+ }
48
+ class Invalid extends ActionImpl {
49
+ constructor(payload = {}) {
50
+ super(payload, 'invalid', {});
51
+ }
52
+ }
53
+ class Valid extends ActionImpl {
54
+ constructor(payload = {}) {
55
+ super(payload, 'valid', {});
56
+ }
57
+ }
58
+ class ExecuteRule extends ActionImpl {
59
+ constructor(payload = {}, dispatch = false) {
60
+ super(payload, 'executeRule', { dispatch });
61
+ }
62
+ }
63
+ const propertyChange = (propertyName, currentValue, prevValue) => {
64
+ return new Change({
65
+ changes: [
66
+ {
67
+ propertyName,
68
+ currentValue,
69
+ prevValue
70
+ }
71
+ ]
72
+ });
73
+ };
74
+ class Initialize extends ActionImpl {
75
+ constructor(payload, dispatch = false) {
76
+ super(payload, 'initialize', { dispatch });
77
+ }
78
+ }
79
+ class FormLoad extends ActionImpl {
80
+ constructor() {
81
+ super({}, 'load', { dispatch: false });
82
+ }
83
+ }
84
+ class Click extends ActionImpl {
85
+ constructor(payload, dispatch = false) {
86
+ super(payload, 'click', { dispatch });
87
+ }
88
+ }
89
+ class Blur extends ActionImpl {
90
+ constructor(payload, dispatch = false) {
91
+ super(payload, 'blur', { dispatch });
92
+ }
93
+ }
94
+ class ValidationComplete extends ActionImpl {
95
+ constructor(payload, dispatch = false) {
96
+ super(payload, 'validationComplete', { dispatch });
97
+ }
98
+ }
99
+ class Focus extends ActionImpl {
100
+ constructor() {
101
+ super({}, 'focus', { dispatch: false });
102
+ }
103
+ }
104
+ class Submit extends ActionImpl {
105
+ constructor(payload, dispatch = false) {
106
+ super(payload, 'submit', { dispatch });
107
+ }
108
+ }
109
+ class SubmitSuccess extends ActionImpl {
110
+ constructor(payload, dispatch = false) {
111
+ super(payload, 'submitSuccess', { dispatch });
112
+ }
113
+ }
114
+ class SubmitFailure extends ActionImpl {
115
+ constructor(payload, dispatch = false) {
116
+ super(payload, 'submitFailure', { dispatch });
117
+ }
118
+ }
119
+ class Reset extends ActionImpl {
120
+ constructor(payload, dispatch = false) {
121
+ super(payload, 'reset', { dispatch });
122
+ }
123
+ }
124
+ class FieldChanged extends ActionImpl {
125
+ constructor(changes, field) {
126
+ super({
127
+ field,
128
+ changes
129
+ }, 'fieldChanged');
130
+ }
131
+ }
132
+ class CustomEvent extends ActionImpl {
133
+ constructor(eventName, payload = {}, dispatch = false) {
134
+ super(payload, eventName, { dispatch });
135
+ }
136
+ get isCustomEvent() {
137
+ return true;
138
+ }
139
+ }
140
+ class AddItem extends ActionImpl {
141
+ constructor(payload) {
142
+ super(payload, 'addItem');
143
+ }
144
+ }
145
+ class RemoveItem extends ActionImpl {
146
+ constructor(payload) {
147
+ super(payload, 'removeItem');
148
+ }
149
+ }
150
+ class AddInstance extends ActionImpl {
151
+ constructor(payload) {
152
+ super(payload, 'addInstance');
153
+ }
154
+ }
155
+ class RemoveInstance extends ActionImpl {
156
+ constructor(payload) {
157
+ super(payload, 'removeInstance');
158
+ }
159
+ }
160
+
161
+ export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Submit, SubmitFailure, SubmitSuccess, Valid, ValidationComplete, propertyChange };