@aemforms/af-core 0.22.18 → 0.22.20

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.
Files changed (120) hide show
  1. package/lib/browser/afb-events.js +151 -0
  2. package/lib/browser/afb-runtime.js +3620 -0
  3. package/lib/cjs/index.cjs +8886 -0
  4. package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +11 -68
  5. package/lib/{BaseNode.js → esm/BaseNode.js} +86 -182
  6. package/lib/esm/Checkbox.d.ts +79 -0
  7. package/lib/esm/Checkbox.js +27 -0
  8. package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
  9. package/lib/esm/CheckboxGroup.js +23 -0
  10. package/lib/esm/Container.d.ts +53 -0
  11. package/lib/{Container.js → esm/Container.js} +76 -124
  12. package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
  13. package/lib/esm/DateField.js +21 -0
  14. package/lib/{Field.d.ts → esm/Field.d.ts} +44 -98
  15. package/lib/{Field.js → esm/Field.js} +172 -206
  16. package/lib/esm/Fieldset.d.ts +16 -0
  17. package/lib/esm/Fieldset.js +45 -0
  18. package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
  19. package/lib/esm/FileObject.js +26 -0
  20. package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
  21. package/lib/esm/FileUpload.js +108 -0
  22. package/lib/esm/Form.d.ts +113 -0
  23. package/lib/esm/Form.js +176 -0
  24. package/lib/esm/FormInstance.d.ts +13 -0
  25. package/lib/esm/FormInstance.js +81 -0
  26. package/lib/esm/FormMetaData.d.ts +7 -0
  27. package/lib/esm/FormMetaData.js +10 -0
  28. package/lib/esm/InstanceManager.d.ts +9 -0
  29. package/lib/esm/InstanceManager.js +31 -0
  30. package/lib/esm/Node.d.ts +7 -0
  31. package/lib/esm/Node.js +16 -0
  32. package/lib/esm/Scriptable.d.ts +17 -0
  33. package/lib/{Scriptable.js → esm/Scriptable.js} +12 -55
  34. package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
  35. package/lib/{controller → esm/controller}/EventQueue.js +10 -26
  36. package/lib/esm/controller/Events.d.ts +85 -0
  37. package/lib/esm/controller/Events.js +149 -0
  38. package/lib/{controller → esm/controller}/Logger.d.ts +0 -6
  39. package/lib/{controller → esm/controller}/Logger.js +5 -11
  40. package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
  41. package/lib/{data → esm/data}/DataGroup.js +20 -35
  42. package/lib/{data → esm/data}/DataValue.d.ts +2 -8
  43. package/lib/esm/data/DataValue.js +46 -0
  44. package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
  45. package/lib/esm/data/EmptyDataValue.js +29 -0
  46. package/lib/esm/index.d.ts +21 -0
  47. package/lib/esm/index.js +21 -0
  48. package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +2 -24
  49. package/lib/{rules → esm/rules}/FunctionRuntime.js +44 -114
  50. package/lib/esm/rules/RuleEngine.d.ts +12 -0
  51. package/lib/esm/rules/RuleEngine.js +47 -0
  52. package/lib/{types → esm/types}/Json.d.ts +6 -22
  53. package/lib/esm/types/Json.js +7 -0
  54. package/lib/esm/types/Model.d.ts +131 -0
  55. package/lib/esm/types/Model.js +8 -0
  56. package/lib/esm/types/index.d.ts +2 -0
  57. package/lib/esm/types/index.js +2 -0
  58. package/lib/{utils → esm/utils}/DataRefParser.d.ts +2 -5
  59. package/lib/{utils → esm/utils}/DataRefParser.js +22 -49
  60. package/lib/{utils → esm/utils}/Fetch.d.ts +1 -0
  61. package/lib/esm/utils/Fetch.js +61 -0
  62. package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
  63. package/lib/esm/utils/FormCreationUtils.js +74 -0
  64. package/lib/esm/utils/FormUtils.d.ts +12 -0
  65. package/lib/esm/utils/FormUtils.js +187 -0
  66. package/lib/esm/utils/JsonUtils.d.ts +11 -0
  67. package/lib/esm/utils/JsonUtils.js +76 -0
  68. package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
  69. package/lib/esm/utils/LogUtils.js +6 -0
  70. package/lib/esm/utils/SchemaUtils.d.ts +3 -0
  71. package/lib/esm/utils/SchemaUtils.js +71 -0
  72. package/lib/esm/utils/TranslationUtils.d.ts +11 -0
  73. package/lib/esm/utils/TranslationUtils.js +115 -0
  74. package/lib/esm/utils/ValidationUtils.d.ts +19 -0
  75. package/lib/{utils → esm/utils}/ValidationUtils.js +29 -187
  76. package/package.json +17 -10
  77. package/lib/Checkbox.d.ts +0 -88
  78. package/lib/Checkbox.js +0 -49
  79. package/lib/CheckboxGroup.js +0 -43
  80. package/lib/Container.d.ts +0 -199
  81. package/lib/DateField.js +0 -35
  82. package/lib/Fieldset.d.ts +0 -34
  83. package/lib/Fieldset.js +0 -113
  84. package/lib/FileObject.js +0 -39
  85. package/lib/FileUpload.js +0 -155
  86. package/lib/Form.d.ts +0 -262
  87. package/lib/Form.js +0 -230
  88. package/lib/FormInstance.d.ts +0 -38
  89. package/lib/FormInstance.js +0 -119
  90. package/lib/FormMetaData.d.ts +0 -11
  91. package/lib/FormMetaData.js +0 -28
  92. package/lib/Node.d.ts +0 -12
  93. package/lib/Node.js +0 -27
  94. package/lib/Scriptable.d.ts +0 -31
  95. package/lib/controller/Controller.d.ts +0 -223
  96. package/lib/controller/Controller.js +0 -287
  97. package/lib/controller/index.d.ts +0 -1
  98. package/lib/controller/index.js +0 -24
  99. package/lib/data/DataValue.js +0 -52
  100. package/lib/data/EmptyDataValue.js +0 -46
  101. package/lib/index.d.ts +0 -28
  102. package/lib/index.js +0 -63
  103. package/lib/rules/RuleEngine.d.ts +0 -23
  104. package/lib/rules/RuleEngine.js +0 -62
  105. package/lib/types/Json.js +0 -19
  106. package/lib/types/Model.d.ts +0 -379
  107. package/lib/types/Model.js +0 -20
  108. package/lib/types/index.d.ts +0 -2
  109. package/lib/types/index.js +0 -25
  110. package/lib/utils/Fetch.js +0 -29
  111. package/lib/utils/FormUtils.d.ts +0 -47
  112. package/lib/utils/FormUtils.js +0 -257
  113. package/lib/utils/JsonUtils.d.ts +0 -62
  114. package/lib/utils/JsonUtils.js +0 -143
  115. package/lib/utils/LogUtils.js +0 -17
  116. package/lib/utils/SchemaUtils.d.ts +0 -16
  117. package/lib/utils/SchemaUtils.js +0 -92
  118. package/lib/utils/TranslationUtils.d.ts +0 -41
  119. package/lib/utils/TranslationUtils.js +0 -185
  120. package/lib/utils/ValidationUtils.d.ts +0 -170
@@ -1,46 +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 DataValue_1 = __importDefault(require("./DataValue"));
14
- const value = Symbol('NullValue');
15
- class NullDataValueClass extends DataValue_1.default {
16
- constructor() {
17
- super('', value, 'null');
18
- }
19
- // eslint-disable-next-line @typescript-eslint/no-empty-function
20
- setValue() {
21
- }
22
- // eslint-disable-next-line @typescript-eslint/no-empty-function
23
- $bindToField() {
24
- }
25
- $length() {
26
- return 0;
27
- }
28
- $convertToDataValue() {
29
- return this;
30
- }
31
- // eslint-disable-next-line @typescript-eslint/no-empty-function
32
- $addDataNode() {
33
- }
34
- // eslint-disable-next-line @typescript-eslint/no-empty-function
35
- $removeDataNode() {
36
- }
37
- $getDataNode() {
38
- return this;
39
- }
40
- $containsDataNode() {
41
- return false;
42
- }
43
- }
44
- //@ts-ignore
45
- const NullDataValue = new NullDataValueClass();
46
- exports.default = NullDataValue;
package/lib/index.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright 2022 Adobe, Inc.
3
- *
4
- * 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.
5
- *
6
- * 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.
7
- */
8
- export * from './FormInstance';
9
- export * from './types/index';
10
- export * from './controller/index';
11
- export * from './utils/TranslationUtils';
12
- export * from './utils/JsonUtils';
13
- export * from './utils/SchemaUtils';
14
- import { getFileSizeInBytes, extractFileInfo } from './utils/FormUtils';
15
- import { BaseNode } from './BaseNode';
16
- import Checkbox from './Checkbox';
17
- import CheckboxGroup from './CheckboxGroup';
18
- import Container from './Container';
19
- import Field from './Field';
20
- import { Fieldset } from './Fieldset';
21
- import { FileObject } from './FileObject';
22
- import FileUpload from './FileUpload';
23
- import FormMetaData from './FormMetaData';
24
- import Node from './Node';
25
- import Scriptable from './Scriptable';
26
- import Form from './Form';
27
- import { FunctionRuntime, request } from './rules/FunctionRuntime';
28
- export { Form, BaseNode, Checkbox, CheckboxGroup, Container, Field, Fieldset, FileObject, FileUpload, FormMetaData, Node, Scriptable, getFileSizeInBytes, extractFileInfo, FunctionRuntime, request };
package/lib/index.js DELETED
@@ -1,63 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
24
- return (mod && mod.__esModule) ? mod : { "default": mod };
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.request = exports.FunctionRuntime = exports.extractFileInfo = exports.getFileSizeInBytes = exports.Scriptable = exports.Node = exports.FormMetaData = exports.FileUpload = exports.FileObject = exports.Fieldset = exports.Field = exports.Container = exports.CheckboxGroup = exports.Checkbox = exports.BaseNode = exports.Form = void 0;
28
- __exportStar(require("./FormInstance"), exports);
29
- __exportStar(require("./types/index"), exports);
30
- __exportStar(require("./controller/index"), exports);
31
- __exportStar(require("./utils/TranslationUtils"), exports);
32
- __exportStar(require("./utils/JsonUtils"), exports);
33
- __exportStar(require("./utils/SchemaUtils"), exports);
34
- const FormUtils_1 = require("./utils/FormUtils");
35
- Object.defineProperty(exports, "getFileSizeInBytes", { enumerable: true, get: function () { return FormUtils_1.getFileSizeInBytes; } });
36
- Object.defineProperty(exports, "extractFileInfo", { enumerable: true, get: function () { return FormUtils_1.extractFileInfo; } });
37
- const BaseNode_1 = require("./BaseNode");
38
- Object.defineProperty(exports, "BaseNode", { enumerable: true, get: function () { return BaseNode_1.BaseNode; } });
39
- const Checkbox_1 = __importDefault(require("./Checkbox"));
40
- exports.Checkbox = Checkbox_1.default;
41
- const CheckboxGroup_1 = __importDefault(require("./CheckboxGroup"));
42
- exports.CheckboxGroup = CheckboxGroup_1.default;
43
- const Container_1 = __importDefault(require("./Container"));
44
- exports.Container = Container_1.default;
45
- const Field_1 = __importDefault(require("./Field"));
46
- exports.Field = Field_1.default;
47
- const Fieldset_1 = require("./Fieldset");
48
- Object.defineProperty(exports, "Fieldset", { enumerable: true, get: function () { return Fieldset_1.Fieldset; } });
49
- const FileObject_1 = require("./FileObject");
50
- Object.defineProperty(exports, "FileObject", { enumerable: true, get: function () { return FileObject_1.FileObject; } });
51
- const FileUpload_1 = __importDefault(require("./FileUpload"));
52
- exports.FileUpload = FileUpload_1.default;
53
- const FormMetaData_1 = __importDefault(require("./FormMetaData"));
54
- exports.FormMetaData = FormMetaData_1.default;
55
- const Node_1 = __importDefault(require("./Node"));
56
- exports.Node = Node_1.default;
57
- const Scriptable_1 = __importDefault(require("./Scriptable"));
58
- exports.Scriptable = Scriptable_1.default;
59
- const Form_1 = __importDefault(require("./Form"));
60
- exports.Form = Form_1.default;
61
- const FunctionRuntime_1 = require("./rules/FunctionRuntime");
62
- Object.defineProperty(exports, "FunctionRuntime", { enumerable: true, get: function () { return FunctionRuntime_1.FunctionRuntime; } });
63
- Object.defineProperty(exports, "request", { enumerable: true, get: function () { return FunctionRuntime_1.request; } });
@@ -1,23 +0,0 @@
1
- /**
2
- * Implementation of rule engine
3
- * @module
4
- * @private
5
- */
6
- import { BaseModel } from '../types';
7
- import { Formula } from '@adobe/json-formula';
8
- /**
9
- * Implementation of rule engine
10
- * @private
11
- */
12
- declare class RuleEngine {
13
- private _context;
14
- private _globalNames;
15
- compileRule(rule: string): Formula;
16
- execute(node: any, data: any, globals: any, useValueOf?: boolean): any;
17
- /**
18
- * Listen to subscriber for
19
- * @param subscriber
20
- */
21
- trackDependency(subscriber: BaseModel): void;
22
- }
23
- export default RuleEngine;
@@ -1,62 +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 json_formula_1 = require("@adobe/json-formula");
11
- const FunctionRuntime_1 = require("./FunctionRuntime");
12
- /**
13
- * Implementation of rule engine
14
- * @private
15
- */
16
- class RuleEngine {
17
- constructor() {
18
- this._globalNames = [
19
- '$form',
20
- '$field',
21
- '$event'
22
- ];
23
- }
24
- compileRule(rule) {
25
- const customFunctions = FunctionRuntime_1.FunctionRuntime.getFunctions();
26
- return new json_formula_1.Formula(rule, customFunctions, undefined, this._globalNames);
27
- }
28
- execute(node, data, globals, useValueOf = false) {
29
- var _a, _b, _c, _d, _e, _f;
30
- const oldContext = this._context;
31
- this._context = globals;
32
- let res = undefined;
33
- try {
34
- node.debug = []; // clean previous debug info
35
- res = node.search(data, globals);
36
- }
37
- catch (err) {
38
- (_c = (_b = (_a = this._context) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.error(err);
39
- }
40
- for (const debugInfo of node.debug) {
41
- (_f = (_e = (_d = this._context) === null || _d === void 0 ? void 0 : _d.form) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.debug(debugInfo);
42
- }
43
- let finalRes = res;
44
- if (useValueOf) {
45
- if (typeof res === 'object' && res !== null) {
46
- finalRes = Object.getPrototypeOf(res).valueOf.call(res);
47
- }
48
- }
49
- this._context = oldContext;
50
- return finalRes;
51
- }
52
- /**
53
- * Listen to subscriber for
54
- * @param subscriber
55
- */
56
- trackDependency(subscriber) {
57
- if (this._context && this._context.field !== undefined && this._context.field !== subscriber) {
58
- subscriber._addDependent(this._context.field);
59
- }
60
- }
61
- }
62
- exports.default = RuleEngine;
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'];
@@ -1,379 +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: () => State<T>;
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
- * Validates the given form field
196
- * @returns list of {@link ValidationError | validation errors}
197
- */
198
- validate(): Array<ValidationError>;
199
- /**
200
- * Imports data to the form field
201
- * @private
202
- */
203
- importData(a?: DataGroup): any;
204
- /**
205
- * @private
206
- */
207
- getRuleNode(): any;
208
- /**
209
- * @private
210
- */
211
- ruleNodeReference(): any;
212
- /**
213
- * @private
214
- */
215
- _initialize(): any;
216
- /**
217
- * @private
218
- */
219
- _addDependent(dependent: BaseModel): any;
220
- }
221
- /**
222
- * Generic field model interface.
223
- * Defines properties that each form field should have
224
- */
225
- export interface FieldModel extends BaseModel, ScriptableField, WithState<FieldJson> {
226
- /**
227
- * Parent of the current field
228
- */
229
- parent: ContainerModel;
230
- /**
231
- * format in which user will edit the value
232
- */
233
- readonly editFormat?: string;
234
- /**
235
- * format in which user will see the value after update
236
- */
237
- readonly displayFormat?: string;
238
- /**
239
- * value to be displayed to the user after update
240
- */
241
- readonly displayValue?: string;
242
- /**
243
- * value to be displayed to the user for edit
244
- */
245
- readonly editValue?: string;
246
- }
247
- /**
248
- * Defines form meta data properties
249
- */
250
- export interface FormMetaDataModel {
251
- /**
252
- * Version of the adaptive form specification
253
- */
254
- readonly version: string;
255
- /**
256
- * Version of the rule grammar
257
- */
258
- readonly grammar: string;
259
- /**
260
- * Form locale
261
- */
262
- readonly locale: string;
263
- }
264
- /**
265
- * Generic container model interface.
266
- * Defines properties that each container should have
267
- */
268
- export interface ContainerModel extends BaseModel, ScriptableField {
269
- /**
270
- * Defines the children/items of the container
271
- */
272
- items: Array<FieldsetModel | FieldModel>;
273
- /**
274
- * Defines the parent of the container
275
- */
276
- parent: ContainerModel;
277
- /**
278
- * Returns the index of the {@link FieldModel | child item} or the {@link FieldsetModel | child container}
279
- * @param f child item
280
- * @returns `index` of the item
281
- */
282
- indexOf(f: FieldModel | FieldsetModel): number;
283
- isTransparent(): boolean;
284
- activeChild: BaseModel | null;
285
- }
286
- /**
287
- * Generic field set model interface.
288
- * Defines properties that each field set should have
289
- */
290
- export interface FieldsetModel extends ContainerModel, WithState<FieldsetJson> {
291
- type?: 'array' | 'object';
292
- }
293
- /**
294
- * Defines the interface for form model
295
- */
296
- export interface FormModel extends ContainerModel, WithState<FormJson> {
297
- /**
298
- * Id of the form.
299
- */
300
- readonly id: string;
301
- /**
302
- * Form data
303
- */
304
- readonly data?: any;
305
- /**
306
- * Form metadata
307
- */
308
- readonly metadata?: MetaDataJson;
309
- /**
310
- * Form title.
311
- */
312
- readonly title: string;
313
- readonly logger: Logger;
314
- /**
315
- * Imports the given form data
316
- * @param data form data
317
- */
318
- importData(data: any): any;
319
- /**
320
- * Exports the form data
321
- */
322
- exportData(): any;
323
- /**
324
- * Get form element model based on the id of the form element
325
- * @param id id of the form element
326
- */
327
- getElement(id: string): FieldModel | FormModel | FieldsetModel;
328
- /**
329
- * @private
330
- */
331
- getUniqueId(): string;
332
- /**
333
- * @private
334
- */
335
- getEventQueue(): EventQueue;
336
- }
337
- /**
338
- * Defines file object interface.
339
- */
340
- export interface IFileObject {
341
- /**
342
- * Name of the file
343
- */
344
- name: string;
345
- /**
346
- * Media type of the file data
347
- */
348
- mediaType: string;
349
- /**
350
- * Data of the file attachment. It can be uri or any file interface specific to channel (in web, it is file object).
351
- */
352
- data?: any;
353
- /**
354
- * Size of the file binary as per iec specification.
355
- */
356
- size?: number;
357
- }
358
- /**
359
- * Defines Validation Error interface.
360
- */
361
- export interface IValidationError {
362
- /**
363
- * {@link FieldModel.id | name} of the field
364
- */
365
- fieldName: string;
366
- /**
367
- * List of error messages
368
- */
369
- errorMessages: Array<string>;
370
- }
371
- /**
372
- * Implementation of {@link IValidationError | Validation Error} interface
373
- */
374
- export declare class ValidationError implements IValidationError {
375
- fieldName: string;
376
- errorMessages: Array<string>;
377
- constructor(fieldName?: string, errorMessages?: Array<any>);
378
- }
379
- export {};
@@ -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;
@@ -1,2 +0,0 @@
1
- export * from './Json';
2
- export * from './Model';
@@ -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);