@glowgreen/gg-questionnaire-v2 0.0.44 → 0.0.46
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 +56 -69
- 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/services/filter.service.js +22 -25
- package/esm5/lib/services/filter.service.js +57 -70
- package/fesm2015/glowgreen-gg-questionnaire-v2.js +21 -24
- package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/fesm5/glowgreen-gg-questionnaire-v2.js +56 -69
- package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/glowgreen-gg-questionnaire-v2.metadata.json +1 -1
- package/lib/services/filter.service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
* @return {?} An array of filtered sections with their filtered questions.
|
|
265
265
|
*/
|
|
266
266
|
function (sections, currentQuestionnaireForm, additionalData) {
|
|
267
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d
|
|
267
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
268
268
|
/** @type {?} */
|
|
269
269
|
var filteredSections = [];
|
|
270
270
|
try {
|
|
@@ -276,8 +276,8 @@
|
|
|
276
276
|
/** @type {?} */
|
|
277
277
|
var filteredQuestions = [];
|
|
278
278
|
try {
|
|
279
|
-
for (var
|
|
280
|
-
var question =
|
|
279
|
+
for (var _e = (e_2 = void 0, __values(section.questions)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
280
|
+
var question = _f.value;
|
|
281
281
|
if (!this.meetsConditionGroups(question.conditionGroups, currentQuestionnaireForm, additionalData)) {
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
@@ -285,69 +285,56 @@
|
|
|
285
285
|
if (question.type === 'repeater') {
|
|
286
286
|
/** @type {?} */
|
|
287
287
|
var items = (/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])));
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
var repeaterQuestion = _l.value;
|
|
296
|
-
/** @type {?} */
|
|
297
|
-
var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, (/** @type {?} */ (repeaterItem)));
|
|
298
|
-
if (meetsConditions) {
|
|
299
|
-
this.setFetchForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm, (/** @type {?} */ (repeaterItem)));
|
|
300
|
-
filteredRepeaterItemQuestions.push(repeaterQuestion);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
305
|
-
finally {
|
|
288
|
+
if (items && items.controls) {
|
|
289
|
+
try {
|
|
290
|
+
for (var _g = (e_3 = void 0, __values(items.controls)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
291
|
+
var repeaterItem = _h.value;
|
|
292
|
+
/** @type {?} */
|
|
293
|
+
var filteredRepeaterItemQuestions = [];
|
|
294
|
+
console.log('Filtering repeater item questions');
|
|
306
295
|
try {
|
|
307
|
-
|
|
296
|
+
for (var _j = (e_4 = void 0, __values(question.repeaterQuestions)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
297
|
+
var repeaterQuestion = _k.value;
|
|
298
|
+
/** @type {?} */
|
|
299
|
+
var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, (/** @type {?} */ (repeaterItem)));
|
|
300
|
+
if (meetsConditions) {
|
|
301
|
+
repeaterQuestion.selectOptions = this.getFetchOptionsForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm, (/** @type {?} */ (repeaterItem)));
|
|
302
|
+
filteredRepeaterItemQuestions.push(repeaterQuestion);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
308
305
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
var filteredRepeaterItemQuestion = filteredRepeaterItemQuestions_1_1.value;
|
|
314
|
-
if (filteredRepeaterItemQuestion.type !== 'select') {
|
|
315
|
-
continue;
|
|
306
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
307
|
+
finally {
|
|
308
|
+
try {
|
|
309
|
+
if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
|
|
316
310
|
}
|
|
317
|
-
|
|
311
|
+
finally { if (e_4) throw e_4.error; }
|
|
318
312
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (filteredRepeaterItemQuestions_1_1 && !filteredRepeaterItemQuestions_1_1.done && (_e = filteredRepeaterItemQuestions_1.return)) _e.call(filteredRepeaterItemQuestions_1);
|
|
313
|
+
/** @type {?} */
|
|
314
|
+
var index = items.controls.indexOf(repeaterItem);
|
|
315
|
+
if (!question.filteredRepeaterQuestions) {
|
|
316
|
+
question.filteredRepeaterQuestions = [];
|
|
324
317
|
}
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
/** @type {?} */
|
|
328
|
-
var index = items.controls.indexOf(repeaterItem);
|
|
329
|
-
if (!question.filteredRepeaterQuestions) {
|
|
330
|
-
question.filteredRepeaterQuestions = [];
|
|
318
|
+
question.filteredRepeaterQuestions[index] = filteredRepeaterItemQuestions;
|
|
331
319
|
}
|
|
332
|
-
question.filteredRepeaterQuestions[index] = filteredRepeaterItemQuestions;
|
|
333
320
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
321
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
322
|
+
finally {
|
|
323
|
+
try {
|
|
324
|
+
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
|
|
325
|
+
}
|
|
326
|
+
finally { if (e_3) throw e_3.error; }
|
|
339
327
|
}
|
|
340
|
-
finally { if (e_3) throw e_3.error; }
|
|
341
328
|
}
|
|
342
329
|
}
|
|
343
|
-
this.
|
|
330
|
+
question.selectOptions = this.getFetchOptionsForQuestion(question, additionalData, currentQuestionnaireForm);
|
|
344
331
|
filteredQuestions.push(question);
|
|
345
332
|
}
|
|
346
333
|
}
|
|
347
334
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
348
335
|
finally {
|
|
349
336
|
try {
|
|
350
|
-
if (
|
|
337
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
351
338
|
}
|
|
352
339
|
finally { if (e_2) throw e_2.error; }
|
|
353
340
|
}
|
|
@@ -375,7 +362,7 @@
|
|
|
375
362
|
* @param {?=} repeaterItem
|
|
376
363
|
* @return {?}
|
|
377
364
|
*/
|
|
378
|
-
FilterService.prototype.
|
|
365
|
+
FilterService.prototype.getFetchOptionsForQuestion = /**
|
|
379
366
|
* @private
|
|
380
367
|
* @param {?} question
|
|
381
368
|
* @param {?} additionalData
|
|
@@ -384,8 +371,8 @@
|
|
|
384
371
|
* @return {?}
|
|
385
372
|
*/
|
|
386
373
|
function (question, additionalData, currentQuestionnaireForm, repeaterItem) {
|
|
387
|
-
if (question.fetchPath) {
|
|
388
|
-
return;
|
|
374
|
+
if (!question.fetchPath) {
|
|
375
|
+
return question.selectOptions;
|
|
389
376
|
}
|
|
390
377
|
/** @type {?} */
|
|
391
378
|
var options = additionalData[question.fetchPath];
|
|
@@ -398,7 +385,7 @@
|
|
|
398
385
|
if (!question.selectOptions) {
|
|
399
386
|
question.selectOptions = [];
|
|
400
387
|
}
|
|
401
|
-
|
|
388
|
+
return question.selectOptions.concat(options);
|
|
402
389
|
};
|
|
403
390
|
/**
|
|
404
391
|
* @private
|
|
@@ -411,7 +398,7 @@
|
|
|
411
398
|
* @return {?}
|
|
412
399
|
*/
|
|
413
400
|
function (items) {
|
|
414
|
-
var
|
|
401
|
+
var e_5, _a;
|
|
415
402
|
if (!items) {
|
|
416
403
|
return null;
|
|
417
404
|
}
|
|
@@ -436,12 +423,12 @@
|
|
|
436
423
|
}
|
|
437
424
|
}
|
|
438
425
|
}
|
|
439
|
-
catch (
|
|
426
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
440
427
|
finally {
|
|
441
428
|
try {
|
|
442
429
|
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
443
430
|
}
|
|
444
|
-
finally { if (
|
|
431
|
+
finally { if (e_5) throw e_5.error; }
|
|
445
432
|
}
|
|
446
433
|
return convertedArray;
|
|
447
434
|
};
|
|
@@ -526,7 +513,7 @@
|
|
|
526
513
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
527
514
|
*/
|
|
528
515
|
function (conditionGroup, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
529
|
-
var
|
|
516
|
+
var e_6, _a;
|
|
530
517
|
if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {
|
|
531
518
|
return true;
|
|
532
519
|
}
|
|
@@ -538,12 +525,12 @@
|
|
|
538
525
|
results.push(this.meetsCondition(condition, currentQuestionnaireForm, additionalData, repeaterItem));
|
|
539
526
|
}
|
|
540
527
|
}
|
|
541
|
-
catch (
|
|
528
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
542
529
|
finally {
|
|
543
530
|
try {
|
|
544
531
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
545
532
|
}
|
|
546
|
-
finally { if (
|
|
533
|
+
finally { if (e_6) throw e_6.error; }
|
|
547
534
|
}
|
|
548
535
|
switch (conditionGroup.relationship) {
|
|
549
536
|
case ConditionRelationship.Every:
|
|
@@ -594,7 +581,7 @@
|
|
|
594
581
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
595
582
|
*/
|
|
596
583
|
function (condition, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
597
|
-
var
|
|
584
|
+
var e_7, _a, e_8, _b;
|
|
598
585
|
/** @type {?} */
|
|
599
586
|
var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
600
587
|
/** @type {?} */
|
|
@@ -624,7 +611,7 @@
|
|
|
624
611
|
for (var v2s_1 = __values(v2s), v2s_1_1 = v2s_1.next(); !v2s_1_1.done; v2s_1_1 = v2s_1.next()) {
|
|
625
612
|
var v2 = v2s_1_1.value;
|
|
626
613
|
try {
|
|
627
|
-
for (var v1s_1 = (
|
|
614
|
+
for (var v1s_1 = (e_8 = void 0, __values(v1s)), v1s_1_1 = v1s_1.next(); !v1s_1_1.done; v1s_1_1 = v1s_1.next()) {
|
|
628
615
|
var v1 = v1s_1_1.value;
|
|
629
616
|
switch (condition.type) {
|
|
630
617
|
case ConditionType.EqualTo:
|
|
@@ -658,21 +645,21 @@
|
|
|
658
645
|
}
|
|
659
646
|
}
|
|
660
647
|
}
|
|
661
|
-
catch (
|
|
648
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
662
649
|
finally {
|
|
663
650
|
try {
|
|
664
651
|
if (v1s_1_1 && !v1s_1_1.done && (_b = v1s_1.return)) _b.call(v1s_1);
|
|
665
652
|
}
|
|
666
|
-
finally { if (
|
|
653
|
+
finally { if (e_8) throw e_8.error; }
|
|
667
654
|
}
|
|
668
655
|
}
|
|
669
656
|
}
|
|
670
|
-
catch (
|
|
657
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
671
658
|
finally {
|
|
672
659
|
try {
|
|
673
660
|
if (v2s_1_1 && !v2s_1_1.done && (_a = v2s_1.return)) _a.call(v2s_1);
|
|
674
661
|
}
|
|
675
|
-
finally { if (
|
|
662
|
+
finally { if (e_7) throw e_7.error; }
|
|
676
663
|
}
|
|
677
664
|
}
|
|
678
665
|
return result;
|
|
@@ -723,7 +710,7 @@
|
|
|
723
710
|
* @return {?} An array of strings/values
|
|
724
711
|
*/
|
|
725
712
|
function (paths, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
726
|
-
var
|
|
713
|
+
var e_9, _a;
|
|
727
714
|
if (currentQuestionnaireForm) {
|
|
728
715
|
/** @type {?} */
|
|
729
716
|
var values = [];
|
|
@@ -735,12 +722,12 @@
|
|
|
735
722
|
values.push(value);
|
|
736
723
|
}
|
|
737
724
|
}
|
|
738
|
-
catch (
|
|
725
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
739
726
|
finally {
|
|
740
727
|
try {
|
|
741
728
|
if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
|
|
742
729
|
}
|
|
743
|
-
finally { if (
|
|
730
|
+
finally { if (e_9) throw e_9.error; }
|
|
744
731
|
}
|
|
745
732
|
return values;
|
|
746
733
|
}
|