@aemforms/af-core 0.22.19 → 0.22.20

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 (122) hide show
  1. package/lib/browser/afb-events.js +151 -0
  2. package/lib/browser/afb-runtime.js +3620 -0
  3. package/lib/cjs/index.cjs +8886 -0
  4. package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
  5. package/lib/{BaseNode.js → esm/BaseNode.js} +84 -184
  6. package/lib/esm/Checkbox.d.ts +79 -0
  7. package/lib/esm/Checkbox.js +27 -0
  8. package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
  9. package/lib/esm/CheckboxGroup.js +23 -0
  10. package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
  11. package/lib/{Container.js → esm/Container.js} +54 -116
  12. package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
  13. package/lib/esm/DateField.js +21 -0
  14. package/lib/{Field.d.ts → esm/Field.d.ts} +39 -104
  15. package/lib/{Field.js → esm/Field.js} +142 -208
  16. package/lib/esm/Fieldset.d.ts +16 -0
  17. package/lib/esm/Fieldset.js +45 -0
  18. package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
  19. package/lib/esm/FileObject.js +26 -0
  20. package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
  21. package/lib/esm/FileUpload.js +108 -0
  22. package/lib/{Form.d.ts → esm/Form.d.ts} +19 -85
  23. package/lib/esm/Form.js +176 -0
  24. package/lib/esm/FormInstance.d.ts +13 -0
  25. package/lib/esm/FormInstance.js +81 -0
  26. package/lib/esm/FormMetaData.d.ts +7 -0
  27. package/lib/esm/FormMetaData.js +10 -0
  28. package/lib/esm/InstanceManager.d.ts +9 -0
  29. package/lib/esm/InstanceManager.js +31 -0
  30. package/lib/esm/Node.d.ts +7 -0
  31. package/lib/esm/Node.js +16 -0
  32. package/lib/esm/Scriptable.d.ts +17 -0
  33. package/lib/{Scriptable.js → esm/Scriptable.js} +11 -54
  34. package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
  35. package/lib/{controller → esm/controller}/EventQueue.js +10 -26
  36. package/lib/esm/controller/Events.d.ts +85 -0
  37. package/lib/esm/controller/Events.js +149 -0
  38. package/lib/{controller → esm/controller}/Logger.d.ts +0 -6
  39. package/lib/{controller → esm/controller}/Logger.js +5 -11
  40. package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
  41. package/lib/{data → esm/data}/DataGroup.js +15 -34
  42. package/lib/{data → esm/data}/DataValue.d.ts +1 -7
  43. package/lib/esm/data/DataValue.js +46 -0
  44. package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
  45. package/lib/esm/data/EmptyDataValue.js +29 -0
  46. package/lib/esm/index.d.ts +21 -0
  47. package/lib/esm/index.js +21 -0
  48. package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +2 -24
  49. package/lib/{rules → esm/rules}/FunctionRuntime.js +41 -117
  50. package/lib/esm/rules/RuleEngine.d.ts +12 -0
  51. package/lib/esm/rules/RuleEngine.js +47 -0
  52. package/lib/{types → esm/types}/Json.d.ts +3 -22
  53. package/lib/esm/types/Json.js +7 -0
  54. package/lib/esm/types/Model.d.ts +131 -0
  55. package/lib/esm/types/Model.js +8 -0
  56. package/lib/esm/types/index.d.ts +2 -0
  57. package/lib/esm/types/index.js +2 -0
  58. package/lib/{utils → esm/utils}/DataRefParser.d.ts +2 -5
  59. package/lib/{utils → esm/utils}/DataRefParser.js +22 -49
  60. package/lib/{utils → esm/utils}/Fetch.d.ts +0 -6
  61. package/lib/esm/utils/Fetch.js +61 -0
  62. package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
  63. package/lib/esm/utils/FormCreationUtils.js +74 -0
  64. package/lib/esm/utils/FormUtils.d.ts +12 -0
  65. package/lib/esm/utils/FormUtils.js +187 -0
  66. package/lib/esm/utils/JsonUtils.d.ts +11 -0
  67. package/lib/esm/utils/JsonUtils.js +76 -0
  68. package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
  69. package/lib/esm/utils/LogUtils.js +6 -0
  70. package/lib/esm/utils/SchemaUtils.d.ts +3 -0
  71. package/lib/esm/utils/SchemaUtils.js +71 -0
  72. package/lib/esm/utils/TranslationUtils.d.ts +11 -0
  73. package/lib/esm/utils/TranslationUtils.js +115 -0
  74. package/lib/esm/utils/ValidationUtils.d.ts +19 -0
  75. package/lib/{utils → esm/utils}/ValidationUtils.js +29 -187
  76. package/package.json +17 -10
  77. package/lib/Checkbox.d.ts +0 -88
  78. package/lib/Checkbox.js +0 -49
  79. package/lib/CheckboxGroup.js +0 -43
  80. package/lib/DateField.js +0 -35
  81. package/lib/Fieldset.d.ts +0 -24
  82. package/lib/Fieldset.js +0 -74
  83. package/lib/FileObject.js +0 -39
  84. package/lib/FileUpload.js +0 -155
  85. package/lib/Form.js +0 -252
  86. package/lib/FormInstance.d.ts +0 -38
  87. package/lib/FormInstance.js +0 -127
  88. package/lib/FormMetaData.d.ts +0 -11
  89. package/lib/FormMetaData.js +0 -28
  90. package/lib/InstanceManager.d.ts +0 -16
  91. package/lib/InstanceManager.js +0 -53
  92. package/lib/Node.d.ts +0 -12
  93. package/lib/Node.js +0 -27
  94. package/lib/Scriptable.d.ts +0 -31
  95. package/lib/controller/Controller.d.ts +0 -255
  96. package/lib/controller/Controller.js +0 -328
  97. package/lib/controller/index.d.ts +0 -1
  98. package/lib/controller/index.js +0 -24
  99. package/lib/data/DataValue.js +0 -56
  100. package/lib/data/EmptyDataValue.js +0 -46
  101. package/lib/index.d.ts +0 -28
  102. package/lib/index.js +0 -63
  103. package/lib/rules/RuleEngine.d.ts +0 -23
  104. package/lib/rules/RuleEngine.js +0 -62
  105. package/lib/types/Json.js +0 -19
  106. package/lib/types/Model.d.ts +0 -393
  107. package/lib/types/Model.js +0 -20
  108. package/lib/types/index.d.ts +0 -2
  109. package/lib/types/index.js +0 -25
  110. package/lib/utils/Fetch.js +0 -87
  111. package/lib/utils/FormCreationUtils.d.ts +0 -11
  112. package/lib/utils/FormCreationUtils.js +0 -83
  113. package/lib/utils/FormUtils.d.ts +0 -47
  114. package/lib/utils/FormUtils.js +0 -257
  115. package/lib/utils/JsonUtils.d.ts +0 -63
  116. package/lib/utils/JsonUtils.js +0 -157
  117. package/lib/utils/LogUtils.js +0 -17
  118. package/lib/utils/SchemaUtils.d.ts +0 -16
  119. package/lib/utils/SchemaUtils.js +0 -92
  120. package/lib/utils/TranslationUtils.d.ts +0 -41
  121. package/lib/utils/TranslationUtils.js +0 -185
  122. package/lib/utils/ValidationUtils.d.ts +0 -170
@@ -0,0 +1,151 @@
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 Reset extends ActionImpl {
110
+ constructor(payload, dispatch = false) {
111
+ super(payload, 'reset', { dispatch });
112
+ }
113
+ }
114
+ class FieldChanged extends ActionImpl {
115
+ constructor(changes, field) {
116
+ super({
117
+ field,
118
+ changes
119
+ }, 'fieldChanged');
120
+ }
121
+ }
122
+ class CustomEvent extends ActionImpl {
123
+ constructor(eventName, payload = {}, dispatch = false) {
124
+ super(payload, eventName, { dispatch });
125
+ }
126
+ get isCustomEvent() {
127
+ return true;
128
+ }
129
+ }
130
+ class AddItem extends ActionImpl {
131
+ constructor(payload) {
132
+ super(payload, 'addItem');
133
+ }
134
+ }
135
+ class RemoveItem extends ActionImpl {
136
+ constructor(payload) {
137
+ super(payload, 'removeItem');
138
+ }
139
+ }
140
+ class AddInstance extends ActionImpl {
141
+ constructor(payload) {
142
+ super(payload, 'addInstance');
143
+ }
144
+ }
145
+ class RemoveInstance extends ActionImpl {
146
+ constructor(payload) {
147
+ super(payload, 'removeInstance');
148
+ }
149
+ }
150
+
151
+ export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Submit, Valid, ValidationComplete, propertyChange };