@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.
- package/LICENSE +18 -4
- package/lib/cjs/index.cjs +7277 -0
- package/lib/{BaseNode.js → esm/BaseNode-dc59ab07.js} +108 -184
- package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
- package/lib/esm/BaseNode.js +26 -0
- package/lib/esm/Checkbox.d.ts +79 -0
- package/lib/esm/Checkbox.js +63 -0
- package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
- package/lib/esm/CheckboxGroup.js +60 -0
- package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
- package/lib/{Container.js → esm/Container.js} +81 -122
- package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
- package/lib/esm/DateField.js +57 -0
- package/lib/{Field.d.ts → esm/Field.d.ts} +41 -106
- package/lib/{Field.js → esm/Field.js} +186 -216
- package/lib/esm/Fieldset.d.ts +16 -0
- package/lib/esm/Fieldset.js +78 -0
- package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
- package/lib/esm/FileObject.js +48 -0
- package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
- package/lib/esm/FileUpload.js +141 -0
- package/lib/{Form.d.ts → esm/Form.d.ts} +20 -86
- package/lib/esm/Form.js +208 -0
- package/lib/esm/FormInstance.d.ts +13 -0
- package/lib/esm/FormInstance.js +129 -0
- package/lib/esm/FormMetaData.d.ts +7 -0
- package/lib/esm/FormMetaData.js +35 -0
- package/lib/esm/InstanceManager.d.ts +9 -0
- package/lib/esm/InstanceManager.js +58 -0
- package/lib/esm/Node.d.ts +7 -0
- package/lib/esm/Node.js +40 -0
- package/lib/esm/Scriptable.d.ts +17 -0
- package/lib/{Scriptable.js → esm/Scriptable.js} +38 -54
- package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
- package/lib/{controller → esm/controller}/EventQueue.js +32 -26
- package/lib/esm/controller/Events.d.ts +85 -0
- package/lib/esm/controller/Events.js +171 -0
- package/lib/{controller → esm/controller}/Logger.d.ts +2 -8
- package/lib/esm/controller/Logger.js +52 -0
- package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
- package/lib/{data → esm/data}/DataGroup.js +38 -34
- package/lib/{data → esm/data}/DataValue.d.ts +1 -7
- package/lib/esm/data/DataValue.js +68 -0
- package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
- package/lib/esm/data/EmptyDataValue.js +51 -0
- package/lib/esm/index.d.ts +21 -0
- package/lib/esm/index.js +55 -0
- package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +3 -25
- package/lib/{rules → esm/rules}/FunctionRuntime.js +66 -117
- package/lib/esm/rules/RuleEngine.d.ts +12 -0
- package/lib/esm/rules/RuleEngine.js +76 -0
- package/lib/esm/types/Json.d.ts +119 -0
- package/lib/esm/types/Json.js +29 -0
- package/lib/esm/types/Model.d.ts +131 -0
- package/lib/esm/types/Model.js +30 -0
- package/lib/esm/types/index.d.ts +2 -0
- package/lib/esm/types/index.js +22 -0
- package/lib/{utils → esm/utils}/DataRefParser.d.ts +4 -7
- package/lib/{utils → esm/utils}/DataRefParser.js +42 -44
- package/lib/{utils → esm/utils}/Fetch.d.ts +1 -7
- package/lib/esm/utils/Fetch.js +83 -0
- package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
- package/lib/esm/utils/FormCreationUtils.js +112 -0
- package/lib/esm/utils/FormUtils.d.ts +12 -0
- package/lib/esm/utils/FormUtils.js +212 -0
- package/lib/esm/utils/JsonUtils.d.ts +11 -0
- package/lib/esm/utils/JsonUtils.js +99 -0
- package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
- package/lib/esm/utils/LogUtils.js +28 -0
- package/lib/esm/utils/SchemaUtils.d.ts +3 -0
- package/lib/esm/utils/SchemaUtils.js +93 -0
- package/lib/esm/utils/TranslationUtils.d.ts +11 -0
- package/lib/esm/utils/TranslationUtils.js +138 -0
- package/lib/esm/utils/ValidationUtils.d.ts +19 -0
- package/lib/{utils → esm/utils}/ValidationUtils.js +55 -187
- package/package.json +18 -10
- package/lib/Checkbox.d.ts +0 -88
- package/lib/Checkbox.js +0 -49
- package/lib/CheckboxGroup.js +0 -43
- package/lib/DateField.js +0 -35
- package/lib/Fieldset.d.ts +0 -24
- package/lib/Fieldset.js +0 -74
- package/lib/FileObject.js +0 -39
- package/lib/FileUpload.js +0 -155
- package/lib/Form.js +0 -252
- package/lib/FormInstance.d.ts +0 -38
- package/lib/FormInstance.js +0 -127
- package/lib/FormMetaData.d.ts +0 -11
- package/lib/FormMetaData.js +0 -28
- package/lib/InstanceManager.d.ts +0 -16
- package/lib/InstanceManager.js +0 -53
- package/lib/Node.d.ts +0 -12
- package/lib/Node.js +0 -27
- package/lib/Scriptable.d.ts +0 -31
- package/lib/controller/Controller.d.ts +0 -255
- package/lib/controller/Controller.js +0 -328
- package/lib/controller/Logger.js +0 -36
- package/lib/controller/index.d.ts +0 -1
- package/lib/controller/index.js +0 -24
- package/lib/data/DataValue.js +0 -56
- package/lib/data/EmptyDataValue.js +0 -46
- package/lib/index.d.ts +0 -28
- package/lib/index.js +0 -63
- package/lib/rules/RuleEngine.d.ts +0 -23
- package/lib/rules/RuleEngine.js +0 -62
- package/lib/types/Json.d.ts +0 -138
- package/lib/types/Json.js +0 -19
- package/lib/types/Model.d.ts +0 -393
- package/lib/types/Model.js +0 -20
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.js +0 -25
- package/lib/utils/Fetch.js +0 -87
- package/lib/utils/FormCreationUtils.d.ts +0 -11
- package/lib/utils/FormCreationUtils.js +0 -83
- package/lib/utils/FormUtils.d.ts +0 -47
- package/lib/utils/FormUtils.js +0 -257
- package/lib/utils/JsonUtils.d.ts +0 -63
- package/lib/utils/JsonUtils.js +0 -157
- package/lib/utils/LogUtils.js +0 -17
- package/lib/utils/SchemaUtils.d.ts +0 -16
- package/lib/utils/SchemaUtils.js +0 -92
- package/lib/utils/TranslationUtils.d.ts +0 -41
- package/lib/utils/TranslationUtils.js +0 -185
- package/lib/utils/ValidationUtils.d.ts +0 -170
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 =
|
|
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
|
-
|
|
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 (
|
|
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:
|
|
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
|
|
117
|
-
//$parent
|
|
115
|
+
if (retValue instanceof BaseNode) {
|
|
118
116
|
return retValue.getRuleNode();
|
|
119
117
|
}
|
|
120
118
|
else if (retValue instanceof Array) {
|
|
121
|
-
|
|
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
|
-
|
|
189
|
+
|
|
190
|
+
export { Scriptable as default };
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
102
|
-
|
|
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
|
|
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 };
|