@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,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,130 +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;
47
+ private updateDataNodeAndTypedValue;
62
48
  get value(): any;
63
49
  set value(v: any);
50
+ reset(): void;
64
51
  protected _updateRuleNodeReference(value: any): void;
65
52
  protected getInternalType(): string | undefined;
66
53
  valueOf(): any;
67
54
  toString(): any;
68
- /**
69
- * Returns the error message for a given constraint
70
- * @param constraint
71
- */
72
55
  getErrorMessage(constraint: keyof (ConstraintsMessages)): string;
73
56
  get errorMessage(): string | undefined;
74
57
  get screenReaderText(): string | undefined;
75
- /**
76
- *
77
- * @private
78
- */
79
58
  _getConstraintObject(): {
80
- type: (constraint: string, inputVal: any) => {
59
+ enum: (constraint: any, inputVal: any) => {
81
60
  valid: boolean;
82
61
  value: any;
83
62
  };
84
- format: (constraint: string, input: string | null) => {
85
- value: string | null;
63
+ accept: (constraint: any, inputVal: any) => {
86
64
  valid: boolean;
65
+ value: any;
87
66
  };
88
- minimum: (constraint: number, value: number) => {
67
+ exclusiveMinimum: (constraint: any, inputVal: any) => {
89
68
  valid: boolean;
90
- value: number;
69
+ value: any;
91
70
  };
92
- maximum: (constraint: number, value: number) => {
71
+ exclusiveMaximum: (constraint: any, inputVal: any) => {
93
72
  valid: boolean;
94
- value: number;
73
+ value: any;
95
74
  };
96
- exclusiveMinimum: (constraint: number, value: number) => {
75
+ format: (constraint: any, inputVal: any) => {
97
76
  valid: boolean;
98
- value: number;
77
+ value: any;
99
78
  };
100
- exclusiveMaximum: (constraint: number, value: number) => {
79
+ maxFileSize: (constraint: any, inputVal: any) => {
101
80
  valid: boolean;
102
- value: number;
81
+ value: any;
103
82
  };
104
- minItems: <T>(constraint: number, value: T[]) => {
83
+ maxLength: (constraint: any, inputVal: any) => {
105
84
  valid: boolean;
106
- value: T[];
85
+ value: any;
107
86
  };
108
- maxItems: <T_1>(constraint: number, value: T_1[]) => {
87
+ maximum: (constraint: any, inputVal: any) => {
109
88
  valid: boolean;
110
- value: T_1[];
89
+ value: any;
111
90
  };
112
- uniqueItems: <T_2>(constraint: boolean, value: T_2[]) => {
91
+ maxItems: (constraint: any, inputVal: any) => {
113
92
  valid: boolean;
114
- value: T_2[];
93
+ value: any;
115
94
  };
116
- minLength: (constraint: number, value: string) => {
117
- value: string;
95
+ minLength: (constraint: any, inputVal: any) => {
118
96
  valid: boolean;
97
+ value: any;
119
98
  };
120
- maxLength: (constraint: number, value: string) => {
121
- value: string;
99
+ minimum: (constraint: any, inputVal: any) => {
122
100
  valid: boolean;
101
+ value: any;
123
102
  };
124
- pattern: (constraint: string | RegExp, value: string) => {
103
+ minItems: (constraint: any, inputVal: any) => {
125
104
  valid: boolean;
126
- value: string;
105
+ value: any;
127
106
  };
128
- required: (constraint: boolean, value: any) => {
107
+ pattern: (constraint: any, inputVal: any) => {
129
108
  valid: boolean;
130
109
  value: any;
131
110
  };
132
- enum: (constraint: any[], value: any) => {
111
+ required: (constraint: any, inputVal: any) => {
133
112
  valid: boolean;
134
113
  value: any;
135
114
  };
136
- accept: (constraint: string[], value: any) => {
115
+ type: (constraint: any, inputVal: any) => {
137
116
  valid: boolean;
138
117
  value: any;
139
118
  };
140
- maxFileSize: (constraint: string | number, value: any) => {
119
+ uniqueItems: (constraint: any, inputVal: any) => {
141
120
  valid: boolean;
142
121
  value: any;
143
122
  };
144
123
  };
145
- /**
146
- * returns whether the field is array type or not
147
- * @private
148
- */
149
124
  private isArrayType;
150
- /**
151
- *
152
- * @param value
153
- * @param constraints
154
- * @private
155
- */
156
125
  private checkEnum;
157
- /**
158
- * checks whether the value can be achieved by stepping the min/default value by the step constraint.
159
- * Basically to find a integer solution for n in the equation
160
- * initialValue + n * step = value
161
- * @param constraints
162
- * @private
163
- */
164
126
  private checkStep;
165
- /**
166
- * checks whether the validation expression returns a boolean value or not
167
- * @private
168
- */
169
127
  private checkValidationExpression;
170
- /**
171
- * Returns the applicable constraints for a given type
172
- * @private
173
- */
174
128
  private getConstraints;
175
- /**
176
- * returns the format constraint
177
- */
178
129
  get format(): string | undefined;
179
130
  get enforceEnum(): boolean | undefined;
180
131
  get tooltip(): string | undefined;
@@ -187,27 +138,18 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
187
138
  get exclusiveMaximum(): number | undefined;
188
139
  set exclusiveMaximum(eM: number | undefined);
189
140
  get default(): any;
190
- /**
191
- * @private
192
- */
141
+ private isNotEmpty;
193
142
  protected evaluateConstraints(): any;
194
143
  triggerValidationEvent(changes: any): void;
195
- /**
196
- * Validates the current form object
197
- */
198
144
  validate(): ValidationError[];
199
145
  importData(contextualDataModel: DataGroup): void;
200
- /**
201
- * @param name
202
- * @private
203
- */
204
146
  defaultDataModel(name: string | number): DataValue;
205
147
  getState(): {
206
148
  editValue: any;
207
149
  displayValue: any;
208
150
  description?: string | undefined;
209
- rules: import("./types").Items<string> & {};
210
- events: import("./types").Items<string | string[] | undefined> & {};
151
+ rules: import("./types/Json.js").Items<string> & {};
152
+ events: import("./types/Json.js").Items<string | string[] | undefined> & {};
211
153
  enumNames?: string[] | undefined;
212
154
  enum?: any[] | undefined;
213
155
  accept?: string[] | undefined;
@@ -219,6 +161,8 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
219
161
  maxLength?: number | undefined;
220
162
  maximum?: number | undefined;
221
163
  maxItems?: number | undefined;
164
+ minOccur?: number | undefined;
165
+ maxOccur?: number | undefined;
222
166
  minLength?: number | undefined;
223
167
  minimum?: number | undefined;
224
168
  minItems?: number | undefined;
@@ -230,7 +174,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
230
174
  uniqueItems?: boolean | undefined;
231
175
  dataRef?: string | null | undefined;
232
176
  ':type': string;
233
- label?: import("./types").Label | undefined;
177
+ label?: import("./types/Json.js").Label | undefined;
234
178
  enabled?: boolean | undefined;
235
179
  visible?: boolean | undefined;
236
180
  name?: string | undefined;
@@ -240,9 +184,11 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
240
184
  properties: {
241
185
  [key: string]: any;
242
186
  };
187
+ repeatable: boolean | undefined;
243
188
  screenReaderText?: string | undefined;
244
189
  tooltip?: string | undefined;
245
190
  altText?: string | undefined;
191
+ viewType?: string | undefined;
246
192
  placeholder?: string | undefined;
247
193
  readOnly?: boolean | undefined;
248
194
  valid?: boolean | undefined;