@glowgreen/gg-questionnaire-v2 0.0.44 → 0.0.45

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