@aemforms/af-core 0.22.17 → 0.22.19

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/lib/Form.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Container from './Container';
2
- import { Action, BaseModel, FieldJson, FieldModel, FieldsetJson, FieldsetModel, FormJson, FormModel, Items } from './types';
2
+ import { Action, BaseModel, FieldJson, FieldModel, FieldsetJson, FieldsetModel, FormJson, FormModel } from './types';
3
3
  import FormMetaData from './FormMetaData';
4
4
  import EventQueue from './controller/EventQueue';
5
5
  import { Logger, LogLevel } from './controller/Logger';
@@ -63,7 +63,11 @@ declare class Form extends Container<FormJson> implements FormModel {
63
63
  maxFileSize?: string | number | undefined;
64
64
  maxLength?: number | undefined;
65
65
  maximum?: number | undefined;
66
- maxItems?: number | undefined;
66
+ maxItems?: number | undefined; /**
67
+ * @private
68
+ */
69
+ minOccur?: number | undefined;
70
+ maxOccur?: number | undefined;
67
71
  minLength?: number | undefined;
68
72
  minimum?: number | undefined;
69
73
  minItems?: number | undefined;
@@ -86,6 +90,10 @@ declare class Form extends Container<FormJson> implements FormModel {
86
90
  properties?: {
87
91
  [key: string]: any;
88
92
  } | undefined;
93
+ repeatable?: boolean | undefined;
94
+ screenReaderText?: string | undefined;
95
+ tooltip?: string | undefined;
96
+ altText?: string | undefined;
89
97
  } & {
90
98
  items: (FieldJson | import("./types").ContainerJson)[];
91
99
  initialItems?: number | undefined;
@@ -95,286 +103,21 @@ declare class Form extends Container<FormJson> implements FormModel {
95
103
  data?: any;
96
104
  title?: string | undefined;
97
105
  action?: string | undefined;
98
- adaptiveForm?: string | undefined;
106
+ adaptiveForm?: string | undefined; /**
107
+ * @param field
108
+ * @private
109
+ */
99
110
  } & {
111
+ items: any[];
112
+ properties: {
113
+ [key: string]: any;
114
+ };
115
+ index: number;
116
+ parent: undefined;
117
+ qualifiedName: any;
118
+ events: {};
119
+ rules: {};
100
120
  ':type': string;
101
- items: ({
102
- description?: string | undefined;
103
- rules?: Items<string> | undefined;
104
- events?: Items<string | string[] | undefined> | undefined;
105
- enumNames?: string[] | undefined;
106
- enum?: any[] | undefined;
107
- accept?: string[] | undefined;
108
- enforceEnum?: boolean | undefined;
109
- exclusiveMinimum?: number | undefined;
110
- exclusiveMaximum?: number | undefined;
111
- format?: string | undefined;
112
- maxFileSize?: string | number | undefined;
113
- maxLength?: number | undefined;
114
- maximum?: number | undefined;
115
- maxItems?: number | undefined;
116
- minLength?: number | undefined;
117
- minimum?: number | undefined;
118
- minItems?: number | undefined;
119
- pattern?: string | undefined;
120
- required?: boolean | undefined;
121
- step?: number | undefined;
122
- type?: string | undefined;
123
- validationExpression?: string | undefined;
124
- uniqueItems?: boolean | undefined;
125
- dataRef?: string | null | undefined;
126
- ':type': string;
127
- label?: import("./types").Label | undefined;
128
- enabled?: boolean | undefined;
129
- visible?: boolean | undefined;
130
- name?: string | undefined;
131
- constraintMessages?: import("./types").ConstraintsMessages | undefined;
132
- fieldType?: string | undefined;
133
- errorMessage?: string | undefined;
134
- properties?: {
135
- [key: string]: any;
136
- } | undefined;
137
- placeholder?: string | undefined;
138
- readOnly?: boolean | undefined;
139
- valid?: boolean | undefined;
140
- default?: any;
141
- value?: any;
142
- displayFormat?: string | undefined;
143
- editFormat?: string | undefined;
144
- editValue?: string | undefined;
145
- displayValue?: string | undefined;
146
- emptyValue?: "" | "undefined" | "null" | undefined;
147
- id: string;
148
- } | {
149
- description?: string | undefined;
150
- rules?: Items<string> | undefined;
151
- events?: Items<string | string[] | undefined> | undefined;
152
- enumNames?: string[] | undefined;
153
- enum?: any[] | undefined;
154
- accept?: string[] | undefined;
155
- enforceEnum?: boolean | undefined;
156
- exclusiveMinimum?: number | undefined;
157
- exclusiveMaximum?: number | undefined;
158
- format?: string | undefined;
159
- maxFileSize?: string | number | undefined;
160
- maxLength?: number | undefined;
161
- maximum?: number | undefined;
162
- maxItems?: number | undefined;
163
- minLength?: number | undefined;
164
- minimum?: number | undefined;
165
- minItems?: number | undefined;
166
- pattern?: string | undefined;
167
- required?: boolean | undefined;
168
- step?: number | undefined;
169
- type?: "object" | "array" | undefined;
170
- validationExpression?: string | undefined;
171
- uniqueItems?: boolean | undefined;
172
- dataRef?: string | null | undefined;
173
- ':type'?: string | undefined;
174
- label?: import("./types").Label | undefined;
175
- enabled?: boolean | undefined;
176
- visible?: boolean | undefined;
177
- name?: string | undefined;
178
- constraintMessages?: import("./types").ConstraintsMessages | undefined;
179
- fieldType?: string | undefined;
180
- errorMessage?: string | undefined;
181
- properties?: {
182
- [key: string]: any;
183
- } | undefined;
184
- items: (FieldJson | import("./types").ContainerJson)[] & (({
185
- description?: string | undefined;
186
- } & import("./types").RulesJson & {
187
- enumNames?: string[] | undefined;
188
- enum?: any[] | undefined;
189
- } & {
190
- accept?: string[] | undefined;
191
- enforceEnum?: boolean | undefined;
192
- exclusiveMinimum?: number | undefined;
193
- exclusiveMaximum?: number | undefined;
194
- format?: string | undefined;
195
- maxFileSize?: string | number | undefined;
196
- maxLength?: number | undefined;
197
- maximum?: number | undefined;
198
- maxItems?: number | undefined;
199
- minLength?: number | undefined;
200
- minimum?: number | undefined;
201
- minItems?: number | undefined;
202
- pattern?: string | undefined;
203
- required?: boolean | undefined;
204
- step?: number | undefined;
205
- type?: string | undefined;
206
- validationExpression?: string | undefined;
207
- uniqueItems?: boolean | undefined;
208
- } & {
209
- dataRef?: string | null | undefined;
210
- ':type'?: string | undefined;
211
- label?: import("./types").Label | undefined;
212
- enabled?: boolean | undefined;
213
- visible?: boolean | undefined;
214
- name?: string | undefined;
215
- constraintMessages?: import("./types").ConstraintsMessages | undefined;
216
- fieldType?: string | undefined;
217
- errorMessage?: string | undefined;
218
- properties?: {
219
- [key: string]: any;
220
- } | undefined;
221
- } & {
222
- placeholder?: string | undefined;
223
- } & {
224
- readOnly?: boolean | undefined;
225
- valid?: boolean | undefined;
226
- default?: any;
227
- value?: any;
228
- displayFormat?: string | undefined;
229
- editFormat?: string | undefined;
230
- editValue?: string | undefined;
231
- displayValue?: string | undefined;
232
- emptyValue?: "" | "undefined" | "null" | undefined;
233
- } & {
234
- id: string;
235
- ':type': string;
236
- }) | ({
237
- description?: string | undefined;
238
- } & import("./types").RulesJson & {
239
- enumNames?: string[] | undefined;
240
- enum?: any[] | undefined;
241
- } & {
242
- accept?: string[] | undefined;
243
- enforceEnum?: boolean | undefined;
244
- exclusiveMinimum?: number | undefined;
245
- exclusiveMaximum?: number | undefined;
246
- format?: string | undefined;
247
- maxFileSize?: string | number | undefined;
248
- maxLength?: number | undefined;
249
- maximum?: number | undefined;
250
- maxItems?: number | undefined;
251
- minLength?: number | undefined;
252
- minimum?: number | undefined;
253
- minItems?: number | undefined;
254
- pattern?: string | undefined;
255
- required?: boolean | undefined;
256
- step?: number | undefined;
257
- type?: string | undefined;
258
- validationExpression?: string | undefined;
259
- uniqueItems?: boolean | undefined;
260
- } & {
261
- dataRef?: string | null | undefined;
262
- ':type'?: string | undefined;
263
- label?: import("./types").Label | undefined;
264
- enabled?: boolean | undefined;
265
- visible?: boolean | undefined;
266
- name?: string | undefined;
267
- constraintMessages?: import("./types").ConstraintsMessages | undefined;
268
- fieldType?: string | undefined;
269
- errorMessage?: string | undefined;
270
- properties?: {
271
- [key: string]: any;
272
- } | undefined;
273
- } & {
274
- items: (FieldJson | import("./types").ContainerJson)[];
275
- initialItems?: number | undefined;
276
- activeChild?: string | undefined;
277
- } & {
278
- id: string;
279
- items: (({
280
- description?: string | undefined;
281
- } & import("./types").RulesJson & {
282
- enumNames?: string[] | undefined;
283
- enum?: any[] | undefined;
284
- } & {
285
- accept?: string[] | undefined;
286
- enforceEnum?: boolean | undefined;
287
- exclusiveMinimum?: number | undefined;
288
- exclusiveMaximum?: number | undefined;
289
- format?: string | undefined;
290
- maxFileSize?: string | number | undefined;
291
- maxLength?: number | undefined;
292
- maximum?: number | undefined;
293
- maxItems?: number | undefined;
294
- minLength?: number | undefined;
295
- minimum?: number | undefined;
296
- minItems?: number | undefined;
297
- pattern?: string | undefined;
298
- required?: boolean | undefined;
299
- step?: number | undefined;
300
- type?: string | undefined;
301
- validationExpression?: string | undefined;
302
- uniqueItems?: boolean | undefined;
303
- } & {
304
- dataRef?: string | null | undefined;
305
- ':type'?: string | undefined;
306
- label?: import("./types").Label | undefined;
307
- enabled?: boolean | undefined;
308
- visible?: boolean | undefined;
309
- name?: string | undefined;
310
- constraintMessages?: import("./types").ConstraintsMessages | undefined;
311
- fieldType?: string | undefined;
312
- errorMessage?: string | undefined;
313
- properties?: {
314
- [key: string]: any;
315
- } | undefined;
316
- } & {
317
- placeholder?: string | undefined;
318
- } & {
319
- readOnly?: boolean | undefined;
320
- valid?: boolean | undefined;
321
- default?: any;
322
- value?: any;
323
- displayFormat?: string | undefined;
324
- editFormat?: string | undefined;
325
- editValue?: string | undefined;
326
- displayValue?: string | undefined;
327
- emptyValue?: "" | "undefined" | "null" | undefined;
328
- } & {
329
- id: string;
330
- ':type': string;
331
- }) | ({
332
- description?: string | undefined;
333
- } & import("./types").RulesJson & {
334
- enumNames?: string[] | undefined;
335
- enum?: any[] | undefined;
336
- } & {
337
- accept?: string[] | undefined;
338
- enforceEnum?: boolean | undefined;
339
- exclusiveMinimum?: number | undefined;
340
- exclusiveMaximum?: number | undefined;
341
- format?: string | undefined;
342
- maxFileSize?: string | number | undefined;
343
- maxLength?: number | undefined;
344
- maximum?: number | undefined;
345
- maxItems?: number | undefined;
346
- minLength?: number | undefined;
347
- minimum?: number | undefined;
348
- minItems?: number | undefined;
349
- pattern?: string | undefined;
350
- required?: boolean | undefined;
351
- step?: number | undefined;
352
- type?: string | undefined;
353
- validationExpression?: string | undefined;
354
- uniqueItems?: boolean | undefined;
355
- } & {
356
- dataRef?: string | null | undefined;
357
- ':type'?: string | undefined;
358
- label?: import("./types").Label | undefined;
359
- enabled?: boolean | undefined;
360
- visible?: boolean | undefined;
361
- name?: string | undefined;
362
- constraintMessages?: import("./types").ConstraintsMessages | undefined;
363
- fieldType?: string | undefined;
364
- errorMessage?: string | undefined;
365
- properties?: {
366
- [key: string]: any;
367
- } | undefined;
368
- } & {
369
- items: (FieldJson | import("./types").ContainerJson)[];
370
- initialItems?: number | undefined;
371
- activeChild?: string | undefined;
372
- } & any))[];
373
- }))[];
374
- initialItems?: number | undefined;
375
- activeChild?: string | undefined;
376
- id: string;
377
- })[];
378
121
  id: string;
379
122
  };
380
123
  get type(): string;
@@ -387,6 +130,19 @@ declare class Form extends Container<FormJson> implements FormModel {
387
130
  * @private
388
131
  */
389
132
  fieldAdded(field: FieldModel | FieldsetModel): void;
133
+ /**
134
+ * visits each element in the form
135
+ * @param callBack a function which is invoked on each form element
136
+ * (including container type elements) visited
137
+ */
138
+ visit(callBack: (field: FieldModel | FieldsetModel) => void): void;
139
+ /**
140
+ *
141
+ * @param container
142
+ * @param callBack
143
+ * @private
144
+ */
145
+ traverseChild(container: Container<any>, callBack: (field: FieldModel | FieldsetModel) => void): void;
390
146
  validate(): import("./types").ValidationError[];
391
147
  /**
392
148
  * Checks if the given form is valid or not
package/lib/Form.js CHANGED
@@ -12,10 +12,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  const Container_1 = __importDefault(require("./Container"));
14
14
  const FormMetaData_1 = __importDefault(require("./FormMetaData"));
15
- const Fieldset_1 = require("./Fieldset");
16
15
  const EventQueue_1 = __importDefault(require("./controller/EventQueue"));
17
16
  const Logger_1 = require("./controller/Logger");
18
17
  const FormUtils_1 = require("./utils/FormUtils");
18
+ const FormCreationUtils_1 = require("./utils/FormCreationUtils");
19
19
  const DataGroup_1 = __importDefault(require("./data/DataGroup"));
20
20
  const FunctionRuntime_1 = require("./rules/FunctionRuntime");
21
21
  const controller_1 = require("./controller");
@@ -63,7 +63,7 @@ class Form extends Container_1.default {
63
63
  return this._jsonModel.action;
64
64
  }
65
65
  _createChild(child) {
66
- return (0, Fieldset_1.createChild)(child, { form: this, parent: this });
66
+ return (0, FormCreationUtils_1.createChild)(child, { form: this, parent: this });
67
67
  }
68
68
  importData(dataModel) {
69
69
  this._bindToDataModel(new DataGroup_1.default('$form', dataModel));
@@ -152,6 +152,28 @@ class Form extends Container_1.default {
152
152
  }
153
153
  });
154
154
  }
155
+ /**
156
+ * visits each element in the form
157
+ * @param callBack a function which is invoked on each form element
158
+ * (including container type elements) visited
159
+ */
160
+ visit(callBack) {
161
+ this.traverseChild(this, callBack);
162
+ }
163
+ /**
164
+ *
165
+ * @param container
166
+ * @param callBack
167
+ * @private
168
+ */
169
+ traverseChild(container, callBack) {
170
+ container.items.forEach((field) => {
171
+ if (field.isContainer) {
172
+ this.traverseChild(field, callBack);
173
+ }
174
+ callBack(field);
175
+ });
176
+ }
155
177
  validate() {
156
178
  const validationErrors = super.validate();
157
179
  // trigger event on form so that user's can customize their application
@@ -183,7 +205,7 @@ class Form extends Container_1.default {
183
205
  * @private
184
206
  */
185
207
  executeAction(action) {
186
- if (action.type !== 'submit' || this._invalidFields.length === 0) {
208
+ if ((action.type !== 'submit') || this._invalidFields.length === 0) {
187
209
  super.executeAction(action);
188
210
  }
189
211
  }
@@ -108,12 +108,20 @@ const fetchForm = (url, headers = {}) => {
108
108
  Object.entries(headers).forEach(([key, value]) => {
109
109
  headerObj.append(key, value);
110
110
  });
111
- return (0, Fetch_1.request)(`${url}.model.json`, null, { headers }).then((formObj) => {
112
- if ('model' in formObj) {
113
- const { model } = formObj;
114
- formObj = model;
115
- }
116
- return (0, JsonUtils_1.jsonString)(formObj);
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
+ });
117
125
  });
118
126
  };
119
127
  exports.fetchForm = fetchForm;
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,53 @@
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;
@@ -7,7 +7,7 @@ import { BaseNode } from './BaseNode';
7
7
  declare abstract class Scriptable<T extends RulesJson> extends BaseNode<T> implements ScriptableField {
8
8
  private _events;
9
9
  private _rules;
10
- get rules(): import("./types").Items<string>;
10
+ getRules(): import("./types").Items<string>;
11
11
  private getCompiledRule;
12
12
  private getCompiledEvent;
13
13
  private applyUpdates;
package/lib/Scriptable.js CHANGED
@@ -18,12 +18,12 @@ class Scriptable extends BaseNode_1.BaseNode {
18
18
  this._events = {};
19
19
  this._rules = {};
20
20
  }
21
- get rules() {
22
- return this._jsonModel.rules || {};
21
+ getRules() {
22
+ return typeof this._jsonModel.rules !== 'object' ? {} : this._jsonModel.rules;
23
23
  }
24
24
  getCompiledRule(eName, rule) {
25
25
  if (!(eName in this._rules)) {
26
- const eString = rule || this.rules[eName];
26
+ const eString = rule || this.getRules()[eName];
27
27
  if (typeof eString === 'string' && eString.length > 0) {
28
28
  try {
29
29
  this._rules[eName] = this.ruleEngine.compileRule(eString);
@@ -76,7 +76,7 @@ class Scriptable extends BaseNode_1.BaseNode {
76
76
  });
77
77
  }
78
78
  executeAllRules(context) {
79
- const entries = Object.entries(this.rules);
79
+ const entries = Object.entries(this.getRules());
80
80
  if (entries.length > 0) {
81
81
  const scope = this.getExpressionScope();
82
82
  entries.forEach(([prop, rule]) => {
@@ -192,14 +192,14 @@ class Scriptable extends BaseNode_1.BaseNode {
192
192
  const eventName = action.isCustomEvent ? `custom:${action.type}` : action.type;
193
193
  const funcName = action.isCustomEvent ? `custom_${action.type}` : action.type;
194
194
  const node = this.getCompiledEvent(eventName);
195
- //todo: apply all the updates at the end or
196
- // not trigger the change event until the execution is finished
197
- node.forEach((n) => this.executeEvent(context, n));
198
195
  // @ts-ignore
199
196
  if (funcName in this && typeof this[funcName] === 'function') {
200
197
  //@ts-ignore
201
198
  this[funcName](action, context);
202
199
  }
200
+ //todo: apply all the updates at the end or
201
+ // not trigger the change event until the execution is finished
202
+ node.forEach((n) => this.executeEvent(context, n));
203
203
  this.notifyDependents(action);
204
204
  }
205
205
  }
@@ -179,6 +179,18 @@ export declare class Submit extends ActionImpl {
179
179
  */
180
180
  constructor(payload?: any, dispatch?: boolean);
181
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
+ }
182
194
  /**
183
195
  * Implementation of `fieldChanged` event. The field changed event is triggered on the field which it has changed.
184
196
  */
@@ -221,3 +233,23 @@ export declare class RemoveItem extends ActionImpl {
221
233
  */
222
234
  constructor(payload?: number);
223
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
+ }
@@ -7,7 +7,7 @@
7
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
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.Change = exports.ActionImpl = void 0;
10
+ exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.Change = exports.ActionImpl = void 0;
11
11
  /**
12
12
  * Implementation of generic event
13
13
  * @private
@@ -226,6 +226,21 @@ class Submit extends ActionImpl {
226
226
  }
227
227
  }
228
228
  exports.Submit = Submit;
229
+ /**
230
+ * Implementation of `reset` event. The reset event is triggered on the Form.
231
+ * To trigger the reset event, reset function needs to be invoked or one can invoke dispatchEvent API.
232
+ */
233
+ class Reset extends ActionImpl {
234
+ /**
235
+ * @constructor
236
+ * @param [payload] event payload
237
+ * @param [dispatch] true to trigger the event on all the fields in DFS order starting from the top level form element, false otherwise
238
+ */
239
+ constructor(payload, dispatch = false) {
240
+ super(payload, 'reset', { dispatch });
241
+ }
242
+ }
243
+ exports.Reset = Reset;
229
244
  /**
230
245
  * Implementation of `fieldChanged` event. The field changed event is triggered on the field which it has changed.
231
246
  */
@@ -285,3 +300,29 @@ class RemoveItem extends ActionImpl {
285
300
  }
286
301
  }
287
302
  exports.RemoveItem = RemoveItem;
303
+ /**
304
+ * Implementation of `addInstance` event. The event is triggered on a field to add an instance of it.
305
+ */
306
+ class AddInstance extends ActionImpl {
307
+ /**
308
+ * @constructor
309
+ * @param [payload] event payload
310
+ */
311
+ constructor(payload) {
312
+ super(payload, 'addInstance');
313
+ }
314
+ }
315
+ exports.AddInstance = AddInstance;
316
+ /**
317
+ * Implementation of `removeInstance` event. The event is triggered on a field to remove an instance of it.
318
+ */
319
+ class RemoveInstance extends ActionImpl {
320
+ /**
321
+ * @constructor
322
+ * @param [payload] event payload
323
+ */
324
+ constructor(payload) {
325
+ super(payload, 'removeInstance');
326
+ }
327
+ }
328
+ exports.RemoveInstance = RemoveInstance;
@@ -42,7 +42,11 @@ class DataGroup extends DataValue_1.default {
42
42
  }
43
43
  }
44
44
  get $value() {
45
- if (this.$type === 'array') {
45
+ const enabled = this.$_fields.find(x => x.enabled !== false);
46
+ if (!enabled && this.$_fields.length) {
47
+ return this.$type === 'array' ? [] : {};
48
+ }
49
+ else if (this.$type === 'array') {
46
50
  return Object.values(this.$_items).filter(x => typeof x !== 'undefined').map(x => x.$value);
47
51
  }
48
52
  else {