@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.
Files changed (124) hide show
  1. package/LICENSE +18 -4
  2. package/lib/cjs/index.cjs +7277 -0
  3. package/lib/{BaseNode.js → esm/BaseNode-dc59ab07.js} +108 -184
  4. package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
  5. package/lib/esm/BaseNode.js +26 -0
  6. package/lib/esm/Checkbox.d.ts +79 -0
  7. package/lib/esm/Checkbox.js +63 -0
  8. package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
  9. package/lib/esm/CheckboxGroup.js +60 -0
  10. package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
  11. package/lib/{Container.js → esm/Container.js} +81 -122
  12. package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
  13. package/lib/esm/DateField.js +57 -0
  14. package/lib/{Field.d.ts → esm/Field.d.ts} +41 -106
  15. package/lib/{Field.js → esm/Field.js} +186 -216
  16. package/lib/esm/Fieldset.d.ts +16 -0
  17. package/lib/esm/Fieldset.js +78 -0
  18. package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
  19. package/lib/esm/FileObject.js +48 -0
  20. package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
  21. package/lib/esm/FileUpload.js +141 -0
  22. package/lib/{Form.d.ts → esm/Form.d.ts} +20 -86
  23. package/lib/esm/Form.js +208 -0
  24. package/lib/esm/FormInstance.d.ts +13 -0
  25. package/lib/esm/FormInstance.js +129 -0
  26. package/lib/esm/FormMetaData.d.ts +7 -0
  27. package/lib/esm/FormMetaData.js +35 -0
  28. package/lib/esm/InstanceManager.d.ts +9 -0
  29. package/lib/esm/InstanceManager.js +58 -0
  30. package/lib/esm/Node.d.ts +7 -0
  31. package/lib/esm/Node.js +40 -0
  32. package/lib/esm/Scriptable.d.ts +17 -0
  33. package/lib/{Scriptable.js → esm/Scriptable.js} +38 -54
  34. package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
  35. package/lib/{controller → esm/controller}/EventQueue.js +32 -26
  36. package/lib/esm/controller/Events.d.ts +85 -0
  37. package/lib/esm/controller/Events.js +171 -0
  38. package/lib/{controller → esm/controller}/Logger.d.ts +2 -8
  39. package/lib/esm/controller/Logger.js +52 -0
  40. package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
  41. package/lib/{data → esm/data}/DataGroup.js +38 -34
  42. package/lib/{data → esm/data}/DataValue.d.ts +1 -7
  43. package/lib/esm/data/DataValue.js +68 -0
  44. package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
  45. package/lib/esm/data/EmptyDataValue.js +51 -0
  46. package/lib/esm/index.d.ts +21 -0
  47. package/lib/esm/index.js +55 -0
  48. package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +3 -25
  49. package/lib/{rules → esm/rules}/FunctionRuntime.js +66 -117
  50. package/lib/esm/rules/RuleEngine.d.ts +12 -0
  51. package/lib/esm/rules/RuleEngine.js +76 -0
  52. package/lib/esm/types/Json.d.ts +119 -0
  53. package/lib/esm/types/Json.js +29 -0
  54. package/lib/esm/types/Model.d.ts +131 -0
  55. package/lib/esm/types/Model.js +30 -0
  56. package/lib/esm/types/index.d.ts +2 -0
  57. package/lib/esm/types/index.js +22 -0
  58. package/lib/{utils → esm/utils}/DataRefParser.d.ts +4 -7
  59. package/lib/{utils → esm/utils}/DataRefParser.js +42 -44
  60. package/lib/{utils → esm/utils}/Fetch.d.ts +1 -7
  61. package/lib/esm/utils/Fetch.js +83 -0
  62. package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
  63. package/lib/esm/utils/FormCreationUtils.js +112 -0
  64. package/lib/esm/utils/FormUtils.d.ts +12 -0
  65. package/lib/esm/utils/FormUtils.js +212 -0
  66. package/lib/esm/utils/JsonUtils.d.ts +11 -0
  67. package/lib/esm/utils/JsonUtils.js +99 -0
  68. package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
  69. package/lib/esm/utils/LogUtils.js +28 -0
  70. package/lib/esm/utils/SchemaUtils.d.ts +3 -0
  71. package/lib/esm/utils/SchemaUtils.js +93 -0
  72. package/lib/esm/utils/TranslationUtils.d.ts +11 -0
  73. package/lib/esm/utils/TranslationUtils.js +138 -0
  74. package/lib/esm/utils/ValidationUtils.d.ts +19 -0
  75. package/lib/{utils → esm/utils}/ValidationUtils.js +55 -187
  76. package/package.json +18 -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/DateField.js +0 -35
  81. package/lib/Fieldset.d.ts +0 -24
  82. package/lib/Fieldset.js +0 -74
  83. package/lib/FileObject.js +0 -39
  84. package/lib/FileUpload.js +0 -155
  85. package/lib/Form.js +0 -252
  86. package/lib/FormInstance.d.ts +0 -38
  87. package/lib/FormInstance.js +0 -127
  88. package/lib/FormMetaData.d.ts +0 -11
  89. package/lib/FormMetaData.js +0 -28
  90. package/lib/InstanceManager.d.ts +0 -16
  91. package/lib/InstanceManager.js +0 -53
  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 -255
  96. package/lib/controller/Controller.js +0 -328
  97. package/lib/controller/Logger.js +0 -36
  98. package/lib/controller/index.d.ts +0 -1
  99. package/lib/controller/index.js +0 -24
  100. package/lib/data/DataValue.js +0 -56
  101. package/lib/data/EmptyDataValue.js +0 -46
  102. package/lib/index.d.ts +0 -28
  103. package/lib/index.js +0 -63
  104. package/lib/rules/RuleEngine.d.ts +0 -23
  105. package/lib/rules/RuleEngine.js +0 -62
  106. package/lib/types/Json.d.ts +0 -138
  107. package/lib/types/Json.js +0 -19
  108. package/lib/types/Model.d.ts +0 -393
  109. package/lib/types/Model.js +0 -20
  110. package/lib/types/index.d.ts +0 -2
  111. package/lib/types/index.js +0 -25
  112. package/lib/utils/Fetch.js +0 -87
  113. package/lib/utils/FormCreationUtils.d.ts +0 -11
  114. package/lib/utils/FormCreationUtils.js +0 -83
  115. package/lib/utils/FormUtils.d.ts +0 -47
  116. package/lib/utils/FormUtils.js +0 -257
  117. package/lib/utils/JsonUtils.d.ts +0 -63
  118. package/lib/utils/JsonUtils.js +0 -157
  119. package/lib/utils/LogUtils.js +0 -17
  120. package/lib/utils/SchemaUtils.d.ts +0 -16
  121. package/lib/utils/SchemaUtils.js +0 -92
  122. package/lib/utils/TranslationUtils.d.ts +0 -41
  123. package/lib/utils/TranslationUtils.js +0 -185
  124. package/lib/utils/ValidationUtils.d.ts +0 -170
@@ -1,24 +1,37 @@
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
- /**
14
- * Defines data group
15
- */
16
- const DataValue_1 = __importDefault(require("./DataValue"));
17
- const EmptyDataValue_1 = __importDefault(require("./EmptyDataValue"));
18
- /**
19
- * @private
20
- */
21
- class DataGroup extends DataValue_1.default {
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import DataValue from './DataValue.js';
22
+ import NullDataValue from './EmptyDataValue.js';
23
+
24
+ class DataGroup extends DataValue {
25
+ $_items;
26
+ createEntry(key, value) {
27
+ const t = value instanceof Array ? 'array' : typeof value;
28
+ if (typeof value === 'object' && value != null) {
29
+ return new DataGroup(key, value, t);
30
+ }
31
+ else {
32
+ return new DataValue(key, value, t);
33
+ }
34
+ }
22
35
  constructor(_name, _value, _type = typeof _value) {
23
36
  super(_name, _value, _type);
24
37
  if (_value instanceof Array) {
@@ -32,15 +45,6 @@ class DataGroup extends DataValue_1.default {
32
45
  }));
33
46
  }
34
47
  }
35
- createEntry(key, value) {
36
- const t = value instanceof Array ? 'array' : typeof value;
37
- if (typeof value === 'object' && value != null) {
38
- return new DataGroup(key, value, t);
39
- }
40
- else {
41
- return new DataValue_1.default(key, value, t);
42
- }
43
- }
44
48
  get $value() {
45
49
  const enabled = this.$_fields.find(x => x.enabled !== false);
46
50
  if (!enabled && this.$_fields.length) {
@@ -59,10 +63,10 @@ class DataGroup extends DataValue_1.default {
59
63
  return Object.entries(this.$_items).length;
60
64
  }
61
65
  $convertToDataValue() {
62
- return new DataValue_1.default(this.$name, this.$value, this.$type);
66
+ return new DataValue(this.$name, this.$value, this.$type);
63
67
  }
64
68
  $addDataNode(name, value, override = false) {
65
- if (value !== EmptyDataValue_1.default) {
69
+ if (value !== NullDataValue) {
66
70
  if (this.$type === 'array') {
67
71
  const index = name;
68
72
  if (!override) {
@@ -78,7 +82,6 @@ class DataGroup extends DataValue_1.default {
78
82
  }
79
83
  }
80
84
  $removeDataNode(name) {
81
- //@ts-ignore not calling delete
82
85
  this.$_items[name] = undefined;
83
86
  }
84
87
  $getDataNode(name) {
@@ -93,4 +96,5 @@ class DataGroup extends DataValue_1.default {
93
96
  return true;
94
97
  }
95
98
  }
96
- exports.default = DataGroup;
99
+
100
+ export { DataGroup as default };
@@ -1,10 +1,4 @@
1
- /**
2
- * Defines data value
3
- */
4
- import { FieldModel } from '../types';
5
- /**
6
- * @private
7
- */
1
+ import { FieldModel } from '../types/index.js';
8
2
  export default class DataValue {
9
3
  private $_name;
10
4
  private $_value;
@@ -0,0 +1,68 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ class DataValue {
22
+ $_name;
23
+ $_value;
24
+ $_type;
25
+ $_fields = [];
26
+ constructor($_name, $_value, $_type = typeof $_value) {
27
+ this.$_name = $_name;
28
+ this.$_value = $_value;
29
+ this.$_type = $_type;
30
+ }
31
+ valueOf() {
32
+ return this.$_value;
33
+ }
34
+ get $name() {
35
+ return this.$_name;
36
+ }
37
+ get $value() {
38
+ const enabled = this.$_fields.find(x => x.enabled !== false);
39
+ if (!enabled && this.$_fields.length) {
40
+ return undefined;
41
+ }
42
+ return this.$_value;
43
+ }
44
+ setValue(typedValue, originalValue, fromField) {
45
+ this.$_value = typedValue;
46
+ this.$_fields.forEach(x => {
47
+ if (fromField !== x) {
48
+ x.value = originalValue;
49
+ }
50
+ });
51
+ }
52
+ get $type() {
53
+ return this.$_type;
54
+ }
55
+ $bindToField(field) {
56
+ if (this.$_fields.indexOf(field) === -1) {
57
+ this.$_fields.push(field);
58
+ }
59
+ }
60
+ $convertToDataValue() {
61
+ return this;
62
+ }
63
+ get $isDataGroup() {
64
+ return false;
65
+ }
66
+ }
67
+
68
+ export { DataValue as default };
@@ -1,4 +1,4 @@
1
- import DataValue from './DataValue';
1
+ import DataValue from './DataValue.js';
2
2
  declare class NullDataValueClass extends DataValue {
3
3
  constructor();
4
4
  setValue(): void;
@@ -0,0 +1,51 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import DataValue from './DataValue.js';
22
+
23
+ const value = Symbol('NullValue');
24
+ class NullDataValueClass extends DataValue {
25
+ constructor() {
26
+ super('', value, 'null');
27
+ }
28
+ setValue() {
29
+ }
30
+ $bindToField() {
31
+ }
32
+ $length() {
33
+ return 0;
34
+ }
35
+ $convertToDataValue() {
36
+ return this;
37
+ }
38
+ $addDataNode() {
39
+ }
40
+ $removeDataNode() {
41
+ }
42
+ $getDataNode() {
43
+ return this;
44
+ }
45
+ $containsDataNode() {
46
+ return false;
47
+ }
48
+ }
49
+ const NullDataValue = new NullDataValueClass();
50
+
51
+ export { NullDataValue as default };
@@ -0,0 +1,21 @@
1
+ export * from './FormInstance.js';
2
+ export * from './types/index.js';
3
+ export * from './controller/Events.js';
4
+ export * from './utils/TranslationUtils.js';
5
+ export * from './utils/JsonUtils.js';
6
+ export * from './utils/SchemaUtils.js';
7
+ import { getFileSizeInBytes, extractFileInfo, isEmpty } from './utils/FormUtils.js';
8
+ import { BaseNode } from './BaseNode.js';
9
+ import Checkbox from './Checkbox.js';
10
+ import CheckboxGroup from './CheckboxGroup.js';
11
+ import Container from './Container.js';
12
+ import Field from './Field.js';
13
+ import { Fieldset } from './Fieldset.js';
14
+ import { FileObject } from './FileObject.js';
15
+ import FileUpload from './FileUpload.js';
16
+ import FormMetaData from './FormMetaData.js';
17
+ import Node from './Node.js';
18
+ import Scriptable from './Scriptable.js';
19
+ import Form from './Form.js';
20
+ import { FunctionRuntime, request } from './rules/FunctionRuntime.js';
21
+ export { Form, BaseNode, Checkbox, CheckboxGroup, Container, Field, Fieldset, FileObject, FileUpload, FormMetaData, Node, Scriptable, getFileSizeInBytes, extractFileInfo, FunctionRuntime, request, isEmpty };
@@ -0,0 +1,55 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ export { createFormInstance, fetchForm, registerFunctions, validateFormData, validateFormInstance } from './FormInstance.js';
22
+ export { constraintProps, translationProps } from './types/Json.js';
23
+ export { ValidationError } from './types/Model.js';
24
+ export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Submit, Valid, ValidationComplete, propertyChange } from './controller/Events.js';
25
+ export { CUSTOM_PROPS_KEY, TRANSLATION_ID, TRANSLATION_TOKEN, addTranslationId, createTranslationObj, createTranslationObject, getOrElse, invalidateTranslation } from './utils/TranslationUtils.js';
26
+ export { checkIfConstraintsArePresent, checkIfKeyAdded, deepClone, getProperty, isCheckbox, isCheckboxGroup, isDateField, isFile, isRepeatable, jsonString } from './utils/JsonUtils.js';
27
+ export { defaultFieldTypes, exportDataSchema } from './utils/SchemaUtils.js';
28
+ export { extractFileInfo, getFileSizeInBytes, isEmpty } from './utils/FormUtils.js';
29
+ export { B as BaseNode } from './BaseNode-dc59ab07.js';
30
+ export { default as Checkbox } from './Checkbox.js';
31
+ export { default as CheckboxGroup } from './CheckboxGroup.js';
32
+ export { default as Container } from './Container.js';
33
+ export { default as Field } from './Field.js';
34
+ export { Fieldset } from './Fieldset.js';
35
+ export { FileObject } from './FileObject.js';
36
+ export { default as FileUpload } from './FileUpload.js';
37
+ export { default as FormMetaData } from './FormMetaData.js';
38
+ export { default as Node } from './Node.js';
39
+ export { default as Scriptable } from './Scriptable.js';
40
+ export { default as Form } from './Form.js';
41
+ export { FunctionRuntime, request } from './rules/FunctionRuntime.js';
42
+ import './utils/Fetch.js';
43
+ import './rules/RuleEngine.js';
44
+ import '@adobe/json-formula';
45
+ import './controller/EventQueue.js';
46
+ import './controller/Logger.js';
47
+ import './utils/FormCreationUtils.js';
48
+ import './InstanceManager.js';
49
+ import './utils/DataRefParser.js';
50
+ import './data/DataGroup.js';
51
+ import './data/DataValue.js';
52
+ import './data/EmptyDataValue.js';
53
+ import './DateField.js';
54
+ import '@aemforms/af-formatters';
55
+ import './utils/ValidationUtils.js';
@@ -1,26 +1,11 @@
1
- declare type HTTP_VERB = 'GET' | 'POST';
2
- /**
3
- * Implementation of generic request API. This API can be used to make external web request
4
- * @param context expression execution context(consists of current form, current field, current event)
5
- * @param uri request URI
6
- * @param httpVerb http verb (for example, GET or POST)
7
- * @param payload request payload
8
- * @param success success handler
9
- * @param error error handler
10
- * @param headers headers
11
- * @private
12
- */
1
+ type HTTP_VERB = 'GET' | 'POST';
13
2
  export declare const request: (context: any, uri: string, httpVerb: HTTP_VERB, payload: any, success: string, error: string, headers: any) => Promise<void>;
14
3
  export declare const submit: (context: any, success: string, error: string, submitAs?: 'application/json' | 'multipart/form-data', input_data?: any) => Promise<void>;
15
- declare type CustomFunction = Function;
16
- declare type FunctionDefinition = {
4
+ export type CustomFunction = Function;
5
+ export type FunctionDefinition = {
17
6
  _func: CustomFunction;
18
7
  _signature: Array<any>;
19
8
  };
20
- /**
21
- * Implementation of function runtime
22
- * @private
23
- */
24
9
  declare class FunctionRuntimeImpl {
25
10
  private customFunctions;
26
11
  registerFunctions(functions: {
@@ -56,13 +41,6 @@ declare class FunctionRuntimeImpl {
56
41
  _func: (args: Array<unknown>, data: unknown, interpreter: any) => {};
57
42
  _signature: never[];
58
43
  };
59
- /**
60
- *
61
- * @name dispatchEvent
62
- * @param [element] element on which to trigger the event. If not defined the event will be triggered on entire form
63
- * @param eventName name of the event to trigger
64
- * @param payload payload to pass in the event
65
- */
66
44
  dispatchEvent: {
67
45
  _func: (args: Array<unknown>, data: unknown, interpreter: any) => {};
68
46
  _signature: never[];