@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/FormInstance.js
DELETED
|
@@ -1,127 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.fetchForm = exports.validateFormData = exports.validateFormInstance = exports.createFormInstance = void 0;
|
|
14
|
-
const Form_1 = __importDefault(require("./Form"));
|
|
15
|
-
const JsonUtils_1 = require("./utils/JsonUtils");
|
|
16
|
-
const Fetch_1 = require("./utils/Fetch");
|
|
17
|
-
const RuleEngine_1 = __importDefault(require("./rules/RuleEngine"));
|
|
18
|
-
const EventQueue_1 = __importDefault(require("./controller/EventQueue"));
|
|
19
|
-
const Logger_1 = require("./controller/Logger");
|
|
20
|
-
/**
|
|
21
|
-
* Creates form instance using form model definition as per `adaptive form specification`
|
|
22
|
-
* @param formModel form model definition
|
|
23
|
-
* @param callback a callback that recieves the FormModel instance that gets executed before any event in the Form
|
|
24
|
-
* is executed
|
|
25
|
-
* @param logLevel Logging Level for the form. Setting it off will disable the logging
|
|
26
|
-
* @param fModel existing form model, this is additional optimization to prevent creation of form instance
|
|
27
|
-
* @returns {@link FormModel | form model}
|
|
28
|
-
*/
|
|
29
|
-
const createFormInstance = (formModel, callback, logLevel = 'error', fModel = undefined) => {
|
|
30
|
-
try {
|
|
31
|
-
let f = fModel;
|
|
32
|
-
if (f == null) {
|
|
33
|
-
f = new Form_1.default(Object.assign({}, formModel), new RuleEngine_1.default(), new EventQueue_1.default(new Logger_1.Logger(logLevel)), logLevel);
|
|
34
|
-
}
|
|
35
|
-
const formData = formModel === null || formModel === void 0 ? void 0 : formModel.data;
|
|
36
|
-
if (formData) {
|
|
37
|
-
f.importData(formData);
|
|
38
|
-
}
|
|
39
|
-
if (typeof callback === 'function') {
|
|
40
|
-
callback(f);
|
|
41
|
-
}
|
|
42
|
-
// Once the field or panel is initialized, execute the initialization script
|
|
43
|
-
// this means initialization happens after prefill and restore
|
|
44
|
-
// Before execution of calcExp, visibleExp, enabledExp, validate, options, navigationChange, we execute init script
|
|
45
|
-
//f.queueEvent(new Initialize(undefined, true));
|
|
46
|
-
//f.queueEvent(new ExecuteRule(undefined, true));
|
|
47
|
-
f.getEventQueue().runPendingQueue();
|
|
48
|
-
return f;
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
console.error(`Unable to create an instance of the Form ${e}`);
|
|
52
|
-
throw new Error(e);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
exports.createFormInstance = createFormInstance;
|
|
56
|
-
/**
|
|
57
|
-
* Validates Form model definition with the given data
|
|
58
|
-
* @param formModel form model definition
|
|
59
|
-
* @param data form data
|
|
60
|
-
* @deprecated use validateFormData
|
|
61
|
-
* @returns `true`, if form is valid against the given form data, `false` otherwise
|
|
62
|
-
*/
|
|
63
|
-
const validateFormInstance = (formModel, data) => {
|
|
64
|
-
try {
|
|
65
|
-
const f = new Form_1.default(Object.assign({}, formModel), new RuleEngine_1.default());
|
|
66
|
-
if (data) {
|
|
67
|
-
f.importData(data);
|
|
68
|
-
}
|
|
69
|
-
return f.validate().length === 0;
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
throw new Error(e);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
exports.validateFormInstance = validateFormInstance;
|
|
76
|
-
/**
|
|
77
|
-
* Validates Form model definition with the given data
|
|
78
|
-
* @param formModel form model definition
|
|
79
|
-
* @param data form data
|
|
80
|
-
* @deprecated use validateFormData
|
|
81
|
-
* @returns {messages: [], valid: boolean}
|
|
82
|
-
*/
|
|
83
|
-
const validateFormData = (formModel, data) => {
|
|
84
|
-
try {
|
|
85
|
-
const f = new Form_1.default(Object.assign({}, formModel), new RuleEngine_1.default());
|
|
86
|
-
if (data) {
|
|
87
|
-
f.importData(data);
|
|
88
|
-
}
|
|
89
|
-
const res = f.validate();
|
|
90
|
-
return {
|
|
91
|
-
messages: res,
|
|
92
|
-
valid: res.length === 0
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
catch (e) {
|
|
96
|
-
throw new Error(e);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
exports.validateFormData = validateFormData;
|
|
100
|
-
/**
|
|
101
|
-
* Helper API to fetch form model definition from an AEM instance
|
|
102
|
-
* @param url URL of the instance
|
|
103
|
-
* @param headers HTTP headers to pass to the aem instance
|
|
104
|
-
* @returns promise which resolves to the form model definition
|
|
105
|
-
*/
|
|
106
|
-
const fetchForm = (url, headers = {}) => {
|
|
107
|
-
const headerObj = new Headers();
|
|
108
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
109
|
-
headerObj.append(key, value);
|
|
110
|
-
});
|
|
111
|
-
return new Promise((resolve, reject) => {
|
|
112
|
-
(0, Fetch_1.request)(`${url}.model.json`, null, { headers }).then((response) => {
|
|
113
|
-
if (response.status !== 200) {
|
|
114
|
-
reject('Not Found');
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
let formObj = response.body;
|
|
118
|
-
if ('model' in formObj) {
|
|
119
|
-
const { model } = formObj;
|
|
120
|
-
formObj = model;
|
|
121
|
-
}
|
|
122
|
-
resolve((0, JsonUtils_1.jsonString)(formObj));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
exports.fetchForm = fetchForm;
|
package/lib/FormMetaData.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FormMetaDataModel, MetaDataJson } from './types';
|
|
2
|
-
import Node from './Node';
|
|
3
|
-
/**
|
|
4
|
-
* Defines form metadata which implements {@link FormMetaDataModel | Form MetaData Model}
|
|
5
|
-
*/
|
|
6
|
-
declare class FormMetaData extends Node<MetaDataJson> implements FormMetaDataModel {
|
|
7
|
-
get version(): string;
|
|
8
|
-
get locale(): string;
|
|
9
|
-
get grammar(): string;
|
|
10
|
-
}
|
|
11
|
-
export default FormMetaData;
|
package/lib/FormMetaData.js
DELETED
|
@@ -1,28 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
const Node_1 = __importDefault(require("./Node"));
|
|
14
|
-
/**
|
|
15
|
-
* Defines form metadata which implements {@link FormMetaDataModel | Form MetaData Model}
|
|
16
|
-
*/
|
|
17
|
-
class FormMetaData extends Node_1.default {
|
|
18
|
-
get version() {
|
|
19
|
-
return this.getP('version', '');
|
|
20
|
-
}
|
|
21
|
-
get locale() {
|
|
22
|
-
return this.getP('locale', '');
|
|
23
|
-
}
|
|
24
|
-
get grammar() {
|
|
25
|
-
return this.getP('grammar', '');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = FormMetaData;
|
package/lib/InstanceManager.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Action, FieldJson, FieldModel, FieldsetJson, FieldsetModel } from './types';
|
|
2
|
-
import { Fieldset } from './Fieldset';
|
|
3
|
-
export declare class InstanceManager extends Fieldset implements FieldsetModel {
|
|
4
|
-
get maxOccur(): number;
|
|
5
|
-
set maxOccur(m: number);
|
|
6
|
-
get minOccur(): number;
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
addInstance(action: Action): void;
|
|
11
|
-
/**
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
removeInstance(action: Action): void;
|
|
15
|
-
protected _createChild(child: FieldsetJson | FieldJson, options: any): FieldModel | FieldsetModel;
|
|
16
|
-
}
|
package/lib/InstanceManager.js
DELETED
|
@@ -1,53 +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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.InstanceManager = void 0;
|
|
17
|
-
const Fieldset_1 = require("./Fieldset");
|
|
18
|
-
const BaseNode_1 = require("./BaseNode");
|
|
19
|
-
const FormCreationUtils_1 = require("./utils/FormCreationUtils");
|
|
20
|
-
class InstanceManager extends Fieldset_1.Fieldset {
|
|
21
|
-
get maxOccur() {
|
|
22
|
-
return this._jsonModel.maxItems;
|
|
23
|
-
}
|
|
24
|
-
set maxOccur(m) {
|
|
25
|
-
this.maxItems = m;
|
|
26
|
-
}
|
|
27
|
-
get minOccur() {
|
|
28
|
-
return this.minItems;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @private
|
|
32
|
-
*/
|
|
33
|
-
addInstance(action) {
|
|
34
|
-
return this.addItem(action);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @private
|
|
38
|
-
*/
|
|
39
|
-
removeInstance(action) {
|
|
40
|
-
return this.removeItem(action);
|
|
41
|
-
}
|
|
42
|
-
_createChild(child, options) {
|
|
43
|
-
const { parent = this } = options;
|
|
44
|
-
return (0, FormCreationUtils_1.createChild)(child, { form: this.form, parent: parent }, true);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, BaseNode_1.dependencyTracked)()
|
|
49
|
-
], InstanceManager.prototype, "maxOccur", null);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, BaseNode_1.dependencyTracked)()
|
|
52
|
-
], InstanceManager.prototype, "minOccur", null);
|
|
53
|
-
exports.InstanceManager = InstanceManager;
|
package/lib/Node.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines generic form object class which any form runtime model (like textbox, checkbox etc)
|
|
3
|
-
* should extend from.
|
|
4
|
-
* @typeparam T type of the node (for example, {@link MetaDataJson | form meta data}
|
|
5
|
-
*/
|
|
6
|
-
declare class Node<T> {
|
|
7
|
-
protected _jsonModel: T;
|
|
8
|
-
constructor(inputModel: T);
|
|
9
|
-
protected getP<S>(key: string, def: S): S;
|
|
10
|
-
get isContainer(): boolean;
|
|
11
|
-
}
|
|
12
|
-
export default Node;
|
package/lib/Node.js
DELETED
|
@@ -1,27 +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
|
-
const JsonUtils_1 = require("./utils/JsonUtils");
|
|
11
|
-
/**
|
|
12
|
-
* Defines generic form object class which any form runtime model (like textbox, checkbox etc)
|
|
13
|
-
* should extend from.
|
|
14
|
-
* @typeparam T type of the node (for example, {@link MetaDataJson | form meta data}
|
|
15
|
-
*/
|
|
16
|
-
class Node {
|
|
17
|
-
constructor(inputModel) {
|
|
18
|
-
this._jsonModel = Object.assign({}, inputModel);
|
|
19
|
-
}
|
|
20
|
-
getP(key, def) {
|
|
21
|
-
return (0, JsonUtils_1.getProperty)(this._jsonModel, key, def);
|
|
22
|
-
}
|
|
23
|
-
get isContainer() {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.default = Node;
|
package/lib/Scriptable.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Action, RulesJson, ScriptableField } from './types';
|
|
2
|
-
import { BaseNode } from './BaseNode';
|
|
3
|
-
/**
|
|
4
|
-
* Defines scriptable aspects (ie rules, events) of form runtime model. Any form runtime object which requires
|
|
5
|
-
* execution of rules/events should extend from this class.
|
|
6
|
-
*/
|
|
7
|
-
declare abstract class Scriptable<T extends RulesJson> extends BaseNode<T> implements ScriptableField {
|
|
8
|
-
private _events;
|
|
9
|
-
private _rules;
|
|
10
|
-
getRules(): import("./types").Items<string>;
|
|
11
|
-
private getCompiledRule;
|
|
12
|
-
private getCompiledEvent;
|
|
13
|
-
private applyUpdates;
|
|
14
|
-
protected executeAllRules(context: any): void;
|
|
15
|
-
private getExpressionScope;
|
|
16
|
-
private executeEvent;
|
|
17
|
-
/**
|
|
18
|
-
* Executes the given rule
|
|
19
|
-
* @param event
|
|
20
|
-
* @param context
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
executeRule(event: Action, context: any): void;
|
|
24
|
-
executeExpression(expr: string): any;
|
|
25
|
-
/**
|
|
26
|
-
* Executes the given action
|
|
27
|
-
* @param action {@link Action | event object}
|
|
28
|
-
*/
|
|
29
|
-
executeAction(action: Action): void;
|
|
30
|
-
}
|
|
31
|
-
export default Scriptable;
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines all form events
|
|
3
|
-
*/
|
|
4
|
-
import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError } from '../types';
|
|
5
|
-
/**
|
|
6
|
-
* Implementation of generic event
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
export declare class ActionImpl implements Action {
|
|
10
|
-
private _metadata?;
|
|
11
|
-
protected _type: string;
|
|
12
|
-
private _payload?;
|
|
13
|
-
private _target;
|
|
14
|
-
constructor(payload: any, type: string, _metadata?: any);
|
|
15
|
-
get type(): string;
|
|
16
|
-
get payload(): any;
|
|
17
|
-
get metadata(): any;
|
|
18
|
-
get target(): FormModel | FieldModel | FieldsetModel;
|
|
19
|
-
get isCustomEvent(): boolean;
|
|
20
|
-
protected payloadToJson(): any;
|
|
21
|
-
toJson(): {
|
|
22
|
-
payload: any;
|
|
23
|
-
type: string;
|
|
24
|
-
isCustomEvent: boolean;
|
|
25
|
-
};
|
|
26
|
-
toString(): string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Payload of change event
|
|
30
|
-
*/
|
|
31
|
-
export declare type ChangePayload = {
|
|
32
|
-
/**
|
|
33
|
-
* List of changes
|
|
34
|
-
*/
|
|
35
|
-
changes: Array<{
|
|
36
|
-
/**
|
|
37
|
-
* Name of the property which has changed
|
|
38
|
-
*/
|
|
39
|
-
propertyName: string;
|
|
40
|
-
/**
|
|
41
|
-
* Previous value of the property changed
|
|
42
|
-
*/
|
|
43
|
-
prevValue?: any;
|
|
44
|
-
/**
|
|
45
|
-
* Current value of the property changed
|
|
46
|
-
*/
|
|
47
|
-
currentValue: any;
|
|
48
|
-
}>;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Implementation of `change` event. The change event is triggered on the field whenever the value of the field is changed
|
|
52
|
-
*/
|
|
53
|
-
export declare class Change extends ActionImpl {
|
|
54
|
-
/**
|
|
55
|
-
* @constructor
|
|
56
|
-
* @param [payload] event payload
|
|
57
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
58
|
-
*/
|
|
59
|
-
constructor(payload: ChangePayload, dispatch?: boolean);
|
|
60
|
-
withAdditionalChange(change: Change): Change;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Implementation of `invalid` event. The invalid event is triggered when a Field’s value becomes invalid after a change event or whenever its value property change
|
|
64
|
-
*/
|
|
65
|
-
export declare class Invalid extends ActionImpl {
|
|
66
|
-
/**
|
|
67
|
-
* @constructor
|
|
68
|
-
* @param [payload] event payload
|
|
69
|
-
*/
|
|
70
|
-
constructor(payload?: any);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Implementation of `valid` event. The valid event is triggered whenever the field’s valid state is changed from invalid to valid.
|
|
74
|
-
*/
|
|
75
|
-
export declare class Valid extends ActionImpl {
|
|
76
|
-
/**
|
|
77
|
-
* @constructor
|
|
78
|
-
* @param [payload] event payload
|
|
79
|
-
*/
|
|
80
|
-
constructor(payload?: any);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Implementation of an ExecuteRule event.
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
export declare class ExecuteRule extends ActionImpl {
|
|
87
|
-
/**
|
|
88
|
-
* @constructor
|
|
89
|
-
* @param [payload] event payload
|
|
90
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
91
|
-
*/
|
|
92
|
-
constructor(payload?: any, dispatch?: boolean);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Creates a change event
|
|
96
|
-
* @param propertyName name of the form field property
|
|
97
|
-
* @param currentValue current value
|
|
98
|
-
* @param prevValue previous value
|
|
99
|
-
* @returns {@link Change} change event
|
|
100
|
-
*/
|
|
101
|
-
export declare const propertyChange: (propertyName: string, currentValue: any, prevValue?: any) => Change;
|
|
102
|
-
/**
|
|
103
|
-
* Implementation of `initialize` event. The event is triggered on all the fields when the form initialisation is complete
|
|
104
|
-
*/
|
|
105
|
-
export declare class Initialize extends ActionImpl {
|
|
106
|
-
/**
|
|
107
|
-
* @constructor
|
|
108
|
-
* @param [payload] event payload
|
|
109
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
110
|
-
*/
|
|
111
|
-
constructor(payload?: any, dispatch?: boolean);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Implementation of `load` event. The event is when the form initialization is complete
|
|
115
|
-
*/
|
|
116
|
-
export declare class FormLoad extends ActionImpl {
|
|
117
|
-
/**
|
|
118
|
-
* @constructor
|
|
119
|
-
*/
|
|
120
|
-
constructor();
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Implementation of `click` event. The event is triggered when user clicks on an element.
|
|
124
|
-
*/
|
|
125
|
-
export declare class Click extends ActionImpl {
|
|
126
|
-
/**
|
|
127
|
-
* @constructor
|
|
128
|
-
* @param [payload] event payload
|
|
129
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
130
|
-
*/
|
|
131
|
-
constructor(payload?: any, dispatch?: boolean);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Implementation of `blur` event. The event is triggered when the element loses focus.
|
|
135
|
-
*/
|
|
136
|
-
export declare class Blur extends ActionImpl {
|
|
137
|
-
/**
|
|
138
|
-
* @constructor
|
|
139
|
-
* @param [payload] event payload
|
|
140
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
141
|
-
*/
|
|
142
|
-
constructor(payload?: any, dispatch?: boolean);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Implementation of `ValidationComplete` event. The ValidationComplete event is triggered once validation is completed
|
|
146
|
-
* on the form.
|
|
147
|
-
*
|
|
148
|
-
* An example of using this event,
|
|
149
|
-
* ```
|
|
150
|
-
* function onValidationComplete(event) {
|
|
151
|
-
* const x = event.payload[0].id;
|
|
152
|
-
* // do something with the invalid field
|
|
153
|
-
* }
|
|
154
|
-
* ```
|
|
155
|
-
*/
|
|
156
|
-
export declare class ValidationComplete extends ActionImpl {
|
|
157
|
-
/**
|
|
158
|
-
* @constructor
|
|
159
|
-
* @param [payload] event payload (ie) list of {@link ValidationError | validation errors}
|
|
160
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
161
|
-
*/
|
|
162
|
-
constructor(payload?: Array<ValidationError>, dispatch?: boolean);
|
|
163
|
-
}
|
|
164
|
-
export declare class Focus extends ActionImpl {
|
|
165
|
-
/**
|
|
166
|
-
* @constructor
|
|
167
|
-
*/
|
|
168
|
-
constructor();
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Implementation of `submit` event. The submit event is triggered on the Form.
|
|
172
|
-
* To trigger the submit event, submit function needs to be invoked or one can invoke dispatchEvent API.
|
|
173
|
-
*/
|
|
174
|
-
export declare class Submit extends ActionImpl {
|
|
175
|
-
/**
|
|
176
|
-
* @constructor
|
|
177
|
-
* @param [payload] event payload
|
|
178
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
179
|
-
*/
|
|
180
|
-
constructor(payload?: any, dispatch?: boolean);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Implementation of `reset` event. The reset event is triggered on the Form.
|
|
184
|
-
* To trigger the reset event, reset function needs to be invoked or one can invoke dispatchEvent API.
|
|
185
|
-
*/
|
|
186
|
-
export declare class Reset extends ActionImpl {
|
|
187
|
-
/**
|
|
188
|
-
* @constructor
|
|
189
|
-
* @param [payload] event payload
|
|
190
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
191
|
-
*/
|
|
192
|
-
constructor(payload?: any, dispatch?: boolean);
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Implementation of `fieldChanged` event. The field changed event is triggered on the field which it has changed.
|
|
196
|
-
*/
|
|
197
|
-
export declare class FieldChanged extends ActionImpl {
|
|
198
|
-
constructor(changes: ChangePayload, field: BaseJson);
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Implementation of `custom event`.
|
|
202
|
-
*/
|
|
203
|
-
export declare class CustomEvent extends ActionImpl {
|
|
204
|
-
/**
|
|
205
|
-
* @constructor
|
|
206
|
-
* @param [eventName] name of the event
|
|
207
|
-
* @param [payload] event payload
|
|
208
|
-
* @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
|
|
209
|
-
*/
|
|
210
|
-
constructor(eventName: string, payload?: any, dispatch?: boolean);
|
|
211
|
-
/**
|
|
212
|
-
* Defines if the event is custom
|
|
213
|
-
*/
|
|
214
|
-
get isCustomEvent(): boolean;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Implementation of `addItem` event. The event is triggered on a panel to add a new instance of items inside it.
|
|
218
|
-
*/
|
|
219
|
-
export declare class AddItem extends ActionImpl {
|
|
220
|
-
/**
|
|
221
|
-
* @constructor
|
|
222
|
-
* @param [payload] event payload
|
|
223
|
-
*/
|
|
224
|
-
constructor(payload?: number);
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Implementation of `removeItem` event. The event is triggered on a panel to remove an instance of items inside it.
|
|
228
|
-
*/
|
|
229
|
-
export declare class RemoveItem extends ActionImpl {
|
|
230
|
-
/**
|
|
231
|
-
* @constructor
|
|
232
|
-
* @param [payload] event payload
|
|
233
|
-
*/
|
|
234
|
-
constructor(payload?: number);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Implementation of `addInstance` event. The event is triggered on a field to add an instance of it.
|
|
238
|
-
*/
|
|
239
|
-
export declare class AddInstance extends ActionImpl {
|
|
240
|
-
/**
|
|
241
|
-
* @constructor
|
|
242
|
-
* @param [payload] event payload
|
|
243
|
-
*/
|
|
244
|
-
constructor(payload?: number);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Implementation of `removeInstance` event. The event is triggered on a field to remove an instance of it.
|
|
248
|
-
*/
|
|
249
|
-
export declare class RemoveInstance extends ActionImpl {
|
|
250
|
-
/**
|
|
251
|
-
* @constructor
|
|
252
|
-
* @param [payload] event payload
|
|
253
|
-
*/
|
|
254
|
-
constructor(payload?: number);
|
|
255
|
-
}
|