@aemforms/af-core 0.22.26 → 0.22.30
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/cjs/index.cjs +345 -1886
- package/lib/esm/BaseNode-d78cc1b0.js +478 -0
- package/lib/esm/BaseNode.d.ts +1 -1
- package/lib/esm/BaseNode.js +26 -454
- package/lib/esm/Checkbox.js +37 -1
- package/lib/esm/CheckboxGroup.js +38 -1
- package/lib/esm/Container.d.ts +6 -1
- package/lib/esm/Container.js +108 -19
- package/lib/esm/DateField.js +38 -2
- package/lib/esm/Field.d.ts +2 -2
- package/lib/esm/Field.js +62 -26
- package/lib/esm/Fieldset.js +36 -3
- package/lib/esm/FileObject.js +23 -1
- package/lib/esm/FileUpload.js +34 -1
- package/lib/esm/Form.d.ts +1 -1
- package/lib/esm/Form.js +40 -8
- package/lib/esm/FormInstance.js +53 -5
- package/lib/esm/FormMetaData.js +26 -1
- package/lib/esm/InstanceManager.js +35 -8
- package/lib/esm/Node.js +25 -1
- package/lib/esm/Scriptable.js +29 -2
- package/lib/esm/controller/EventQueue.js +23 -1
- package/lib/esm/controller/Events.d.ts +1 -1
- package/lib/esm/controller/Events.js +41 -19
- package/lib/esm/controller/Logger.d.ts +2 -2
- package/lib/esm/controller/Logger.js +23 -1
- package/lib/esm/data/DataGroup.js +24 -1
- package/lib/esm/data/DataValue.js +23 -1
- package/lib/esm/data/EmptyDataValue.js +23 -1
- package/lib/esm/index.js +55 -21
- package/lib/esm/rules/FunctionRuntime.d.ts +3 -3
- package/lib/esm/rules/FunctionRuntime.js +31 -6
- package/lib/esm/rules/RuleEngine.js +30 -1
- package/lib/esm/types/Json.d.ts +16 -16
- package/lib/esm/types/Json.js +24 -2
- package/lib/esm/types/Model.d.ts +4 -4
- package/lib/esm/types/Model.js +23 -1
- package/lib/esm/types/index.js +22 -2
- package/lib/esm/utils/DataRefParser.d.ts +2 -2
- package/lib/esm/utils/DataRefParser.js +31 -6
- package/lib/esm/utils/Fetch.d.ts +1 -1
- package/lib/esm/utils/Fetch.js +24 -2
- package/lib/esm/utils/FormCreationUtils.js +40 -2
- package/lib/esm/utils/FormUtils.js +33 -8
- package/lib/esm/utils/JsonUtils.js +34 -11
- package/lib/esm/utils/LogUtils.js +23 -1
- package/lib/esm/utils/SchemaUtils.js +24 -2
- package/lib/esm/utils/TranslationUtils.d.ts +1 -1
- package/lib/esm/utils/TranslationUtils.js +32 -9
- package/lib/esm/utils/ValidationUtils.d.ts +4 -4
- package/lib/esm/utils/ValidationUtils.js +30 -4
- package/package.json +14 -2
- package/lib/browser/afb-events.js +0 -151
- package/lib/browser/afb-runtime.js +0 -3620
package/lib/esm/index.js
CHANGED
|
@@ -1,21 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
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
|
+
export { createFormInstance, fetchForm, registerFunctions, validateFormData, validateFormInstance } from './FormInstance.js';
|
|
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-d78cc1b0.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,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
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
|
|
5
|
-
export
|
|
4
|
+
export type CustomFunction = Function;
|
|
5
|
+
export type FunctionDefinition = {
|
|
6
6
|
_func: CustomFunction;
|
|
7
7
|
_signature: Array<any>;
|
|
8
8
|
};
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { CustomEvent, Submit, RemoveInstance, AddInstance, Reset, RemoveItem, AddItem, Click, Change } from '../controller/Events.js';
|
|
22
|
+
import { request as request$1 } from '../utils/Fetch.js';
|
|
3
23
|
import { FileObject } from '../FileObject.js';
|
|
4
24
|
import { getAttachments } from '../utils/FormUtils.js';
|
|
5
25
|
import { jsonString } from '../utils/JsonUtils.js';
|
|
26
|
+
import '../types/Json.js';
|
|
27
|
+
import '../utils/SchemaUtils.js';
|
|
28
|
+
|
|
6
29
|
const getCustomEventName = (name) => {
|
|
7
30
|
const eName = name;
|
|
8
31
|
if (eName.length > 0 && eName.startsWith('custom:')) {
|
|
@@ -10,7 +33,7 @@ const getCustomEventName = (name) => {
|
|
|
10
33
|
}
|
|
11
34
|
return eName;
|
|
12
35
|
};
|
|
13
|
-
|
|
36
|
+
const request = async (context, uri, httpVerb, payload, success, error, headers) => {
|
|
14
37
|
const endpoint = uri;
|
|
15
38
|
const requestOptions = {
|
|
16
39
|
method: httpVerb
|
|
@@ -48,7 +71,7 @@ export const request = async (context, uri, httpVerb, payload, success, error, h
|
|
|
48
71
|
inputPayload = urlEncoded(payload);
|
|
49
72
|
}
|
|
50
73
|
}
|
|
51
|
-
result = await
|
|
74
|
+
result = await request$1(endpoint, inputPayload, requestOptions);
|
|
52
75
|
}
|
|
53
76
|
catch (e) {
|
|
54
77
|
context.form.logger.error('Error invoking a rest API');
|
|
@@ -103,7 +126,7 @@ const multipartFormData = (data, attachments) => {
|
|
|
103
126
|
}
|
|
104
127
|
return formData;
|
|
105
128
|
};
|
|
106
|
-
|
|
129
|
+
const submit = async (context, success, error, submitAs = 'multipart/form-data', input_data = null) => {
|
|
107
130
|
const endpoint = context.form.action;
|
|
108
131
|
let data = input_data;
|
|
109
132
|
if (typeof data != 'object' || data == null) {
|
|
@@ -317,4 +340,6 @@ class FunctionRuntimeImpl {
|
|
|
317
340
|
return { ...defaultFunctions, ...this.customFunctions };
|
|
318
341
|
}
|
|
319
342
|
}
|
|
320
|
-
|
|
343
|
+
const FunctionRuntime = new FunctionRuntimeImpl();
|
|
344
|
+
|
|
345
|
+
export { FunctionRuntime, request, submit };
|
|
@@ -1,5 +1,33 @@
|
|
|
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
|
+
|
|
1
21
|
import Formula from '@adobe/json-formula';
|
|
2
22
|
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
|
+
|
|
3
31
|
class RuleEngine {
|
|
4
32
|
_context;
|
|
5
33
|
_globalNames = [
|
|
@@ -44,4 +72,5 @@ class RuleEngine {
|
|
|
44
72
|
}
|
|
45
73
|
}
|
|
46
74
|
}
|
|
47
|
-
|
|
75
|
+
|
|
76
|
+
export { RuleEngine as default };
|
package/lib/esm/types/Json.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Items<T> = {
|
|
2
2
|
[key: string]: T;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type Primitives = string | number | boolean | null | undefined;
|
|
5
|
+
export type Label = {
|
|
6
6
|
value: string;
|
|
7
7
|
richText?: boolean;
|
|
8
8
|
visible?: boolean;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type TranslationConstraintsJson = {
|
|
11
11
|
enumNames?: string[];
|
|
12
12
|
enum?: any[];
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type ConstraintsJson = TranslationConstraintsJson & {
|
|
15
15
|
accept?: string[];
|
|
16
16
|
enforceEnum?: boolean;
|
|
17
17
|
exclusiveMinimum?: number;
|
|
@@ -33,7 +33,7 @@ export declare type ConstraintsJson = TranslationConstraintsJson & {
|
|
|
33
33
|
validationExpression?: string;
|
|
34
34
|
uniqueItems?: boolean;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type ConstraintsMessages = {
|
|
37
37
|
accept?: string;
|
|
38
38
|
enum?: string;
|
|
39
39
|
exclusiveMinimum?: string;
|
|
@@ -53,14 +53,14 @@ export declare type ConstraintsMessages = {
|
|
|
53
53
|
type?: string;
|
|
54
54
|
validationExpression?: string;
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type RulesJson = {
|
|
57
57
|
rules?: Items<string>;
|
|
58
58
|
events?: Items<string[] | string | undefined>;
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
type TranslationBaseJson = {
|
|
61
61
|
description?: string;
|
|
62
62
|
};
|
|
63
|
-
export
|
|
63
|
+
export type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson & {
|
|
64
64
|
dataRef?: string | null;
|
|
65
65
|
':type'?: string;
|
|
66
66
|
label?: Label;
|
|
@@ -79,10 +79,10 @@ export declare type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson
|
|
|
79
79
|
altText?: string;
|
|
80
80
|
viewType?: string;
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
type TranslationFieldJson = {
|
|
83
83
|
placeholder?: string;
|
|
84
84
|
};
|
|
85
|
-
export
|
|
85
|
+
export type FieldJson = BaseJson & TranslationFieldJson & {
|
|
86
86
|
readOnly?: boolean;
|
|
87
87
|
valid?: boolean;
|
|
88
88
|
default?: any;
|
|
@@ -93,19 +93,19 @@ export declare type FieldJson = BaseJson & TranslationFieldJson & {
|
|
|
93
93
|
displayValue?: string;
|
|
94
94
|
emptyValue?: 'null' | 'undefined' | '';
|
|
95
95
|
};
|
|
96
|
-
export
|
|
96
|
+
export type ContainerJson = BaseJson & {
|
|
97
97
|
items: Array<FieldJson | ContainerJson>;
|
|
98
98
|
initialItems?: number;
|
|
99
99
|
activeChild?: string;
|
|
100
100
|
};
|
|
101
|
-
export
|
|
101
|
+
export type MetaDataJson = {
|
|
102
102
|
version?: string;
|
|
103
103
|
grammar?: string;
|
|
104
104
|
};
|
|
105
|
-
export
|
|
105
|
+
export type FieldsetJson = ContainerJson & {
|
|
106
106
|
'type'?: 'array' | 'object';
|
|
107
107
|
};
|
|
108
|
-
export
|
|
108
|
+
export type FormJson = ContainerJson & {
|
|
109
109
|
metadata?: MetaDataJson;
|
|
110
110
|
data?: any;
|
|
111
111
|
title?: string;
|
|
@@ -113,7 +113,7 @@ export declare type FormJson = ContainerJson & {
|
|
|
113
113
|
adaptiveForm?: string;
|
|
114
114
|
lang?: string;
|
|
115
115
|
};
|
|
116
|
-
export
|
|
116
|
+
export 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,7 +1,29 @@
|
|
|
1
|
-
|
|
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',
|
|
2
22
|
'constraintMessages.enum', 'constraintMessages.exclusiveMinimum', 'constraintMessages.exclusiveMaximum', 'constraintMessages.format', 'constraintMessages.maxFileSize', 'constraintMessages.maxLength',
|
|
3
23
|
'constraintMessages.maximum', 'constraintMessages.maxItems', 'constraintMessages.minLength', 'constraintMessages.minimum', 'constraintMessages.minItems', 'constraintMessages.pattern', 'constraintMessages.required',
|
|
4
24
|
'constraintMessages.step', 'constraintMessages.type', 'constraintMessages.validationExpression'];
|
|
5
|
-
|
|
25
|
+
const constraintProps = ['accept', 'enum', 'exclusiveMinimum', 'exclusiveMaximum',
|
|
6
26
|
'format', 'maxFileSize', 'maxLength', 'maximum', 'maxItems',
|
|
7
27
|
'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
|
-
|
|
18
|
+
type stateProps = {
|
|
19
19
|
id: string;
|
|
20
20
|
index: number;
|
|
21
21
|
':type': string;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type State<T> = stateProps & (T extends ContainerJson ? T & {
|
|
24
24
|
items: Array<State<FieldJson | ContainerJson>>;
|
|
25
25
|
} : T);
|
|
26
|
-
export
|
|
26
|
+
export 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
|
|
37
|
+
export type callbackFn = (action: Action) => void;
|
|
38
38
|
export interface WithController {
|
|
39
39
|
subscribe(callback: callbackFn, eventName?: string): Subscription;
|
|
40
40
|
dispatch(action: Action): void;
|
package/lib/esm/types/Model.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
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 ValidationError {
|
|
2
22
|
fieldName;
|
|
3
23
|
errorMessages;
|
|
4
24
|
constructor(fieldName = '', errorMessages = []) {
|
|
@@ -6,3 +26,5 @@ export class ValidationError {
|
|
|
6
26
|
this.fieldName = fieldName;
|
|
7
27
|
}
|
|
8
28
|
}
|
|
29
|
+
|
|
30
|
+
export { ValidationError };
|
package/lib/esm/types/index.js
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
export { constraintProps, translationProps } from './Json.js';
|
|
22
|
+
export { ValidationError } from './Model.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import DataGroup from '../data/DataGroup.js';
|
|
2
2
|
import DataValue from '../data/DataValue.js';
|
|
3
|
-
|
|
3
|
+
type TokenType = string;
|
|
4
4
|
export declare const TOK_GLOBAL: TokenType;
|
|
5
|
-
export
|
|
5
|
+
export type Token = {
|
|
6
6
|
type: TokenType;
|
|
7
7
|
value: string | number;
|
|
8
8
|
start: number;
|
|
@@ -1,25 +1,48 @@
|
|
|
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
|
+
|
|
1
21
|
import DataGroup from '../data/DataGroup.js';
|
|
22
|
+
import '../data/DataValue.js';
|
|
23
|
+
import '../data/EmptyDataValue.js';
|
|
24
|
+
|
|
2
25
|
const TOK_DOT = 'DOT';
|
|
3
26
|
const TOK_IDENTIFIER = 'Identifier';
|
|
4
|
-
|
|
27
|
+
const TOK_GLOBAL = 'Global';
|
|
5
28
|
const TOK_BRACKET = 'bracket';
|
|
6
29
|
const TOK_NUMBER = 'Number';
|
|
7
30
|
const globalStartToken = '$';
|
|
8
|
-
|
|
31
|
+
const identifier = (value, start) => {
|
|
9
32
|
return {
|
|
10
33
|
type: TOK_IDENTIFIER,
|
|
11
34
|
value,
|
|
12
35
|
start
|
|
13
36
|
};
|
|
14
37
|
};
|
|
15
|
-
|
|
38
|
+
const bracket = (value, start) => {
|
|
16
39
|
return {
|
|
17
40
|
type: TOK_BRACKET,
|
|
18
41
|
value,
|
|
19
42
|
start
|
|
20
43
|
};
|
|
21
44
|
};
|
|
22
|
-
|
|
45
|
+
const global$ = () => {
|
|
23
46
|
return {
|
|
24
47
|
type: TOK_GLOBAL,
|
|
25
48
|
start: 0,
|
|
@@ -154,10 +177,10 @@ class Tokenizer {
|
|
|
154
177
|
return this._result_tokens;
|
|
155
178
|
}
|
|
156
179
|
}
|
|
157
|
-
|
|
180
|
+
const tokenize = (stream) => {
|
|
158
181
|
return new Tokenizer(stream).tokenize();
|
|
159
182
|
};
|
|
160
|
-
|
|
183
|
+
const resolveData = (data, input, create) => {
|
|
161
184
|
let tokens;
|
|
162
185
|
if (typeof input === 'string') {
|
|
163
186
|
tokens = tokenize(input);
|
|
@@ -220,3 +243,5 @@ export const resolveData = (data, input, create) => {
|
|
|
220
243
|
}
|
|
221
244
|
return result;
|
|
222
245
|
};
|
|
246
|
+
|
|
247
|
+
export { TOK_GLOBAL, bracket, global$, identifier, resolveData, tokenize };
|
package/lib/esm/utils/Fetch.d.ts
CHANGED
package/lib/esm/utils/Fetch.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
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 request = (url, data = null, options = {}) => {
|
|
2
22
|
const opts = { ...defaultRequestOptions, ...options };
|
|
3
23
|
const updatedUrl = opts.method === 'GET' && data ? convertQueryString(url, data) : url;
|
|
4
24
|
if (opts.method !== 'GET') {
|
|
@@ -34,7 +54,7 @@ export const request = (url, data = null, options = {}) => {
|
|
|
34
54
|
const defaultRequestOptions = {
|
|
35
55
|
method: 'GET'
|
|
36
56
|
};
|
|
37
|
-
|
|
57
|
+
const convertQueryString = (endpoint, payload) => {
|
|
38
58
|
if (!payload) {
|
|
39
59
|
return endpoint;
|
|
40
60
|
}
|
|
@@ -59,3 +79,5 @@ export const convertQueryString = (endpoint, payload) => {
|
|
|
59
79
|
}
|
|
60
80
|
return endpoint.includes('?') ? `${endpoint}&${params.join('&')}` : `${endpoint}?${params.join('&')}`;
|
|
61
81
|
};
|
|
82
|
+
|
|
83
|
+
export { convertQueryString, request };
|
|
@@ -1,11 +1,47 @@
|
|
|
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
|
+
|
|
1
21
|
import { InstanceManager } from '../InstanceManager.js';
|
|
2
22
|
import { Fieldset } from '../Fieldset.js';
|
|
3
|
-
import {
|
|
23
|
+
import { isRepeatable, isFile, isCheckbox, isCheckboxGroup, isDateField } from './JsonUtils.js';
|
|
4
24
|
import FileUpload from '../FileUpload.js';
|
|
5
25
|
import Checkbox from '../Checkbox.js';
|
|
6
26
|
import CheckboxGroup from '../CheckboxGroup.js';
|
|
7
27
|
import DateField from '../DateField.js';
|
|
8
28
|
import Field from '../Field.js';
|
|
29
|
+
import '../BaseNode-d78cc1b0.js';
|
|
30
|
+
import '../controller/Events.js';
|
|
31
|
+
import './DataRefParser.js';
|
|
32
|
+
import '../data/DataGroup.js';
|
|
33
|
+
import '../data/DataValue.js';
|
|
34
|
+
import '../data/EmptyDataValue.js';
|
|
35
|
+
import '../Container.js';
|
|
36
|
+
import '../Scriptable.js';
|
|
37
|
+
import '../types/Json.js';
|
|
38
|
+
import './SchemaUtils.js';
|
|
39
|
+
import './FormUtils.js';
|
|
40
|
+
import '../FileObject.js';
|
|
41
|
+
import './ValidationUtils.js';
|
|
42
|
+
import '../types/Model.js';
|
|
43
|
+
import '@aemforms/af-formatters';
|
|
44
|
+
|
|
9
45
|
const alternateFieldTypeMapping = {
|
|
10
46
|
'text': 'text-input',
|
|
11
47
|
'number': 'number-input',
|
|
@@ -71,4 +107,6 @@ class FormFieldFactoryImpl {
|
|
|
71
107
|
return retVal;
|
|
72
108
|
}
|
|
73
109
|
}
|
|
74
|
-
|
|
110
|
+
const FormFieldFactory = new FormFieldFactoryImpl();
|
|
111
|
+
|
|
112
|
+
export { FormFieldFactory };
|