@glowgreen/gg-questionnaire-v2 0.0.43 → 0.0.44
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/bundles/glowgreen-gg-questionnaire-v2.umd.js +104 -44
- package/bundles/glowgreen-gg-questionnaire-v2.umd.js.map +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js.map +1 -1
- package/esm2015/lib/interfaces/question.js +3 -1
- package/esm2015/lib/services/filter.service.js +48 -20
- package/esm2015/lib/services/form-constructor.service.js +9 -4
- package/esm5/lib/interfaces/question.js +3 -1
- package/esm5/lib/services/filter.service.js +94 -40
- package/esm5/lib/services/form-constructor.service.js +12 -6
- package/fesm2015/glowgreen-gg-questionnaire-v2.js +55 -22
- package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/fesm5/glowgreen-gg-questionnaire-v2.js +104 -44
- package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/lib/interfaces/question.d.ts +1 -0
- package/lib/services/form-constructor.service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ var FilterService = /** @class */ (function () {
|
|
|
76
76
|
* @return {?} An array of filtered sections with their filtered questions.
|
|
77
77
|
*/
|
|
78
78
|
function (sections, currentQuestionnaireForm, additionalData) {
|
|
79
|
-
var e_1, _a, e_2, _b, e_3, _c;
|
|
79
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
|
|
80
80
|
/** @type {?} */
|
|
81
81
|
var filteredSections = [];
|
|
82
82
|
try {
|
|
@@ -88,27 +88,66 @@ var FilterService = /** @class */ (function () {
|
|
|
88
88
|
/** @type {?} */
|
|
89
89
|
var filteredQuestions = [];
|
|
90
90
|
try {
|
|
91
|
-
for (var
|
|
92
|
-
var question =
|
|
91
|
+
for (var _f = (e_2 = void 0, __values(section.questions)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
92
|
+
var question = _g.value;
|
|
93
93
|
if (!this.meetsConditionGroups(question.conditionGroups, currentQuestionnaireForm, additionalData)) {
|
|
94
94
|
continue;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
// If it's a repeater we need to do a lot of extra filtering due to per item conditions.
|
|
97
|
+
if (question.type === 'repeater') {
|
|
97
98
|
/** @type {?} */
|
|
98
|
-
var
|
|
99
|
+
var items = (/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])));
|
|
99
100
|
try {
|
|
100
|
-
for (var
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
for (var _h = (e_3 = void 0, __values(items.controls)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
102
|
+
var repeaterItem = _j.value;
|
|
103
|
+
/** @type {?} */
|
|
104
|
+
var filteredRepeaterItemQuestions = [];
|
|
105
|
+
try {
|
|
106
|
+
for (var _k = (e_4 = void 0, __values(question.repeaterQuestions)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
107
|
+
var repeaterQuestion = _l.value;
|
|
108
|
+
/** @type {?} */
|
|
109
|
+
var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, (/** @type {?} */ (repeaterItem)));
|
|
110
|
+
if (meetsConditions) {
|
|
111
|
+
this.setFetchForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm, (/** @type {?} */ (repeaterItem)));
|
|
112
|
+
filteredRepeaterItemQuestions.push(repeaterQuestion);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
117
|
+
finally {
|
|
118
|
+
try {
|
|
119
|
+
if (_l && !_l.done && (_d = _k.return)) _d.call(_k);
|
|
120
|
+
}
|
|
121
|
+
finally { if (e_4) throw e_4.error; }
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
for (var filteredRepeaterItemQuestions_1 = (e_5 = void 0, __values(filteredRepeaterItemQuestions)), filteredRepeaterItemQuestions_1_1 = filteredRepeaterItemQuestions_1.next(); !filteredRepeaterItemQuestions_1_1.done; filteredRepeaterItemQuestions_1_1 = filteredRepeaterItemQuestions_1.next()) {
|
|
125
|
+
var filteredRepeaterItemQuestion = filteredRepeaterItemQuestions_1_1.value;
|
|
126
|
+
if (filteredRepeaterItemQuestion.type !== 'select') {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
this.setFetchForQuestion(filteredRepeaterItemQuestion, additionalData, currentQuestionnaireForm);
|
|
130
|
+
}
|
|
105
131
|
}
|
|
132
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
133
|
+
finally {
|
|
134
|
+
try {
|
|
135
|
+
if (filteredRepeaterItemQuestions_1_1 && !filteredRepeaterItemQuestions_1_1.done && (_e = filteredRepeaterItemQuestions_1.return)) _e.call(filteredRepeaterItemQuestions_1);
|
|
136
|
+
}
|
|
137
|
+
finally { if (e_5) throw e_5.error; }
|
|
138
|
+
}
|
|
139
|
+
/** @type {?} */
|
|
140
|
+
var index = items.controls.indexOf(repeaterItem);
|
|
141
|
+
if (!question.filteredRepeaterQuestions) {
|
|
142
|
+
question.filteredRepeaterQuestions = [];
|
|
143
|
+
}
|
|
144
|
+
question.filteredRepeaterQuestions[index] = filteredRepeaterItemQuestions;
|
|
106
145
|
}
|
|
107
146
|
}
|
|
108
147
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
109
148
|
finally {
|
|
110
149
|
try {
|
|
111
|
-
if (
|
|
150
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
112
151
|
}
|
|
113
152
|
finally { if (e_3) throw e_3.error; }
|
|
114
153
|
}
|
|
@@ -120,7 +159,7 @@ var FilterService = /** @class */ (function () {
|
|
|
120
159
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
121
160
|
finally {
|
|
122
161
|
try {
|
|
123
|
-
if (
|
|
162
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
124
163
|
}
|
|
125
164
|
finally { if (e_2) throw e_2.error; }
|
|
126
165
|
}
|
|
@@ -145,6 +184,7 @@ var FilterService = /** @class */ (function () {
|
|
|
145
184
|
* @param {?} question
|
|
146
185
|
* @param {?} additionalData
|
|
147
186
|
* @param {?} currentQuestionnaireForm
|
|
187
|
+
* @param {?=} repeaterItem
|
|
148
188
|
* @return {?}
|
|
149
189
|
*/
|
|
150
190
|
FilterService.prototype.setFetchForQuestion = /**
|
|
@@ -152,9 +192,10 @@ var FilterService = /** @class */ (function () {
|
|
|
152
192
|
* @param {?} question
|
|
153
193
|
* @param {?} additionalData
|
|
154
194
|
* @param {?} currentQuestionnaireForm
|
|
195
|
+
* @param {?=} repeaterItem
|
|
155
196
|
* @return {?}
|
|
156
197
|
*/
|
|
157
|
-
function (question, additionalData, currentQuestionnaireForm) {
|
|
198
|
+
function (question, additionalData, currentQuestionnaireForm, repeaterItem) {
|
|
158
199
|
if (question.fetchPath) {
|
|
159
200
|
return;
|
|
160
201
|
}
|
|
@@ -162,7 +203,7 @@ var FilterService = /** @class */ (function () {
|
|
|
162
203
|
var options = additionalData[question.fetchPath];
|
|
163
204
|
if (question.fetchSelectors && question.fetchSelectors.length > 0) {
|
|
164
205
|
/** @type {?} */
|
|
165
|
-
var values = this.getValuesForArray(question.fetchSelectors, currentQuestionnaireForm, additionalData);
|
|
206
|
+
var values = this.getValuesForArray(question.fetchSelectors, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
166
207
|
options = get(additionalData[question.fetchPath], values);
|
|
167
208
|
}
|
|
168
209
|
options = this.getFinalFetchArray(options);
|
|
@@ -182,7 +223,7 @@ var FilterService = /** @class */ (function () {
|
|
|
182
223
|
* @return {?}
|
|
183
224
|
*/
|
|
184
225
|
function (items) {
|
|
185
|
-
var
|
|
226
|
+
var e_6, _a;
|
|
186
227
|
if (!items) {
|
|
187
228
|
return null;
|
|
188
229
|
}
|
|
@@ -207,12 +248,12 @@ var FilterService = /** @class */ (function () {
|
|
|
207
248
|
}
|
|
208
249
|
}
|
|
209
250
|
}
|
|
210
|
-
catch (
|
|
251
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
211
252
|
finally {
|
|
212
253
|
try {
|
|
213
254
|
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
214
255
|
}
|
|
215
|
-
finally { if (
|
|
256
|
+
finally { if (e_6) throw e_6.error; }
|
|
216
257
|
}
|
|
217
258
|
return convertedArray;
|
|
218
259
|
};
|
|
@@ -243,6 +284,7 @@ var FilterService = /** @class */ (function () {
|
|
|
243
284
|
* @param {?} conditionGroups The array of condition groups.
|
|
244
285
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
245
286
|
* @param {?=} additionalData
|
|
287
|
+
* @param {?=} repeaterItem
|
|
246
288
|
* @return {?} A boolean stating if the condition groups conditions has been met.
|
|
247
289
|
*/
|
|
248
290
|
FilterService.prototype.meetsConditionGroups = /**
|
|
@@ -252,9 +294,10 @@ var FilterService = /** @class */ (function () {
|
|
|
252
294
|
* @param {?} conditionGroups The array of condition groups.
|
|
253
295
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
254
296
|
* @param {?=} additionalData
|
|
297
|
+
* @param {?=} repeaterItem
|
|
255
298
|
* @return {?} A boolean stating if the condition groups conditions has been met.
|
|
256
299
|
*/
|
|
257
|
-
function (conditionGroups, currentQuestionnaireForm, additionalData) {
|
|
300
|
+
function (conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
258
301
|
var _this = this;
|
|
259
302
|
if (!conditionGroups || conditionGroups.length === 0) {
|
|
260
303
|
return true;
|
|
@@ -264,7 +307,7 @@ var FilterService = /** @class */ (function () {
|
|
|
264
307
|
* @return {?}
|
|
265
308
|
*/
|
|
266
309
|
function (x) {
|
|
267
|
-
return _this.meetsConditionGroup(x, currentQuestionnaireForm, additionalData) === true;
|
|
310
|
+
return _this.meetsConditionGroup(x, currentQuestionnaireForm, additionalData, repeaterItem) === true;
|
|
268
311
|
}));
|
|
269
312
|
};
|
|
270
313
|
/**
|
|
@@ -281,6 +324,7 @@ var FilterService = /** @class */ (function () {
|
|
|
281
324
|
* @param {?} conditionGroup The condition group to check.
|
|
282
325
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
283
326
|
* @param {?=} additionalData
|
|
327
|
+
* @param {?=} repeaterItem
|
|
284
328
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
285
329
|
*/
|
|
286
330
|
FilterService.prototype.meetsConditionGroup = /**
|
|
@@ -290,10 +334,11 @@ var FilterService = /** @class */ (function () {
|
|
|
290
334
|
* @param {?} conditionGroup The condition group to check.
|
|
291
335
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
292
336
|
* @param {?=} additionalData
|
|
337
|
+
* @param {?=} repeaterItem
|
|
293
338
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
294
339
|
*/
|
|
295
|
-
function (conditionGroup, currentQuestionnaireForm, additionalData) {
|
|
296
|
-
var
|
|
340
|
+
function (conditionGroup, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
341
|
+
var e_7, _a;
|
|
297
342
|
if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {
|
|
298
343
|
return true;
|
|
299
344
|
}
|
|
@@ -302,15 +347,15 @@ var FilterService = /** @class */ (function () {
|
|
|
302
347
|
try {
|
|
303
348
|
for (var _b = __values(conditionGroup.conditions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
304
349
|
var condition = _c.value;
|
|
305
|
-
results.push(this.meetsCondition(condition, currentQuestionnaireForm, additionalData));
|
|
350
|
+
results.push(this.meetsCondition(condition, currentQuestionnaireForm, additionalData, repeaterItem));
|
|
306
351
|
}
|
|
307
352
|
}
|
|
308
|
-
catch (
|
|
353
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
309
354
|
finally {
|
|
310
355
|
try {
|
|
311
356
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
312
357
|
}
|
|
313
|
-
finally { if (
|
|
358
|
+
finally { if (e_7) throw e_7.error; }
|
|
314
359
|
}
|
|
315
360
|
switch (conditionGroup.relationship) {
|
|
316
361
|
case ConditionRelationship.Every:
|
|
@@ -347,6 +392,7 @@ var FilterService = /** @class */ (function () {
|
|
|
347
392
|
* @param {?} condition The condition to check.
|
|
348
393
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
349
394
|
* @param {?=} additionalData
|
|
395
|
+
* @param {?=} repeaterItem
|
|
350
396
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
351
397
|
*/
|
|
352
398
|
FilterService.prototype.meetsCondition = /**
|
|
@@ -356,14 +402,15 @@ var FilterService = /** @class */ (function () {
|
|
|
356
402
|
* @param {?} condition The condition to check.
|
|
357
403
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
358
404
|
* @param {?=} additionalData
|
|
405
|
+
* @param {?=} repeaterItem
|
|
359
406
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
360
407
|
*/
|
|
361
|
-
function (condition, currentQuestionnaireForm, additionalData) {
|
|
362
|
-
var
|
|
408
|
+
function (condition, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
409
|
+
var e_8, _a, e_9, _b;
|
|
363
410
|
/** @type {?} */
|
|
364
|
-
var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData);
|
|
411
|
+
var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
365
412
|
/** @type {?} */
|
|
366
|
-
var v2s = this.getValuesForArray(condition.v2s, currentQuestionnaireForm, additionalData);
|
|
413
|
+
var v2s = this.getValuesForArray(condition.v2s, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
367
414
|
/** @type {?} */
|
|
368
415
|
var result = false;
|
|
369
416
|
switch (condition.type) {
|
|
@@ -389,7 +436,7 @@ var FilterService = /** @class */ (function () {
|
|
|
389
436
|
for (var v2s_1 = __values(v2s), v2s_1_1 = v2s_1.next(); !v2s_1_1.done; v2s_1_1 = v2s_1.next()) {
|
|
390
437
|
var v2 = v2s_1_1.value;
|
|
391
438
|
try {
|
|
392
|
-
for (var v1s_1 = (
|
|
439
|
+
for (var v1s_1 = (e_9 = void 0, __values(v1s)), v1s_1_1 = v1s_1.next(); !v1s_1_1.done; v1s_1_1 = v1s_1.next()) {
|
|
393
440
|
var v1 = v1s_1_1.value;
|
|
394
441
|
switch (condition.type) {
|
|
395
442
|
case ConditionType.EqualTo:
|
|
@@ -423,21 +470,21 @@ var FilterService = /** @class */ (function () {
|
|
|
423
470
|
}
|
|
424
471
|
}
|
|
425
472
|
}
|
|
426
|
-
catch (
|
|
473
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
427
474
|
finally {
|
|
428
475
|
try {
|
|
429
476
|
if (v1s_1_1 && !v1s_1_1.done && (_b = v1s_1.return)) _b.call(v1s_1);
|
|
430
477
|
}
|
|
431
|
-
finally { if (
|
|
478
|
+
finally { if (e_9) throw e_9.error; }
|
|
432
479
|
}
|
|
433
480
|
}
|
|
434
481
|
}
|
|
435
|
-
catch (
|
|
482
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
436
483
|
finally {
|
|
437
484
|
try {
|
|
438
485
|
if (v2s_1_1 && !v2s_1_1.done && (_a = v2s_1.return)) _a.call(v2s_1);
|
|
439
486
|
}
|
|
440
|
-
finally { if (
|
|
487
|
+
finally { if (e_8) throw e_8.error; }
|
|
441
488
|
}
|
|
442
489
|
}
|
|
443
490
|
return result;
|
|
@@ -474,6 +521,7 @@ var FilterService = /** @class */ (function () {
|
|
|
474
521
|
* @param {?} paths The array of strings to check.
|
|
475
522
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
476
523
|
* @param {?=} additionalData
|
|
524
|
+
* @param {?=} repeaterItem
|
|
477
525
|
* @return {?} An array of strings/values
|
|
478
526
|
*/
|
|
479
527
|
FilterService.prototype.getValuesForArray = /**
|
|
@@ -483,10 +531,11 @@ var FilterService = /** @class */ (function () {
|
|
|
483
531
|
* @param {?} paths The array of strings to check.
|
|
484
532
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
485
533
|
* @param {?=} additionalData
|
|
534
|
+
* @param {?=} repeaterItem
|
|
486
535
|
* @return {?} An array of strings/values
|
|
487
536
|
*/
|
|
488
|
-
function (paths, currentQuestionnaireForm, additionalData) {
|
|
489
|
-
var
|
|
537
|
+
function (paths, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
538
|
+
var e_10, _a;
|
|
490
539
|
if (currentQuestionnaireForm) {
|
|
491
540
|
/** @type {?} */
|
|
492
541
|
var values = [];
|
|
@@ -494,16 +543,16 @@ var FilterService = /** @class */ (function () {
|
|
|
494
543
|
for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
|
|
495
544
|
var path = paths_1_1.value;
|
|
496
545
|
/** @type {?} */
|
|
497
|
-
var value = this.getValueForString(path, currentQuestionnaireForm, additionalData);
|
|
546
|
+
var value = this.getValueForString(path, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
498
547
|
values.push(value);
|
|
499
548
|
}
|
|
500
549
|
}
|
|
501
|
-
catch (
|
|
550
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
502
551
|
finally {
|
|
503
552
|
try {
|
|
504
553
|
if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
|
|
505
554
|
}
|
|
506
|
-
finally { if (
|
|
555
|
+
finally { if (e_10) throw e_10.error; }
|
|
507
556
|
}
|
|
508
557
|
return values;
|
|
509
558
|
}
|
|
@@ -525,6 +574,7 @@ var FilterService = /** @class */ (function () {
|
|
|
525
574
|
* @param {?} path The string value to check.
|
|
526
575
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
527
576
|
* @param {?=} additionalData
|
|
577
|
+
* @param {?=} repeaterItem
|
|
528
578
|
* @return {?} A string/value.
|
|
529
579
|
*/
|
|
530
580
|
FilterService.prototype.getValueForString = /**
|
|
@@ -534,15 +584,19 @@ var FilterService = /** @class */ (function () {
|
|
|
534
584
|
* @param {?} path The string value to check.
|
|
535
585
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
536
586
|
* @param {?=} additionalData
|
|
587
|
+
* @param {?=} repeaterItem
|
|
537
588
|
* @return {?} A string/value.
|
|
538
589
|
*/
|
|
539
|
-
function (path, currentQuestionnaireForm, additionalData) {
|
|
590
|
+
function (path, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
540
591
|
if (currentQuestionnaireForm) {
|
|
541
592
|
if (!additionalData) {
|
|
542
593
|
additionalData = {};
|
|
543
594
|
}
|
|
544
595
|
/** @type {?} */
|
|
545
596
|
var control = currentQuestionnaireForm.get(path.toString());
|
|
597
|
+
if ((!control || !control.value) && repeaterItem) {
|
|
598
|
+
control = repeaterItem.get(path.toString());
|
|
599
|
+
}
|
|
546
600
|
/** @type {?} */
|
|
547
601
|
var value = control ? control.value : this.convertStringToValue(path);
|
|
548
602
|
return get(additionalData, path, value);
|
|
@@ -843,25 +897,29 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
843
897
|
* Generates the form template for a repeater question.
|
|
844
898
|
* @author Will Poulson
|
|
845
899
|
* @param {?} question The question. Must be of type repeater or else null is returned.
|
|
900
|
+
* @param {?=} index
|
|
846
901
|
* @return {?} A form group.
|
|
847
902
|
*/
|
|
848
903
|
FormConstructorService.prototype.generateFormsForRepeater = /**
|
|
849
904
|
* Generates the form template for a repeater question.
|
|
850
905
|
* @author Will Poulson
|
|
851
906
|
* @param {?} question The question. Must be of type repeater or else null is returned.
|
|
907
|
+
* @param {?=} index
|
|
852
908
|
* @return {?} A form group.
|
|
853
909
|
*/
|
|
854
|
-
function (question) {
|
|
910
|
+
function (question, index) {
|
|
855
911
|
var e_4, _a;
|
|
856
912
|
if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {
|
|
857
913
|
console.log('Question isnt a repeater or has no questions, returning null');
|
|
858
914
|
return null;
|
|
859
915
|
}
|
|
860
916
|
/** @type {?} */
|
|
917
|
+
var repeaterQuestions = index ? question.filteredRepeaterQuestions[index] : question.repeaterQuestions;
|
|
918
|
+
/** @type {?} */
|
|
861
919
|
var repeaterForms = this.fb.group({});
|
|
862
920
|
try {
|
|
863
|
-
for (var
|
|
864
|
-
var repeaterQuestion =
|
|
921
|
+
for (var repeaterQuestions_1 = __values(repeaterQuestions), repeaterQuestions_1_1 = repeaterQuestions_1.next(); !repeaterQuestions_1_1.done; repeaterQuestions_1_1 = repeaterQuestions_1.next()) {
|
|
922
|
+
var repeaterQuestion = repeaterQuestions_1_1.value;
|
|
865
923
|
/** @type {?} */
|
|
866
924
|
var repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);
|
|
867
925
|
repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);
|
|
@@ -870,7 +928,7 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
870
928
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
871
929
|
finally {
|
|
872
930
|
try {
|
|
873
|
-
if (
|
|
931
|
+
if (repeaterQuestions_1_1 && !repeaterQuestions_1_1.done && (_a = repeaterQuestions_1.return)) _a.call(repeaterQuestions_1);
|
|
874
932
|
}
|
|
875
933
|
finally { if (e_4) throw e_4.error; }
|
|
876
934
|
}
|
|
@@ -1020,7 +1078,9 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1020
1078
|
for (var repeaterArray_1 = (e_8 = void 0, __values(repeaterArray)), repeaterArray_1_1 = repeaterArray_1.next(); !repeaterArray_1_1.done; repeaterArray_1_1 = repeaterArray_1.next()) {
|
|
1021
1079
|
var repeaterItem = repeaterArray_1_1.value;
|
|
1022
1080
|
/** @type {?} */
|
|
1023
|
-
var
|
|
1081
|
+
var index = repeaterArray.indexOf(repeaterItem);
|
|
1082
|
+
/** @type {?} */
|
|
1083
|
+
var repeaterItemTemplate = this.generateFormsForRepeater(question, index);
|
|
1024
1084
|
repeaterFormArray.push(repeaterItemTemplate);
|
|
1025
1085
|
}
|
|
1026
1086
|
}
|