@glowgreen/gg-questionnaire-v2 0.0.82 → 0.0.83

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 (61) hide show
  1. package/bundles/glowgreen-gg-questionnaire-v2.umd.js +305 -1239
  2. package/bundles/glowgreen-gg-questionnaire-v2.umd.js.map +1 -1
  3. package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js +15 -1
  4. package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js.map +1 -1
  5. package/esm2015/glowgreen-gg-questionnaire-v2.js +2 -8
  6. package/esm2015/lib/enums/condition-relationship.enum.js +6 -11
  7. package/esm2015/lib/enums/condition-type.enum.js +10 -15
  8. package/esm2015/lib/enums/input-type.enum.js +15 -20
  9. package/esm2015/lib/enums/question-type.enum.js +15 -20
  10. package/esm2015/lib/enums/repeater-question-type.enum.js +7 -12
  11. package/esm2015/lib/enums/validation-type.enum.js +10 -15
  12. package/esm2015/lib/gg-questionnaire-v2.module.js +17 -13
  13. package/esm2015/lib/interfaces/attachment.js +1 -15
  14. package/esm2015/lib/interfaces/checklist-item.js +1 -15
  15. package/esm2015/lib/interfaces/condition-group.js +1 -15
  16. package/esm2015/lib/interfaces/condition.js +1 -17
  17. package/esm2015/lib/interfaces/question.js +1 -59
  18. package/esm2015/lib/interfaces/questionnaire-options.js +1 -21
  19. package/esm2015/lib/interfaces/questionnaire.js +1 -15
  20. package/esm2015/lib/interfaces/repeater-question.js +1 -33
  21. package/esm2015/lib/interfaces/section.js +1 -19
  22. package/esm2015/lib/interfaces/select-option.js +1 -19
  23. package/esm2015/lib/interfaces/validator.js +1 -15
  24. package/esm2015/lib/services/filter.service.js +44 -123
  25. package/esm2015/lib/services/form-constructor.service.js +30 -113
  26. package/esm2015/lib/services/questionnaire.service.js +97 -377
  27. package/esm2015/public_api.js +1 -5
  28. package/esm5/glowgreen-gg-questionnaire-v2.js +2 -8
  29. package/esm5/lib/enums/condition-relationship.enum.js +6 -11
  30. package/esm5/lib/enums/condition-type.enum.js +10 -15
  31. package/esm5/lib/enums/input-type.enum.js +15 -20
  32. package/esm5/lib/enums/question-type.enum.js +15 -20
  33. package/esm5/lib/enums/repeater-question-type.enum.js +7 -12
  34. package/esm5/lib/enums/validation-type.enum.js +10 -15
  35. package/esm5/lib/gg-questionnaire-v2.module.js +27 -27
  36. package/esm5/lib/interfaces/attachment.js +1 -15
  37. package/esm5/lib/interfaces/checklist-item.js +1 -15
  38. package/esm5/lib/interfaces/condition-group.js +1 -15
  39. package/esm5/lib/interfaces/condition.js +1 -17
  40. package/esm5/lib/interfaces/question.js +1 -59
  41. package/esm5/lib/interfaces/questionnaire-options.js +1 -21
  42. package/esm5/lib/interfaces/questionnaire.js +1 -15
  43. package/esm5/lib/interfaces/repeater-question.js +1 -33
  44. package/esm5/lib/interfaces/section.js +1 -19
  45. package/esm5/lib/interfaces/select-option.js +1 -19
  46. package/esm5/lib/interfaces/validator.js +1 -15
  47. package/esm5/lib/services/filter.service.js +46 -263
  48. package/esm5/lib/services/form-constructor.service.js +35 -247
  49. package/esm5/lib/services/questionnaire.service.js +105 -608
  50. package/esm5/public_api.js +1 -5
  51. package/fesm2015/glowgreen-gg-questionnaire-v2.js +244 -711
  52. package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
  53. package/fesm5/glowgreen-gg-questionnaire-v2.js +242 -1203
  54. package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
  55. package/glowgreen-gg-questionnaire-v2.d.ts +1 -2
  56. package/lib/gg-questionnaire-v2.module.d.ts +5 -1
  57. package/lib/services/filter.service.d.ts +3 -0
  58. package/lib/services/form-constructor.service.d.ts +3 -0
  59. package/lib/services/questionnaire.service.d.ts +12 -9
  60. package/package.json +5 -3
  61. package/glowgreen-gg-questionnaire-v2.metadata.json +0 -1
@@ -2,21 +2,21 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('lodash')) :
3
3
  typeof define === 'function' && define.amd ? define('@glowgreen/gg-questionnaire-v2', ['exports', '@angular/core', '@angular/forms', 'lodash'], factory) :
4
4
  (global = global || self, factory((global.glowgreen = global.glowgreen || {}, global.glowgreen['gg-questionnaire-v2'] = {}), global.ng.core, global.ng.forms, global.lodash));
5
- }(this, function (exports, core, forms, lodash) { 'use strict';
5
+ }(this, (function (exports, core, forms, lodash) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation. All rights reserved.
9
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
- this file except in compliance with the License. You may obtain a copy of the
11
- License at http://www.apache.org/licenses/LICENSE-2.0
8
+ Copyright (c) Microsoft Corporation.
12
9
 
13
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
- MERCHANTABLITY OR NON-INFRINGEMENT.
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
17
12
 
18
- See the Apache Version 2.0 License for specific language governing permissions
19
- and limitations under the License.
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
20
  ***************************************************************************** */
21
21
  /* global Reflect, Promise */
22
22
 
@@ -49,8 +49,10 @@
49
49
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
50
  t[p] = s[p];
51
51
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
53
- t[p[i]] = s[p[i]];
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
54
56
  return t;
55
57
  }
56
58
 
@@ -70,10 +72,11 @@
70
72
  }
71
73
 
72
74
  function __awaiter(thisArg, _arguments, P, generator) {
75
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
73
76
  return new (P || (P = Promise))(function (resolve, reject) {
74
77
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
75
78
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
76
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
79
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
77
80
  step((generator = generator.apply(thisArg, _arguments || [])).next());
78
81
  });
79
82
  }
@@ -106,19 +109,25 @@
106
109
  }
107
110
  }
108
111
 
112
+ function __createBinding(o, m, k, k2) {
113
+ if (k2 === undefined) k2 = k;
114
+ o[k2] = m[k];
115
+ }
116
+
109
117
  function __exportStar(m, exports) {
110
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
118
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
111
119
  }
112
120
 
113
121
  function __values(o) {
114
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
122
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
115
123
  if (m) return m.call(o);
116
- return {
124
+ if (o && typeof o.length === "number") return {
117
125
  next: function () {
118
126
  if (o && i >= o.length) o = void 0;
119
127
  return { value: o && o[i++], done: !o };
120
128
  }
121
129
  };
130
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
122
131
  }
123
132
 
124
133
  function __read(o, n) {
@@ -144,6 +153,14 @@
144
153
  return ar;
145
154
  }
146
155
 
156
+ function __spreadArrays() {
157
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
158
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
159
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
160
+ r[k] = a[j];
161
+ return r;
162
+ };
163
+
147
164
  function __await(v) {
148
165
  return this instanceof __await ? (this.v = v, this) : new __await(v);
149
166
  }
@@ -189,55 +206,53 @@
189
206
 
190
207
  function __importDefault(mod) {
191
208
  return (mod && mod.__esModule) ? mod : { default: mod };
209
+ }
210
+
211
+ function __classPrivateFieldGet(receiver, privateMap) {
212
+ if (!privateMap.has(receiver)) {
213
+ throw new TypeError("attempted to get private field on non-instance");
214
+ }
215
+ return privateMap.get(receiver);
216
+ }
217
+
218
+ function __classPrivateFieldSet(receiver, privateMap, value) {
219
+ if (!privateMap.has(receiver)) {
220
+ throw new TypeError("attempted to set private field on non-instance");
221
+ }
222
+ privateMap.set(receiver, value);
223
+ return value;
192
224
  }
193
225
 
194
- /**
195
- * @fileoverview added by tsickle
196
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
197
- */
198
- /** @enum {string} */
199
- var QuestionType = {
200
- Input: 'input',
201
- Select: 'select',
202
- Textarea: 'textarea',
203
- Repeater: 'repeater',
204
- Checklist: 'checklist',
205
- Attachment: 'attachment',
206
- Upload: 'upload',
207
- Signature: 'signature',
208
- Slider: 'slider',
209
- Info: 'info',
210
- Feedback: 'feedback',
211
- };
226
+ (function (QuestionType) {
227
+ QuestionType["Input"] = "input";
228
+ QuestionType["Select"] = "select";
229
+ QuestionType["Textarea"] = "textarea";
230
+ QuestionType["Repeater"] = "repeater";
231
+ QuestionType["Checklist"] = "checklist";
232
+ QuestionType["Attachment"] = "attachment";
233
+ QuestionType["Upload"] = "upload";
234
+ QuestionType["Signature"] = "signature";
235
+ QuestionType["Slider"] = "slider";
236
+ QuestionType["Info"] = "info";
237
+ QuestionType["Feedback"] = "feedback";
238
+ })(exports.QuestionType || (exports.QuestionType = {}));
212
239
 
213
- /**
214
- * @fileoverview added by tsickle
215
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
216
- */
217
- /** @enum {string} */
218
- var ConditionType = {
219
- EqualTo: 'equalTo',
220
- NotEqualTo: 'notEqualTo',
221
- LessThan: 'lessThan',
222
- GreaterThan: 'greaterThan',
223
- Includes: 'includes',
224
- Excludes: 'excludes',
225
- };
226
240
 
227
- /**
228
- * @fileoverview added by tsickle
229
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
230
- */
231
- /** @enum {string} */
232
- var ConditionRelationship = {
233
- Every: 'every',
234
- Any: 'any',
235
- };
241
+ (function (ConditionType) {
242
+ ConditionType["EqualTo"] = "equalTo";
243
+ ConditionType["NotEqualTo"] = "notEqualTo";
244
+ ConditionType["LessThan"] = "lessThan";
245
+ ConditionType["GreaterThan"] = "greaterThan";
246
+ ConditionType["Includes"] = "includes";
247
+ ConditionType["Excludes"] = "excludes";
248
+ })(exports.ConditionType || (exports.ConditionType = {}));
249
+
250
+
251
+ (function (ConditionRelationship) {
252
+ ConditionRelationship["Every"] = "every";
253
+ ConditionRelationship["Any"] = "any";
254
+ })(exports.ConditionRelationship || (exports.ConditionRelationship = {}));
236
255
 
237
- /**
238
- * @fileoverview added by tsickle
239
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
240
- */
241
256
  var FilterService = /** @class */ (function () {
242
257
  function FilterService() {
243
258
  }
@@ -248,25 +263,8 @@
248
263
  * @returns An array of filtered sections with their filtered questions.
249
264
  * @author Will Poulson
250
265
  */
251
- /**
252
- * Filters an array of sections based on their condition groups.
253
- * @author Will Poulson
254
- * @param {?} sections The array of sections to filter.
255
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
256
- * @param {?=} additionalData
257
- * @return {?} An array of filtered sections with their filtered questions.
258
- */
259
- FilterService.prototype.filterSections = /**
260
- * Filters an array of sections based on their condition groups.
261
- * @author Will Poulson
262
- * @param {?} sections The array of sections to filter.
263
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
264
- * @param {?=} additionalData
265
- * @return {?} An array of filtered sections with their filtered questions.
266
- */
267
- function (sections, currentQuestionnaireForm, additionalData) {
266
+ FilterService.prototype.filterSections = function (sections, currentQuestionnaireForm, additionalData) {
268
267
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
269
- /** @type {?} */
270
268
  var filteredSections = [];
271
269
  try {
272
270
  for (var sections_1 = __values(sections), sections_1_1 = sections_1.next(); !sections_1_1.done; sections_1_1 = sections_1.next()) {
@@ -274,7 +272,6 @@
274
272
  if (!this.meetsConditionGroups(section.conditionGroups, currentQuestionnaireForm, additionalData)) {
275
273
  continue;
276
274
  }
277
- /** @type {?} */
278
275
  var filteredQuestions = [];
279
276
  try {
280
277
  for (var _e = (e_2 = void 0, __values(section.questions)), _f = _e.next(); !_f.done; _f = _e.next()) {
@@ -284,23 +281,19 @@
284
281
  }
285
282
  // If it's a repeater we need to do a lot of extra filtering due to per item conditions.
286
283
  if (question.type === 'repeater' && currentQuestionnaireForm) {
287
- /** @type {?} */
288
- var items = (/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])));
284
+ var items = currentQuestionnaireForm.get([section.name, question.name]);
289
285
  if (items && items.controls) {
290
286
  try {
291
287
  for (var _g = (e_3 = void 0, __values(items.controls)), _h = _g.next(); !_h.done; _h = _g.next()) {
292
288
  var repeaterItem = _h.value;
293
- /** @type {?} */
294
289
  var filteredRepeaterItemQuestions = [];
295
290
  try {
296
291
  for (var _j = (e_4 = void 0, __values(question.repeaterQuestions)), _k = _j.next(); !_k.done; _k = _j.next()) {
297
292
  var repeaterQuestion = _k.value;
298
- /** @type {?} */
299
- var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, (/** @type {?} */ (repeaterItem)));
293
+ var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem);
300
294
  if (meetsConditions) {
301
- /** @type {?} */
302
295
  var cloneQuestion = lodash.clone(repeaterQuestion);
303
- cloneQuestion.selectOptions = this.getFetchOptionsForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm, (/** @type {?} */ (repeaterItem)));
296
+ cloneQuestion.selectOptions = this.getFetchOptionsForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm, repeaterItem);
304
297
  filteredRepeaterItemQuestions.push(cloneQuestion);
305
298
  }
306
299
  }
@@ -312,7 +305,6 @@
312
305
  }
313
306
  finally { if (e_4) throw e_4.error; }
314
307
  }
315
- /** @type {?} */
316
308
  var index = items.controls.indexOf(repeaterItem);
317
309
  if (!question.filteredRepeaterQuestions) {
318
310
  question.filteredRepeaterQuestions = [];
@@ -356,30 +348,12 @@
356
348
  }
357
349
  return filteredSections;
358
350
  };
359
- /**
360
- * @private
361
- * @param {?} question
362
- * @param {?} additionalData
363
- * @param {?} currentQuestionnaireForm
364
- * @param {?=} repeaterItem
365
- * @return {?}
366
- */
367
- FilterService.prototype.getFetchOptionsForQuestion = /**
368
- * @private
369
- * @param {?} question
370
- * @param {?} additionalData
371
- * @param {?} currentQuestionnaireForm
372
- * @param {?=} repeaterItem
373
- * @return {?}
374
- */
375
- function (question, additionalData, currentQuestionnaireForm, repeaterItem) {
351
+ FilterService.prototype.getFetchOptionsForQuestion = function (question, additionalData, currentQuestionnaireForm, repeaterItem) {
376
352
  if (!question.fetchPath) {
377
353
  return question.selectOptions;
378
354
  }
379
- /** @type {?} */
380
355
  var options = additionalData[question.fetchPath];
381
356
  if (question.fetchSelectors && question.fetchSelectors.length > 0) {
382
- /** @type {?} */
383
357
  var values = this.getValuesForArray(question.fetchSelectors, currentQuestionnaireForm, additionalData, repeaterItem);
384
358
  options = lodash.get(additionalData[question.fetchPath], values);
385
359
  }
@@ -389,17 +363,7 @@
389
363
  }
390
364
  return question.selectOptions.concat(options);
391
365
  };
392
- /**
393
- * @private
394
- * @param {?} items
395
- * @return {?}
396
- */
397
- FilterService.prototype.getFinalFetchArray = /**
398
- * @private
399
- * @param {?} items
400
- * @return {?}
401
- */
402
- function (items) {
366
+ FilterService.prototype.getFinalFetchArray = function (items) {
403
367
  var e_5, _a;
404
368
  if (!items) {
405
369
  return null;
@@ -410,7 +374,6 @@
410
374
  if (items.length <= 0) {
411
375
  return null;
412
376
  }
413
- /** @type {?} */
414
377
  var convertedArray = [];
415
378
  try {
416
379
  for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
@@ -434,17 +397,10 @@
434
397
  }
435
398
  return convertedArray;
436
399
  };
437
- /**
438
- * @private
439
- * @param {?} item
440
- * @return {?}
441
- */
442
- FilterService.prototype.uppercase = /**
443
- * @private
444
- * @param {?} item
445
- * @return {?}
446
- */
447
- function (item) {
400
+ FilterService.prototype.uppercase = function (item) {
401
+ if (!isNaN(item)) {
402
+ return item;
403
+ }
448
404
  return item.charAt(0).toUpperCase() + item.slice(1);
449
405
  };
450
406
  /**
@@ -454,38 +410,14 @@
454
410
  * @returns A boolean stating if the condition groups conditions has been met.
455
411
  * @author Will Poulson
456
412
  */
457
- /**
458
- * Checks if each condition groups conditions have been met.
459
- * @author Will Poulson
460
- * @private
461
- * @param {?} conditionGroups The array of condition groups.
462
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
463
- * @param {?=} additionalData
464
- * @param {?=} repeaterItem
465
- * @return {?} A boolean stating if the condition groups conditions has been met.
466
- */
467
- FilterService.prototype.meetsConditionGroups = /**
468
- * Checks if each condition groups conditions have been met.
469
- * @author Will Poulson
470
- * @private
471
- * @param {?} conditionGroups The array of condition groups.
472
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
473
- * @param {?=} additionalData
474
- * @param {?=} repeaterItem
475
- * @return {?} A boolean stating if the condition groups conditions has been met.
476
- */
477
- function (conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem) {
413
+ FilterService.prototype.meetsConditionGroups = function (conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem) {
478
414
  var _this = this;
479
415
  if (!conditionGroups || conditionGroups.length === 0) {
480
416
  return true;
481
417
  }
482
- return conditionGroups.every((/**
483
- * @param {?} x
484
- * @return {?}
485
- */
486
- function (x) {
418
+ return conditionGroups.every(function (x) {
487
419
  return _this.meetsConditionGroup(x, currentQuestionnaireForm, additionalData, repeaterItem) === true;
488
- }));
420
+ });
489
421
  };
490
422
  /**
491
423
  * Checks if a condition groups conditions have been met.
@@ -494,32 +426,11 @@
494
426
  * @returns A boolean stating if the condition group conditions has been met.
495
427
  * @author Will Poulson
496
428
  */
497
- /**
498
- * Checks if a condition groups conditions have been met.
499
- * @author Will Poulson
500
- * @private
501
- * @param {?} conditionGroup The condition group to check.
502
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
503
- * @param {?=} additionalData
504
- * @param {?=} repeaterItem
505
- * @return {?} A boolean stating if the condition group conditions has been met.
506
- */
507
- FilterService.prototype.meetsConditionGroup = /**
508
- * Checks if a condition groups conditions have been met.
509
- * @author Will Poulson
510
- * @private
511
- * @param {?} conditionGroup The condition group to check.
512
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
513
- * @param {?=} additionalData
514
- * @param {?=} repeaterItem
515
- * @return {?} A boolean stating if the condition group conditions has been met.
516
- */
517
- function (conditionGroup, currentQuestionnaireForm, additionalData, repeaterItem) {
429
+ FilterService.prototype.meetsConditionGroup = function (conditionGroup, currentQuestionnaireForm, additionalData, repeaterItem) {
518
430
  var e_6, _a;
519
431
  if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {
520
432
  return true;
521
433
  }
522
- /** @type {?} */
523
434
  var results = [];
524
435
  try {
525
436
  for (var _b = __values(conditionGroup.conditions), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -535,22 +446,14 @@
535
446
  finally { if (e_6) throw e_6.error; }
536
447
  }
537
448
  switch (conditionGroup.relationship) {
538
- case ConditionRelationship.Every:
539
- return results.every((/**
540
- * @param {?} x
541
- * @return {?}
542
- */
543
- function (x) {
449
+ case exports.ConditionRelationship.Every:
450
+ return results.every(function (x) {
544
451
  return x === true;
545
- }));
546
- case ConditionRelationship.Any:
547
- return !!results.find((/**
548
- * @param {?} x
549
- * @return {?}
550
- */
551
- function (x) {
452
+ });
453
+ case exports.ConditionRelationship.Any:
454
+ return !!results.find(function (x) {
552
455
  return x === true;
553
- }));
456
+ });
554
457
  default:
555
458
  return true;
556
459
  }
@@ -562,52 +465,21 @@
562
465
  * @returns A boolean stating if the condition group conditions has been met.
563
466
  * @author Will Poulson
564
467
  */
565
- /**
566
- * Checks if a condition has been met.
567
- * @author Will Poulson
568
- * @private
569
- * @param {?} condition The condition to check.
570
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
571
- * @param {?=} additionalData
572
- * @param {?=} repeaterItem
573
- * @return {?} A boolean stating if the condition group conditions has been met.
574
- */
575
- FilterService.prototype.meetsCondition = /**
576
- * Checks if a condition has been met.
577
- * @author Will Poulson
578
- * @private
579
- * @param {?} condition The condition to check.
580
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
581
- * @param {?=} additionalData
582
- * @param {?=} repeaterItem
583
- * @return {?} A boolean stating if the condition group conditions has been met.
584
- */
585
- function (condition, currentQuestionnaireForm, additionalData, repeaterItem) {
468
+ FilterService.prototype.meetsCondition = function (condition, currentQuestionnaireForm, additionalData, repeaterItem) {
586
469
  var e_7, _a, e_8, _b;
587
- /** @type {?} */
588
470
  var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData, repeaterItem);
589
- /** @type {?} */
590
471
  var v2s = this.getValuesForArray(condition.v2s, currentQuestionnaireForm, additionalData, repeaterItem);
591
- /** @type {?} */
592
472
  var result = false;
593
473
  switch (condition.type) {
594
- case ConditionType.Excludes:
595
- result = v1s.filter((/**
596
- * @param {?} v1
597
- * @return {?}
598
- */
599
- function (v1) {
474
+ case exports.ConditionType.Excludes:
475
+ result = v1s.filter(function (v1) {
600
476
  return v2s.indexOf(v1) > -1;
601
- })).length === 0;
477
+ }).length === 0;
602
478
  break;
603
- case ConditionType.Includes:
604
- result = v1s.filter((/**
605
- * @param {?} v1
606
- * @return {?}
607
- */
608
- function (v1) {
479
+ case exports.ConditionType.Includes:
480
+ result = v1s.filter(function (v1) {
609
481
  return v2s.indexOf(v1) > -1;
610
- })).length !== 0;
482
+ }).length !== 0;
611
483
  break;
612
484
  default: try {
613
485
  for (var v2s_1 = __values(v2s), v2s_1_1 = v2s_1.next(); !v2s_1_1.done; v2s_1_1 = v2s_1.next()) {
@@ -616,28 +488,28 @@
616
488
  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()) {
617
489
  var v1 = v1s_1_1.value;
618
490
  switch (condition.type) {
619
- case ConditionType.EqualTo:
491
+ case exports.ConditionType.EqualTo:
620
492
  v1 = this.getStringForValue(v1);
621
493
  v2 = this.getStringForValue(v2);
622
494
  if (v1 === v2) {
623
495
  result = true;
624
496
  }
625
497
  break;
626
- case ConditionType.NotEqualTo:
498
+ case exports.ConditionType.NotEqualTo:
627
499
  v1 = this.getStringForValue(v1);
628
500
  v2 = this.getStringForValue(v2);
629
501
  if (v1 !== v2) {
630
502
  result = true;
631
503
  }
632
504
  break;
633
- case ConditionType.GreaterThan:
505
+ case exports.ConditionType.GreaterThan:
634
506
  v1 = parseFloat(v1);
635
507
  v2 = parseFloat(v2);
636
508
  if (v1 >= v2) {
637
509
  result = true;
638
510
  }
639
511
  break;
640
- case ConditionType.LessThan:
512
+ case exports.ConditionType.LessThan:
641
513
  v1 = parseFloat(v1);
642
514
  v2 = parseFloat(v2);
643
515
  if (v1 <= v2) {
@@ -666,17 +538,7 @@
666
538
  }
667
539
  return result;
668
540
  };
669
- /**
670
- * @private
671
- * @param {?} value
672
- * @return {?}
673
- */
674
- FilterService.prototype.getStringForValue = /**
675
- * @private
676
- * @param {?} value
677
- * @return {?}
678
- */
679
- function (value) {
541
+ FilterService.prototype.getStringForValue = function (value) {
680
542
  switch (value) {
681
543
  case null:
682
544
  return 'null';
@@ -691,35 +553,13 @@
691
553
  * @returns An array of strings/values
692
554
  * @author Will Poulson
693
555
  */
694
- /**
695
- * Gets the current values for an array of strings.
696
- * @author Will Poulson
697
- * @private
698
- * @param {?} paths The array of strings to check.
699
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
700
- * @param {?=} additionalData
701
- * @param {?=} repeaterItem
702
- * @return {?} An array of strings/values
703
- */
704
- FilterService.prototype.getValuesForArray = /**
705
- * Gets the current values for an array of strings.
706
- * @author Will Poulson
707
- * @private
708
- * @param {?} paths The array of strings to check.
709
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
710
- * @param {?=} additionalData
711
- * @param {?=} repeaterItem
712
- * @return {?} An array of strings/values
713
- */
714
- function (paths, currentQuestionnaireForm, additionalData, repeaterItem) {
556
+ FilterService.prototype.getValuesForArray = function (paths, currentQuestionnaireForm, additionalData, repeaterItem) {
715
557
  var e_9, _a;
716
558
  if (currentQuestionnaireForm) {
717
- /** @type {?} */
718
559
  var values = [];
719
560
  try {
720
561
  for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
721
562
  var path = paths_1_1.value;
722
- /** @type {?} */
723
563
  var value = this.getValueForString(path, currentQuestionnaireForm, additionalData, repeaterItem);
724
564
  values.push(value);
725
565
  }
@@ -744,37 +584,15 @@
744
584
  * @returns A string/value.
745
585
  * @author Will Poulson
746
586
  */
747
- /**
748
- * Gets a current value for a string.
749
- * @author Will Poulson
750
- * @private
751
- * @param {?} path The string value to check.
752
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
753
- * @param {?=} additionalData
754
- * @param {?=} repeaterItem
755
- * @return {?} A string/value.
756
- */
757
- FilterService.prototype.getValueForString = /**
758
- * Gets a current value for a string.
759
- * @author Will Poulson
760
- * @private
761
- * @param {?} path The string value to check.
762
- * @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
763
- * @param {?=} additionalData
764
- * @param {?=} repeaterItem
765
- * @return {?} A string/value.
766
- */
767
- function (path, currentQuestionnaireForm, additionalData, repeaterItem) {
587
+ FilterService.prototype.getValueForString = function (path, currentQuestionnaireForm, additionalData, repeaterItem) {
768
588
  if (currentQuestionnaireForm) {
769
589
  if (!additionalData) {
770
590
  additionalData = {};
771
591
  }
772
- /** @type {?} */
773
592
  var control = currentQuestionnaireForm.get(path.toString());
774
593
  if (!control && repeaterItem) {
775
594
  control = repeaterItem.get(path);
776
595
  }
777
- /** @type {?} */
778
596
  var value = control ? control.value : this.convertStringToValue(path);
779
597
  return lodash.get(additionalData, path, value);
780
598
  }
@@ -789,23 +607,7 @@
789
607
  * @returns Either a string or the converted value.
790
608
  * @author Will Poulson
791
609
  */
792
- /**
793
- * Converts a string to a value.
794
- * Eg. true/false.
795
- * @author Will Poulson
796
- * @private
797
- * @param {?} path The string value to check for conversion;
798
- * @return {?} Either a string or the converted value.
799
- */
800
- FilterService.prototype.convertStringToValue = /**
801
- * Converts a string to a value.
802
- * Eg. true/false.
803
- * @author Will Poulson
804
- * @private
805
- * @param {?} path The string value to check for conversion;
806
- * @return {?} Either a string or the converted value.
807
- */
808
- function (path) {
610
+ FilterService.prototype.convertStringToValue = function (path) {
809
611
  switch (path) {
810
612
  case 'true':
811
613
  return true;
@@ -817,35 +619,27 @@
817
619
  return path;
818
620
  }
819
621
  };
820
- FilterService.decorators = [
821
- { type: core.Injectable, args: [{
822
- providedIn: 'root'
823
- },] }
824
- ];
825
- /** @nocollapse */
826
- FilterService.ctorParameters = function () { return []; };
827
- /** @nocollapse */ FilterService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function FilterService_Factory() { return new FilterService(); }, token: FilterService, providedIn: "root" });
622
+ FilterService.ɵfac = function FilterService_Factory(t) { return new (t || FilterService)(); };
623
+ FilterService.ɵprov = core.ɵɵdefineInjectable({ token: FilterService, factory: FilterService.ɵfac, providedIn: 'root' });
828
624
  return FilterService;
829
625
  }());
626
+ /*@__PURE__*/ (function () { core.ɵsetClassMetadata(FilterService, [{
627
+ type: core.Injectable,
628
+ args: [{
629
+ providedIn: 'root'
630
+ }]
631
+ }], function () { return []; }, null); })();
632
+
830
633
 
831
- /**
832
- * @fileoverview added by tsickle
833
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
834
- */
835
- /** @enum {string} */
836
- var ValidationType = {
837
- Required: 'required',
838
- Boolean: 'boolean',
839
- Number: 'number',
840
- String: 'string',
841
- Email: 'email',
842
- Telephone: 'telephone',
843
- };
634
+ (function (ValidationType) {
635
+ ValidationType["Required"] = "required";
636
+ ValidationType["Boolean"] = "boolean";
637
+ ValidationType["Number"] = "number";
638
+ ValidationType["String"] = "string";
639
+ ValidationType["Email"] = "email";
640
+ ValidationType["Telephone"] = "telephone";
641
+ })(exports.ValidationType || (exports.ValidationType = {}));
844
642
 
845
- /**
846
- * @fileoverview added by tsickle
847
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
848
- */
849
643
  var FormConstructorService = /** @class */ (function () {
850
644
  function FormConstructorService(fb, filterService) {
851
645
  this.fb = fb;
@@ -858,62 +652,23 @@
858
652
  * @returns A filted form group.
859
653
  * @author Will Poulson
860
654
  */
861
- /**
862
- * Constructs a form group based on the questionnaire data.
863
- * This form group has been filtered down based on the conditions of the sections and questions.
864
- * @author Will Poulson
865
- * @param {?} questionnaire The questionnaire data to build the form group on.
866
- * @param {?} currentQuestionnaire
867
- * @param {?} currentQuestionnaireForm
868
- * @param {?=} additionalData
869
- * @param {?=} skipFilter
870
- * @return {?} A filted form group.
871
- */
872
- FormConstructorService.prototype.generateFormsForQuestionnaire = /**
873
- * Constructs a form group based on the questionnaire data.
874
- * This form group has been filtered down based on the conditions of the sections and questions.
875
- * @author Will Poulson
876
- * @param {?} questionnaire The questionnaire data to build the form group on.
877
- * @param {?} currentQuestionnaire
878
- * @param {?} currentQuestionnaireForm
879
- * @param {?=} additionalData
880
- * @param {?=} skipFilter
881
- * @return {?} A filted form group.
882
- */
883
- function (questionnaire, currentQuestionnaire, currentQuestionnaireForm, additionalData, skipFilter) {
884
- /** @type {?} */
655
+ FormConstructorService.prototype.generateFormsForQuestionnaire = function (questionnaire, currentQuestionnaire, currentQuestionnaireForm, additionalData, skipFilter) {
885
656
  var sections = skipFilter ?
886
657
  questionnaire.sections :
887
658
  this.filterService.filterSections(questionnaire.sections, currentQuestionnaireForm, additionalData);
888
- /** @type {?} */
889
659
  var noChange = currentQuestionnaireForm && (sections === currentQuestionnaire.sections);
890
660
  if (noChange && !skipFilter) {
891
661
  return null;
892
662
  }
893
- /** @type {?} */
894
663
  var questionnaireForms = this.generateFormsForSections(sections, currentQuestionnaireForm);
895
664
  return { sections: sections, forms: questionnaireForms };
896
665
  };
897
- /**
898
- * @private
899
- * @param {?} sections
900
- * @param {?} currentQuestionnaireForm
901
- * @return {?}
902
- */
903
- FormConstructorService.prototype.generateFormsForSections = /**
904
- * @private
905
- * @param {?} sections
906
- * @param {?} currentQuestionnaireForm
907
- * @return {?}
908
- */
909
- function (sections, currentQuestionnaireForm) {
666
+ FormConstructorService.prototype.generateFormsForSections = function (sections, currentQuestionnaireForm) {
910
667
  var e_1, _a;
911
- /** @type {?} */
912
668
  var questionnaireForms = this.fb.group({});
913
669
  try {
914
670
  for (var sections_1 = __values(sections), sections_1_1 = sections_1.next(); !sections_1_1.done; sections_1_1 = sections_1.next()) {
915
671
  var section = sections_1_1.value;
916
- /** @type {?} */
917
672
  var sectionForms = this.generateFormsForSection(section, currentQuestionnaireForm);
918
673
  questionnaireForms.addControl(section.name, sectionForms);
919
674
  }
@@ -934,35 +689,15 @@
934
689
  * @returns A filtered form group.
935
690
  * @author Will Poulson
936
691
  */
937
- /**
938
- * Constructs a form group based on the section data.
939
- * This form group has been filtered down based on the conditions of the questions.
940
- * @author Will Poulson
941
- * @private
942
- * @param {?} section The section data to build the form group on.
943
- * @param {?} currentQuestionnaireForm
944
- * @return {?} A filtered form group.
945
- */
946
- FormConstructorService.prototype.generateFormsForSection = /**
947
- * Constructs a form group based on the section data.
948
- * This form group has been filtered down based on the conditions of the questions.
949
- * @author Will Poulson
950
- * @private
951
- * @param {?} section The section data to build the form group on.
952
- * @param {?} currentQuestionnaireForm
953
- * @return {?} A filtered form group.
954
- */
955
- function (section, currentQuestionnaireForm) {
692
+ FormConstructorService.prototype.generateFormsForSection = function (section, currentQuestionnaireForm) {
956
693
  var e_2, _a;
957
- /** @type {?} */
958
694
  var sectionForms = this.fb.group({});
959
695
  try {
960
696
  for (var _b = __values(section.questions), _c = _b.next(); !_c.done; _c = _b.next()) {
961
697
  var question = _c.value;
962
- if (question.type === QuestionType.Info) {
698
+ if (question.type === exports.QuestionType.Info) {
963
699
  continue;
964
700
  }
965
- /** @type {?} */
966
701
  var questionControl = this.generateControlForQuestion(question, section, currentQuestionnaireForm);
967
702
  sectionForms.addControl(question.name, questionControl);
968
703
  }
@@ -982,65 +717,30 @@
982
717
  * @returns An abstract control.
983
718
  * @author Will Poulson
984
719
  */
985
- /**
986
- * Constructs an astract form control based on the question data.
987
- * @author Will Poulson
988
- * @private
989
- * @param {?} question The question data to build the abstract control on.
990
- * @param {?} section
991
- * @param {?} currentQuestionnaireForm
992
- * @return {?} An abstract control.
993
- */
994
- FormConstructorService.prototype.generateControlForQuestion = /**
995
- * Constructs an astract form control based on the question data.
996
- * @author Will Poulson
997
- * @private
998
- * @param {?} question The question data to build the abstract control on.
999
- * @param {?} section
1000
- * @param {?} currentQuestionnaireForm
1001
- * @return {?} An abstract control.
1002
- */
1003
- function (question, section, currentQuestionnaireForm) {
720
+ FormConstructorService.prototype.generateControlForQuestion = function (question, section, currentQuestionnaireForm) {
1004
721
  var e_3, _a;
1005
- /** @type {?} */
1006
722
  var convertedValidators = this.convertValidators(question.validators);
1007
- /** @type {?} */
1008
723
  var defaultValue = question.defaultValue ? question.defaultValue : null;
1009
724
  switch (question.type) {
1010
- case QuestionType.Repeater:
1011
- /** @type {?} */
725
+ case exports.QuestionType.Repeater:
1012
726
  var newArray = this.fb.array([], convertedValidators);
1013
- /** @type {?} */
1014
- var currentArray = currentQuestionnaireForm ? ((/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])))) : false;
727
+ var currentArray = currentQuestionnaireForm ? currentQuestionnaireForm.get([section.name, question.name]) : false;
1015
728
  if (currentArray && question.filteredRepeaterQuestions) {
1016
729
  var _loop_1 = function (control) {
1017
730
  var e_4, _a, e_5, _b;
1018
- /** @type {?} */
1019
731
  var index = currentArray.controls.indexOf(control);
1020
732
  if (index === -1) {
1021
733
  return "continue";
1022
734
  }
1023
- /** @type {?} */
1024
735
  var filteredQuestions = question.filteredRepeaterQuestions[index];
1025
736
  if (!filteredQuestions) {
1026
737
  return "continue";
1027
738
  }
1028
- /** @type {?} */
1029
- var filteredQuestionNames = filteredQuestions.map((/**
1030
- * @param {?} x
1031
- * @return {?}
1032
- */
1033
- function (x) { return x.name; }));
1034
- /** @type {?} */
1035
- var filteredOutQuestions = question.repeaterQuestions.filter((/**
1036
- * @param {?} x
1037
- * @return {?}
1038
- */
1039
- function (x) { return !filteredQuestionNames.includes(x.name); }));
739
+ var filteredQuestionNames = filteredQuestions.map(function (x) { return x.name; });
740
+ var filteredOutQuestions = question.repeaterQuestions.filter(function (x) { return !filteredQuestionNames.includes(x.name); });
1040
741
  try {
1041
742
  for (var filteredOutQuestions_1 = (e_4 = void 0, __values(filteredOutQuestions)), filteredOutQuestions_1_1 = filteredOutQuestions_1.next(); !filteredOutQuestions_1_1.done; filteredOutQuestions_1_1 = filteredOutQuestions_1.next()) {
1042
743
  var filteredOutQuestion = filteredOutQuestions_1_1.value;
1043
- /** @type {?} */
1044
744
  var childControl = control.get(filteredOutQuestion.name);
1045
745
  childControl.setValidators([]);
1046
746
  childControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });
@@ -1056,13 +756,11 @@
1056
756
  try {
1057
757
  for (var filteredQuestions_1 = (e_5 = void 0, __values(filteredQuestions)), filteredQuestions_1_1 = filteredQuestions_1.next(); !filteredQuestions_1_1.done; filteredQuestions_1_1 = filteredQuestions_1.next()) {
1058
758
  var filteredQuestion = filteredQuestions_1_1.value;
1059
- /** @type {?} */
1060
759
  var childControl = control.get(filteredQuestion.name);
1061
760
  if (childControl.value) {
1062
761
  // If there's a value just skip it, no need to redo the validators each time.
1063
762
  continue;
1064
763
  }
1065
- /** @type {?} */
1066
764
  var convertedValidators_1 = this_1.convertValidators(filteredQuestion.validators);
1067
765
  childControl.setValidators(convertedValidators_1);
1068
766
  childControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });
@@ -1092,9 +790,9 @@
1092
790
  }
1093
791
  }
1094
792
  return currentArray ? currentArray : newArray;
1095
- case QuestionType.Checklist:
793
+ case exports.QuestionType.Checklist:
1096
794
  return this.generateGroupForChecklist(question, convertedValidators);
1097
- case QuestionType.Slider:
795
+ case exports.QuestionType.Slider:
1098
796
  return this.fb.control(defaultValue, { validators: convertedValidators }); // Remove update on blur for sliders.
1099
797
  default:
1100
798
  return this.fb.control(defaultValue, { validators: convertedValidators, updateOn: 'blur' });
@@ -1106,33 +804,15 @@
1106
804
  * @returns A form group.
1107
805
  * @author Will Poulson
1108
806
  */
1109
- /**
1110
- * Generates the form group for a checklist question.
1111
- * @author Will Poulson
1112
- * @private
1113
- * @param {?} question The question. Must be of type checklist or else null is returned.
1114
- * @param {?} convertedValidators
1115
- * @return {?} A form group.
1116
- */
1117
- FormConstructorService.prototype.generateGroupForChecklist = /**
1118
- * Generates the form group for a checklist question.
1119
- * @author Will Poulson
1120
- * @private
1121
- * @param {?} question The question. Must be of type checklist or else null is returned.
1122
- * @param {?} convertedValidators
1123
- * @return {?} A form group.
1124
- */
1125
- function (question, convertedValidators) {
807
+ FormConstructorService.prototype.generateGroupForChecklist = function (question, convertedValidators) {
1126
808
  var e_6, _a;
1127
- if (question.type !== QuestionType.Checklist || question.checklistItems.length === 0) {
809
+ if (question.type !== exports.QuestionType.Checklist || question.checklistItems.length === 0) {
1128
810
  return null;
1129
811
  }
1130
- /** @type {?} */
1131
812
  var checklistForms = this.fb.group({});
1132
813
  try {
1133
814
  for (var _b = __values(question.checklistItems), _c = _b.next(); !_c.done; _c = _b.next()) {
1134
815
  var checklistItem = _c.value;
1135
- /** @type {?} */
1136
816
  var checklistItemControl = this.fb.control(null, convertedValidators);
1137
817
  checklistForms.addControl(checklistItem.name, checklistItemControl);
1138
818
  }
@@ -1152,32 +832,16 @@
1152
832
  * @returns A form group.
1153
833
  * @author Will Poulson
1154
834
  */
1155
- /**
1156
- * Generates the form template for a repeater question.
1157
- * @author Will Poulson
1158
- * @param {?} question The question. Must be of type repeater or else null is returned.
1159
- * @param {?=} index
1160
- * @return {?} A form group.
1161
- */
1162
- FormConstructorService.prototype.generateFormsForRepeater = /**
1163
- * Generates the form template for a repeater question.
1164
- * @author Will Poulson
1165
- * @param {?} question The question. Must be of type repeater or else null is returned.
1166
- * @param {?=} index
1167
- * @return {?} A form group.
1168
- */
1169
- function (question, index) {
835
+ FormConstructorService.prototype.generateFormsForRepeater = function (question, index) {
1170
836
  var e_7, _a;
1171
- if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {
837
+ if (question.type !== exports.QuestionType.Repeater || question.repeaterQuestions.length === 0) {
1172
838
  console.log('Question isnt a repeater or has no questions, returning null');
1173
839
  return null;
1174
840
  }
1175
- /** @type {?} */
1176
841
  var repeaterForms = this.fb.group({});
1177
842
  try {
1178
843
  for (var _b = __values(question.repeaterQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
1179
844
  var repeaterQuestion = _c.value;
1180
- /** @type {?} */
1181
845
  var repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);
1182
846
  repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);
1183
847
  }
@@ -1197,22 +861,7 @@
1197
861
  * @returns An abstract control.
1198
862
  * @author Will Poulson
1199
863
  */
1200
- /**
1201
- * Generates a control for a repeaters question.
1202
- * @author Will Poulson
1203
- * @private
1204
- * @param {?} repeaterQuestion A repeater question.
1205
- * @return {?} An abstract control.
1206
- */
1207
- FormConstructorService.prototype.generateControlForRepeaterQuestion = /**
1208
- * Generates a control for a repeaters question.
1209
- * @author Will Poulson
1210
- * @private
1211
- * @param {?} repeaterQuestion A repeater question.
1212
- * @return {?} An abstract control.
1213
- */
1214
- function (repeaterQuestion) {
1215
- /** @type {?} */
864
+ FormConstructorService.prototype.generateControlForRepeaterQuestion = function (repeaterQuestion) {
1216
865
  var convertedValidators = this.convertValidators(repeaterQuestion.validators);
1217
866
  return this.fb.control(null, { validators: convertedValidators, updateOn: repeaterQuestion.type === 'select' ? 'change' : 'blur' });
1218
867
  };
@@ -1222,31 +871,15 @@
1222
871
  * @returns A convered array of form validators.
1223
872
  * @author Will Poulson
1224
873
  */
1225
- /**
1226
- * Converts an array of validators into form validators.
1227
- * @author Will Poulson
1228
- * @private
1229
- * @param {?} validators The uncoverted array of validators.
1230
- * @return {?} A convered array of form validators.
1231
- */
1232
- FormConstructorService.prototype.convertValidators = /**
1233
- * Converts an array of validators into form validators.
1234
- * @author Will Poulson
1235
- * @private
1236
- * @param {?} validators The uncoverted array of validators.
1237
- * @return {?} A convered array of form validators.
1238
- */
1239
- function (validators) {
874
+ FormConstructorService.prototype.convertValidators = function (validators) {
1240
875
  var e_8, _a;
1241
876
  if (!validators || validators.length === 0) {
1242
877
  return [];
1243
878
  }
1244
- /** @type {?} */
1245
879
  var convertedValidators = [];
1246
880
  try {
1247
881
  for (var validators_1 = __values(validators), validators_1_1 = validators_1.next(); !validators_1_1.done; validators_1_1 = validators_1.next()) {
1248
882
  var validator = validators_1_1.value;
1249
- /** @type {?} */
1250
883
  var convertedValidator = this.convertValidator(validator);
1251
884
  if (convertedValidator) {
1252
885
  convertedValidators.push(convertedValidator);
@@ -1268,23 +901,9 @@
1268
901
  * @returns A converted form validator.
1269
902
  * @author Will Poulson
1270
903
  */
1271
- /**
1272
- * Converts a single validator into a form validator.
1273
- * @author Will Poulson
1274
- * @private
1275
- * @param {?} validator The unconverted validator.
1276
- * @return {?} A converted form validator.
1277
- */
1278
- FormConstructorService.prototype.convertValidator = /**
1279
- * Converts a single validator into a form validator.
1280
- * @author Will Poulson
1281
- * @private
1282
- * @param {?} validator The unconverted validator.
1283
- * @return {?} A converted form validator.
1284
- */
1285
- function (validator) {
904
+ FormConstructorService.prototype.convertValidator = function (validator) {
1286
905
  switch (validator.type) {
1287
- case ValidationType.Required:
906
+ case exports.ValidationType.Required:
1288
907
  return forms.Validators.required;
1289
908
  default:
1290
909
  return null;
@@ -1295,21 +914,7 @@
1295
914
  * @param savedState The saved state to load.
1296
915
  * @param sections The sections already generated by the form constructor.
1297
916
  */
1298
- /**
1299
- * Constructs the forms for repeaters from saved state.
1300
- * @param {?} savedState The saved state to load.
1301
- * @param {?} sections The sections already generated by the form constructor.
1302
- * @param {?} currentQuestionnaireForm
1303
- * @return {?}
1304
- */
1305
- FormConstructorService.prototype.constructRepeaterFromsFromState = /**
1306
- * Constructs the forms for repeaters from saved state.
1307
- * @param {?} savedState The saved state to load.
1308
- * @param {?} sections The sections already generated by the form constructor.
1309
- * @param {?} currentQuestionnaireForm
1310
- * @return {?}
1311
- */
1312
- function (savedState, sections, currentQuestionnaireForm) {
917
+ FormConstructorService.prototype.constructRepeaterFromsFromState = function (savedState, sections, currentQuestionnaireForm) {
1313
918
  var e_9, _a, e_10, _b, e_11, _c;
1314
919
  try {
1315
920
  for (var sections_2 = __values(sections), sections_2_1 = sections_2.next(); !sections_2_1.done; sections_2_1 = sections_2.next()) {
@@ -1317,16 +922,14 @@
1317
922
  try {
1318
923
  for (var _d = (e_10 = void 0, __values(section.questions)), _e = _d.next(); !_e.done; _e = _d.next()) {
1319
924
  var question = _e.value;
1320
- if (question.type !== QuestionType.Repeater) {
925
+ if (question.type !== exports.QuestionType.Repeater) {
1321
926
  continue;
1322
927
  }
1323
- /** @type {?} */
1324
928
  var repeaterArray = savedState[section.name][question.name];
1325
929
  if (!repeaterArray || repeaterArray.length === 0) {
1326
930
  continue;
1327
931
  }
1328
- /** @type {?} */
1329
- var repeaterFormArray = (/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])));
932
+ var repeaterFormArray = currentQuestionnaireForm.get([section.name, question.name]);
1330
933
  if (repeaterFormArray.controls.length === repeaterArray.length) {
1331
934
  continue;
1332
935
  }
@@ -1334,9 +937,7 @@
1334
937
  // For each item that used to be there push a new empty template there to be populated.
1335
938
  for (var repeaterArray_1 = (e_11 = void 0, __values(repeaterArray)), repeaterArray_1_1 = repeaterArray_1.next(); !repeaterArray_1_1.done; repeaterArray_1_1 = repeaterArray_1.next()) {
1336
939
  var repeaterItem = repeaterArray_1_1.value;
1337
- /** @type {?} */
1338
940
  var index = repeaterArray.indexOf(repeaterItem);
1339
- /** @type {?} */
1340
941
  var repeaterItemTemplate = this.generateFormsForRepeater(question, index);
1341
942
  repeaterFormArray.push(repeaterItemTemplate);
1342
943
  }
@@ -1367,36 +968,17 @@
1367
968
  finally { if (e_9) throw e_9.error; }
1368
969
  }
1369
970
  };
1370
- FormConstructorService.decorators = [
1371
- { type: core.Injectable, args: [{
1372
- providedIn: 'root'
1373
- },] }
1374
- ];
1375
- /** @nocollapse */
1376
- FormConstructorService.ctorParameters = function () { return [
1377
- { type: forms.FormBuilder },
1378
- { type: FilterService }
1379
- ]; };
1380
- /** @nocollapse */ FormConstructorService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function FormConstructorService_Factory() { return new FormConstructorService(core.ɵɵinject(forms.FormBuilder), core.ɵɵinject(FilterService)); }, token: FormConstructorService, providedIn: "root" });
971
+ FormConstructorService.ɵfac = function FormConstructorService_Factory(t) { return new (t || FormConstructorService)(core.ɵɵinject(forms.FormBuilder), core.ɵɵinject(FilterService)); };
972
+ FormConstructorService.ɵprov = core.ɵɵdefineInjectable({ token: FormConstructorService, factory: FormConstructorService.ɵfac, providedIn: 'root' });
1381
973
  return FormConstructorService;
1382
974
  }());
1383
- if (false) {
1384
- /**
1385
- * @type {?}
1386
- * @private
1387
- */
1388
- FormConstructorService.prototype.fb;
1389
- /**
1390
- * @type {?}
1391
- * @private
1392
- */
1393
- FormConstructorService.prototype.filterService;
1394
- }
975
+ /*@__PURE__*/ (function () { core.ɵsetClassMetadata(FormConstructorService, [{
976
+ type: core.Injectable,
977
+ args: [{
978
+ providedIn: 'root'
979
+ }]
980
+ }], function () { return [{ type: forms.FormBuilder }, { type: FilterService }]; }, null); })();
1395
981
 
1396
- /**
1397
- * @fileoverview added by tsickle
1398
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1399
- */
1400
982
  var QuestionnaireService = /** @class */ (function () {
1401
983
  function QuestionnaireService(formConstuctor, options) {
1402
984
  this.formConstuctor = formConstuctor;
@@ -1412,28 +994,11 @@
1412
994
  * @returns null
1413
995
  * @author Will Poulson
1414
996
  */
1415
- /**
1416
- * Loads a questionnaire from data.
1417
- * @author Will Poulson
1418
- * @param {?} questionnaire The questionnaire data to load, often parsed JSON from the editor.
1419
- * @param {?=} savedState The saved state of the questionnaire, often from localstorage.
1420
- * @param {?=} additionalData
1421
- * @return {?} null
1422
- */
1423
- QuestionnaireService.prototype.loadQuestionnaire = /**
1424
- * Loads a questionnaire from data.
1425
- * @author Will Poulson
1426
- * @param {?} questionnaire The questionnaire data to load, often parsed JSON from the editor.
1427
- * @param {?=} savedState The saved state of the questionnaire, often from localstorage.
1428
- * @param {?=} additionalData
1429
- * @return {?} null
1430
- */
1431
- function (questionnaire, savedState, additionalData) {
997
+ QuestionnaireService.prototype.loadQuestionnaire = function (questionnaire, savedState, additionalData) {
1432
998
  this.originalQuestionnaire = lodash.cloneDeep(questionnaire);
1433
999
  this.currentQuestionnaire = lodash.cloneDeep(questionnaire);
1434
1000
  this.additionalData = additionalData;
1435
1001
  if (savedState && Object.keys(savedState).length > 0) {
1436
- /** @type {?} */
1437
1002
  var newData = this.formConstuctor.generateFormsForQuestionnaire(lodash.cloneDeep(this.originalQuestionnaire), lodash.cloneDeep(this.currentQuestionnaire), this.currentQuestionnaireForm, this.additionalData, true);
1438
1003
  if (newData) {
1439
1004
  this.formConstuctor.constructRepeaterFromsFromState(savedState, newData.sections, newData.forms);
@@ -1455,33 +1020,10 @@
1455
1020
  * @returns null
1456
1021
  * @author Will Poulson
1457
1022
  */
1458
- /**
1459
- * Updates the current questionnaire, used when a value is updated to check conditions.
1460
- * @author Will Poulson
1461
- * @param {?=} savedState The saved state of the questionnaire, often from localstorage.
1462
- * @return {?} null
1463
- */
1464
- QuestionnaireService.prototype.updateQuestionnaire = /**
1465
- * Updates the current questionnaire, used when a value is updated to check conditions.
1466
- * @author Will Poulson
1467
- * @param {?=} savedState The saved state of the questionnaire, often from localstorage.
1468
- * @return {?} null
1469
- */
1470
- function (savedState) {
1023
+ QuestionnaireService.prototype.updateQuestionnaire = function (savedState) {
1471
1024
  var e_1, _a, e_2, _b;
1472
1025
  var _this = this;
1473
- /** @type {?} */
1474
- var oldLength = this.currentQuestionnaire.sections.map((/**
1475
- * @param {?} x
1476
- * @return {?}
1477
- */
1478
- function (x) { return x.questions.length; })).reduce((/**
1479
- * @param {?} a
1480
- * @param {?} b
1481
- * @return {?}
1482
- */
1483
- function (a, b) { return a + b; }), 0);
1484
- /** @type {?} */
1026
+ var oldLength = this.currentQuestionnaire.sections.map(function (x) { return x.questions.length; }).reduce(function (a, b) { return a + b; }, 0);
1485
1027
  var newData = this.formConstuctor.generateFormsForQuestionnaire(lodash.cloneDeep(this.originalQuestionnaire), lodash.cloneDeep(this.currentQuestionnaire), this.currentQuestionnaireForm, this.additionalData);
1486
1028
  if (newData) {
1487
1029
  this.currentQuestionnaireForm = newData.forms;
@@ -1496,32 +1038,16 @@
1496
1038
  if (this.questionValueChangeSubscription) {
1497
1039
  this.questionValueChangeSubscription.unsubscribe();
1498
1040
  }
1499
- this.questionnaireValueChangeSubscription = this.currentQuestionnaireForm.valueChanges.subscribe((/**
1500
- * @return {?}
1501
- */
1502
- function () {
1041
+ this.questionnaireValueChangeSubscription = this.currentQuestionnaireForm.valueChanges.subscribe(function () {
1503
1042
  _this.dataChangedEvent.emit();
1504
1043
  _this.updateQuestionnaire(_this.currentQuestionnaireForm.getRawValue());
1505
- }));
1044
+ });
1506
1045
  if (this.currentQuestion && this.currentQuestion.formControl) {
1507
- this.questionValueChangeSubscription = this.currentQuestion.formControl.valueChanges.subscribe((/**
1508
- * @return {?}
1509
- */
1510
- function () {
1046
+ this.questionValueChangeSubscription = this.currentQuestion.formControl.valueChanges.subscribe(function () {
1511
1047
  _this.clearFields(_this.currentQuestion.data.clearfields);
1512
- }));
1048
+ });
1513
1049
  }
1514
- /** @type {?} */
1515
- var newLength = this.currentQuestionnaire.sections.map((/**
1516
- * @param {?} x
1517
- * @return {?}
1518
- */
1519
- function (x) { return x.questions.length; })).reduce((/**
1520
- * @param {?} a
1521
- * @param {?} b
1522
- * @return {?}
1523
- */
1524
- function (a, b) { return a + b; }), 0);
1050
+ var newLength = this.currentQuestionnaire.sections.map(function (x) { return x.questions.length; }).reduce(function (a, b) { return a + b; }, 0);
1525
1051
  if (oldLength !== newLength) {
1526
1052
  try {
1527
1053
  for (var _c = __values(this.currentQuestionnaire.sections), _d = _c.next(); !_d.done; _d = _c.next()) {
@@ -1529,7 +1055,6 @@
1529
1055
  try {
1530
1056
  for (var _e = (e_2 = void 0, __values(section.questions)), _f = _e.next(); !_f.done; _f = _e.next()) {
1531
1057
  var question = _f.value;
1532
- /** @type {?} */
1533
1058
  var control = this.currentQuestionnaireForm.get([section.name, question.name]);
1534
1059
  if (control && control.value === null && question.defaultValue) {
1535
1060
  control.setValue(question.defaultValue);
@@ -1554,47 +1079,26 @@
1554
1079
  }
1555
1080
  }
1556
1081
  };
1557
- /**
1558
- * @param {?} payload
1559
- * @return {?}
1560
- */
1561
- QuestionnaireService.prototype.updateAdditionalData = /**
1562
- * @param {?} payload
1563
- * @return {?}
1564
- */
1565
- function (payload) {
1082
+ QuestionnaireService.prototype.updateAdditionalData = function (payload) {
1566
1083
  this.additionalData = Object.assign(this.additionalData, payload);
1567
1084
  this.updateQuestionnaire(this.currentQuestionnaireForm.getRawValue());
1568
1085
  };
1569
- /**
1570
- * @return {?}
1571
- */
1572
- QuestionnaireService.prototype.clearAdditionalData = /**
1573
- * @return {?}
1574
- */
1575
- function () {
1086
+ QuestionnaireService.prototype.clearAdditionalData = function () {
1576
1087
  this.additionalData = {};
1577
1088
  this.updateQuestionnaire(this.currentQuestionnaireForm.getRawValue());
1578
1089
  };
1579
1090
  Object.defineProperty(QuestionnaireService.prototype, "isValid", {
1580
- get: /**
1581
- * @return {?}
1582
- */
1583
- function () {
1091
+ get: function () {
1584
1092
  return this.currentQuestionnaireForm.valid;
1585
1093
  },
1586
1094
  enumerable: true,
1587
1095
  configurable: true
1588
1096
  });
1589
1097
  Object.defineProperty(QuestionnaireService.prototype, "isFirstQuestion", {
1590
- get: /**
1591
- * @return {?}
1592
- */
1593
- function () {
1098
+ get: function () {
1594
1099
  if (!this.currentSection || !this.currentQuestion) {
1595
1100
  return false;
1596
1101
  }
1597
- /** @type {?} */
1598
1102
  var currentIndex = this.currentSection.data.questions.indexOf(this.currentQuestion.data);
1599
1103
  return currentIndex === 0;
1600
1104
  },
@@ -1602,16 +1106,11 @@
1602
1106
  configurable: true
1603
1107
  });
1604
1108
  Object.defineProperty(QuestionnaireService.prototype, "isLastQuestion", {
1605
- get: /**
1606
- * @return {?}
1607
- */
1608
- function () {
1109
+ get: function () {
1609
1110
  if (!this.currentSection || !this.currentQuestion) {
1610
1111
  return false;
1611
1112
  }
1612
- /** @type {?} */
1613
1113
  var currentIndex = this.currentSection.data.questions.indexOf(this.currentQuestion.data);
1614
- /** @type {?} */
1615
1114
  var maxIndex = this.currentSection.data.questions.length - 1;
1616
1115
  return currentIndex === maxIndex;
1617
1116
  },
@@ -1619,14 +1118,10 @@
1619
1118
  configurable: true
1620
1119
  });
1621
1120
  Object.defineProperty(QuestionnaireService.prototype, "isFirstSection", {
1622
- get: /**
1623
- * @return {?}
1624
- */
1625
- function () {
1121
+ get: function () {
1626
1122
  if (!this.currentSection) {
1627
1123
  return false;
1628
1124
  }
1629
- /** @type {?} */
1630
1125
  var currentIndex = this.currentQuestionnaire.sections.indexOf(this.currentSection.data);
1631
1126
  return currentIndex === 0;
1632
1127
  },
@@ -1634,31 +1129,18 @@
1634
1129
  configurable: true
1635
1130
  });
1636
1131
  Object.defineProperty(QuestionnaireService.prototype, "isLastSection", {
1637
- get: /**
1638
- * @return {?}
1639
- */
1640
- function () {
1132
+ get: function () {
1641
1133
  if (!this.currentSection) {
1642
1134
  return false;
1643
1135
  }
1644
- /** @type {?} */
1645
1136
  var currentIndex = this.currentQuestionnaire.sections.indexOf(this.currentSection.data);
1646
- /** @type {?} */
1647
1137
  var maxIndex = this.currentQuestionnaire.sections.length - 1;
1648
1138
  return currentIndex === maxIndex;
1649
1139
  },
1650
1140
  enumerable: true,
1651
1141
  configurable: true
1652
1142
  });
1653
- /**
1654
- * @param {?} name
1655
- * @return {?}
1656
- */
1657
- QuestionnaireService.prototype.sectionValid = /**
1658
- * @param {?} name
1659
- * @return {?}
1660
- */
1661
- function (name) {
1143
+ QuestionnaireService.prototype.sectionValid = function (name) {
1662
1144
  return this.currentQuestionnaireForm.get(name).valid;
1663
1145
  };
1664
1146
  /**
@@ -1666,21 +1148,7 @@
1666
1148
  * @param clearfields An array of strings, paths to clear.
1667
1149
  * @author Will Poulson
1668
1150
  */
1669
- /**
1670
- * Clears all the fields parsed
1671
- * @author Will Poulson
1672
- * @private
1673
- * @param {?} clearfields An array of strings, paths to clear.
1674
- * @return {?}
1675
- */
1676
- QuestionnaireService.prototype.clearFields = /**
1677
- * Clears all the fields parsed
1678
- * @author Will Poulson
1679
- * @private
1680
- * @param {?} clearfields An array of strings, paths to clear.
1681
- * @return {?}
1682
- */
1683
- function (clearfields) {
1151
+ QuestionnaireService.prototype.clearFields = function (clearfields) {
1684
1152
  var e_3, _a;
1685
1153
  if (!clearfields || clearfields.length === 0) {
1686
1154
  return;
@@ -1688,7 +1156,6 @@
1688
1156
  try {
1689
1157
  for (var clearfields_1 = __values(clearfields), clearfields_1_1 = clearfields_1.next(); !clearfields_1_1.done; clearfields_1_1 = clearfields_1.next()) {
1690
1158
  var clearfield = clearfields_1_1.value;
1691
- /** @type {?} */
1692
1159
  var control = this.currentQuestionnaireForm.get(clearfield);
1693
1160
  if (control) {
1694
1161
  control.reset(undefined);
@@ -1708,19 +1175,7 @@
1708
1175
  * Useful when exiting a questionnaire page or completing a questionnaire.
1709
1176
  * @author Will Poulson
1710
1177
  */
1711
- /**
1712
- * Unloads the current questionnaire.
1713
- * Useful when exiting a questionnaire page or completing a questionnaire.
1714
- * @author Will Poulson
1715
- * @return {?}
1716
- */
1717
- QuestionnaireService.prototype.unloadQuestionnaire = /**
1718
- * Unloads the current questionnaire.
1719
- * Useful when exiting a questionnaire page or completing a questionnaire.
1720
- * @author Will Poulson
1721
- * @return {?}
1722
- */
1723
- function () {
1178
+ QuestionnaireService.prototype.unloadQuestionnaire = function () {
1724
1179
  this.originalQuestionnaire = undefined;
1725
1180
  this.currentQuestionnaireForm = undefined;
1726
1181
  this.currentQuestionnaire = undefined;
@@ -1734,30 +1189,20 @@
1734
1189
  * @returns An object containing the section data and the related form group.
1735
1190
  * @author Will Poulson
1736
1191
  */
1737
- get: /**
1738
- * Gets the current selected section.
1739
- * @author Will Poulson
1740
- * @return {?} An object containing the section data and the related form group.
1741
- */
1742
- function () {
1192
+ get: function () {
1743
1193
  var _this = this;
1744
1194
  if (!this.currentSectionName) {
1745
1195
  return null;
1746
1196
  }
1747
- /** @type {?} */
1748
- var data = this.currentQuestionnaire.sections.find((/**
1749
- * @param {?} x
1750
- * @return {?}
1751
- */
1752
- function (x) {
1197
+ var data = this.currentQuestionnaire.sections.find(function (x) {
1753
1198
  return x.name === _this.currentSectionName;
1754
- }));
1199
+ });
1755
1200
  if (!data) {
1756
1201
  return null;
1757
1202
  }
1758
1203
  return {
1759
1204
  data: data,
1760
- formGroup: (/** @type {?} */ (this.currentQuestionnaireForm.get(data.name)))
1205
+ formGroup: this.currentQuestionnaireForm.get(data.name)
1761
1206
  };
1762
1207
  },
1763
1208
  enumerable: true,
@@ -1769,12 +1214,7 @@
1769
1214
  * @returns An array of all avaialble sections.
1770
1215
  * @author Will Poulson
1771
1216
  */
1772
- get: /**
1773
- * Gets all the avaialble sections.
1774
- * @author Will Poulson
1775
- * @return {?} An array of all avaialble sections.
1776
- */
1777
- function () {
1217
+ get: function () {
1778
1218
  if (!this.currentQuestionnaire || !this.currentQuestionnaire.sections) {
1779
1219
  return [];
1780
1220
  }
@@ -1789,12 +1229,7 @@
1789
1229
  * @returns An object of data.
1790
1230
  * @author Will Poulson
1791
1231
  */
1792
- get: /**
1793
- * Gets the current data for the entire questionnaire.
1794
- * @author Will Poulson
1795
- * @return {?} An object of data.
1796
- */
1797
- function () {
1232
+ get: function () {
1798
1233
  return this.currentQuestionnaireForm ? this.currentQuestionnaireForm.getRawValue() : {};
1799
1234
  },
1800
1235
  enumerable: true,
@@ -1806,29 +1241,18 @@
1806
1241
  * @returns An object containing the question data and the related form control.
1807
1242
  * @author Will Poulson
1808
1243
  */
1809
- get: /**
1810
- * Gets the current selected question.
1811
- * @author Will Poulson
1812
- * @return {?} An object containing the question data and the related form control.
1813
- */
1814
- function () {
1244
+ get: function () {
1815
1245
  var _this = this;
1816
1246
  if (!this.currentQuestionName) {
1817
1247
  return null;
1818
1248
  }
1819
- /** @type {?} */
1820
- var data = this.currentSection.data.questions.find((/**
1821
- * @param {?} x
1822
- * @return {?}
1823
- */
1824
- function (x) {
1249
+ var data = this.currentSection.data.questions.find(function (x) {
1825
1250
  return x.name === _this.currentQuestionName;
1826
- }));
1251
+ });
1827
1252
  if (!data) {
1828
1253
  return null;
1829
1254
  }
1830
- /** @type {?} */
1831
- var formControl = (/** @type {?} */ (this.currentSection.formGroup.get(data.name)));
1255
+ var formControl = this.currentSection.formGroup.get(data.name);
1832
1256
  return {
1833
1257
  data: data,
1834
1258
  formControl: formControl
@@ -1845,70 +1269,31 @@
1845
1269
  * @returns A promise which will resolve when the question has been navigated to.
1846
1270
  * @author Will Poulson
1847
1271
  */
1848
- /**
1849
- * Navigates to the next question.
1850
- * If there is no question to navigate to it will reject with a out of bounds exception.
1851
- * If allowSkipRequiredField is false then it will reject if the current question is invalid.
1852
- * If emitSectionFinishEvent is true then it will emit an event if it's navigating past the length of questions.
1853
- * @author Will Poulson
1854
- * @return {?} A promise which will resolve when the question has been navigated to.
1855
- */
1856
- QuestionnaireService.prototype.nextQuestion = /**
1857
- * Navigates to the next question.
1858
- * If there is no question to navigate to it will reject with a out of bounds exception.
1859
- * If allowSkipRequiredField is false then it will reject if the current question is invalid.
1860
- * If emitSectionFinishEvent is true then it will emit an event if it's navigating past the length of questions.
1861
- * @author Will Poulson
1862
- * @return {?} A promise which will resolve when the question has been navigated to.
1863
- */
1864
- function () {
1272
+ QuestionnaireService.prototype.nextQuestion = function () {
1865
1273
  var _this = this;
1866
- return new Promise((/**
1867
- * @param {?} resolve
1868
- * @param {?} reject
1869
- * @return {?}
1870
- */
1871
- function (resolve, reject) {
1274
+ return new Promise(function (resolve, reject) {
1872
1275
  if (!_this.options.allowSkipRequiredField) {
1873
1276
  if (_this.currentQuestion.formControl && !_this.currentQuestion.formControl.valid) {
1874
1277
  return reject('Current question is invalid');
1875
1278
  }
1876
1279
  }
1877
- _this.getCurrentQuestionIndex().then((/**
1878
- * @param {?} currentIndex
1879
- * @return {?}
1880
- */
1881
- function (currentIndex) {
1882
- /** @type {?} */
1280
+ _this.getCurrentQuestionIndex().then(function (currentIndex) {
1883
1281
  var lastQuestionIndex = _this.currentSection.data.questions.length - 1;
1884
- /** @type {?} */
1885
1282
  var isLastQuestion = lastQuestionIndex === currentIndex;
1886
1283
  if (isLastQuestion) {
1887
1284
  _this.sectionFinishedEvent.emit();
1888
1285
  return resolve();
1889
1286
  }
1890
- /** @type {?} */
1891
1287
  var newIndex = currentIndex + 1;
1892
- _this.navigateToQuestion(newIndex).then((/**
1893
- * @return {?}
1894
- */
1895
- function () {
1288
+ _this.navigateToQuestion(newIndex).then(function () {
1896
1289
  return resolve();
1897
- })).catch((/**
1898
- * @param {?} error
1899
- * @return {?}
1900
- */
1901
- function (error) {
1290
+ }).catch(function (error) {
1902
1291
  return reject(error);
1903
- }));
1904
- })).catch((/**
1905
- * @param {?} error
1906
- * @return {?}
1907
- */
1908
- function (error) {
1292
+ });
1293
+ }).catch(function (error) {
1909
1294
  return reject(error);
1910
- }));
1911
- }));
1295
+ });
1296
+ });
1912
1297
  };
1913
1298
  /**
1914
1299
  * Navigates to the previous question.
@@ -1917,91 +1302,38 @@
1917
1302
  * @returns A promise which will resolve when the question has been navigated to.
1918
1303
  * @author Will Poulson
1919
1304
  */
1920
- /**
1921
- * Navigates to the previous question.
1922
- * If there is no question to navigate to it will reject with a out of bounds exception.
1923
- * If allowNavigateBackwards is false then it will reject.
1924
- * @author Will Poulson
1925
- * @return {?} A promise which will resolve when the question has been navigated to.
1926
- */
1927
- QuestionnaireService.prototype.prevQuestion = /**
1928
- * Navigates to the previous question.
1929
- * If there is no question to navigate to it will reject with a out of bounds exception.
1930
- * If allowNavigateBackwards is false then it will reject.
1931
- * @author Will Poulson
1932
- * @return {?} A promise which will resolve when the question has been navigated to.
1933
- */
1934
- function () {
1305
+ QuestionnaireService.prototype.prevQuestion = function () {
1935
1306
  var _this = this;
1936
- return new Promise((/**
1937
- * @param {?} resolve
1938
- * @param {?} reject
1939
- * @return {?}
1940
- */
1941
- function (resolve, reject) {
1307
+ return new Promise(function (resolve, reject) {
1942
1308
  if (!_this.options.allowNavigateBackwards) {
1943
1309
  return reject('This questionnaire does not allow for backwards navigation');
1944
1310
  }
1945
- _this.getCurrentQuestionIndex().then((/**
1946
- * @param {?} currentIndex
1947
- * @return {?}
1948
- */
1949
- function (currentIndex) {
1950
- /** @type {?} */
1311
+ _this.getCurrentQuestionIndex().then(function (currentIndex) {
1951
1312
  var newIndex = currentIndex - 1;
1952
- _this.navigateToQuestion(newIndex).then((/**
1953
- * @return {?}
1954
- */
1955
- function () {
1313
+ _this.navigateToQuestion(newIndex).then(function () {
1956
1314
  return resolve();
1957
- })).catch((/**
1958
- * @param {?} error
1959
- * @return {?}
1960
- */
1961
- function (error) {
1315
+ }).catch(function (error) {
1962
1316
  return reject(error);
1963
- }));
1964
- })).catch((/**
1965
- * @param {?} error
1966
- * @return {?}
1967
- */
1968
- function (error) {
1317
+ });
1318
+ }).catch(function (error) {
1969
1319
  return reject(error);
1970
- }));
1971
- }));
1320
+ });
1321
+ });
1972
1322
  };
1973
1323
  /**
1974
1324
  * Gets the current questions index.
1975
1325
  * @returns A promise which resolves a number.
1976
1326
  * @author Will Poulson
1977
1327
  */
1978
- /**
1979
- * Gets the current questions index.
1980
- * @author Will Poulson
1981
- * @private
1982
- * @return {?} A promise which resolves a number.
1983
- */
1984
- QuestionnaireService.prototype.getCurrentQuestionIndex = /**
1985
- * Gets the current questions index.
1986
- * @author Will Poulson
1987
- * @private
1988
- * @return {?} A promise which resolves a number.
1989
- */
1990
- function () {
1328
+ QuestionnaireService.prototype.getCurrentQuestionIndex = function () {
1991
1329
  var _this = this;
1992
- return new Promise((/**
1993
- * @param {?} resolve
1994
- * @param {?} reject
1995
- * @return {?}
1996
- */
1997
- function (resolve, reject) {
1998
- /** @type {?} */
1330
+ return new Promise(function (resolve, reject) {
1999
1331
  var currentIndex = _this.currentSection.data.questions.indexOf(_this.currentQuestion.data);
2000
1332
  if (currentIndex === -1) {
2001
1333
  return reject('Could not find current question');
2002
1334
  }
2003
1335
  return resolve(currentIndex);
2004
- }));
1336
+ });
2005
1337
  };
2006
1338
  /**
2007
1339
  * Checks a question is in bounds then navigates to it.
@@ -2009,167 +1341,70 @@
2009
1341
  * @returns A promise which will resolve when the question has been navigated to.
2010
1342
  * @author Will Poulson
2011
1343
  */
2012
- /**
2013
- * Checks a question is in bounds then navigates to it.
2014
- * @author Will Poulson
2015
- * @param {?} index The index to navigate to.
2016
- * @return {?} A promise which will resolve when the question has been navigated to.
2017
- */
2018
- QuestionnaireService.prototype.navigateToQuestion = /**
2019
- * Checks a question is in bounds then navigates to it.
2020
- * @author Will Poulson
2021
- * @param {?} index The index to navigate to.
2022
- * @return {?} A promise which will resolve when the question has been navigated to.
2023
- */
2024
- function (index) {
1344
+ QuestionnaireService.prototype.navigateToQuestion = function (index) {
2025
1345
  var _this = this;
2026
- return new Promise((/**
2027
- * @param {?} resolve
2028
- * @param {?} reject
2029
- * @return {?}
2030
- */
2031
- function (resolve, reject) {
1346
+ return new Promise(function (resolve, reject) {
2032
1347
  if (_this.currentSection.data.questions.length - 1 < index || index < 0) {
2033
1348
  return reject('Out of bounds exception');
2034
1349
  }
2035
1350
  _this.currentQuestionName = _this.currentSection.data.questions[index].name;
2036
1351
  return resolve();
2037
- }));
1352
+ });
2038
1353
  };
2039
1354
  /**
2040
1355
  * Navigates to the next section.
2041
1356
  * @returns A promise which will resolve when the section has been navigated to.
2042
1357
  * @author Will Poulson
2043
1358
  */
2044
- /**
2045
- * Navigates to the next section.
2046
- * @author Will Poulson
2047
- * @return {?} A promise which will resolve when the section has been navigated to.
2048
- */
2049
- QuestionnaireService.prototype.nextSection = /**
2050
- * Navigates to the next section.
2051
- * @author Will Poulson
2052
- * @return {?} A promise which will resolve when the section has been navigated to.
2053
- */
2054
- function () {
1359
+ QuestionnaireService.prototype.nextSection = function () {
2055
1360
  var _this = this;
2056
- return new Promise((/**
2057
- * @param {?} resolve
2058
- * @param {?} reject
2059
- * @return {?}
2060
- */
2061
- function (resolve, reject) {
2062
- _this.getCurrentSectionIndex().then((/**
2063
- * @param {?} currentIndex
2064
- * @return {?}
2065
- */
2066
- function (currentIndex) {
2067
- /** @type {?} */
1361
+ return new Promise(function (resolve, reject) {
1362
+ _this.getCurrentSectionIndex().then(function (currentIndex) {
2068
1363
  var newIndex = currentIndex + 1;
2069
- _this.navigateToSection(newIndex).then((/**
2070
- * @return {?}
2071
- */
2072
- function () {
1364
+ _this.navigateToSection(newIndex).then(function () {
2073
1365
  return resolve();
2074
- })).catch((/**
2075
- * @param {?} error
2076
- * @return {?}
2077
- */
2078
- function (error) {
1366
+ }).catch(function (error) {
2079
1367
  return reject(error);
2080
- }));
2081
- })).catch((/**
2082
- * @param {?} error
2083
- * @return {?}
2084
- */
2085
- function (error) {
1368
+ });
1369
+ }).catch(function (error) {
2086
1370
  return reject(error);
2087
- }));
2088
- }));
1371
+ });
1372
+ });
2089
1373
  };
2090
1374
  /**
2091
1375
  * Navigates to the previous section.
2092
1376
  * @returns A promise which will resolve when the section has been navigated to.
2093
1377
  * @author Will Poulson
2094
1378
  */
2095
- /**
2096
- * Navigates to the previous section.
2097
- * @author Will Poulson
2098
- * @return {?} A promise which will resolve when the section has been navigated to.
2099
- */
2100
- QuestionnaireService.prototype.prevSection = /**
2101
- * Navigates to the previous section.
2102
- * @author Will Poulson
2103
- * @return {?} A promise which will resolve when the section has been navigated to.
2104
- */
2105
- function () {
1379
+ QuestionnaireService.prototype.prevSection = function () {
2106
1380
  var _this = this;
2107
- return new Promise((/**
2108
- * @param {?} resolve
2109
- * @param {?} reject
2110
- * @return {?}
2111
- */
2112
- function (resolve, reject) {
2113
- _this.getCurrentSectionIndex().then((/**
2114
- * @param {?} currentIndex
2115
- * @return {?}
2116
- */
2117
- function (currentIndex) {
2118
- /** @type {?} */
1381
+ return new Promise(function (resolve, reject) {
1382
+ _this.getCurrentSectionIndex().then(function (currentIndex) {
2119
1383
  var newIndex = currentIndex - 1;
2120
- _this.navigateToSection(newIndex).then((/**
2121
- * @return {?}
2122
- */
2123
- function () {
1384
+ _this.navigateToSection(newIndex).then(function () {
2124
1385
  return resolve();
2125
- })).catch((/**
2126
- * @param {?} error
2127
- * @return {?}
2128
- */
2129
- function (error) {
1386
+ }).catch(function (error) {
2130
1387
  return reject(error);
2131
- }));
2132
- })).catch((/**
2133
- * @param {?} error
2134
- * @return {?}
2135
- */
2136
- function (error) {
1388
+ });
1389
+ }).catch(function (error) {
2137
1390
  return reject(error);
2138
- }));
2139
- }));
1391
+ });
1392
+ });
2140
1393
  };
2141
1394
  /**
2142
1395
  * Gets the current section index.
2143
1396
  * @returns A promise which resolves a number.
2144
1397
  * @author Will Poulson
2145
1398
  */
2146
- /**
2147
- * Gets the current section index.
2148
- * @author Will Poulson
2149
- * @private
2150
- * @return {?} A promise which resolves a number.
2151
- */
2152
- QuestionnaireService.prototype.getCurrentSectionIndex = /**
2153
- * Gets the current section index.
2154
- * @author Will Poulson
2155
- * @private
2156
- * @return {?} A promise which resolves a number.
2157
- */
2158
- function () {
1399
+ QuestionnaireService.prototype.getCurrentSectionIndex = function () {
2159
1400
  var _this = this;
2160
- return new Promise((/**
2161
- * @param {?} resolve
2162
- * @param {?} reject
2163
- * @return {?}
2164
- */
2165
- function (resolve, reject) {
2166
- /** @type {?} */
1401
+ return new Promise(function (resolve, reject) {
2167
1402
  var currentIndex = _this.currentQuestionnaire.sections.indexOf(_this.currentSection.data);
2168
1403
  if (currentIndex === -1) {
2169
1404
  return reject('Could not find current section');
2170
1405
  }
2171
1406
  return resolve(currentIndex);
2172
- }));
1407
+ });
2173
1408
  };
2174
1409
  /**
2175
1410
  * Checks a section is in bounds then navigates to it.
@@ -2177,53 +1412,22 @@
2177
1412
  * @returns A promise which will resolve when the section has been navigated to.
2178
1413
  * @author Will Poulson
2179
1414
  */
2180
- /**
2181
- * Checks a section is in bounds then navigates to it.
2182
- * @author Will Poulson
2183
- * @param {?} index The index to navigate to.
2184
- * @return {?} A promise which will resolve when the section has been navigated to.
2185
- */
2186
- QuestionnaireService.prototype.navigateToSection = /**
2187
- * Checks a section is in bounds then navigates to it.
2188
- * @author Will Poulson
2189
- * @param {?} index The index to navigate to.
2190
- * @return {?} A promise which will resolve when the section has been navigated to.
2191
- */
2192
- function (index) {
1415
+ QuestionnaireService.prototype.navigateToSection = function (index) {
2193
1416
  var _this = this;
2194
- return new Promise((/**
2195
- * @param {?} resolve
2196
- * @param {?} reject
2197
- * @return {?}
2198
- */
2199
- function (resolve, reject) {
1417
+ return new Promise(function (resolve, reject) {
2200
1418
  if (_this.currentQuestionnaire.sections.length - 1 < index || index < 0) {
2201
1419
  return reject('Out of bounds exception');
2202
1420
  }
2203
1421
  _this.currentSectionName = _this.currentQuestionnaire.sections[index].name;
2204
1422
  return resolve();
2205
- }));
1423
+ });
2206
1424
  };
2207
1425
  /**
2208
1426
  * Answers the current question with the parsed value.
2209
1427
  * @param answer The value to answer the question with.
2210
1428
  * @author Will Poulson
2211
1429
  */
2212
- /**
2213
- * Answers the current question with the parsed value.
2214
- * @author Will Poulson
2215
- * @param {?} answer The value to answer the question with.
2216
- * @param {?=} sendToNextQuestion
2217
- * @return {?}
2218
- */
2219
- QuestionnaireService.prototype.answerCurrentQuestion = /**
2220
- * Answers the current question with the parsed value.
2221
- * @author Will Poulson
2222
- * @param {?} answer The value to answer the question with.
2223
- * @param {?=} sendToNextQuestion
2224
- * @return {?}
2225
- */
2226
- function (answer, sendToNextQuestion) {
1430
+ QuestionnaireService.prototype.answerCurrentQuestion = function (answer, sendToNextQuestion) {
2227
1431
  var _this = this;
2228
1432
  if (!sendToNextQuestion) {
2229
1433
  this.currentQuestion.formControl.setValue(answer);
@@ -2231,18 +1435,12 @@
2231
1435
  }
2232
1436
  if (this.skippable) { // Timeout to prevent skipping glitch.
2233
1437
  this.skippable = false;
2234
- setTimeout((/**
2235
- * @return {?}
2236
- */
2237
- function () {
1438
+ setTimeout(function () {
2238
1439
  _this.currentQuestion.formControl.setValue(answer);
2239
- _this.nextQuestion().then((/**
2240
- * @return {?}
2241
- */
2242
- function () {
1440
+ _this.nextQuestion().then(function () {
2243
1441
  _this.skippable = true;
2244
- }));
2245
- }), 150);
1442
+ });
1443
+ }, 150);
2246
1444
  }
2247
1445
  };
2248
1446
  /**
@@ -2251,30 +1449,12 @@
2251
1449
  * @returns A promise which resolves when the repeater item has been added.
2252
1450
  * @author Will Poulson
2253
1451
  */
2254
- /**
2255
- * Adds a repeater item to the current question.
2256
- * Current question must be of type Repeater.
2257
- * @author Will Poulson
2258
- * @return {?} A promise which resolves when the repeater item has been added.
2259
- */
2260
- QuestionnaireService.prototype.addRepeaterItem = /**
2261
- * Adds a repeater item to the current question.
2262
- * Current question must be of type Repeater.
2263
- * @author Will Poulson
2264
- * @return {?} A promise which resolves when the repeater item has been added.
2265
- */
2266
- function () {
1452
+ QuestionnaireService.prototype.addRepeaterItem = function () {
2267
1453
  var _this = this;
2268
- return new Promise((/**
2269
- * @param {?} resolve
2270
- * @param {?} reject
2271
- * @return {?}
2272
- */
2273
- function (resolve, reject) {
2274
- if (_this.currentQuestion.data.type !== QuestionType.Repeater) {
1454
+ return new Promise(function (resolve, reject) {
1455
+ if (_this.currentQuestion.data.type !== exports.QuestionType.Repeater) {
2275
1456
  return reject("Current question isn't a repeater");
2276
1457
  }
2277
- /** @type {?} */
2278
1458
  var repeaterForm = _this.formConstuctor.generateFormsForRepeater(_this.currentQuestion.data);
2279
1459
  if (!repeaterForm) {
2280
1460
  return reject("Repeater template failed to generate. May be due to the repeater having no items in the editor.");
@@ -2284,7 +1464,7 @@
2284
1464
  }
2285
1465
  _this.currentQuestion.formControl.push(repeaterForm);
2286
1466
  return resolve();
2287
- }));
1467
+ });
2288
1468
  };
2289
1469
  /**
2290
1470
  * Removes a repeater item on the current question.
@@ -2293,29 +1473,10 @@
2293
1473
  * @returns A promise which resolves when the repeater item has been removed.
2294
1474
  * @author Will Poulson
2295
1475
  */
2296
- /**
2297
- * Removes a repeater item on the current question.
2298
- * Current question must be of type Repeater.
2299
- * @author Will Poulson
2300
- * @param {?} index The index at which to remove.
2301
- * @return {?} A promise which resolves when the repeater item has been removed.
2302
- */
2303
- QuestionnaireService.prototype.removeRepeaterItem = /**
2304
- * Removes a repeater item on the current question.
2305
- * Current question must be of type Repeater.
2306
- * @author Will Poulson
2307
- * @param {?} index The index at which to remove.
2308
- * @return {?} A promise which resolves when the repeater item has been removed.
2309
- */
2310
- function (index) {
1476
+ QuestionnaireService.prototype.removeRepeaterItem = function (index) {
2311
1477
  var _this = this;
2312
- return new Promise((/**
2313
- * @param {?} resolve
2314
- * @param {?} reject
2315
- * @return {?}
2316
- */
2317
- function (resolve, reject) {
2318
- if (_this.currentQuestion.data.type !== QuestionType.Repeater) {
1478
+ return new Promise(function (resolve, reject) {
1479
+ if (_this.currentQuestion.data.type !== exports.QuestionType.Repeater) {
2319
1480
  return reject("Current question isn't a repeater");
2320
1481
  }
2321
1482
  if (!(_this.currentQuestion.formControl instanceof forms.FormArray)) {
@@ -2323,7 +1484,7 @@
2323
1484
  }
2324
1485
  _this.currentQuestion.formControl.removeAt(index);
2325
1486
  return resolve();
2326
- }));
1487
+ });
2327
1488
  };
2328
1489
  /**
2329
1490
  * Returns the display text for a given repeater item
@@ -2331,43 +1492,24 @@
2331
1492
  * @returns A string which is the display text.
2332
1493
  * @author Will Poulson
2333
1494
  */
2334
- /**
2335
- * Returns the display text for a given repeater item
2336
- * @author Will Poulson
2337
- * @param {?} index The index at which to get the label for.
2338
- * @return {?} A string which is the display text.
2339
- */
2340
- QuestionnaireService.prototype.getRepeaterItemLabel = /**
2341
- * Returns the display text for a given repeater item
2342
- * @author Will Poulson
2343
- * @param {?} index The index at which to get the label for.
2344
- * @return {?} A string which is the display text.
2345
- */
2346
- function (index) {
1495
+ QuestionnaireService.prototype.getRepeaterItemLabel = function (index) {
2347
1496
  var e_4, _a;
2348
1497
  if (!this.currentQuestion.formControl || !(this.currentQuestion.formControl instanceof forms.FormArray)) {
2349
1498
  return '';
2350
1499
  }
2351
- /** @type {?} */
2352
1500
  var repeaterItem = this.currentQuestion.formControl.controls[index];
2353
1501
  if (!repeaterItem) {
2354
1502
  return '';
2355
1503
  }
2356
- /** @type {?} */
2357
1504
  var template = this.currentQuestion.data.repeaterDisplayName;
2358
- /** @type {?} */
2359
1505
  var splitTemplate = template.split(' ');
2360
- /** @type {?} */
2361
1506
  var displayArray = [];
2362
1507
  try {
2363
1508
  for (var splitTemplate_1 = __values(splitTemplate), splitTemplate_1_1 = splitTemplate_1.next(); !splitTemplate_1_1.done; splitTemplate_1_1 = splitTemplate_1.next()) {
2364
1509
  var templateItem = splitTemplate_1_1.value;
2365
1510
  if (templateItem.match(/\[.*?\]/)) {
2366
- /** @type {?} */
2367
1511
  var path = templateItem.replace(/[\[\]']+/g, '');
2368
- /** @type {?} */
2369
1512
  var item = repeaterItem.get(path);
2370
- /** @type {?} */
2371
1513
  var value = (item && item.value ? item.value : '?');
2372
1514
  displayArray.push(value);
2373
1515
  }
@@ -2383,98 +1525,27 @@
2383
1525
  }
2384
1526
  finally { if (e_4) throw e_4.error; }
2385
1527
  }
2386
- /** @type {?} */
2387
1528
  var display = displayArray.join(' ');
2388
1529
  return display;
2389
1530
  };
2390
- QuestionnaireService.decorators = [
2391
- { type: core.Injectable, args: [{
2392
- providedIn: 'root'
2393
- },] }
2394
- ];
2395
- /** @nocollapse */
2396
- QuestionnaireService.ctorParameters = function () { return [
2397
- { type: FormConstructorService },
2398
- { type: undefined, decorators: [{ type: core.Inject, args: ['options',] }] }
2399
- ]; };
2400
- /** @nocollapse */ QuestionnaireService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function QuestionnaireService_Factory() { return new QuestionnaireService(core.ɵɵinject(FormConstructorService), core.ɵɵinject("options")); }, token: QuestionnaireService, providedIn: "root" });
1531
+ QuestionnaireService.ɵfac = function QuestionnaireService_Factory(t) { return new (t || QuestionnaireService)(core.ɵɵinject(FormConstructorService), core.ɵɵinject('options')); };
1532
+ QuestionnaireService.ɵprov = core.ɵɵdefineInjectable({ token: QuestionnaireService, factory: QuestionnaireService.ɵfac, providedIn: 'root' });
2401
1533
  return QuestionnaireService;
2402
1534
  }());
2403
- if (false) {
2404
- /** @type {?} */
2405
- QuestionnaireService.prototype.dataChangedEvent;
2406
- /** @type {?} */
2407
- QuestionnaireService.prototype.sectionFinishedEvent;
2408
- /**
2409
- * @type {?}
2410
- * @private
2411
- */
2412
- QuestionnaireService.prototype.originalQuestionnaire;
2413
- /**
2414
- * @type {?}
2415
- * @private
2416
- */
2417
- QuestionnaireService.prototype.currentQuestionnaire;
2418
- /**
2419
- * @type {?}
2420
- * @private
2421
- */
2422
- QuestionnaireService.prototype.currentQuestionnaireForm;
2423
- /**
2424
- * @type {?}
2425
- * @private
2426
- */
2427
- QuestionnaireService.prototype.currentSectionName;
2428
- /**
2429
- * @type {?}
2430
- * @private
2431
- */
2432
- QuestionnaireService.prototype.currentQuestionName;
2433
- /**
2434
- * @type {?}
2435
- * @private
2436
- */
2437
- QuestionnaireService.prototype.questionnaireValueChangeSubscription;
2438
- /**
2439
- * @type {?}
2440
- * @private
2441
- */
2442
- QuestionnaireService.prototype.questionValueChangeSubscription;
2443
- /** @type {?} */
2444
- QuestionnaireService.prototype.additionalData;
2445
- /**
2446
- * @type {?}
2447
- * @private
2448
- */
2449
- QuestionnaireService.prototype.skippable;
2450
- /**
2451
- * @type {?}
2452
- * @private
2453
- */
2454
- QuestionnaireService.prototype.formConstuctor;
2455
- /**
2456
- * @type {?}
2457
- * @private
2458
- */
2459
- QuestionnaireService.prototype.options;
2460
- }
1535
+ /*@__PURE__*/ (function () { core.ɵsetClassMetadata(QuestionnaireService, [{
1536
+ type: core.Injectable,
1537
+ args: [{
1538
+ providedIn: 'root'
1539
+ }]
1540
+ }], function () { return [{ type: FormConstructorService }, { type: undefined, decorators: [{
1541
+ type: core.Inject,
1542
+ args: ['options']
1543
+ }] }]; }, null); })();
2461
1544
 
2462
- /**
2463
- * @fileoverview added by tsickle
2464
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2465
- */
2466
1545
  var GgQuestionnaireV2Module = /** @class */ (function () {
2467
1546
  function GgQuestionnaireV2Module() {
2468
1547
  }
2469
- /**
2470
- * @param {?} options
2471
- * @return {?}
2472
- */
2473
- GgQuestionnaireV2Module.forRoot = /**
2474
- * @param {?} options
2475
- * @return {?}
2476
- */
2477
- function (options) {
1548
+ GgQuestionnaireV2Module.forRoot = function (options) {
2478
1549
  return {
2479
1550
  ngModule: GgQuestionnaireV2Module,
2480
1551
  providers: [
@@ -2486,64 +1557,59 @@
2486
1557
  ]
2487
1558
  };
2488
1559
  };
2489
- GgQuestionnaireV2Module.decorators = [
2490
- { type: core.NgModule, args: [{
2491
- declarations: [],
2492
- providers: [
2493
- FormConstructorService,
2494
- FilterService
2495
- ],
2496
- imports: [
2497
- forms.FormsModule,
2498
- forms.ReactiveFormsModule
2499
- ],
2500
- },] }
2501
- ];
1560
+ GgQuestionnaireV2Module.ɵmod = core.ɵɵdefineNgModule({ type: GgQuestionnaireV2Module });
1561
+ GgQuestionnaireV2Module.ɵinj = core.ɵɵdefineInjector({ factory: function GgQuestionnaireV2Module_Factory(t) { return new (t || GgQuestionnaireV2Module)(); }, providers: [
1562
+ FormConstructorService,
1563
+ FilterService
1564
+ ], imports: [[
1565
+ forms.FormsModule,
1566
+ forms.ReactiveFormsModule
1567
+ ]] });
2502
1568
  return GgQuestionnaireV2Module;
2503
1569
  }());
1570
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && core.ɵɵsetNgModuleScope(GgQuestionnaireV2Module, { imports: [forms.FormsModule,
1571
+ forms.ReactiveFormsModule] }); })();
1572
+ /*@__PURE__*/ (function () { core.ɵsetClassMetadata(GgQuestionnaireV2Module, [{
1573
+ type: core.NgModule,
1574
+ args: [{
1575
+ declarations: [],
1576
+ providers: [
1577
+ FormConstructorService,
1578
+ FilterService
1579
+ ],
1580
+ imports: [
1581
+ forms.FormsModule,
1582
+ forms.ReactiveFormsModule
1583
+ ],
1584
+ }]
1585
+ }], null, null); })();
1586
+
1587
+
1588
+ (function (InputType) {
1589
+ InputType["Text"] = "text";
1590
+ InputType["Number"] = "number";
1591
+ InputType["Email"] = "email";
1592
+ InputType["Telephone"] = "tel";
1593
+ InputType["Password"] = "password";
1594
+ InputType["Color"] = "color";
1595
+ InputType["Date"] = "date";
1596
+ InputType["DateTimeLocal"] = "datetime-local";
1597
+ InputType["Time"] = "time";
1598
+ InputType["Month"] = "month";
1599
+ InputType["Week"] = "week";
1600
+ })(exports.InputType || (exports.InputType = {}));
2504
1601
 
2505
- /**
2506
- * @fileoverview added by tsickle
2507
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2508
- */
2509
- /** @enum {string} */
2510
- var InputType = {
2511
- Text: 'text',
2512
- Number: 'number',
2513
- Email: 'email',
2514
- Telephone: 'tel',
2515
- Password: 'password',
2516
- Color: 'color',
2517
- Date: 'date',
2518
- DateTimeLocal: 'datetime-local',
2519
- Time: 'time',
2520
- Month: 'month',
2521
- Week: 'week',
2522
- };
2523
1602
 
2524
- /**
2525
- * @fileoverview added by tsickle
2526
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2527
- */
2528
- /** @enum {string} */
2529
- var RepeaterQuestionType = {
2530
- Input: 'input',
2531
- Select: 'select',
2532
- Upload: 'upload',
2533
- };
1603
+ (function (RepeaterQuestionType) {
1604
+ RepeaterQuestionType["Input"] = "input";
1605
+ RepeaterQuestionType["Select"] = "select";
1606
+ RepeaterQuestionType["Upload"] = "upload";
1607
+ })(exports.RepeaterQuestionType || (exports.RepeaterQuestionType = {}));
2534
1608
 
2535
- exports.ConditionRelationship = ConditionRelationship;
2536
- exports.ConditionType = ConditionType;
2537
1609
  exports.GgQuestionnaireV2Module = GgQuestionnaireV2Module;
2538
- exports.InputType = InputType;
2539
- exports.QuestionType = QuestionType;
2540
1610
  exports.QuestionnaireService = QuestionnaireService;
2541
- exports.RepeaterQuestionType = RepeaterQuestionType;
2542
- exports.ValidationType = ValidationType;
2543
- exports.ɵa = FormConstructorService;
2544
- exports.ɵb = FilterService;
2545
1611
 
2546
1612
  Object.defineProperty(exports, '__esModule', { value: true });
2547
1613
 
2548
- }));
1614
+ })));
2549
1615
  //# sourceMappingURL=glowgreen-gg-questionnaire-v2.umd.js.map