@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
package/lib/types/Json.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines generic types based on `adaptive form specification`
|
|
3
|
-
*/
|
|
4
|
-
/** Type for `items property` based on `adaptive form specification` */
|
|
5
|
-
export declare type Items<T> = {
|
|
6
|
-
[key: string]: T;
|
|
7
|
-
};
|
|
8
|
-
/** Type alias for primitive types */
|
|
9
|
-
export declare type Primitives = string | number | boolean | null | undefined;
|
|
10
|
-
/** Type for `label` based on `adaptive form specification` */
|
|
11
|
-
export declare type Label = {
|
|
12
|
-
value: string;
|
|
13
|
-
richText?: boolean;
|
|
14
|
-
visible?: boolean;
|
|
15
|
-
};
|
|
16
|
-
/** Type for `constraint properties` which can be translated based on `adaptive form specification` */
|
|
17
|
-
declare type TranslationConstraintsJson = {
|
|
18
|
-
enumNames?: string[];
|
|
19
|
-
enum?: any[];
|
|
20
|
-
};
|
|
21
|
-
/** Type for `constraint properties` based on `adaptive form specification` */
|
|
22
|
-
export declare type ConstraintsJson = TranslationConstraintsJson & {
|
|
23
|
-
accept?: string[];
|
|
24
|
-
enforceEnum?: boolean;
|
|
25
|
-
exclusiveMinimum?: number;
|
|
26
|
-
exclusiveMaximum?: number;
|
|
27
|
-
format?: string;
|
|
28
|
-
maxFileSize?: number | string;
|
|
29
|
-
maxLength?: number;
|
|
30
|
-
maximum?: number;
|
|
31
|
-
maxItems?: number;
|
|
32
|
-
minOccur?: number;
|
|
33
|
-
maxOccur?: number;
|
|
34
|
-
minLength?: number;
|
|
35
|
-
minimum?: number;
|
|
36
|
-
minItems?: number;
|
|
37
|
-
pattern?: string;
|
|
38
|
-
required?: boolean;
|
|
39
|
-
step?: number;
|
|
40
|
-
type?: string;
|
|
41
|
-
validationExpression?: string;
|
|
42
|
-
uniqueItems?: boolean;
|
|
43
|
-
};
|
|
44
|
-
/** Type for `constraint messages` based on `adaptive form specification` */
|
|
45
|
-
export declare type ConstraintsMessages = {
|
|
46
|
-
accept?: string;
|
|
47
|
-
enum?: string;
|
|
48
|
-
exclusiveMinimum?: string;
|
|
49
|
-
exclusiveMaximum?: string;
|
|
50
|
-
format?: string;
|
|
51
|
-
maxFileSize?: string;
|
|
52
|
-
maxLength?: string;
|
|
53
|
-
maximum?: string;
|
|
54
|
-
maxItems?: string;
|
|
55
|
-
minLength?: string;
|
|
56
|
-
minimum?: string;
|
|
57
|
-
minItems?: string;
|
|
58
|
-
pattern?: string;
|
|
59
|
-
required?: string;
|
|
60
|
-
step?: string;
|
|
61
|
-
type?: string;
|
|
62
|
-
validationExpression?: string;
|
|
63
|
-
};
|
|
64
|
-
/** Type for `constraint messages` based on `adaptive form specification` */
|
|
65
|
-
export declare type RulesJson = {
|
|
66
|
-
rules?: Items<string>;
|
|
67
|
-
events?: Items<string[] | string | undefined>;
|
|
68
|
-
};
|
|
69
|
-
/** Type for `generic form properties` which can be translated based on `adaptive form specification` */
|
|
70
|
-
declare type TranslationBaseJson = {
|
|
71
|
-
description?: string;
|
|
72
|
-
};
|
|
73
|
-
/** Type for `generic form properties` based on `adaptive form specification` */
|
|
74
|
-
export declare type BaseJson = TranslationBaseJson & RulesJson & ConstraintsJson & {
|
|
75
|
-
dataRef?: string | null;
|
|
76
|
-
':type'?: string;
|
|
77
|
-
label?: Label;
|
|
78
|
-
enabled?: boolean;
|
|
79
|
-
visible?: boolean;
|
|
80
|
-
name?: string;
|
|
81
|
-
constraintMessages?: ConstraintsMessages;
|
|
82
|
-
fieldType?: string;
|
|
83
|
-
errorMessage?: string;
|
|
84
|
-
properties?: {
|
|
85
|
-
[key: string]: any;
|
|
86
|
-
};
|
|
87
|
-
repeatable?: boolean;
|
|
88
|
-
screenReaderText?: string;
|
|
89
|
-
tooltip?: string;
|
|
90
|
-
altText?: string;
|
|
91
|
-
};
|
|
92
|
-
/** Type for `form field properties`which can be translated based on `adaptive form specification` */
|
|
93
|
-
declare type TranslationFieldJson = {
|
|
94
|
-
placeholder?: string;
|
|
95
|
-
};
|
|
96
|
-
/** Type for `form field properties` based on `adaptive form specification` */
|
|
97
|
-
export declare type FieldJson = BaseJson & TranslationFieldJson & {
|
|
98
|
-
readOnly?: boolean;
|
|
99
|
-
valid?: boolean;
|
|
100
|
-
default?: any;
|
|
101
|
-
value?: any;
|
|
102
|
-
displayFormat?: string;
|
|
103
|
-
editFormat?: string;
|
|
104
|
-
editValue?: string;
|
|
105
|
-
displayValue?: string;
|
|
106
|
-
emptyValue?: 'null' | 'undefined' | '';
|
|
107
|
-
};
|
|
108
|
-
/** Type for `form container properties` based on `adaptive form specification` */
|
|
109
|
-
export declare type ContainerJson = BaseJson & {
|
|
110
|
-
items: Array<FieldJson | ContainerJson>;
|
|
111
|
-
initialItems?: number;
|
|
112
|
-
activeChild?: string;
|
|
113
|
-
};
|
|
114
|
-
/** Type for `form metadata` based on `adaptive form specification` */
|
|
115
|
-
export declare type MetaDataJson = {
|
|
116
|
-
version?: string;
|
|
117
|
-
grammar?: string;
|
|
118
|
-
locale?: string;
|
|
119
|
-
};
|
|
120
|
-
/** Type for `form fieldset` based on `adaptive form specification` */
|
|
121
|
-
export declare type FieldsetJson = ContainerJson & {
|
|
122
|
-
'type'?: 'array' | 'object';
|
|
123
|
-
};
|
|
124
|
-
/** Type for `form model` based on `adaptive form specification` */
|
|
125
|
-
export declare type FormJson = ContainerJson & {
|
|
126
|
-
metadata?: MetaDataJson;
|
|
127
|
-
data?: any;
|
|
128
|
-
title?: string;
|
|
129
|
-
action?: string;
|
|
130
|
-
adaptiveForm?: string;
|
|
131
|
-
};
|
|
132
|
-
/** Type for all properties which can be translated based on `adaptive form specification` */
|
|
133
|
-
export declare type TranslationJson = TranslationBaseJson & TranslationFieldJson & TranslationConstraintsJson;
|
|
134
|
-
/** Constant for all properties which can be translated based on `adaptive form specification` */
|
|
135
|
-
export declare const translationProps: string[];
|
|
136
|
-
/** Constant for all properties which are constraints based on `adaptive form specification` */
|
|
137
|
-
export declare const constraintProps: string[];
|
|
138
|
-
export {};
|
package/lib/types/Json.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2022 Adobe, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
|
|
6
|
-
*
|
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.constraintProps = exports.translationProps = void 0;
|
|
11
|
-
/** Constant for all properties which can be translated based on `adaptive form specification` */
|
|
12
|
-
exports.translationProps = ['description', 'placeholder', 'enum', 'enumNames', 'label.value', 'constraintMessages.accept',
|
|
13
|
-
'constraintMessages.enum', 'constraintMessages.exclusiveMinimum', 'constraintMessages.exclusiveMaximum', 'constraintMessages.format', 'constraintMessages.maxFileSize', 'constraintMessages.maxLength',
|
|
14
|
-
'constraintMessages.maximum', 'constraintMessages.maxItems', 'constraintMessages.minLength', 'constraintMessages.minimum', 'constraintMessages.minItems', 'constraintMessages.pattern', 'constraintMessages.required',
|
|
15
|
-
'constraintMessages.step', 'constraintMessages.type', 'constraintMessages.validationExpression'];
|
|
16
|
-
/** Constant for all properties which are constraints based on `adaptive form specification` */
|
|
17
|
-
exports.constraintProps = ['accept', 'enum', 'exclusiveMinimum', 'exclusiveMaximum',
|
|
18
|
-
'format', 'maxFileSize', 'maxLength', 'maximum', 'maxItems',
|
|
19
|
-
'minLength', 'minimum', 'minItems', 'pattern', 'required', 'step', 'validationExpression', 'enumNames'];
|
package/lib/types/Model.d.ts
DELETED
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines generic interface's for form runtime model
|
|
3
|
-
*/
|
|
4
|
-
import { ConstraintsJson, ContainerJson, FieldJson, FieldsetJson, FormJson, Label, MetaDataJson } from './Json';
|
|
5
|
-
import RuleEngine from '../rules/RuleEngine';
|
|
6
|
-
import EventQueue from '../controller/EventQueue';
|
|
7
|
-
import DataGroup from '../data/DataGroup';
|
|
8
|
-
import { Logger } from '../controller/Logger';
|
|
9
|
-
/**
|
|
10
|
-
* Generic Scriptable field interface. All non-transparent fields which support rule/events
|
|
11
|
-
* should implement this interface
|
|
12
|
-
*/
|
|
13
|
-
export interface ScriptableField {
|
|
14
|
-
/**
|
|
15
|
-
* Rules that modify the property of the object dynamically. The rules are evaluated whenever the dependency changes.
|
|
16
|
-
*/
|
|
17
|
-
rules?: {
|
|
18
|
-
[key: string]: string;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Events is a dictionary of eventName to the actions to perform.
|
|
22
|
-
*/
|
|
23
|
-
events?: {
|
|
24
|
-
[key: string]: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Instance of rule engine
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
ruleEngine: RuleEngine;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Generic interface which defines {@link State | form object state}.
|
|
34
|
-
* @typeparam T type of the form object (for example, {@link FieldJson | form field}
|
|
35
|
-
*/
|
|
36
|
-
interface WithState<T> {
|
|
37
|
-
/**
|
|
38
|
-
* {@link State | state} of the form object
|
|
39
|
-
*/
|
|
40
|
-
getState: () => any;
|
|
41
|
-
}
|
|
42
|
-
declare type stateProps = {
|
|
43
|
-
id: string;
|
|
44
|
-
index: number;
|
|
45
|
-
':type': string;
|
|
46
|
-
};
|
|
47
|
-
/** Generic type for a form object state */
|
|
48
|
-
export declare type State<T> = stateProps & (T extends ContainerJson ? T & {
|
|
49
|
-
items: Array<State<FieldJson | ContainerJson>>;
|
|
50
|
-
} : T);
|
|
51
|
-
/**
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
export declare type Subscription = {
|
|
55
|
-
unsubscribe(): void;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Generic Action/Event interface.
|
|
59
|
-
* Defines common properties that each action/event should have
|
|
60
|
-
*/
|
|
61
|
-
export interface Action {
|
|
62
|
-
/**
|
|
63
|
-
* Name of the event.
|
|
64
|
-
*/
|
|
65
|
-
type: string;
|
|
66
|
-
/**
|
|
67
|
-
* Event payload as defined by the event.
|
|
68
|
-
*/
|
|
69
|
-
payload: any;
|
|
70
|
-
/**
|
|
71
|
-
* Event metadata.
|
|
72
|
-
*/
|
|
73
|
-
metadata: any;
|
|
74
|
-
/**
|
|
75
|
-
* Is the event custom
|
|
76
|
-
*/
|
|
77
|
-
readonly isCustomEvent: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* The field element on which the event is triggered.
|
|
80
|
-
*/
|
|
81
|
-
readonly target: FormModel | FieldModel | FieldsetModel;
|
|
82
|
-
/**
|
|
83
|
-
* Original event. If the event is dispatched, this refers the original event
|
|
84
|
-
*/
|
|
85
|
-
readonly originalAction?: Action;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @private
|
|
89
|
-
*/
|
|
90
|
-
export declare type callbackFn = (action: Action) => void;
|
|
91
|
-
/**
|
|
92
|
-
* @private
|
|
93
|
-
*/
|
|
94
|
-
export interface WithController {
|
|
95
|
-
/**
|
|
96
|
-
* @param callback
|
|
97
|
-
* @param eventName
|
|
98
|
-
* @private
|
|
99
|
-
*/
|
|
100
|
-
subscribe(callback: callbackFn, eventName?: string): Subscription;
|
|
101
|
-
/**
|
|
102
|
-
* @param action
|
|
103
|
-
* @private
|
|
104
|
-
*/
|
|
105
|
-
dispatch(action: Action): void;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Generic base model interface.
|
|
109
|
-
* Defines common properties that each form field should have
|
|
110
|
-
*/
|
|
111
|
-
export interface BaseModel extends ConstraintsJson, WithController {
|
|
112
|
-
/**
|
|
113
|
-
* Name of the form field.
|
|
114
|
-
*/
|
|
115
|
-
readonly name?: string;
|
|
116
|
-
/**
|
|
117
|
-
* To map the field’s value to a property in the data model.
|
|
118
|
-
*/
|
|
119
|
-
readonly dataRef?: string | null;
|
|
120
|
-
/**
|
|
121
|
-
* Unique id of the form field.
|
|
122
|
-
*/
|
|
123
|
-
readonly id: string;
|
|
124
|
-
/**
|
|
125
|
-
* The index of the Field within its parent.
|
|
126
|
-
*/
|
|
127
|
-
readonly index: number;
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
readonly qualifiedName: string;
|
|
132
|
-
/**
|
|
133
|
-
* Label to be used for the field.
|
|
134
|
-
*/
|
|
135
|
-
label?: Label;
|
|
136
|
-
/**
|
|
137
|
-
* Extra description to be shown to the user to aid in form filling experience. It can be rich text.
|
|
138
|
-
*/
|
|
139
|
-
description?: string;
|
|
140
|
-
/**
|
|
141
|
-
* Whether the field should be readOnly to end user or not.
|
|
142
|
-
*/
|
|
143
|
-
readOnly?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Whether the field is enabled and takes part in rules, events etc.
|
|
146
|
-
*/
|
|
147
|
-
enabled?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Whether the field should be visible to author or not.
|
|
150
|
-
*/
|
|
151
|
-
visible?: boolean;
|
|
152
|
-
/**
|
|
153
|
-
* The placeholder to show on the widget.
|
|
154
|
-
*/
|
|
155
|
-
placeholder?: string;
|
|
156
|
-
/**
|
|
157
|
-
* The current validation state of the Field. The property is always computed after merging the Data Model with the Form
|
|
158
|
-
*/
|
|
159
|
-
valid?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Custom widget type show to the user for capturing the data.
|
|
162
|
-
*/
|
|
163
|
-
readonly ':type': string;
|
|
164
|
-
/**
|
|
165
|
-
* Type of field to capture the user data.
|
|
166
|
-
*/
|
|
167
|
-
readonly 'fieldType': string;
|
|
168
|
-
/**
|
|
169
|
-
* Custom properties of the form field.
|
|
170
|
-
*/
|
|
171
|
-
properties: {
|
|
172
|
-
[key: string]: any;
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Whether the form field is container or not
|
|
176
|
-
*/
|
|
177
|
-
readonly isContainer: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* The Parent Panel of the Field/Panel.
|
|
180
|
-
*/
|
|
181
|
-
readonly parent: ContainerModel | null;
|
|
182
|
-
/**
|
|
183
|
-
* Array containing Fields or Panels.
|
|
184
|
-
*/
|
|
185
|
-
readonly items?: Array<FieldsetModel | FieldModel>;
|
|
186
|
-
/**
|
|
187
|
-
* The current value of the Field. The property is serialized in the Data Model.
|
|
188
|
-
*/
|
|
189
|
-
value: any;
|
|
190
|
-
/**
|
|
191
|
-
* Default value of the Field.
|
|
192
|
-
*/
|
|
193
|
-
readonly default?: any;
|
|
194
|
-
/**
|
|
195
|
-
* Field is repeatable or not
|
|
196
|
-
*/
|
|
197
|
-
readonly repeatable?: boolean;
|
|
198
|
-
/**
|
|
199
|
-
* Validates the given form field
|
|
200
|
-
* @returns list of {@link ValidationError | validation errors}
|
|
201
|
-
*/
|
|
202
|
-
validate(): Array<ValidationError>;
|
|
203
|
-
/**
|
|
204
|
-
* Resets the form model
|
|
205
|
-
*/
|
|
206
|
-
reset(): any;
|
|
207
|
-
/**
|
|
208
|
-
* Imports data to the form field
|
|
209
|
-
* @private
|
|
210
|
-
*/
|
|
211
|
-
importData(a?: DataGroup): any;
|
|
212
|
-
/**
|
|
213
|
-
* @private
|
|
214
|
-
*/
|
|
215
|
-
getRuleNode(): any;
|
|
216
|
-
/**
|
|
217
|
-
* @private
|
|
218
|
-
*/
|
|
219
|
-
ruleNodeReference(): any;
|
|
220
|
-
/**
|
|
221
|
-
* @private
|
|
222
|
-
*/
|
|
223
|
-
_initialize(): any;
|
|
224
|
-
/**
|
|
225
|
-
* @private
|
|
226
|
-
*/
|
|
227
|
-
_addDependent(dependent: BaseModel): any;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Generic field model interface.
|
|
231
|
-
* Defines properties that each form field should have
|
|
232
|
-
*/
|
|
233
|
-
export interface FieldModel extends BaseModel, ScriptableField, WithState<FieldJson> {
|
|
234
|
-
/**
|
|
235
|
-
* Parent of the current field
|
|
236
|
-
*/
|
|
237
|
-
parent: ContainerModel;
|
|
238
|
-
/**
|
|
239
|
-
* format in which user will edit the value
|
|
240
|
-
*/
|
|
241
|
-
readonly editFormat?: string;
|
|
242
|
-
/**
|
|
243
|
-
* format in which user will see the value after update
|
|
244
|
-
*/
|
|
245
|
-
readonly displayFormat?: string;
|
|
246
|
-
/**
|
|
247
|
-
* value to be displayed to the user after update
|
|
248
|
-
*/
|
|
249
|
-
readonly displayValue?: string;
|
|
250
|
-
/**
|
|
251
|
-
* value to be displayed to the user for edit
|
|
252
|
-
*/
|
|
253
|
-
readonly editValue?: string;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Defines form meta data properties
|
|
257
|
-
*/
|
|
258
|
-
export interface FormMetaDataModel {
|
|
259
|
-
/**
|
|
260
|
-
* Version of the adaptive form specification
|
|
261
|
-
*/
|
|
262
|
-
readonly version: string;
|
|
263
|
-
/**
|
|
264
|
-
* Version of the rule grammar
|
|
265
|
-
*/
|
|
266
|
-
readonly grammar: string;
|
|
267
|
-
/**
|
|
268
|
-
* Form locale
|
|
269
|
-
*/
|
|
270
|
-
readonly locale: string;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Generic container model interface.
|
|
274
|
-
* Defines properties that each container should have
|
|
275
|
-
*/
|
|
276
|
-
export interface ContainerModel extends BaseModel, ScriptableField {
|
|
277
|
-
/**
|
|
278
|
-
* Defines the children/items of the container
|
|
279
|
-
*/
|
|
280
|
-
items: Array<FieldsetModel | FieldModel>;
|
|
281
|
-
/**
|
|
282
|
-
* Defines the parent of the container
|
|
283
|
-
*/
|
|
284
|
-
parent: ContainerModel;
|
|
285
|
-
/**
|
|
286
|
-
* Returns the index of the {@link FieldModel | child item} or the {@link FieldsetModel | child container}
|
|
287
|
-
* @param f child item
|
|
288
|
-
* @returns `index` of the item
|
|
289
|
-
*/
|
|
290
|
-
indexOf(f: FieldModel | FieldsetModel): number;
|
|
291
|
-
isTransparent(): boolean;
|
|
292
|
-
activeChild: BaseModel | null;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Generic field set model interface.
|
|
296
|
-
* Defines properties that each field set should have
|
|
297
|
-
*/
|
|
298
|
-
export interface FieldsetModel extends ContainerModel, WithState<FieldsetJson> {
|
|
299
|
-
type?: 'array' | 'object';
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Defines the interface for form model
|
|
303
|
-
*/
|
|
304
|
-
export interface FormModel extends ContainerModel, WithState<FormJson> {
|
|
305
|
-
/**
|
|
306
|
-
* Id of the form.
|
|
307
|
-
*/
|
|
308
|
-
readonly id: string;
|
|
309
|
-
/**
|
|
310
|
-
* Form data
|
|
311
|
-
*/
|
|
312
|
-
readonly data?: any;
|
|
313
|
-
/**
|
|
314
|
-
* Form metadata
|
|
315
|
-
*/
|
|
316
|
-
readonly metadata?: MetaDataJson;
|
|
317
|
-
/**
|
|
318
|
-
* Form title.
|
|
319
|
-
*/
|
|
320
|
-
readonly title: string;
|
|
321
|
-
readonly logger: Logger;
|
|
322
|
-
/**
|
|
323
|
-
* Imports the given form data
|
|
324
|
-
* @param data form data
|
|
325
|
-
*/
|
|
326
|
-
importData(data: any): any;
|
|
327
|
-
/**
|
|
328
|
-
* Exports the form data
|
|
329
|
-
*/
|
|
330
|
-
exportData(): any;
|
|
331
|
-
/**
|
|
332
|
-
* Get form element model based on the id of the form element
|
|
333
|
-
* @param id id of the form element
|
|
334
|
-
*/
|
|
335
|
-
getElement(id: string): FieldModel | FormModel | FieldsetModel;
|
|
336
|
-
/**
|
|
337
|
-
* @private
|
|
338
|
-
*/
|
|
339
|
-
getUniqueId(): string;
|
|
340
|
-
/**
|
|
341
|
-
* @private
|
|
342
|
-
*/
|
|
343
|
-
getEventQueue(): EventQueue;
|
|
344
|
-
/**
|
|
345
|
-
* visits each element in the form
|
|
346
|
-
* @param callBack a function which is invoked on each form element
|
|
347
|
-
* (including container type elements) visited
|
|
348
|
-
*/
|
|
349
|
-
visit(callBack: (field: FieldModel | FieldsetModel) => void): void;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Defines file object interface.
|
|
353
|
-
*/
|
|
354
|
-
export interface IFileObject {
|
|
355
|
-
/**
|
|
356
|
-
* Name of the file
|
|
357
|
-
*/
|
|
358
|
-
name: string;
|
|
359
|
-
/**
|
|
360
|
-
* Media type of the file data
|
|
361
|
-
*/
|
|
362
|
-
mediaType: string;
|
|
363
|
-
/**
|
|
364
|
-
* Data of the file attachment. It can be uri or any file interface specific to channel (in web, it is file object).
|
|
365
|
-
*/
|
|
366
|
-
data?: any;
|
|
367
|
-
/**
|
|
368
|
-
* Size of the file binary as per iec specification.
|
|
369
|
-
*/
|
|
370
|
-
size?: number;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Defines Validation Error interface.
|
|
374
|
-
*/
|
|
375
|
-
export interface IValidationError {
|
|
376
|
-
/**
|
|
377
|
-
* {@link FieldModel.id | name} of the field
|
|
378
|
-
*/
|
|
379
|
-
fieldName: string;
|
|
380
|
-
/**
|
|
381
|
-
* List of error messages
|
|
382
|
-
*/
|
|
383
|
-
errorMessages: Array<string>;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Implementation of {@link IValidationError | Validation Error} interface
|
|
387
|
-
*/
|
|
388
|
-
export declare class ValidationError implements IValidationError {
|
|
389
|
-
fieldName: string;
|
|
390
|
-
errorMessages: Array<string>;
|
|
391
|
-
constructor(fieldName?: string, errorMessages?: Array<any>);
|
|
392
|
-
}
|
|
393
|
-
export {};
|
package/lib/types/Model.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2022 Adobe, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
|
|
6
|
-
*
|
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ValidationError = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* Implementation of {@link IValidationError | Validation Error} interface
|
|
13
|
-
*/
|
|
14
|
-
class ValidationError {
|
|
15
|
-
constructor(fieldName = '', errorMessages = []) {
|
|
16
|
-
this.errorMessages = errorMessages;
|
|
17
|
-
this.fieldName = fieldName;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ValidationError = ValidationError;
|
package/lib/types/index.d.ts
DELETED
package/lib/types/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2022 Adobe, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
|
|
6
|
-
*
|
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
__exportStar(require("./Json"), exports);
|
|
25
|
-
__exportStar(require("./Model"), exports);
|
package/lib/utils/Fetch.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2022 Adobe, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
|
|
6
|
-
*
|
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
-
*/
|
|
9
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
10
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.convertQueryString = exports.request = void 0;
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @param url
|
|
23
|
-
* @param data
|
|
24
|
-
* @param options
|
|
25
|
-
*/
|
|
26
|
-
const request = (url, data = null, options = {}) => {
|
|
27
|
-
const opts = Object.assign(Object.assign({}, defaultRequestOptions), options);
|
|
28
|
-
const updatedUrl = opts.method === 'GET' && data ? (0, exports.convertQueryString)(url, data) : url;
|
|
29
|
-
if (opts.method !== 'GET') {
|
|
30
|
-
opts.body = data;
|
|
31
|
-
}
|
|
32
|
-
return fetch(updatedUrl, Object.assign({}, opts)).then((response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
var _a, _b, _c;
|
|
34
|
-
let body;
|
|
35
|
-
if (!response.ok) {
|
|
36
|
-
console.error(`Error fetching response from ${url} : ${response.statusText}`);
|
|
37
|
-
body = response.statusText;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
|
|
41
|
-
body = yield response.json();
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
body = yield response.text();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const headers = {};
|
|
48
|
-
(_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c.forEach((value, key) => {
|
|
49
|
-
headers[key] = value;
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
status: response.status,
|
|
53
|
-
body,
|
|
54
|
-
headers
|
|
55
|
-
};
|
|
56
|
-
}));
|
|
57
|
-
};
|
|
58
|
-
exports.request = request;
|
|
59
|
-
const defaultRequestOptions = {
|
|
60
|
-
method: 'GET'
|
|
61
|
-
};
|
|
62
|
-
const convertQueryString = (endpoint, payload) => {
|
|
63
|
-
if (!payload) {
|
|
64
|
-
return endpoint;
|
|
65
|
-
}
|
|
66
|
-
let updatedPayload = {};
|
|
67
|
-
try {
|
|
68
|
-
updatedPayload = JSON.parse(payload);
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
console.log('Query params invalid');
|
|
72
|
-
}
|
|
73
|
-
const params = [];
|
|
74
|
-
Object.keys(updatedPayload).forEach((key) => {
|
|
75
|
-
if (Array.isArray(updatedPayload[key])) {
|
|
76
|
-
params.push(`${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(updatedPayload[key]))}`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
params.push(`${encodeURIComponent(key)}=${encodeURIComponent(updatedPayload[key])}`);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
if (!params.length) {
|
|
83
|
-
return endpoint;
|
|
84
|
-
}
|
|
85
|
-
return endpoint.includes('?') ? `${endpoint}&${params.join('&')}` : `${endpoint}?${params.join('&')}`;
|
|
86
|
-
};
|
|
87
|
-
exports.convertQueryString = convertQueryString;
|