@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
@@ -1,328 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.Change = exports.ActionImpl = void 0;
11
- /**
12
- * Implementation of generic event
13
- * @private
14
- */
15
- class ActionImpl {
16
- constructor(payload, type, _metadata) {
17
- this._metadata = _metadata;
18
- this._payload = payload;
19
- this._type = type;
20
- }
21
- get type() {
22
- return this._type;
23
- }
24
- get payload() {
25
- return this._payload;
26
- }
27
- get metadata() {
28
- return this._metadata;
29
- }
30
- get target() {
31
- return this._target;
32
- }
33
- get isCustomEvent() {
34
- return false;
35
- }
36
- payloadToJson() {
37
- return this.payload;
38
- }
39
- toJson() {
40
- return {
41
- payload: this.payloadToJson(),
42
- type: this.type,
43
- isCustomEvent: this.isCustomEvent
44
- };
45
- }
46
- toString() {
47
- return JSON.stringify(this.toJson());
48
- }
49
- }
50
- exports.ActionImpl = ActionImpl;
51
- /**
52
- * Implementation of `change` event. The change event is triggered on the field whenever the value of the field is changed
53
- */
54
- class Change extends ActionImpl {
55
- /**
56
- * @constructor
57
- * @param [payload] event payload
58
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
59
- */
60
- constructor(payload, dispatch = false) {
61
- super(payload, 'change', { dispatch });
62
- }
63
- withAdditionalChange(change) {
64
- return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
65
- }
66
- }
67
- exports.Change = Change;
68
- /**
69
- * Implementation of `invalid` event. The invalid event is triggered when a Field’s value becomes invalid after a change event or whenever its value property change
70
- */
71
- class Invalid extends ActionImpl {
72
- /**
73
- * @constructor
74
- * @param [payload] event payload
75
- */
76
- constructor(payload = {}) {
77
- super(payload, 'invalid', {});
78
- }
79
- }
80
- exports.Invalid = Invalid;
81
- /**
82
- * Implementation of `valid` event. The valid event is triggered whenever the field’s valid state is changed from invalid to valid.
83
- */
84
- class Valid extends ActionImpl {
85
- /**
86
- * @constructor
87
- * @param [payload] event payload
88
- */
89
- constructor(payload = {}) {
90
- super(payload, 'valid', {});
91
- }
92
- }
93
- exports.Valid = Valid;
94
- /**
95
- * Implementation of an ExecuteRule event.
96
- * @private
97
- */
98
- class ExecuteRule extends ActionImpl {
99
- /**
100
- * @constructor
101
- * @param [payload] event payload
102
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
103
- */
104
- constructor(payload = {}, dispatch = false) {
105
- super(payload, 'executeRule', { dispatch });
106
- }
107
- }
108
- exports.ExecuteRule = ExecuteRule;
109
- /**
110
- * Creates a change event
111
- * @param propertyName name of the form field property
112
- * @param currentValue current value
113
- * @param prevValue previous value
114
- * @returns {@link Change} change event
115
- */
116
- const propertyChange = (propertyName, currentValue, prevValue) => {
117
- return new Change({
118
- changes: [
119
- {
120
- propertyName,
121
- currentValue,
122
- prevValue
123
- }
124
- ]
125
- });
126
- };
127
- exports.propertyChange = propertyChange;
128
- /**
129
- * Implementation of `initialize` event. The event is triggered on all the fields when the form initialisation is complete
130
- */
131
- class Initialize extends ActionImpl {
132
- /**
133
- * @constructor
134
- * @param [payload] event payload
135
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
136
- */
137
- constructor(payload, dispatch = false) {
138
- super(payload, 'initialize', { dispatch });
139
- }
140
- }
141
- exports.Initialize = Initialize;
142
- /**
143
- * Implementation of `load` event. The event is when the form initialization is complete
144
- */
145
- class FormLoad extends ActionImpl {
146
- /**
147
- * @constructor
148
- */
149
- constructor() {
150
- super({}, 'load', { dispatch: false });
151
- }
152
- }
153
- exports.FormLoad = FormLoad;
154
- /**
155
- * Implementation of `click` event. The event is triggered when user clicks on an element.
156
- */
157
- class Click extends ActionImpl {
158
- /**
159
- * @constructor
160
- * @param [payload] event payload
161
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
162
- */
163
- constructor(payload, dispatch = false) {
164
- super(payload, 'click', { dispatch });
165
- }
166
- }
167
- exports.Click = Click;
168
- /**
169
- * Implementation of `blur` event. The event is triggered when the element loses focus.
170
- */
171
- class Blur extends ActionImpl {
172
- /**
173
- * @constructor
174
- * @param [payload] event payload
175
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
176
- */
177
- constructor(payload, dispatch = false) {
178
- super(payload, 'blur', { dispatch });
179
- }
180
- }
181
- exports.Blur = Blur;
182
- /**
183
- * Implementation of `ValidationComplete` event. The ValidationComplete event is triggered once validation is completed
184
- * on the form.
185
- *
186
- * An example of using this event,
187
- * ```
188
- * function onValidationComplete(event) {
189
- * const x = event.payload[0].id;
190
- * // do something with the invalid field
191
- * }
192
- * ```
193
- */
194
- class ValidationComplete extends ActionImpl {
195
- /**
196
- * @constructor
197
- * @param [payload] event payload (ie) list of {@link ValidationError | validation errors}
198
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
199
- */
200
- constructor(payload, dispatch = false) {
201
- super(payload, 'validationComplete', { dispatch });
202
- }
203
- }
204
- exports.ValidationComplete = ValidationComplete;
205
- class Focus extends ActionImpl {
206
- /**
207
- * @constructor
208
- */
209
- constructor() {
210
- super({}, 'focus', { dispatch: false });
211
- }
212
- }
213
- exports.Focus = Focus;
214
- /**
215
- * Implementation of `submit` event. The submit event is triggered on the Form.
216
- * To trigger the submit event, submit function needs to be invoked or one can invoke dispatchEvent API.
217
- */
218
- class Submit extends ActionImpl {
219
- /**
220
- * @constructor
221
- * @param [payload] event payload
222
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
223
- */
224
- constructor(payload, dispatch = false) {
225
- super(payload, 'submit', { dispatch });
226
- }
227
- }
228
- exports.Submit = Submit;
229
- /**
230
- * Implementation of `reset` event. The reset event is triggered on the Form.
231
- * To trigger the reset event, reset function needs to be invoked or one can invoke dispatchEvent API.
232
- */
233
- class Reset extends ActionImpl {
234
- /**
235
- * @constructor
236
- * @param [payload] event payload
237
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
238
- */
239
- constructor(payload, dispatch = false) {
240
- super(payload, 'reset', { dispatch });
241
- }
242
- }
243
- exports.Reset = Reset;
244
- /**
245
- * Implementation of `fieldChanged` event. The field changed event is triggered on the field which it has changed.
246
- */
247
- class FieldChanged extends ActionImpl {
248
- constructor(changes, field) {
249
- super({
250
- field,
251
- changes
252
- }, 'fieldChanged');
253
- }
254
- }
255
- exports.FieldChanged = FieldChanged;
256
- /**
257
- * Implementation of `custom event`.
258
- */
259
- class CustomEvent extends ActionImpl {
260
- /**
261
- * @constructor
262
- * @param [eventName] name of the event
263
- * @param [payload] event payload
264
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
265
- */
266
- constructor(eventName, payload = {}, dispatch = false) {
267
- super(payload, eventName, { dispatch });
268
- }
269
- /**
270
- * Defines if the event is custom
271
- */
272
- get isCustomEvent() {
273
- return true;
274
- }
275
- }
276
- exports.CustomEvent = CustomEvent;
277
- /**
278
- * Implementation of `addItem` event. The event is triggered on a panel to add a new instance of items inside it.
279
- */
280
- class AddItem extends ActionImpl {
281
- /**
282
- * @constructor
283
- * @param [payload] event payload
284
- */
285
- constructor(payload) {
286
- super(payload, 'addItem');
287
- }
288
- }
289
- exports.AddItem = AddItem;
290
- /**
291
- * Implementation of `removeItem` event. The event is triggered on a panel to remove an instance of items inside it.
292
- */
293
- class RemoveItem extends ActionImpl {
294
- /**
295
- * @constructor
296
- * @param [payload] event payload
297
- */
298
- constructor(payload) {
299
- super(payload, 'removeItem');
300
- }
301
- }
302
- exports.RemoveItem = RemoveItem;
303
- /**
304
- * Implementation of `addInstance` event. The event is triggered on a field to add an instance of it.
305
- */
306
- class AddInstance extends ActionImpl {
307
- /**
308
- * @constructor
309
- * @param [payload] event payload
310
- */
311
- constructor(payload) {
312
- super(payload, 'addInstance');
313
- }
314
- }
315
- exports.AddInstance = AddInstance;
316
- /**
317
- * Implementation of `removeInstance` event. The event is triggered on a field to remove an instance of it.
318
- */
319
- class RemoveInstance extends ActionImpl {
320
- /**
321
- * @constructor
322
- * @param [payload] event payload
323
- */
324
- constructor(payload) {
325
- super(payload, 'removeInstance');
326
- }
327
- }
328
- exports.RemoveInstance = RemoveInstance;
@@ -1 +0,0 @@
1
- export * from './Controller';
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- __exportStar(require("./Controller"), exports);
@@ -1,56 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- /**
11
- * @private
12
- */
13
- class DataValue {
14
- constructor($_name, $_value, $_type = typeof $_value) {
15
- this.$_name = $_name;
16
- this.$_value = $_value;
17
- this.$_type = $_type;
18
- this.$_fields = [];
19
- }
20
- valueOf() {
21
- return this.$_value;
22
- }
23
- get $name() {
24
- return this.$_name;
25
- }
26
- get $value() {
27
- const enabled = this.$_fields.find(x => x.enabled !== false);
28
- if (!enabled && this.$_fields.length) {
29
- return undefined;
30
- }
31
- return this.$_value;
32
- }
33
- setValue(typedValue, originalValue, fromField) {
34
- this.$_value = typedValue;
35
- this.$_fields.forEach(x => {
36
- if (fromField !== x) {
37
- x.value = originalValue;
38
- }
39
- });
40
- }
41
- get $type() {
42
- return this.$_type;
43
- }
44
- $bindToField(field) {
45
- if (this.$_fields.indexOf(field) === -1) {
46
- this.$_fields.push(field);
47
- }
48
- }
49
- $convertToDataValue() {
50
- return this;
51
- }
52
- get $isDataGroup() {
53
- return false;
54
- }
55
- }
56
- exports.default = DataValue;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- const DataValue_1 = __importDefault(require("./DataValue"));
14
- const value = Symbol('NullValue');
15
- class NullDataValueClass extends DataValue_1.default {
16
- constructor() {
17
- super('', value, 'null');
18
- }
19
- // eslint-disable-next-line @typescript-eslint/no-empty-function
20
- setValue() {
21
- }
22
- // eslint-disable-next-line @typescript-eslint/no-empty-function
23
- $bindToField() {
24
- }
25
- $length() {
26
- return 0;
27
- }
28
- $convertToDataValue() {
29
- return this;
30
- }
31
- // eslint-disable-next-line @typescript-eslint/no-empty-function
32
- $addDataNode() {
33
- }
34
- // eslint-disable-next-line @typescript-eslint/no-empty-function
35
- $removeDataNode() {
36
- }
37
- $getDataNode() {
38
- return this;
39
- }
40
- $containsDataNode() {
41
- return false;
42
- }
43
- }
44
- //@ts-ignore
45
- const NullDataValue = new NullDataValueClass();
46
- exports.default = NullDataValue;
package/lib/index.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright 2022 Adobe, Inc.
3
- *
4
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
5
- *
6
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
- */
8
- export * from './FormInstance';
9
- export * from './types/index';
10
- export * from './controller/index';
11
- export * from './utils/TranslationUtils';
12
- export * from './utils/JsonUtils';
13
- export * from './utils/SchemaUtils';
14
- import { getFileSizeInBytes, extractFileInfo } from './utils/FormUtils';
15
- import { BaseNode } from './BaseNode';
16
- import Checkbox from './Checkbox';
17
- import CheckboxGroup from './CheckboxGroup';
18
- import Container from './Container';
19
- import Field from './Field';
20
- import { Fieldset } from './Fieldset';
21
- import { FileObject } from './FileObject';
22
- import FileUpload from './FileUpload';
23
- import FormMetaData from './FormMetaData';
24
- import Node from './Node';
25
- import Scriptable from './Scriptable';
26
- import Form from './Form';
27
- import { FunctionRuntime, request } from './rules/FunctionRuntime';
28
- export { Form, BaseNode, Checkbox, CheckboxGroup, Container, Field, Fieldset, FileObject, FileUpload, FormMetaData, Node, Scriptable, getFileSizeInBytes, extractFileInfo, FunctionRuntime, request };
package/lib/index.js DELETED
@@ -1,63 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- var __importDefault = (this && this.__importDefault) || function (mod) {
24
- return (mod && mod.__esModule) ? mod : { "default": mod };
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.request = exports.FunctionRuntime = exports.extractFileInfo = exports.getFileSizeInBytes = exports.Scriptable = exports.Node = exports.FormMetaData = exports.FileUpload = exports.FileObject = exports.Fieldset = exports.Field = exports.Container = exports.CheckboxGroup = exports.Checkbox = exports.BaseNode = exports.Form = void 0;
28
- __exportStar(require("./FormInstance"), exports);
29
- __exportStar(require("./types/index"), exports);
30
- __exportStar(require("./controller/index"), exports);
31
- __exportStar(require("./utils/TranslationUtils"), exports);
32
- __exportStar(require("./utils/JsonUtils"), exports);
33
- __exportStar(require("./utils/SchemaUtils"), exports);
34
- const FormUtils_1 = require("./utils/FormUtils");
35
- Object.defineProperty(exports, "getFileSizeInBytes", { enumerable: true, get: function () { return FormUtils_1.getFileSizeInBytes; } });
36
- Object.defineProperty(exports, "extractFileInfo", { enumerable: true, get: function () { return FormUtils_1.extractFileInfo; } });
37
- const BaseNode_1 = require("./BaseNode");
38
- Object.defineProperty(exports, "BaseNode", { enumerable: true, get: function () { return BaseNode_1.BaseNode; } });
39
- const Checkbox_1 = __importDefault(require("./Checkbox"));
40
- exports.Checkbox = Checkbox_1.default;
41
- const CheckboxGroup_1 = __importDefault(require("./CheckboxGroup"));
42
- exports.CheckboxGroup = CheckboxGroup_1.default;
43
- const Container_1 = __importDefault(require("./Container"));
44
- exports.Container = Container_1.default;
45
- const Field_1 = __importDefault(require("./Field"));
46
- exports.Field = Field_1.default;
47
- const Fieldset_1 = require("./Fieldset");
48
- Object.defineProperty(exports, "Fieldset", { enumerable: true, get: function () { return Fieldset_1.Fieldset; } });
49
- const FileObject_1 = require("./FileObject");
50
- Object.defineProperty(exports, "FileObject", { enumerable: true, get: function () { return FileObject_1.FileObject; } });
51
- const FileUpload_1 = __importDefault(require("./FileUpload"));
52
- exports.FileUpload = FileUpload_1.default;
53
- const FormMetaData_1 = __importDefault(require("./FormMetaData"));
54
- exports.FormMetaData = FormMetaData_1.default;
55
- const Node_1 = __importDefault(require("./Node"));
56
- exports.Node = Node_1.default;
57
- const Scriptable_1 = __importDefault(require("./Scriptable"));
58
- exports.Scriptable = Scriptable_1.default;
59
- const Form_1 = __importDefault(require("./Form"));
60
- exports.Form = Form_1.default;
61
- const FunctionRuntime_1 = require("./rules/FunctionRuntime");
62
- Object.defineProperty(exports, "FunctionRuntime", { enumerable: true, get: function () { return FunctionRuntime_1.FunctionRuntime; } });
63
- Object.defineProperty(exports, "request", { enumerable: true, get: function () { return FunctionRuntime_1.request; } });
@@ -1,23 +0,0 @@
1
- /**
2
- * Implementation of rule engine
3
- * @module
4
- * @private
5
- */
6
- import { BaseModel } from '../types';
7
- import { Formula } from '@adobe/json-formula';
8
- /**
9
- * Implementation of rule engine
10
- * @private
11
- */
12
- declare class RuleEngine {
13
- private _context;
14
- private _globalNames;
15
- compileRule(rule: string): Formula;
16
- execute(node: any, data: any, globals: any, useValueOf?: boolean): any;
17
- /**
18
- * Listen to subscriber for
19
- * @param subscriber
20
- */
21
- trackDependency(subscriber: BaseModel): void;
22
- }
23
- export default RuleEngine;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const json_formula_1 = require("@adobe/json-formula");
11
- const FunctionRuntime_1 = require("./FunctionRuntime");
12
- /**
13
- * Implementation of rule engine
14
- * @private
15
- */
16
- class RuleEngine {
17
- constructor() {
18
- this._globalNames = [
19
- '$form',
20
- '$field',
21
- '$event'
22
- ];
23
- }
24
- compileRule(rule) {
25
- const customFunctions = FunctionRuntime_1.FunctionRuntime.getFunctions();
26
- return new json_formula_1.Formula(rule, customFunctions, undefined, this._globalNames);
27
- }
28
- execute(node, data, globals, useValueOf = false) {
29
- var _a, _b, _c, _d, _e, _f;
30
- const oldContext = this._context;
31
- this._context = globals;
32
- let res = undefined;
33
- try {
34
- node.debug = []; // clean previous debug info
35
- res = node.search(data, globals);
36
- }
37
- catch (err) {
38
- (_c = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.error(err);
39
- }
40
- for (const debugInfo of node.debug) {
41
- (_f = (_e = (_d = this._context) === null || _d === void 0 ? void 0 : _d.form) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.debug(debugInfo);
42
- }
43
- let finalRes = res;
44
- if (useValueOf) {
45
- if (typeof res === 'object' && res !== null) {
46
- finalRes = Object.getPrototypeOf(res).valueOf.call(res);
47
- }
48
- }
49
- this._context = oldContext;
50
- return finalRes;
51
- }
52
- /**
53
- * Listen to subscriber for
54
- * @param subscriber
55
- */
56
- trackDependency(subscriber) {
57
- if (this._context && this._context.field !== undefined && this._context.field !== subscriber) {
58
- subscriber._addDependent(this._context.field);
59
- }
60
- }
61
- }
62
- exports.default = RuleEngine;
package/lib/types/Json.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.constraintProps = exports.translationProps = void 0;
11
- /** Constant for all properties which can be translated based on `adaptive form specification` */
12
- exports.translationProps = ['description', 'placeholder', 'enum', 'enumNames', 'label.value', 'constraintMessages.accept',
13
- 'constraintMessages.enum', 'constraintMessages.exclusiveMinimum', 'constraintMessages.exclusiveMaximum', 'constraintMessages.format', 'constraintMessages.maxFileSize', 'constraintMessages.maxLength',
14
- 'constraintMessages.maximum', 'constraintMessages.maxItems', 'constraintMessages.minLength', 'constraintMessages.minimum', 'constraintMessages.minItems', 'constraintMessages.pattern', 'constraintMessages.required',
15
- 'constraintMessages.step', 'constraintMessages.type', 'constraintMessages.validationExpression'];
16
- /** Constant for all properties which are constraints based on `adaptive form specification` */
17
- exports.constraintProps = ['accept', 'enum', 'exclusiveMinimum', 'exclusiveMaximum',
18
- 'format', 'maxFileSize', 'maxLength', 'maximum', 'maxItems',
19
- 'minLength', 'minimum', 'minItems', 'pattern', 'required', 'step', 'validationExpression', 'enumNames'];