@aemforms/af-core 0.22.19 → 0.22.22

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 (124) hide show
  1. package/LICENSE +18 -4
  2. package/lib/cjs/index.cjs +7277 -0
  3. package/lib/{BaseNode.js → esm/BaseNode-dc59ab07.js} +108 -184
  4. package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
  5. package/lib/esm/BaseNode.js +26 -0
  6. package/lib/esm/Checkbox.d.ts +79 -0
  7. package/lib/esm/Checkbox.js +63 -0
  8. package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
  9. package/lib/esm/CheckboxGroup.js +60 -0
  10. package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
  11. package/lib/{Container.js → esm/Container.js} +81 -122
  12. package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
  13. package/lib/esm/DateField.js +57 -0
  14. package/lib/{Field.d.ts → esm/Field.d.ts} +41 -106
  15. package/lib/{Field.js → esm/Field.js} +186 -216
  16. package/lib/esm/Fieldset.d.ts +16 -0
  17. package/lib/esm/Fieldset.js +78 -0
  18. package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
  19. package/lib/esm/FileObject.js +48 -0
  20. package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
  21. package/lib/esm/FileUpload.js +141 -0
  22. package/lib/{Form.d.ts → esm/Form.d.ts} +20 -86
  23. package/lib/esm/Form.js +208 -0
  24. package/lib/esm/FormInstance.d.ts +13 -0
  25. package/lib/esm/FormInstance.js +129 -0
  26. package/lib/esm/FormMetaData.d.ts +7 -0
  27. package/lib/esm/FormMetaData.js +35 -0
  28. package/lib/esm/InstanceManager.d.ts +9 -0
  29. package/lib/esm/InstanceManager.js +58 -0
  30. package/lib/esm/Node.d.ts +7 -0
  31. package/lib/esm/Node.js +40 -0
  32. package/lib/esm/Scriptable.d.ts +17 -0
  33. package/lib/{Scriptable.js → esm/Scriptable.js} +38 -54
  34. package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
  35. package/lib/{controller → esm/controller}/EventQueue.js +32 -26
  36. package/lib/esm/controller/Events.d.ts +85 -0
  37. package/lib/esm/controller/Events.js +171 -0
  38. package/lib/{controller → esm/controller}/Logger.d.ts +2 -8
  39. package/lib/esm/controller/Logger.js +52 -0
  40. package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
  41. package/lib/{data → esm/data}/DataGroup.js +38 -34
  42. package/lib/{data → esm/data}/DataValue.d.ts +1 -7
  43. package/lib/esm/data/DataValue.js +68 -0
  44. package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
  45. package/lib/esm/data/EmptyDataValue.js +51 -0
  46. package/lib/esm/index.d.ts +21 -0
  47. package/lib/esm/index.js +55 -0
  48. package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +3 -25
  49. package/lib/{rules → esm/rules}/FunctionRuntime.js +66 -117
  50. package/lib/esm/rules/RuleEngine.d.ts +12 -0
  51. package/lib/esm/rules/RuleEngine.js +76 -0
  52. package/lib/esm/types/Json.d.ts +119 -0
  53. package/lib/esm/types/Json.js +29 -0
  54. package/lib/esm/types/Model.d.ts +131 -0
  55. package/lib/esm/types/Model.js +30 -0
  56. package/lib/esm/types/index.d.ts +2 -0
  57. package/lib/esm/types/index.js +22 -0
  58. package/lib/{utils → esm/utils}/DataRefParser.d.ts +4 -7
  59. package/lib/{utils → esm/utils}/DataRefParser.js +42 -44
  60. package/lib/{utils → esm/utils}/Fetch.d.ts +1 -7
  61. package/lib/esm/utils/Fetch.js +83 -0
  62. package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
  63. package/lib/esm/utils/FormCreationUtils.js +112 -0
  64. package/lib/esm/utils/FormUtils.d.ts +12 -0
  65. package/lib/esm/utils/FormUtils.js +212 -0
  66. package/lib/esm/utils/JsonUtils.d.ts +11 -0
  67. package/lib/esm/utils/JsonUtils.js +99 -0
  68. package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
  69. package/lib/esm/utils/LogUtils.js +28 -0
  70. package/lib/esm/utils/SchemaUtils.d.ts +3 -0
  71. package/lib/esm/utils/SchemaUtils.js +93 -0
  72. package/lib/esm/utils/TranslationUtils.d.ts +11 -0
  73. package/lib/esm/utils/TranslationUtils.js +138 -0
  74. package/lib/esm/utils/ValidationUtils.d.ts +19 -0
  75. package/lib/{utils → esm/utils}/ValidationUtils.js +55 -187
  76. package/package.json +18 -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/Logger.js +0 -36
  98. package/lib/controller/index.d.ts +0 -1
  99. package/lib/controller/index.js +0 -24
  100. package/lib/data/DataValue.js +0 -56
  101. package/lib/data/EmptyDataValue.js +0 -46
  102. package/lib/index.d.ts +0 -28
  103. package/lib/index.js +0 -63
  104. package/lib/rules/RuleEngine.d.ts +0 -23
  105. package/lib/rules/RuleEngine.js +0 -62
  106. package/lib/types/Json.d.ts +0 -138
  107. package/lib/types/Json.js +0 -19
  108. package/lib/types/Model.d.ts +0 -393
  109. package/lib/types/Model.js +0 -20
  110. package/lib/types/index.d.ts +0 -2
  111. package/lib/types/index.js +0 -25
  112. package/lib/utils/Fetch.js +0 -87
  113. package/lib/utils/FormCreationUtils.d.ts +0 -11
  114. package/lib/utils/FormCreationUtils.js +0 -83
  115. package/lib/utils/FormUtils.d.ts +0 -47
  116. package/lib/utils/FormUtils.js +0 -257
  117. package/lib/utils/JsonUtils.d.ts +0 -63
  118. package/lib/utils/JsonUtils.js +0 -157
  119. package/lib/utils/LogUtils.js +0 -17
  120. package/lib/utils/SchemaUtils.d.ts +0 -16
  121. package/lib/utils/SchemaUtils.js +0 -92
  122. package/lib/utils/TranslationUtils.d.ts +0 -41
  123. package/lib/utils/TranslationUtils.js +0 -185
  124. package/lib/utils/ValidationUtils.d.ts +0 -170
@@ -1,23 +1,33 @@
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 BaseNode_1 = require("./BaseNode");
11
- /**
12
- * Defines scriptable aspects (ie rules, events) of form runtime model. Any form runtime object which requires
13
- * execution of rules/events should extend from this class.
14
- */
15
- class Scriptable extends BaseNode_1.BaseNode {
16
- constructor() {
17
- super(...arguments);
18
- this._events = {};
19
- this._rules = {};
20
- }
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import { B as BaseNode, a as editableProperties } from './BaseNode-dc59ab07.js';
22
+ import './controller/Events.js';
23
+ import './utils/DataRefParser.js';
24
+ import './data/DataGroup.js';
25
+ import './data/DataValue.js';
26
+ import './data/EmptyDataValue.js';
27
+
28
+ class Scriptable extends BaseNode {
29
+ _events = {};
30
+ _rules = {};
21
31
  getRules() {
22
32
  return typeof this._jsonModel.rules !== 'object' ? {} : this._jsonModel.rules;
23
33
  }
@@ -39,9 +49,8 @@ class Scriptable extends BaseNode_1.BaseNode {
39
49
  return this._rules[eName];
40
50
  }
41
51
  getCompiledEvent(eName) {
42
- var _a;
43
52
  if (!(eName in this._events)) {
44
- let eString = (_a = this._jsonModel.events) === null || _a === void 0 ? void 0 : _a[eName];
53
+ let eString = this._jsonModel.events?.[eName];
45
54
  if (typeof eString === 'string' && eString.length > 0) {
46
55
  eString = [eString];
47
56
  }
@@ -61,12 +70,8 @@ class Scriptable extends BaseNode_1.BaseNode {
61
70
  }
62
71
  applyUpdates(updates) {
63
72
  Object.entries(updates).forEach(([key, value]) => {
64
- // @ts-ignore
65
- // the first check is to disable accessing this.value & this.items property
66
- // otherwise that will trigger dependency tracking
67
- if (key in BaseNode_1.editableProperties || (key in this && typeof this[key] !== 'function')) {
73
+ if (key in editableProperties || (key in this && typeof this[key] !== 'function')) {
68
74
  try {
69
- // @ts-ignore
70
75
  this[key] = value;
71
76
  }
72
77
  catch (e) {
@@ -83,8 +88,7 @@ class Scriptable extends BaseNode_1.BaseNode {
83
88
  const node = this.getCompiledRule(prop, rule);
84
89
  if (node) {
85
90
  const newVal = this.ruleEngine.execute(node, scope, context, true);
86
- if (BaseNode_1.editableProperties.indexOf(prop) > -1) {
87
- //@ts-ignore
91
+ if (editableProperties.indexOf(prop) > -1) {
88
92
  this[prop] = newVal;
89
93
  }
90
94
  else {
@@ -98,7 +102,7 @@ class Scriptable extends BaseNode_1.BaseNode {
98
102
  const parent = this.getNonTransparentParent();
99
103
  const target = {
100
104
  self: this.getRuleNode(),
101
- siblings: (parent === null || parent === void 0 ? void 0 : parent.ruleNodeReference()) || {}
105
+ siblings: parent?.ruleNodeReference() || {}
102
106
  };
103
107
  const scope = new Proxy(target, {
104
108
  get: (target, prop) => {
@@ -106,20 +110,13 @@ class Scriptable extends BaseNode_1.BaseNode {
106
110
  return 'Object';
107
111
  }
108
112
  prop = prop;
109
- // The order of resolution is
110
- // 1. property
111
- // 2. sibling
112
- // 3. child
113
113
  if (prop.startsWith('$')) {
114
- //this returns children as well, so adding an explicit check for property name
115
114
  const retValue = target.self[prop];
116
- if (retValue instanceof BaseNode_1.BaseNode) {
117
- //$parent
115
+ if (retValue instanceof BaseNode) {
118
116
  return retValue.getRuleNode();
119
117
  }
120
118
  else if (retValue instanceof Array) {
121
- //$items
122
- return retValue.map(r => r instanceof BaseNode_1.BaseNode ? r.getRuleNode() : r);
119
+ return retValue.map(r => r instanceof BaseNode ? r.getRuleNode() : r);
123
120
  }
124
121
  else {
125
122
  return retValue;
@@ -152,12 +149,6 @@ class Scriptable extends BaseNode_1.BaseNode {
152
149
  this.applyUpdates(updates);
153
150
  }
154
151
  }
155
- /**
156
- * Executes the given rule
157
- * @param event
158
- * @param context
159
- * @private
160
- */
161
152
  executeRule(event, context) {
162
153
  if (typeof event.payload.ruleName === 'undefined') {
163
154
  this.executeAllRules(context);
@@ -173,10 +164,6 @@ class Scriptable extends BaseNode_1.BaseNode {
173
164
  const node = this.ruleEngine.compileRule(expr);
174
165
  return this.ruleEngine.execute(node, this.getExpressionScope(), ruleContext);
175
166
  }
176
- /**
177
- * Executes the given action
178
- * @param action {@link Action | event object}
179
- */
180
167
  executeAction(action) {
181
168
  const context = {
182
169
  'form': this.form,
@@ -192,15 +179,12 @@ class Scriptable extends BaseNode_1.BaseNode {
192
179
  const eventName = action.isCustomEvent ? `custom:${action.type}` : action.type;
193
180
  const funcName = action.isCustomEvent ? `custom_${action.type}` : action.type;
194
181
  const node = this.getCompiledEvent(eventName);
195
- // @ts-ignore
196
182
  if (funcName in this && typeof this[funcName] === 'function') {
197
- //@ts-ignore
198
183
  this[funcName](action, context);
199
184
  }
200
- //todo: apply all the updates at the end or
201
- // not trigger the change event until the execution is finished
202
185
  node.forEach((n) => this.executeEvent(context, n));
203
186
  this.notifyDependents(action);
204
187
  }
205
188
  }
206
- exports.default = Scriptable;
189
+
190
+ export { Scriptable as default };
@@ -1,14 +1,6 @@
1
- /**
2
- * Defines event queue and event node
3
- */
4
- import { Action, BaseJson } from '../types';
5
- import { BaseNode } from '../BaseNode';
6
- import { Logger } from './Logger';
7
- /**
8
- * Implementation of event queue. When a user event, like change or click, is captured the expression to be evaluated
9
- * must be put in an Event Queue and then evaluated.
10
- * @private
11
- */
1
+ import { Action, BaseJson } from '../types/index.js';
2
+ import { BaseNode } from '../BaseNode.js';
3
+ import { Logger } from './Logger.js';
12
4
  declare class EventQueue {
13
5
  private logger;
14
6
  static readonly MAX_EVENT_CYCLE_COUNT = 10;
@@ -1,18 +1,28 @@
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 Logger_1 = require("./Logger");
11
- /**
12
- * Implementation of event node
13
- * @private
14
- */
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import { Logger } from './Logger.js';
22
+
15
23
  class EventNode {
24
+ _node;
25
+ _event;
16
26
  constructor(_node, _event) {
17
27
  this._node = _node;
18
28
  this._event = _event;
@@ -33,16 +43,14 @@ class EventNode {
33
43
  return this.toString();
34
44
  }
35
45
  }
36
- /**
37
- * Implementation of event queue. When a user event, like change or click, is captured the expression to be evaluated
38
- * must be put in an Event Queue and then evaluated.
39
- * @private
40
- */
41
46
  class EventQueue {
42
- constructor(logger = new Logger_1.Logger('off')) {
47
+ logger;
48
+ static MAX_EVENT_CYCLE_COUNT = 10;
49
+ _runningEventCount;
50
+ _isProcessing = false;
51
+ _pendingEvents = [];
52
+ constructor(logger = new Logger('off')) {
43
53
  this.logger = logger;
44
- this._isProcessing = false;
45
- this._pendingEvents = [];
46
54
  this._runningEventCount = {};
47
55
  }
48
56
  get length() {
@@ -67,7 +75,6 @@ class EventQueue {
67
75
  const counter = this._runningEventCount[evntNode.valueOf()] || 0;
68
76
  if (counter < EventQueue.MAX_EVENT_CYCLE_COUNT) {
69
77
  this.logger.info(`Queued event : ${e.type} node: ${node.id} - ${node.name}`);
70
- //console.log(`Event Details ${e.toString()}`)
71
78
  if (priority) {
72
79
  const index = this._isProcessing ? 1 : 0;
73
80
  this._pendingEvents.splice(index, 0, evntNode);
@@ -90,7 +97,6 @@ class EventQueue {
90
97
  while (this._pendingEvents.length > 0) {
91
98
  const e = this._pendingEvents[0];
92
99
  this.logger.info(`Dequeued event : ${e.event.type} node: ${e.node.id} - ${e.node.name}`);
93
- //console.log(`Event Details ${e.event.toString()}`);
94
100
  e.node.executeAction(e.event);
95
101
  this._pendingEvents.shift();
96
102
  }
@@ -98,5 +104,5 @@ class EventQueue {
98
104
  this._isProcessing = false;
99
105
  }
100
106
  }
101
- EventQueue.MAX_EVENT_CYCLE_COUNT = 10;
102
- exports.default = EventQueue;
107
+
108
+ export { EventQueue as default };
@@ -0,0 +1,85 @@
1
+ import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError } from '../types/index.js';
2
+ declare class ActionImpl implements Action {
3
+ private _metadata?;
4
+ protected _type: string;
5
+ private _payload?;
6
+ private _target;
7
+ constructor(payload: any, type: string, _metadata?: any);
8
+ get type(): string;
9
+ get payload(): any;
10
+ get metadata(): any;
11
+ get target(): FormModel | FieldModel | FieldsetModel;
12
+ get isCustomEvent(): boolean;
13
+ protected payloadToJson(): any;
14
+ toJson(): {
15
+ payload: any;
16
+ type: string;
17
+ isCustomEvent: boolean;
18
+ };
19
+ toString(): string;
20
+ }
21
+ export type ChangePayload = {
22
+ changes: Array<{
23
+ propertyName: string;
24
+ prevValue?: any;
25
+ currentValue: any;
26
+ }>;
27
+ };
28
+ export declare class Change extends ActionImpl {
29
+ constructor(payload: ChangePayload, dispatch?: boolean);
30
+ withAdditionalChange(change: Change): Change;
31
+ }
32
+ export declare class Invalid extends ActionImpl {
33
+ constructor(payload?: any);
34
+ }
35
+ export declare class Valid extends ActionImpl {
36
+ constructor(payload?: any);
37
+ }
38
+ export declare class ExecuteRule extends ActionImpl {
39
+ constructor(payload?: any, dispatch?: boolean);
40
+ }
41
+ export declare const propertyChange: (propertyName: string, currentValue: any, prevValue?: any) => Change;
42
+ export declare class Initialize extends ActionImpl {
43
+ constructor(payload?: any, dispatch?: boolean);
44
+ }
45
+ export declare class FormLoad extends ActionImpl {
46
+ constructor();
47
+ }
48
+ export declare class Click extends ActionImpl {
49
+ constructor(payload?: any, dispatch?: boolean);
50
+ }
51
+ export declare class Blur extends ActionImpl {
52
+ constructor(payload?: any, dispatch?: boolean);
53
+ }
54
+ export declare class ValidationComplete extends ActionImpl {
55
+ constructor(payload?: Array<ValidationError>, dispatch?: boolean);
56
+ }
57
+ export declare class Focus extends ActionImpl {
58
+ constructor();
59
+ }
60
+ export declare class Submit extends ActionImpl {
61
+ constructor(payload?: any, dispatch?: boolean);
62
+ }
63
+ export declare class Reset extends ActionImpl {
64
+ constructor(payload?: any, dispatch?: boolean);
65
+ }
66
+ export declare class FieldChanged extends ActionImpl {
67
+ constructor(changes: ChangePayload, field: BaseJson);
68
+ }
69
+ export declare class CustomEvent extends ActionImpl {
70
+ constructor(eventName: string, payload?: any, dispatch?: boolean);
71
+ get isCustomEvent(): boolean;
72
+ }
73
+ export declare class AddItem extends ActionImpl {
74
+ constructor(payload?: number);
75
+ }
76
+ export declare class RemoveItem extends ActionImpl {
77
+ constructor(payload?: number);
78
+ }
79
+ export declare class AddInstance extends ActionImpl {
80
+ constructor(payload?: number);
81
+ }
82
+ export declare class RemoveInstance extends ActionImpl {
83
+ constructor(payload?: number);
84
+ }
85
+ export {};
@@ -0,0 +1,171 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ class ActionImpl {
22
+ _metadata;
23
+ _type;
24
+ _payload;
25
+ _target;
26
+ constructor(payload, type, _metadata) {
27
+ this._metadata = _metadata;
28
+ this._payload = payload;
29
+ this._type = type;
30
+ }
31
+ get type() {
32
+ return this._type;
33
+ }
34
+ get payload() {
35
+ return this._payload;
36
+ }
37
+ get metadata() {
38
+ return this._metadata;
39
+ }
40
+ get target() {
41
+ return this._target;
42
+ }
43
+ get isCustomEvent() {
44
+ return false;
45
+ }
46
+ payloadToJson() {
47
+ return this.payload;
48
+ }
49
+ toJson() {
50
+ return {
51
+ payload: this.payloadToJson(),
52
+ type: this.type,
53
+ isCustomEvent: this.isCustomEvent
54
+ };
55
+ }
56
+ toString() {
57
+ return JSON.stringify(this.toJson());
58
+ }
59
+ }
60
+ class Change extends ActionImpl {
61
+ constructor(payload, dispatch = false) {
62
+ super(payload, 'change', { dispatch });
63
+ }
64
+ withAdditionalChange(change) {
65
+ return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
66
+ }
67
+ }
68
+ class Invalid extends ActionImpl {
69
+ constructor(payload = {}) {
70
+ super(payload, 'invalid', {});
71
+ }
72
+ }
73
+ class Valid extends ActionImpl {
74
+ constructor(payload = {}) {
75
+ super(payload, 'valid', {});
76
+ }
77
+ }
78
+ class ExecuteRule extends ActionImpl {
79
+ constructor(payload = {}, dispatch = false) {
80
+ super(payload, 'executeRule', { dispatch });
81
+ }
82
+ }
83
+ const propertyChange = (propertyName, currentValue, prevValue) => {
84
+ return new Change({
85
+ changes: [
86
+ {
87
+ propertyName,
88
+ currentValue,
89
+ prevValue
90
+ }
91
+ ]
92
+ });
93
+ };
94
+ class Initialize extends ActionImpl {
95
+ constructor(payload, dispatch = false) {
96
+ super(payload, 'initialize', { dispatch });
97
+ }
98
+ }
99
+ class FormLoad extends ActionImpl {
100
+ constructor() {
101
+ super({}, 'load', { dispatch: false });
102
+ }
103
+ }
104
+ class Click extends ActionImpl {
105
+ constructor(payload, dispatch = false) {
106
+ super(payload, 'click', { dispatch });
107
+ }
108
+ }
109
+ class Blur extends ActionImpl {
110
+ constructor(payload, dispatch = false) {
111
+ super(payload, 'blur', { dispatch });
112
+ }
113
+ }
114
+ class ValidationComplete extends ActionImpl {
115
+ constructor(payload, dispatch = false) {
116
+ super(payload, 'validationComplete', { dispatch });
117
+ }
118
+ }
119
+ class Focus extends ActionImpl {
120
+ constructor() {
121
+ super({}, 'focus', { dispatch: false });
122
+ }
123
+ }
124
+ class Submit extends ActionImpl {
125
+ constructor(payload, dispatch = false) {
126
+ super(payload, 'submit', { dispatch });
127
+ }
128
+ }
129
+ class Reset extends ActionImpl {
130
+ constructor(payload, dispatch = false) {
131
+ super(payload, 'reset', { dispatch });
132
+ }
133
+ }
134
+ class FieldChanged extends ActionImpl {
135
+ constructor(changes, field) {
136
+ super({
137
+ field,
138
+ changes
139
+ }, 'fieldChanged');
140
+ }
141
+ }
142
+ class CustomEvent extends ActionImpl {
143
+ constructor(eventName, payload = {}, dispatch = false) {
144
+ super(payload, eventName, { dispatch });
145
+ }
146
+ get isCustomEvent() {
147
+ return true;
148
+ }
149
+ }
150
+ class AddItem extends ActionImpl {
151
+ constructor(payload) {
152
+ super(payload, 'addItem');
153
+ }
154
+ }
155
+ class RemoveItem extends ActionImpl {
156
+ constructor(payload) {
157
+ super(payload, 'removeItem');
158
+ }
159
+ }
160
+ class AddInstance extends ActionImpl {
161
+ constructor(payload) {
162
+ super(payload, 'addInstance');
163
+ }
164
+ }
165
+ class RemoveInstance extends ActionImpl {
166
+ constructor(payload) {
167
+ super(payload, 'removeInstance');
168
+ }
169
+ }
170
+
171
+ export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Submit, Valid, ValidationComplete, propertyChange };
@@ -1,11 +1,5 @@
1
- export declare type LogFunction = 'info' | 'warn' | 'error' | 'debug';
2
- /**
3
- * Logging levels.
4
- */
5
- export declare type LogLevel = 'off' | LogFunction;
6
- /**
7
- * @private
8
- */
1
+ export type LogFunction = 'info' | 'warn' | 'error' | 'debug';
2
+ export type LogLevel = 'off' | LogFunction;
9
3
  export declare class Logger {
10
4
  debug(msg: string): void;
11
5
  info(msg: string): void;
@@ -0,0 +1,52 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ const levels = {
22
+ off: 0,
23
+ debug: 1,
24
+ info: 2,
25
+ warn: 3,
26
+ error: 4
27
+ };
28
+ class Logger {
29
+ debug(msg) {
30
+ this.log(msg, 'debug');
31
+ }
32
+ info(msg) {
33
+ this.log(msg, 'info');
34
+ }
35
+ warn(msg) {
36
+ this.log(msg, 'warn');
37
+ }
38
+ error(msg) {
39
+ this.log(msg, 'error');
40
+ }
41
+ log(msg, level) {
42
+ if (this.logLevel !== 0 && this.logLevel <= levels[level]) {
43
+ console[level](msg);
44
+ }
45
+ }
46
+ logLevel;
47
+ constructor(logLevel = 'off') {
48
+ this.logLevel = levels[logLevel];
49
+ }
50
+ }
51
+
52
+ export { Logger };
@@ -1,10 +1,4 @@
1
- /**
2
- * Defines data group
3
- */
4
- import DataValue from './DataValue';
5
- /**
6
- * @private
7
- */
1
+ import DataValue from './DataValue.js';
8
2
  export default class DataGroup extends DataValue {
9
3
  $_items: {
10
4
  [key: string]: DataValue | DataGroup;