@aemforms/af-core 0.22.18 → 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 (120) 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} +11 -68
  5. package/lib/{BaseNode.js → esm/BaseNode.js} +86 -182
  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/esm/Container.d.ts +53 -0
  11. package/lib/{Container.js → esm/Container.js} +76 -124
  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} +44 -98
  15. package/lib/{Field.js → esm/Field.js} +172 -206
  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/esm/Form.d.ts +113 -0
  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} +12 -55
  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 +20 -35
  42. package/lib/{data → esm/data}/DataValue.d.ts +2 -8
  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 +44 -114
  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 +6 -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 +1 -0
  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/Container.d.ts +0 -199
  81. package/lib/DateField.js +0 -35
  82. package/lib/Fieldset.d.ts +0 -34
  83. package/lib/Fieldset.js +0 -113
  84. package/lib/FileObject.js +0 -39
  85. package/lib/FileUpload.js +0 -155
  86. package/lib/Form.d.ts +0 -262
  87. package/lib/Form.js +0 -230
  88. package/lib/FormInstance.d.ts +0 -38
  89. package/lib/FormInstance.js +0 -119
  90. package/lib/FormMetaData.d.ts +0 -11
  91. package/lib/FormMetaData.js +0 -28
  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 -223
  96. package/lib/controller/Controller.js +0 -287
  97. package/lib/controller/index.d.ts +0 -1
  98. package/lib/controller/index.js +0 -24
  99. package/lib/data/DataValue.js +0 -52
  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 -379
  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 -29
  111. package/lib/utils/FormUtils.d.ts +0 -47
  112. package/lib/utils/FormUtils.js +0 -257
  113. package/lib/utils/JsonUtils.d.ts +0 -62
  114. package/lib/utils/JsonUtils.js +0 -143
  115. package/lib/utils/LogUtils.js +0 -17
  116. package/lib/utils/SchemaUtils.d.ts +0 -16
  117. package/lib/utils/SchemaUtils.js +0 -92
  118. package/lib/utils/TranslationUtils.d.ts +0 -41
  119. package/lib/utils/TranslationUtils.js +0 -185
  120. package/lib/utils/ValidationUtils.d.ts +0 -170
package/lib/Node.d.ts DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * Defines generic form object class which any form runtime model (like textbox, checkbox etc)
3
- * should extend from.
4
- * @typeparam T type of the node (for example, {@link MetaDataJson | form meta data}
5
- */
6
- declare class Node<T> {
7
- protected _jsonModel: T;
8
- constructor(inputModel: T);
9
- protected getP<S>(key: string, def: S): S;
10
- get isContainer(): boolean;
11
- }
12
- export default Node;
package/lib/Node.js DELETED
@@ -1,27 +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 JsonUtils_1 = require("./utils/JsonUtils");
11
- /**
12
- * Defines generic form object class which any form runtime model (like textbox, checkbox etc)
13
- * should extend from.
14
- * @typeparam T type of the node (for example, {@link MetaDataJson | form meta data}
15
- */
16
- class Node {
17
- constructor(inputModel) {
18
- this._jsonModel = Object.assign({}, inputModel);
19
- }
20
- getP(key, def) {
21
- return (0, JsonUtils_1.getProperty)(this._jsonModel, key, def);
22
- }
23
- get isContainer() {
24
- return false;
25
- }
26
- }
27
- exports.default = Node;
@@ -1,31 +0,0 @@
1
- import { Action, RulesJson, ScriptableField } from './types';
2
- import { BaseNode } from './BaseNode';
3
- /**
4
- * Defines scriptable aspects (ie rules, events) of form runtime model. Any form runtime object which requires
5
- * execution of rules/events should extend from this class.
6
- */
7
- declare abstract class Scriptable<T extends RulesJson> extends BaseNode<T> implements ScriptableField {
8
- private _events;
9
- private _rules;
10
- getRules(): import("./types").Items<string>;
11
- private getCompiledRule;
12
- private getCompiledEvent;
13
- private applyUpdates;
14
- protected executeAllRules(context: any): void;
15
- private getExpressionScope;
16
- private executeEvent;
17
- /**
18
- * Executes the given rule
19
- * @param event
20
- * @param context
21
- * @private
22
- */
23
- executeRule(event: Action, context: any): void;
24
- executeExpression(expr: string): any;
25
- /**
26
- * Executes the given action
27
- * @param action {@link Action | event object}
28
- */
29
- executeAction(action: Action): void;
30
- }
31
- export default Scriptable;
@@ -1,223 +0,0 @@
1
- /**
2
- * Defines all form events
3
- */
4
- import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError } from '../types';
5
- /**
6
- * Implementation of generic event
7
- * @private
8
- */
9
- export declare class ActionImpl implements Action {
10
- private _metadata?;
11
- protected _type: string;
12
- private _payload?;
13
- private _target;
14
- constructor(payload: any, type: string, _metadata?: any);
15
- get type(): string;
16
- get payload(): any;
17
- get metadata(): any;
18
- get target(): FormModel | FieldModel | FieldsetModel;
19
- get isCustomEvent(): boolean;
20
- protected payloadToJson(): any;
21
- toJson(): {
22
- payload: any;
23
- type: string;
24
- isCustomEvent: boolean;
25
- };
26
- toString(): string;
27
- }
28
- /**
29
- * Payload of change event
30
- */
31
- export declare type ChangePayload = {
32
- /**
33
- * List of changes
34
- */
35
- changes: Array<{
36
- /**
37
- * Name of the property which has changed
38
- */
39
- propertyName: string;
40
- /**
41
- * Previous value of the property changed
42
- */
43
- prevValue?: any;
44
- /**
45
- * Current value of the property changed
46
- */
47
- currentValue: any;
48
- }>;
49
- };
50
- /**
51
- * Implementation of `change` event. The change event is triggered on the field whenever the value of the field is changed
52
- */
53
- export declare class Change extends ActionImpl {
54
- /**
55
- * @constructor
56
- * @param [payload] event payload
57
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
58
- */
59
- constructor(payload: ChangePayload, dispatch?: boolean);
60
- withAdditionalChange(change: Change): Change;
61
- }
62
- /**
63
- * 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
64
- */
65
- export declare class Invalid extends ActionImpl {
66
- /**
67
- * @constructor
68
- * @param [payload] event payload
69
- */
70
- constructor(payload?: any);
71
- }
72
- /**
73
- * Implementation of `valid` event. The valid event is triggered whenever the field’s valid state is changed from invalid to valid.
74
- */
75
- export declare class Valid extends ActionImpl {
76
- /**
77
- * @constructor
78
- * @param [payload] event payload
79
- */
80
- constructor(payload?: any);
81
- }
82
- /**
83
- * Implementation of an ExecuteRule event.
84
- * @private
85
- */
86
- export declare class ExecuteRule extends ActionImpl {
87
- /**
88
- * @constructor
89
- * @param [payload] event payload
90
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
91
- */
92
- constructor(payload?: any, dispatch?: boolean);
93
- }
94
- /**
95
- * Creates a change event
96
- * @param propertyName name of the form field property
97
- * @param currentValue current value
98
- * @param prevValue previous value
99
- * @returns {@link Change} change event
100
- */
101
- export declare const propertyChange: (propertyName: string, currentValue: any, prevValue?: any) => Change;
102
- /**
103
- * Implementation of `initialize` event. The event is triggered on all the fields when the form initialisation is complete
104
- */
105
- export declare class Initialize extends ActionImpl {
106
- /**
107
- * @constructor
108
- * @param [payload] event payload
109
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
110
- */
111
- constructor(payload?: any, dispatch?: boolean);
112
- }
113
- /**
114
- * Implementation of `load` event. The event is when the form initialization is complete
115
- */
116
- export declare class FormLoad extends ActionImpl {
117
- /**
118
- * @constructor
119
- */
120
- constructor();
121
- }
122
- /**
123
- * Implementation of `click` event. The event is triggered when user clicks on an element.
124
- */
125
- export declare class Click extends ActionImpl {
126
- /**
127
- * @constructor
128
- * @param [payload] event payload
129
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
130
- */
131
- constructor(payload?: any, dispatch?: boolean);
132
- }
133
- /**
134
- * Implementation of `blur` event. The event is triggered when the element loses focus.
135
- */
136
- export declare class Blur extends ActionImpl {
137
- /**
138
- * @constructor
139
- * @param [payload] event payload
140
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
141
- */
142
- constructor(payload?: any, dispatch?: boolean);
143
- }
144
- /**
145
- * Implementation of `ValidationComplete` event. The ValidationComplete event is triggered once validation is completed
146
- * on the form.
147
- *
148
- * An example of using this event,
149
- * ```
150
- * function onValidationComplete(event) {
151
- * const x = event.payload[0].id;
152
- * // do something with the invalid field
153
- * }
154
- * ```
155
- */
156
- export declare class ValidationComplete extends ActionImpl {
157
- /**
158
- * @constructor
159
- * @param [payload] event payload (ie) list of {@link ValidationError | validation errors}
160
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
161
- */
162
- constructor(payload?: Array<ValidationError>, dispatch?: boolean);
163
- }
164
- export declare class Focus extends ActionImpl {
165
- /**
166
- * @constructor
167
- */
168
- constructor();
169
- }
170
- /**
171
- * Implementation of `submit` event. The submit event is triggered on the Form.
172
- * To trigger the submit event, submit function needs to be invoked or one can invoke dispatchEvent API.
173
- */
174
- export declare class Submit extends ActionImpl {
175
- /**
176
- * @constructor
177
- * @param [payload] event payload
178
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
179
- */
180
- constructor(payload?: any, dispatch?: boolean);
181
- }
182
- /**
183
- * Implementation of `fieldChanged` event. The field changed event is triggered on the field which it has changed.
184
- */
185
- export declare class FieldChanged extends ActionImpl {
186
- constructor(changes: ChangePayload, field: BaseJson);
187
- }
188
- /**
189
- * Implementation of `custom event`.
190
- */
191
- export declare class CustomEvent extends ActionImpl {
192
- /**
193
- * @constructor
194
- * @param [eventName] name of the event
195
- * @param [payload] event payload
196
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
197
- */
198
- constructor(eventName: string, payload?: any, dispatch?: boolean);
199
- /**
200
- * Defines if the event is custom
201
- */
202
- get isCustomEvent(): boolean;
203
- }
204
- /**
205
- * Implementation of `addItem` event. The event is triggered on a panel to add a new instance of items inside it.
206
- */
207
- export declare class AddItem extends ActionImpl {
208
- /**
209
- * @constructor
210
- * @param [payload] event payload
211
- */
212
- constructor(payload?: number);
213
- }
214
- /**
215
- * Implementation of `removeItem` event. The event is triggered on a panel to remove an instance of items inside it.
216
- */
217
- export declare class RemoveItem extends ActionImpl {
218
- /**
219
- * @constructor
220
- * @param [payload] event payload
221
- */
222
- constructor(payload?: number);
223
- }
@@ -1,287 +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.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = 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 `fieldChanged` event. The field changed event is triggered on the field which it has changed.
231
- */
232
- class FieldChanged extends ActionImpl {
233
- constructor(changes, field) {
234
- super({
235
- field,
236
- changes
237
- }, 'fieldChanged');
238
- }
239
- }
240
- exports.FieldChanged = FieldChanged;
241
- /**
242
- * Implementation of `custom event`.
243
- */
244
- class CustomEvent extends ActionImpl {
245
- /**
246
- * @constructor
247
- * @param [eventName] name of the event
248
- * @param [payload] event payload
249
- * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
250
- */
251
- constructor(eventName, payload = {}, dispatch = false) {
252
- super(payload, eventName, { dispatch });
253
- }
254
- /**
255
- * Defines if the event is custom
256
- */
257
- get isCustomEvent() {
258
- return true;
259
- }
260
- }
261
- exports.CustomEvent = CustomEvent;
262
- /**
263
- * Implementation of `addItem` event. The event is triggered on a panel to add a new instance of items inside it.
264
- */
265
- class AddItem extends ActionImpl {
266
- /**
267
- * @constructor
268
- * @param [payload] event payload
269
- */
270
- constructor(payload) {
271
- super(payload, 'addItem');
272
- }
273
- }
274
- exports.AddItem = AddItem;
275
- /**
276
- * Implementation of `removeItem` event. The event is triggered on a panel to remove an instance of items inside it.
277
- */
278
- class RemoveItem extends ActionImpl {
279
- /**
280
- * @constructor
281
- * @param [payload] event payload
282
- */
283
- constructor(payload) {
284
- super(payload, 'removeItem');
285
- }
286
- }
287
- exports.RemoveItem = RemoveItem;
@@ -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,52 +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
- return this.$_value;
28
- }
29
- setValue(typedValue, originalValue, fromField) {
30
- this.$_value = typedValue;
31
- this.$_fields.forEach(x => {
32
- if (fromField !== x) {
33
- x.value = originalValue;
34
- }
35
- });
36
- }
37
- get $type() {
38
- return this.$_type;
39
- }
40
- $bindToField(field) {
41
- if (this.$_fields.indexOf(field) === -1) {
42
- this.$_fields.push(field);
43
- }
44
- }
45
- $convertToDataValue() {
46
- return this;
47
- }
48
- get $isDataGroup() {
49
- return false;
50
- }
51
- }
52
- exports.default = DataValue;