@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,21 +1,13 @@
1
- import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
2
- import Scriptable from './Scriptable';
3
- import DataValue from './data/DataValue';
4
- import DataGroup from './data/DataGroup';
1
+ import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types/index.js';
2
+ import Scriptable from './Scriptable.js';
3
+ import DataValue from './data/DataValue.js';
4
+ import DataGroup from './data/DataGroup.js';
5
5
  declare class Field extends Scriptable<FieldJson> implements FieldModel {
6
- /**
7
- * @param params
8
- * @param _options
9
- * @private
10
- */
11
6
  constructor(params: FieldJson, _options: {
12
7
  form: FormModel;
13
8
  parent: ContainerModel;
14
9
  });
15
10
  private _ruleNodeReference;
16
- /**
17
- * @private
18
- */
19
11
  _initialize(): any;
20
12
  ruleNodeReference(): any;
21
13
  protected _getDefaults(): {
@@ -24,19 +16,15 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
24
16
  visible: boolean;
25
17
  type: string | undefined;
26
18
  };
27
- /**
28
- * Returns the fallback type to be used for this field, in case type is not defined. Otherwise returns
29
- * undefined
30
- * @protected
31
- */
32
19
  protected _getFallbackType(): string | undefined;
33
20
  protected _applyDefaults(): void;
21
+ private unset;
22
+ private coerceParam;
34
23
  get editFormat(): string | undefined;
35
24
  get displayFormat(): string | undefined;
36
25
  get placeholder(): string | undefined;
37
26
  get readOnly(): boolean | undefined;
38
27
  set readOnly(e: boolean | undefined);
39
- get language(): string;
40
28
  get enabled(): boolean | undefined;
41
29
  set enabled(e: boolean | undefined);
42
30
  get valid(): boolean | undefined;
@@ -51,137 +39,93 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
51
39
  set maximum(m: number | undefined);
52
40
  get minimum(): number | undefined;
53
41
  set minimum(m: number | undefined);
54
- /**
55
- * returns whether the value is empty. Empty value is either a '', undefined or null
56
- * @private
57
- */
58
42
  private isEmpty;
43
+ private withCategory;
59
44
  get editValue(): any;
60
45
  get displayValue(): any;
61
46
  protected getDataNodeValue(typedValue: any): any;
62
47
  private updateDataNodeAndTypedValue;
63
48
  get value(): any;
64
49
  set value(v: any);
65
- /**
66
- * @summary reset the value of the current field to its default
67
- * @method reset
68
- * @private
69
- */
70
50
  reset(): void;
71
51
  protected _updateRuleNodeReference(value: any): void;
72
52
  protected getInternalType(): string | undefined;
73
53
  valueOf(): any;
74
54
  toString(): any;
75
- /**
76
- * Returns the error message for a given constraint
77
- * @param constraint
78
- */
79
55
  getErrorMessage(constraint: keyof (ConstraintsMessages)): string;
80
56
  get errorMessage(): string | undefined;
81
57
  get screenReaderText(): string | undefined;
82
- /**
83
- *
84
- * @private
85
- */
86
58
  _getConstraintObject(): {
87
- type: (constraint: string, inputVal: any) => {
59
+ enum: (constraint: any, inputVal: any) => {
88
60
  valid: boolean;
89
61
  value: any;
90
62
  };
91
- format: (constraint: string, input: string | null) => {
92
- value: string | null;
63
+ accept: (constraint: any, inputVal: any) => {
93
64
  valid: boolean;
65
+ value: any;
94
66
  };
95
- minimum: (constraint: number, value: number) => {
67
+ exclusiveMinimum: (constraint: any, inputVal: any) => {
96
68
  valid: boolean;
97
- value: number;
69
+ value: any;
98
70
  };
99
- maximum: (constraint: number, value: number) => {
71
+ exclusiveMaximum: (constraint: any, inputVal: any) => {
100
72
  valid: boolean;
101
- value: number;
73
+ value: any;
102
74
  };
103
- exclusiveMinimum: (constraint: number, value: number) => {
75
+ format: (constraint: any, inputVal: any) => {
104
76
  valid: boolean;
105
- value: number;
77
+ value: any;
106
78
  };
107
- exclusiveMaximum: (constraint: number, value: number) => {
79
+ maxFileSize: (constraint: any, inputVal: any) => {
108
80
  valid: boolean;
109
- value: number;
81
+ value: any;
110
82
  };
111
- minItems: <T>(constraint: number, value: T[]) => {
83
+ maxLength: (constraint: any, inputVal: any) => {
112
84
  valid: boolean;
113
- value: T[];
85
+ value: any;
114
86
  };
115
- maxItems: <T_1>(constraint: number, value: T_1[]) => {
87
+ maximum: (constraint: any, inputVal: any) => {
116
88
  valid: boolean;
117
- value: T_1[];
89
+ value: any;
118
90
  };
119
- uniqueItems: <T_2>(constraint: boolean, value: T_2[]) => {
91
+ maxItems: (constraint: any, inputVal: any) => {
120
92
  valid: boolean;
121
- value: T_2[];
93
+ value: any;
122
94
  };
123
- minLength: (constraint: number, value: string) => {
124
- value: string;
95
+ minLength: (constraint: any, inputVal: any) => {
125
96
  valid: boolean;
97
+ value: any;
126
98
  };
127
- maxLength: (constraint: number, value: string) => {
128
- value: string;
99
+ minimum: (constraint: any, inputVal: any) => {
129
100
  valid: boolean;
101
+ value: any;
130
102
  };
131
- pattern: (constraint: string | RegExp, value: string) => {
103
+ minItems: (constraint: any, inputVal: any) => {
132
104
  valid: boolean;
133
- value: string;
105
+ value: any;
134
106
  };
135
- required: (constraint: boolean, value: any) => {
107
+ pattern: (constraint: any, inputVal: any) => {
136
108
  valid: boolean;
137
109
  value: any;
138
110
  };
139
- enum: (constraint: any[], value: any) => {
111
+ required: (constraint: any, inputVal: any) => {
140
112
  valid: boolean;
141
113
  value: any;
142
114
  };
143
- accept: (constraint: string[], value: any) => {
115
+ type: (constraint: any, inputVal: any) => {
144
116
  valid: boolean;
145
117
  value: any;
146
118
  };
147
- maxFileSize: (constraint: string | number, value: any) => {
119
+ uniqueItems: (constraint: any, inputVal: any) => {
148
120
  valid: boolean;
149
121
  value: any;
150
122
  };
151
123
  };
152
- /**
153
- * returns whether the field is array type or not
154
- * @private
155
- */
156
124
  private isArrayType;
157
- /**
158
- *
159
- * @param value
160
- * @param constraints
161
- * @private
162
- */
163
125
  private checkEnum;
164
- /**
165
- * checks whether the value can be achieved by stepping the min/default value by the step constraint.
166
- * Basically to find a integer solution for n in the equation
167
- * initialValue + n * step = value
168
- * @param constraints
169
- * @private
170
- */
171
126
  private checkStep;
172
- /**
173
- * checks whether the validation expression returns a boolean value or not
174
- * @private
175
- */
176
127
  private checkValidationExpression;
177
- /**
178
- * Returns the applicable constraints for a given type
179
- * @private
180
- */
181
128
  private getConstraints;
182
- /**
183
- * returns the format constraint
184
- */
185
129
  get format(): string | undefined;
186
130
  get enforceEnum(): boolean | undefined;
187
131
  get tooltip(): string | undefined;
@@ -195,27 +139,19 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
195
139
  set exclusiveMaximum(eM: number | undefined);
196
140
  get default(): any;
197
141
  private isNotEmpty;
198
- /**
199
- * @private
200
- */
201
142
  protected evaluateConstraints(): any;
202
143
  triggerValidationEvent(changes: any): void;
203
- /**
204
- * Validates the current form object
205
- */
206
144
  validate(): ValidationError[];
207
145
  importData(contextualDataModel: DataGroup): void;
208
- /**
209
- * @param name
210
- * @private
211
- */
212
146
  defaultDataModel(name: string | number): DataValue;
213
147
  getState(): {
148
+ editFormat: string | undefined;
149
+ displayFormat: string | undefined;
214
150
  editValue: any;
215
151
  displayValue: any;
216
152
  description?: string | undefined;
217
- rules: import("./types").Items<string> & {};
218
- events: import("./types").Items<string | string[] | undefined> & {};
153
+ rules: import("./types/Json.js").Items<string> & {};
154
+ events: import("./types/Json.js").Items<string | string[] | undefined> & {};
219
155
  enumNames?: string[] | undefined;
220
156
  enum?: any[] | undefined;
221
157
  accept?: string[] | undefined;
@@ -240,7 +176,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
240
176
  uniqueItems?: boolean | undefined;
241
177
  dataRef?: string | null | undefined;
242
178
  ':type': string;
243
- label?: import("./types").Label | undefined;
179
+ label?: import("./types/Json.js").Label | undefined;
244
180
  enabled?: boolean | undefined;
245
181
  visible?: boolean | undefined;
246
182
  name?: string | undefined;
@@ -250,17 +186,16 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
250
186
  properties: {
251
187
  [key: string]: any;
252
188
  };
253
- repeatable?: boolean | undefined;
189
+ repeatable: boolean | undefined;
254
190
  screenReaderText?: string | undefined;
255
191
  tooltip?: string | undefined;
256
192
  altText?: string | undefined;
193
+ viewType?: string | undefined;
257
194
  placeholder?: string | undefined;
258
195
  readOnly?: boolean | undefined;
259
196
  valid?: boolean | undefined;
260
197
  default?: any;
261
198
  value?: any;
262
- displayFormat?: string | undefined;
263
- editFormat?: string | undefined;
264
199
  emptyValue?: "" | "undefined" | "null" | undefined;
265
200
  index: number;
266
201
  parent: undefined;