@aemforms/af-core 0.22.23 → 0.22.26
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/lib/browser/afb-events.js +151 -0
- package/lib/browser/afb-runtime.js +3620 -0
- package/lib/cjs/index.cjs +1876 -267
- package/lib/esm/BaseNode.js +454 -26
- package/lib/esm/Checkbox.js +1 -37
- package/lib/esm/CheckboxGroup.js +1 -38
- package/lib/esm/Container.js +9 -30
- package/lib/esm/DateField.js +2 -38
- package/lib/esm/Field.d.ts +2 -2
- package/lib/esm/Field.js +26 -62
- package/lib/esm/Fieldset.js +3 -36
- package/lib/esm/FileObject.js +1 -23
- package/lib/esm/FileUpload.js +1 -34
- package/lib/esm/Form.d.ts +1 -1
- package/lib/esm/Form.js +8 -40
- package/lib/esm/FormInstance.js +5 -53
- package/lib/esm/FormMetaData.js +1 -26
- package/lib/esm/InstanceManager.js +8 -35
- package/lib/esm/Node.js +1 -25
- package/lib/esm/Scriptable.js +2 -29
- package/lib/esm/controller/EventQueue.js +1 -23
- package/lib/esm/controller/Events.d.ts +1 -1
- package/lib/esm/controller/Events.js +19 -41
- package/lib/esm/controller/Logger.d.ts +2 -2
- package/lib/esm/controller/Logger.js +1 -23
- package/lib/esm/data/DataGroup.js +1 -24
- package/lib/esm/data/DataValue.js +1 -23
- package/lib/esm/data/EmptyDataValue.js +1 -23
- package/lib/esm/index.js +21 -55
- package/lib/esm/rules/FunctionRuntime.d.ts +3 -3
- package/lib/esm/rules/FunctionRuntime.js +6 -31
- package/lib/esm/rules/RuleEngine.js +1 -30
- package/lib/esm/types/Json.d.ts +16 -16
- package/lib/esm/types/Json.js +2 -24
- package/lib/esm/types/Model.d.ts +4 -4
- package/lib/esm/types/Model.js +1 -23
- package/lib/esm/types/index.js +2 -22
- package/lib/esm/utils/DataRefParser.d.ts +2 -2
- package/lib/esm/utils/DataRefParser.js +6 -31
- package/lib/esm/utils/Fetch.d.ts +1 -1
- package/lib/esm/utils/Fetch.js +2 -24
- package/lib/esm/utils/FormCreationUtils.js +2 -40
- package/lib/esm/utils/FormUtils.js +8 -33
- package/lib/esm/utils/JsonUtils.js +11 -34
- package/lib/esm/utils/LogUtils.js +1 -23
- package/lib/esm/utils/SchemaUtils.js +2 -24
- package/lib/esm/utils/TranslationUtils.d.ts +1 -1
- package/lib/esm/utils/TranslationUtils.js +9 -32
- package/lib/esm/utils/ValidationUtils.d.ts +4 -4
- package/lib/esm/utils/ValidationUtils.js +4 -30
- package/package.json +2 -14
- package/lib/esm/BaseNode-dc59ab07.js +0 -478
|
@@ -1,23 +1,3 @@
|
|
|
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
1
|
class ActionImpl {
|
|
22
2
|
_metadata;
|
|
23
3
|
_type;
|
|
@@ -57,7 +37,7 @@ class ActionImpl {
|
|
|
57
37
|
return JSON.stringify(this.toJson());
|
|
58
38
|
}
|
|
59
39
|
}
|
|
60
|
-
class Change extends ActionImpl {
|
|
40
|
+
export class Change extends ActionImpl {
|
|
61
41
|
constructor(payload, dispatch = false) {
|
|
62
42
|
super(payload, 'change', { dispatch });
|
|
63
43
|
}
|
|
@@ -65,22 +45,22 @@ class Change extends ActionImpl {
|
|
|
65
45
|
return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
|
|
66
46
|
}
|
|
67
47
|
}
|
|
68
|
-
class Invalid extends ActionImpl {
|
|
48
|
+
export class Invalid extends ActionImpl {
|
|
69
49
|
constructor(payload = {}) {
|
|
70
50
|
super(payload, 'invalid', {});
|
|
71
51
|
}
|
|
72
52
|
}
|
|
73
|
-
class Valid extends ActionImpl {
|
|
53
|
+
export class Valid extends ActionImpl {
|
|
74
54
|
constructor(payload = {}) {
|
|
75
55
|
super(payload, 'valid', {});
|
|
76
56
|
}
|
|
77
57
|
}
|
|
78
|
-
class ExecuteRule extends ActionImpl {
|
|
58
|
+
export class ExecuteRule extends ActionImpl {
|
|
79
59
|
constructor(payload = {}, dispatch = false) {
|
|
80
60
|
super(payload, 'executeRule', { dispatch });
|
|
81
61
|
}
|
|
82
62
|
}
|
|
83
|
-
const propertyChange = (propertyName, currentValue, prevValue) => {
|
|
63
|
+
export const propertyChange = (propertyName, currentValue, prevValue) => {
|
|
84
64
|
return new Change({
|
|
85
65
|
changes: [
|
|
86
66
|
{
|
|
@@ -91,47 +71,47 @@ const propertyChange = (propertyName, currentValue, prevValue) => {
|
|
|
91
71
|
]
|
|
92
72
|
});
|
|
93
73
|
};
|
|
94
|
-
class Initialize extends ActionImpl {
|
|
74
|
+
export class Initialize extends ActionImpl {
|
|
95
75
|
constructor(payload, dispatch = false) {
|
|
96
76
|
super(payload, 'initialize', { dispatch });
|
|
97
77
|
}
|
|
98
78
|
}
|
|
99
|
-
class FormLoad extends ActionImpl {
|
|
79
|
+
export class FormLoad extends ActionImpl {
|
|
100
80
|
constructor() {
|
|
101
81
|
super({}, 'load', { dispatch: false });
|
|
102
82
|
}
|
|
103
83
|
}
|
|
104
|
-
class Click extends ActionImpl {
|
|
84
|
+
export class Click extends ActionImpl {
|
|
105
85
|
constructor(payload, dispatch = false) {
|
|
106
86
|
super(payload, 'click', { dispatch });
|
|
107
87
|
}
|
|
108
88
|
}
|
|
109
|
-
class Blur extends ActionImpl {
|
|
89
|
+
export class Blur extends ActionImpl {
|
|
110
90
|
constructor(payload, dispatch = false) {
|
|
111
91
|
super(payload, 'blur', { dispatch });
|
|
112
92
|
}
|
|
113
93
|
}
|
|
114
|
-
class ValidationComplete extends ActionImpl {
|
|
94
|
+
export class ValidationComplete extends ActionImpl {
|
|
115
95
|
constructor(payload, dispatch = false) {
|
|
116
96
|
super(payload, 'validationComplete', { dispatch });
|
|
117
97
|
}
|
|
118
98
|
}
|
|
119
|
-
class Focus extends ActionImpl {
|
|
99
|
+
export class Focus extends ActionImpl {
|
|
120
100
|
constructor() {
|
|
121
101
|
super({}, 'focus', { dispatch: false });
|
|
122
102
|
}
|
|
123
103
|
}
|
|
124
|
-
class Submit extends ActionImpl {
|
|
104
|
+
export class Submit extends ActionImpl {
|
|
125
105
|
constructor(payload, dispatch = false) {
|
|
126
106
|
super(payload, 'submit', { dispatch });
|
|
127
107
|
}
|
|
128
108
|
}
|
|
129
|
-
class Reset extends ActionImpl {
|
|
109
|
+
export class Reset extends ActionImpl {
|
|
130
110
|
constructor(payload, dispatch = false) {
|
|
131
111
|
super(payload, 'reset', { dispatch });
|
|
132
112
|
}
|
|
133
113
|
}
|
|
134
|
-
class FieldChanged extends ActionImpl {
|
|
114
|
+
export class FieldChanged extends ActionImpl {
|
|
135
115
|
constructor(changes, field) {
|
|
136
116
|
super({
|
|
137
117
|
field,
|
|
@@ -139,7 +119,7 @@ class FieldChanged extends ActionImpl {
|
|
|
139
119
|
}, 'fieldChanged');
|
|
140
120
|
}
|
|
141
121
|
}
|
|
142
|
-
class CustomEvent extends ActionImpl {
|
|
122
|
+
export class CustomEvent extends ActionImpl {
|
|
143
123
|
constructor(eventName, payload = {}, dispatch = false) {
|
|
144
124
|
super(payload, eventName, { dispatch });
|
|
145
125
|
}
|
|
@@ -147,25 +127,23 @@ class CustomEvent extends ActionImpl {
|
|
|
147
127
|
return true;
|
|
148
128
|
}
|
|
149
129
|
}
|
|
150
|
-
class AddItem extends ActionImpl {
|
|
130
|
+
export class AddItem extends ActionImpl {
|
|
151
131
|
constructor(payload) {
|
|
152
132
|
super(payload, 'addItem');
|
|
153
133
|
}
|
|
154
134
|
}
|
|
155
|
-
class RemoveItem extends ActionImpl {
|
|
135
|
+
export class RemoveItem extends ActionImpl {
|
|
156
136
|
constructor(payload) {
|
|
157
137
|
super(payload, 'removeItem');
|
|
158
138
|
}
|
|
159
139
|
}
|
|
160
|
-
class AddInstance extends ActionImpl {
|
|
140
|
+
export class AddInstance extends ActionImpl {
|
|
161
141
|
constructor(payload) {
|
|
162
142
|
super(payload, 'addInstance');
|
|
163
143
|
}
|
|
164
144
|
}
|
|
165
|
-
class RemoveInstance extends ActionImpl {
|
|
145
|
+
export class RemoveInstance extends ActionImpl {
|
|
166
146
|
constructor(payload) {
|
|
167
147
|
super(payload, 'removeInstance');
|
|
168
148
|
}
|
|
169
149
|
}
|
|
170
|
-
|
|
171
|
-
export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Submit, Valid, ValidationComplete, propertyChange };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type LogFunction = 'info' | 'warn' | 'error' | 'debug';
|
|
2
|
-
export type LogLevel = 'off' | LogFunction;
|
|
1
|
+
export declare type LogFunction = 'info' | 'warn' | 'error' | 'debug';
|
|
2
|
+
export declare type LogLevel = 'off' | LogFunction;
|
|
3
3
|
export declare class Logger {
|
|
4
4
|
debug(msg: string): void;
|
|
5
5
|
info(msg: string): void;
|
|
@@ -1,23 +1,3 @@
|
|
|
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
1
|
const levels = {
|
|
22
2
|
off: 0,
|
|
23
3
|
debug: 1,
|
|
@@ -25,7 +5,7 @@ const levels = {
|
|
|
25
5
|
warn: 3,
|
|
26
6
|
error: 4
|
|
27
7
|
};
|
|
28
|
-
class Logger {
|
|
8
|
+
export class Logger {
|
|
29
9
|
debug(msg) {
|
|
30
10
|
this.log(msg, 'debug');
|
|
31
11
|
}
|
|
@@ -48,5 +28,3 @@ class Logger {
|
|
|
48
28
|
this.logLevel = levels[logLevel];
|
|
49
29
|
}
|
|
50
30
|
}
|
|
51
|
-
|
|
52
|
-
export { Logger };
|
|
@@ -1,27 +1,6 @@
|
|
|
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
1
|
import DataValue from './DataValue.js';
|
|
22
2
|
import NullDataValue from './EmptyDataValue.js';
|
|
23
|
-
|
|
24
|
-
class DataGroup extends DataValue {
|
|
3
|
+
export default class DataGroup extends DataValue {
|
|
25
4
|
$_items;
|
|
26
5
|
createEntry(key, value) {
|
|
27
6
|
const t = value instanceof Array ? 'array' : typeof value;
|
|
@@ -96,5 +75,3 @@ class DataGroup extends DataValue {
|
|
|
96
75
|
return true;
|
|
97
76
|
}
|
|
98
77
|
}
|
|
99
|
-
|
|
100
|
-
export { DataGroup as default };
|
|
@@ -1,24 +1,4 @@
|
|
|
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 DataValue {
|
|
1
|
+
export default class DataValue {
|
|
22
2
|
$_name;
|
|
23
3
|
$_value;
|
|
24
4
|
$_type;
|
|
@@ -64,5 +44,3 @@ class DataValue {
|
|
|
64
44
|
return false;
|
|
65
45
|
}
|
|
66
46
|
}
|
|
67
|
-
|
|
68
|
-
export { DataValue as default };
|
|
@@ -1,25 +1,4 @@
|
|
|
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
1
|
import DataValue from './DataValue.js';
|
|
22
|
-
|
|
23
2
|
const value = Symbol('NullValue');
|
|
24
3
|
class NullDataValueClass extends DataValue {
|
|
25
4
|
constructor() {
|
|
@@ -47,5 +26,4 @@ class NullDataValueClass extends DataValue {
|
|
|
47
26
|
}
|
|
48
27
|
}
|
|
49
28
|
const NullDataValue = new NullDataValueClass();
|
|
50
|
-
|
|
51
|
-
export { NullDataValue as default };
|
|
29
|
+
export default NullDataValue;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,55 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
export { constraintProps, translationProps } from './types/Json.js';
|
|
23
|
-
export { ValidationError } from './types/Model.js';
|
|
24
|
-
export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Submit, Valid, ValidationComplete, propertyChange } from './controller/Events.js';
|
|
25
|
-
export { CUSTOM_PROPS_KEY, TRANSLATION_ID, TRANSLATION_TOKEN, addTranslationId, createTranslationObj, createTranslationObject, getOrElse, invalidateTranslation } from './utils/TranslationUtils.js';
|
|
26
|
-
export { checkIfConstraintsArePresent, checkIfKeyAdded, deepClone, getProperty, isCheckbox, isCheckboxGroup, isDateField, isFile, isRepeatable, jsonString } from './utils/JsonUtils.js';
|
|
27
|
-
export { defaultFieldTypes, exportDataSchema } from './utils/SchemaUtils.js';
|
|
28
|
-
export { extractFileInfo, getFileSizeInBytes, isEmpty } from './utils/FormUtils.js';
|
|
29
|
-
export { B as BaseNode } from './BaseNode-dc59ab07.js';
|
|
30
|
-
export { default as Checkbox } from './Checkbox.js';
|
|
31
|
-
export { default as CheckboxGroup } from './CheckboxGroup.js';
|
|
32
|
-
export { default as Container } from './Container.js';
|
|
33
|
-
export { default as Field } from './Field.js';
|
|
34
|
-
export { Fieldset } from './Fieldset.js';
|
|
35
|
-
export { FileObject } from './FileObject.js';
|
|
36
|
-
export { default as FileUpload } from './FileUpload.js';
|
|
37
|
-
export { default as FormMetaData } from './FormMetaData.js';
|
|
38
|
-
export { default as Node } from './Node.js';
|
|
39
|
-
export { default as Scriptable } from './Scriptable.js';
|
|
40
|
-
export { default as Form } from './Form.js';
|
|
41
|
-
export { FunctionRuntime, request } from './rules/FunctionRuntime.js';
|
|
42
|
-
import './utils/Fetch.js';
|
|
43
|
-
import './rules/RuleEngine.js';
|
|
44
|
-
import '@adobe/json-formula';
|
|
45
|
-
import './controller/EventQueue.js';
|
|
46
|
-
import './controller/Logger.js';
|
|
47
|
-
import './utils/FormCreationUtils.js';
|
|
48
|
-
import './InstanceManager.js';
|
|
49
|
-
import './utils/DataRefParser.js';
|
|
50
|
-
import './data/DataGroup.js';
|
|
51
|
-
import './data/DataValue.js';
|
|
52
|
-
import './data/EmptyDataValue.js';
|
|
53
|
-
import './DateField.js';
|
|
54
|
-
import '@aemforms/af-formatters';
|
|
55
|
-
import './utils/ValidationUtils.js';
|
|
1
|
+
export * from './FormInstance.js';
|
|
2
|
+
export * from './types/index.js';
|
|
3
|
+
export * from './controller/Events.js';
|
|
4
|
+
export * from './utils/TranslationUtils.js';
|
|
5
|
+
export * from './utils/JsonUtils.js';
|
|
6
|
+
export * from './utils/SchemaUtils.js';
|
|
7
|
+
import { getFileSizeInBytes, extractFileInfo, isEmpty } from './utils/FormUtils.js';
|
|
8
|
+
import { BaseNode } from './BaseNode.js';
|
|
9
|
+
import Checkbox from './Checkbox.js';
|
|
10
|
+
import CheckboxGroup from './CheckboxGroup.js';
|
|
11
|
+
import Container from './Container.js';
|
|
12
|
+
import Field from './Field.js';
|
|
13
|
+
import { Fieldset } from './Fieldset.js';
|
|
14
|
+
import { FileObject } from './FileObject.js';
|
|
15
|
+
import FileUpload from './FileUpload.js';
|
|
16
|
+
import FormMetaData from './FormMetaData.js';
|
|
17
|
+
import Node from './Node.js';
|
|
18
|
+
import Scriptable from './Scriptable.js';
|
|
19
|
+
import Form from './Form.js';
|
|
20
|
+
import { FunctionRuntime, request } from './rules/FunctionRuntime.js';
|
|
21
|
+
export { Form, BaseNode, Checkbox, CheckboxGroup, Container, Field, Fieldset, FileObject, FileUpload, FormMetaData, Node, Scriptable, getFileSizeInBytes, extractFileInfo, FunctionRuntime, request, isEmpty };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
type HTTP_VERB = 'GET' | 'POST';
|
|
1
|
+
declare type HTTP_VERB = 'GET' | 'POST';
|
|
2
2
|
export declare const request: (context: any, uri: string, httpVerb: HTTP_VERB, payload: any, success: string, error: string, headers: any) => Promise<void>;
|
|
3
3
|
export declare const submit: (context: any, success: string, error: string, submitAs?: 'application/json' | 'multipart/form-data', input_data?: any) => Promise<void>;
|
|
4
|
-
export type CustomFunction = Function;
|
|
5
|
-
export type FunctionDefinition = {
|
|
4
|
+
export declare type CustomFunction = Function;
|
|
5
|
+
export declare type FunctionDefinition = {
|
|
6
6
|
_func: CustomFunction;
|
|
7
7
|
_signature: Array<any>;
|
|
8
8
|
};
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { CustomEvent, Submit, RemoveInstance, AddInstance, Reset, RemoveItem, AddItem, Click, Change } from '../controller/Events.js';
|
|
22
|
-
import { request as request$1 } from '../utils/Fetch.js';
|
|
1
|
+
import { AddInstance, AddItem, Change, Click, CustomEvent, RemoveInstance, RemoveItem, Reset, Submit } from '../controller/Events.js';
|
|
2
|
+
import { request as fRequest } from '../utils/Fetch.js';
|
|
23
3
|
import { FileObject } from '../FileObject.js';
|
|
24
4
|
import { getAttachments } from '../utils/FormUtils.js';
|
|
25
5
|
import { jsonString } from '../utils/JsonUtils.js';
|
|
26
|
-
import '../types/Json.js';
|
|
27
|
-
import '../utils/SchemaUtils.js';
|
|
28
|
-
|
|
29
6
|
const getCustomEventName = (name) => {
|
|
30
7
|
const eName = name;
|
|
31
8
|
if (eName.length > 0 && eName.startsWith('custom:')) {
|
|
@@ -33,7 +10,7 @@ const getCustomEventName = (name) => {
|
|
|
33
10
|
}
|
|
34
11
|
return eName;
|
|
35
12
|
};
|
|
36
|
-
const request = async (context, uri, httpVerb, payload, success, error, headers) => {
|
|
13
|
+
export const request = async (context, uri, httpVerb, payload, success, error, headers) => {
|
|
37
14
|
const endpoint = uri;
|
|
38
15
|
const requestOptions = {
|
|
39
16
|
method: httpVerb
|
|
@@ -71,7 +48,7 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
|
|
|
71
48
|
inputPayload = urlEncoded(payload);
|
|
72
49
|
}
|
|
73
50
|
}
|
|
74
|
-
result = await
|
|
51
|
+
result = await fRequest(endpoint, inputPayload, requestOptions);
|
|
75
52
|
}
|
|
76
53
|
catch (e) {
|
|
77
54
|
context.form.logger.error('Error invoking a rest API');
|
|
@@ -126,7 +103,7 @@ const multipartFormData = (data, attachments) => {
|
|
|
126
103
|
}
|
|
127
104
|
return formData;
|
|
128
105
|
};
|
|
129
|
-
const submit = async (context, success, error, submitAs = 'multipart/form-data', input_data = null) => {
|
|
106
|
+
export const submit = async (context, success, error, submitAs = 'multipart/form-data', input_data = null) => {
|
|
130
107
|
const endpoint = context.form.action;
|
|
131
108
|
let data = input_data;
|
|
132
109
|
if (typeof data != 'object' || data == null) {
|
|
@@ -340,6 +317,4 @@ class FunctionRuntimeImpl {
|
|
|
340
317
|
return { ...defaultFunctions, ...this.customFunctions };
|
|
341
318
|
}
|
|
342
319
|
}
|
|
343
|
-
const FunctionRuntime = new FunctionRuntimeImpl();
|
|
344
|
-
|
|
345
|
-
export { FunctionRuntime, request, submit };
|
|
320
|
+
export const FunctionRuntime = new FunctionRuntimeImpl();
|
|
@@ -1,33 +1,5 @@
|
|
|
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
1
|
import Formula from '@adobe/json-formula';
|
|
22
2
|
import { FunctionRuntime } from './FunctionRuntime.js';
|
|
23
|
-
import '../controller/Events.js';
|
|
24
|
-
import '../utils/Fetch.js';
|
|
25
|
-
import '../FileObject.js';
|
|
26
|
-
import '../utils/FormUtils.js';
|
|
27
|
-
import '../utils/JsonUtils.js';
|
|
28
|
-
import '../types/Json.js';
|
|
29
|
-
import '../utils/SchemaUtils.js';
|
|
30
|
-
|
|
31
3
|
class RuleEngine {
|
|
32
4
|
_context;
|
|
33
5
|
_globalNames = [
|
|
@@ -72,5 +44,4 @@ class RuleEngine {
|
|
|
72
44
|
}
|
|
73
45
|
}
|
|
74
46
|
}
|
|
75
|
-
|
|
76
|
-
export { RuleEngine as default };
|
|
47
|
+
export default RuleEngine;
|
package/lib/esm/types/Json.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export type Items<T> = {
|
|
1
|
+
export declare type Items<T> = {
|
|
2
2
|
[key: string]: T;
|
|
3
3
|
};
|
|
4
|
-
export type Primitives = string | number | boolean | null | undefined;
|
|
5
|
-
export type Label = {
|
|
4
|
+
export declare type Primitives = string | number | boolean | null | undefined;
|
|
5
|
+
export declare type Label = {
|
|
6
6
|
value: string;
|
|
7
7
|
richText?: boolean;
|
|
8
8
|
visible?: boolean;
|
|
9
9
|
};
|
|
10
|
-
type TranslationConstraintsJson = {
|
|
10
|
+
declare type TranslationConstraintsJson = {
|
|
11
11
|
enumNames?: string[];
|
|
12
12
|
enum?: any[];
|
|
13
13
|
};
|
|
14
|
-
export type ConstraintsJson = TranslationConstraintsJson & {
|
|
14
|
+
export declare type ConstraintsJson = TranslationConstraintsJson & {
|
|
15
15
|
accept?: string[];
|
|
16
16
|
enforceEnum?: boolean;
|
|
17
17
|
exclusiveMinimum?: number;
|
|
@@ -33,7 +33,7 @@ export type ConstraintsJson = TranslationConstraintsJson & {
|
|
|
33
33
|
validationExpression?: string;
|
|
34
34
|
uniqueItems?: boolean;
|
|
35
35
|
};
|
|
36
|
-
export type ConstraintsMessages = {
|
|
36
|
+
export declare type ConstraintsMessages = {
|
|
37
37
|
accept?: string;
|
|
38
38
|
enum?: string;
|
|
39
39
|
exclusiveMinimum?: string;
|
|
@@ -53,14 +53,14 @@ export type ConstraintsMessages = {
|
|
|
53
53
|
type?: string;
|
|
54
54
|
validationExpression?: string;
|
|
55
55
|
};
|
|
56
|
-
export type RulesJson = {
|
|
56
|
+
export declare type RulesJson = {
|
|
57
57
|
rules?: Items<string>;
|
|
58
58
|
events?: Items<string[] | string | undefined>;
|
|
59
59
|
};
|
|
60
|
-
type TranslationBaseJson = {
|
|
60
|
+
declare type TranslationBaseJson = {
|
|
61
61
|
description?: string;
|
|
62
62
|
};
|
|
63
|
-
export type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson & {
|
|
63
|
+
export declare type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson & {
|
|
64
64
|
dataRef?: string | null;
|
|
65
65
|
':type'?: string;
|
|
66
66
|
label?: Label;
|
|
@@ -79,10 +79,10 @@ export type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson & {
|
|
|
79
79
|
altText?: string;
|
|
80
80
|
viewType?: string;
|
|
81
81
|
};
|
|
82
|
-
type TranslationFieldJson = {
|
|
82
|
+
declare type TranslationFieldJson = {
|
|
83
83
|
placeholder?: string;
|
|
84
84
|
};
|
|
85
|
-
export type FieldJson = BaseJson & TranslationFieldJson & {
|
|
85
|
+
export declare type FieldJson = BaseJson & TranslationFieldJson & {
|
|
86
86
|
readOnly?: boolean;
|
|
87
87
|
valid?: boolean;
|
|
88
88
|
default?: any;
|
|
@@ -93,19 +93,19 @@ export type FieldJson = BaseJson & TranslationFieldJson & {
|
|
|
93
93
|
displayValue?: string;
|
|
94
94
|
emptyValue?: 'null' | 'undefined' | '';
|
|
95
95
|
};
|
|
96
|
-
export type ContainerJson = BaseJson & {
|
|
96
|
+
export declare type ContainerJson = BaseJson & {
|
|
97
97
|
items: Array<FieldJson | ContainerJson>;
|
|
98
98
|
initialItems?: number;
|
|
99
99
|
activeChild?: string;
|
|
100
100
|
};
|
|
101
|
-
export type MetaDataJson = {
|
|
101
|
+
export declare type MetaDataJson = {
|
|
102
102
|
version?: string;
|
|
103
103
|
grammar?: string;
|
|
104
104
|
};
|
|
105
|
-
export type FieldsetJson = ContainerJson & {
|
|
105
|
+
export declare type FieldsetJson = ContainerJson & {
|
|
106
106
|
'type'?: 'array' | 'object';
|
|
107
107
|
};
|
|
108
|
-
export type FormJson = ContainerJson & {
|
|
108
|
+
export declare type FormJson = ContainerJson & {
|
|
109
109
|
metadata?: MetaDataJson;
|
|
110
110
|
data?: any;
|
|
111
111
|
title?: string;
|
|
@@ -113,7 +113,7 @@ export type FormJson = ContainerJson & {
|
|
|
113
113
|
adaptiveForm?: string;
|
|
114
114
|
lang?: string;
|
|
115
115
|
};
|
|
116
|
-
export type TranslationJson = TranslationBaseJson & TranslationFieldJson & TranslationConstraintsJson;
|
|
116
|
+
export declare type TranslationJson = TranslationBaseJson & TranslationFieldJson & TranslationConstraintsJson;
|
|
117
117
|
export declare const translationProps: string[];
|
|
118
118
|
export declare const constraintProps: string[];
|
|
119
119
|
export {};
|
package/lib/esm/types/Json.js
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
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 translationProps = ['description', 'placeholder', 'enum', 'enumNames', 'label.value', 'constraintMessages.accept',
|
|
1
|
+
export const translationProps = ['description', 'placeholder', 'enum', 'enumNames', 'label.value', 'constraintMessages.accept',
|
|
22
2
|
'constraintMessages.enum', 'constraintMessages.exclusiveMinimum', 'constraintMessages.exclusiveMaximum', 'constraintMessages.format', 'constraintMessages.maxFileSize', 'constraintMessages.maxLength',
|
|
23
3
|
'constraintMessages.maximum', 'constraintMessages.maxItems', 'constraintMessages.minLength', 'constraintMessages.minimum', 'constraintMessages.minItems', 'constraintMessages.pattern', 'constraintMessages.required',
|
|
24
4
|
'constraintMessages.step', 'constraintMessages.type', 'constraintMessages.validationExpression'];
|
|
25
|
-
const constraintProps = ['accept', 'enum', 'exclusiveMinimum', 'exclusiveMaximum',
|
|
5
|
+
export const constraintProps = ['accept', 'enum', 'exclusiveMinimum', 'exclusiveMaximum',
|
|
26
6
|
'format', 'maxFileSize', 'maxLength', 'maximum', 'maxItems',
|
|
27
7
|
'minLength', 'minimum', 'minItems', 'pattern', 'required', 'step', 'validationExpression', 'enumNames'];
|
|
28
|
-
|
|
29
|
-
export { constraintProps, translationProps };
|
package/lib/esm/types/Model.d.ts
CHANGED
|
@@ -15,15 +15,15 @@ export interface ScriptableField {
|
|
|
15
15
|
interface WithState<T> {
|
|
16
16
|
getState: () => any;
|
|
17
17
|
}
|
|
18
|
-
type stateProps = {
|
|
18
|
+
declare type stateProps = {
|
|
19
19
|
id: string;
|
|
20
20
|
index: number;
|
|
21
21
|
':type': string;
|
|
22
22
|
};
|
|
23
|
-
export type State<T> = stateProps & (T extends ContainerJson ? T & {
|
|
23
|
+
export declare type State<T> = stateProps & (T extends ContainerJson ? T & {
|
|
24
24
|
items: Array<State<FieldJson | ContainerJson>>;
|
|
25
25
|
} : T);
|
|
26
|
-
export type Subscription = {
|
|
26
|
+
export declare type Subscription = {
|
|
27
27
|
unsubscribe(): void;
|
|
28
28
|
};
|
|
29
29
|
export interface Action {
|
|
@@ -34,7 +34,7 @@ export interface Action {
|
|
|
34
34
|
readonly target: FormModel | FieldModel | FieldsetModel;
|
|
35
35
|
readonly originalAction?: Action;
|
|
36
36
|
}
|
|
37
|
-
export type callbackFn = (action: Action) => void;
|
|
37
|
+
export declare type callbackFn = (action: Action) => void;
|
|
38
38
|
export interface WithController {
|
|
39
39
|
subscribe(callback: callbackFn, eventName?: string): Subscription;
|
|
40
40
|
dispatch(action: Action): void;
|