@glowgreen/gg-questionnaire-v2 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/glowgreen-gg-questionnaire-v2.umd.js +49 -22
- package/bundles/glowgreen-gg-questionnaire-v2.umd.js.map +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js.map +1 -1
- package/esm2015/lib/services/filter.service.js +34 -18
- package/esm2015/lib/services/form-constructor.service.js +4 -3
- package/esm2015/lib/services/questionnaire.service.js +12 -4
- package/esm5/lib/services/filter.service.js +40 -18
- package/esm5/lib/services/form-constructor.service.js +5 -3
- package/esm5/lib/services/questionnaire.service.js +13 -4
- package/fesm2015/glowgreen-gg-questionnaire-v2.js +42 -23
- package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/fesm5/glowgreen-gg-questionnaire-v2.js +50 -23
- package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/glowgreen-gg-questionnaire-v2.metadata.json +1 -1
- package/lib/services/filter.service.d.ts +1 -1
- package/lib/services/form-constructor.service.d.ts +1 -1
- package/lib/services/questionnaire.service.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __values, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { cloneDeep } from 'lodash';
|
|
2
|
+
import { get, cloneDeep } from 'lodash';
|
|
3
3
|
import { Injectable, NgModule, defineInjectable, inject, EventEmitter, Inject } from '@angular/core';
|
|
4
4
|
import { FormBuilder, Validators, FormsModule, ReactiveFormsModule, FormArray } from '@angular/forms';
|
|
5
5
|
|
|
@@ -62,6 +62,7 @@ var FilterService = /** @class */ (function () {
|
|
|
62
62
|
* @author Will Poulson
|
|
63
63
|
* @param {?} sections The array of sections to filter.
|
|
64
64
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
65
|
+
* @param {?=} additionalData
|
|
65
66
|
* @return {?} An array of filtered sections with their filtered questions.
|
|
66
67
|
*/
|
|
67
68
|
FilterService.prototype.filterSections = /**
|
|
@@ -69,27 +70,28 @@ var FilterService = /** @class */ (function () {
|
|
|
69
70
|
* @author Will Poulson
|
|
70
71
|
* @param {?} sections The array of sections to filter.
|
|
71
72
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
73
|
+
* @param {?=} additionalData
|
|
72
74
|
* @return {?} An array of filtered sections with their filtered questions.
|
|
73
75
|
*/
|
|
74
|
-
function (sections, currentQuestionnaireForm) {
|
|
76
|
+
function (sections, currentQuestionnaireForm, additionalData) {
|
|
75
77
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
76
78
|
/** @type {?} */
|
|
77
79
|
var filteredSections = [];
|
|
78
80
|
try {
|
|
79
81
|
for (var sections_1 = __values(sections), sections_1_1 = sections_1.next(); !sections_1_1.done; sections_1_1 = sections_1.next()) {
|
|
80
82
|
var section = sections_1_1.value;
|
|
81
|
-
if (this.meetsConditionGroups(section.conditionGroups, currentQuestionnaireForm)) {
|
|
83
|
+
if (this.meetsConditionGroups(section.conditionGroups, currentQuestionnaireForm, additionalData)) {
|
|
82
84
|
/** @type {?} */
|
|
83
85
|
var filteredQuestions = [];
|
|
84
86
|
try {
|
|
85
87
|
for (var _d = __values(section.questions), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
86
88
|
var question = _e.value;
|
|
87
|
-
if (this.meetsConditionGroups(question.conditionGroups, currentQuestionnaireForm)) {
|
|
89
|
+
if (this.meetsConditionGroups(question.conditionGroups, currentQuestionnaireForm, additionalData)) {
|
|
88
90
|
if (question.repeaterQuestions) {
|
|
89
91
|
try {
|
|
90
92
|
for (var _f = __values(question.repeaterQuestions), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
91
93
|
var repeaterQuestion = _g.value;
|
|
92
|
-
if (this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm)) ;
|
|
94
|
+
if (this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData)) ;
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -138,6 +140,7 @@ var FilterService = /** @class */ (function () {
|
|
|
138
140
|
* @private
|
|
139
141
|
* @param {?} conditionGroups The array of condition groups.
|
|
140
142
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
143
|
+
* @param {?=} additionalData
|
|
141
144
|
* @return {?} A boolean stating if the condition groups conditions has been met.
|
|
142
145
|
*/
|
|
143
146
|
FilterService.prototype.meetsConditionGroups = /**
|
|
@@ -146,9 +149,10 @@ var FilterService = /** @class */ (function () {
|
|
|
146
149
|
* @private
|
|
147
150
|
* @param {?} conditionGroups The array of condition groups.
|
|
148
151
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
152
|
+
* @param {?=} additionalData
|
|
149
153
|
* @return {?} A boolean stating if the condition groups conditions has been met.
|
|
150
154
|
*/
|
|
151
|
-
function (conditionGroups, currentQuestionnaireForm) {
|
|
155
|
+
function (conditionGroups, currentQuestionnaireForm, additionalData) {
|
|
152
156
|
var _this = this;
|
|
153
157
|
if (!conditionGroups || conditionGroups.length === 0) {
|
|
154
158
|
return true;
|
|
@@ -158,7 +162,7 @@ var FilterService = /** @class */ (function () {
|
|
|
158
162
|
* @return {?}
|
|
159
163
|
*/
|
|
160
164
|
function (x) {
|
|
161
|
-
return _this.meetsConditionGroup(x, currentQuestionnaireForm) === true;
|
|
165
|
+
return _this.meetsConditionGroup(x, currentQuestionnaireForm, additionalData) === true;
|
|
162
166
|
}));
|
|
163
167
|
};
|
|
164
168
|
/**
|
|
@@ -174,6 +178,7 @@ var FilterService = /** @class */ (function () {
|
|
|
174
178
|
* @private
|
|
175
179
|
* @param {?} conditionGroup The condition group to check.
|
|
176
180
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
181
|
+
* @param {?=} additionalData
|
|
177
182
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
178
183
|
*/
|
|
179
184
|
FilterService.prototype.meetsConditionGroup = /**
|
|
@@ -182,9 +187,10 @@ var FilterService = /** @class */ (function () {
|
|
|
182
187
|
* @private
|
|
183
188
|
* @param {?} conditionGroup The condition group to check.
|
|
184
189
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
190
|
+
* @param {?=} additionalData
|
|
185
191
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
186
192
|
*/
|
|
187
|
-
function (conditionGroup, currentQuestionnaireForm) {
|
|
193
|
+
function (conditionGroup, currentQuestionnaireForm, additionalData) {
|
|
188
194
|
var e_4, _a;
|
|
189
195
|
if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {
|
|
190
196
|
return true;
|
|
@@ -194,7 +200,7 @@ var FilterService = /** @class */ (function () {
|
|
|
194
200
|
try {
|
|
195
201
|
for (var _b = __values(conditionGroup.conditions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
196
202
|
var condition = _c.value;
|
|
197
|
-
results.push(this.meetsCondition(condition, currentQuestionnaireForm));
|
|
203
|
+
results.push(this.meetsCondition(condition, currentQuestionnaireForm, additionalData));
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -238,6 +244,7 @@ var FilterService = /** @class */ (function () {
|
|
|
238
244
|
* @private
|
|
239
245
|
* @param {?} condition The condition to check.
|
|
240
246
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
247
|
+
* @param {?=} additionalData
|
|
241
248
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
242
249
|
*/
|
|
243
250
|
FilterService.prototype.meetsCondition = /**
|
|
@@ -246,14 +253,15 @@ var FilterService = /** @class */ (function () {
|
|
|
246
253
|
* @private
|
|
247
254
|
* @param {?} condition The condition to check.
|
|
248
255
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
256
|
+
* @param {?=} additionalData
|
|
249
257
|
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
250
258
|
*/
|
|
251
|
-
function (condition, currentQuestionnaireForm) {
|
|
259
|
+
function (condition, currentQuestionnaireForm, additionalData) {
|
|
252
260
|
var e_5, _a, e_6, _b;
|
|
253
261
|
/** @type {?} */
|
|
254
|
-
var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm);
|
|
262
|
+
var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData);
|
|
255
263
|
/** @type {?} */
|
|
256
|
-
var v2s = this.getValuesForArray(condition.v2s, currentQuestionnaireForm);
|
|
264
|
+
var v2s = this.getValuesForArray(condition.v2s, currentQuestionnaireForm, additionalData);
|
|
257
265
|
/** @type {?} */
|
|
258
266
|
var result = false;
|
|
259
267
|
switch (condition.type) {
|
|
@@ -363,6 +371,7 @@ var FilterService = /** @class */ (function () {
|
|
|
363
371
|
* @private
|
|
364
372
|
* @param {?} paths The array of strings to check.
|
|
365
373
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
374
|
+
* @param {?=} additionalData
|
|
366
375
|
* @return {?} An array of strings/values
|
|
367
376
|
*/
|
|
368
377
|
FilterService.prototype.getValuesForArray = /**
|
|
@@ -371,9 +380,10 @@ var FilterService = /** @class */ (function () {
|
|
|
371
380
|
* @private
|
|
372
381
|
* @param {?} paths The array of strings to check.
|
|
373
382
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
383
|
+
* @param {?=} additionalData
|
|
374
384
|
* @return {?} An array of strings/values
|
|
375
385
|
*/
|
|
376
|
-
function (paths, currentQuestionnaireForm) {
|
|
386
|
+
function (paths, currentQuestionnaireForm, additionalData) {
|
|
377
387
|
var e_7, _a;
|
|
378
388
|
if (currentQuestionnaireForm) {
|
|
379
389
|
/** @type {?} */
|
|
@@ -382,7 +392,7 @@ var FilterService = /** @class */ (function () {
|
|
|
382
392
|
for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
|
|
383
393
|
var path = paths_1_1.value;
|
|
384
394
|
/** @type {?} */
|
|
385
|
-
var value = this.getValueForString(path, currentQuestionnaireForm);
|
|
395
|
+
var value = this.getValueForString(path, currentQuestionnaireForm, additionalData);
|
|
386
396
|
values.push(value);
|
|
387
397
|
}
|
|
388
398
|
}
|
|
@@ -412,6 +422,7 @@ var FilterService = /** @class */ (function () {
|
|
|
412
422
|
* @private
|
|
413
423
|
* @param {?} path The string value to check.
|
|
414
424
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
425
|
+
* @param {?=} additionalData
|
|
415
426
|
* @return {?} A string/value.
|
|
416
427
|
*/
|
|
417
428
|
FilterService.prototype.getValueForString = /**
|
|
@@ -420,13 +431,23 @@ var FilterService = /** @class */ (function () {
|
|
|
420
431
|
* @private
|
|
421
432
|
* @param {?} path The string value to check.
|
|
422
433
|
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
434
|
+
* @param {?=} additionalData
|
|
423
435
|
* @return {?} A string/value.
|
|
424
436
|
*/
|
|
425
|
-
function (path, currentQuestionnaireForm) {
|
|
437
|
+
function (path, currentQuestionnaireForm, additionalData) {
|
|
426
438
|
if (currentQuestionnaireForm) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
439
|
+
if (additionalData) {
|
|
440
|
+
/** @type {?} */
|
|
441
|
+
var data = get(additionalData, path);
|
|
442
|
+
if (data) {
|
|
443
|
+
return data;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
/** @type {?} */
|
|
448
|
+
var control = currentQuestionnaireForm.get(path);
|
|
449
|
+
return control ? control.value : this.convertStringToValue(path);
|
|
450
|
+
}
|
|
430
451
|
}
|
|
431
452
|
else {
|
|
432
453
|
return this.convertStringToValue(path);
|
|
@@ -514,6 +535,7 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
514
535
|
* @author Will Poulson
|
|
515
536
|
* @param {?} questionnaire The questionnaire data to build the form group on.
|
|
516
537
|
* @param {?} currentQuestionnaireForm
|
|
538
|
+
* @param {?=} additionalData
|
|
517
539
|
* @param {?=} skipFilter
|
|
518
540
|
* @return {?} A filted form group.
|
|
519
541
|
*/
|
|
@@ -523,14 +545,15 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
523
545
|
* @author Will Poulson
|
|
524
546
|
* @param {?} questionnaire The questionnaire data to build the form group on.
|
|
525
547
|
* @param {?} currentQuestionnaireForm
|
|
548
|
+
* @param {?=} additionalData
|
|
526
549
|
* @param {?=} skipFilter
|
|
527
550
|
* @return {?} A filted form group.
|
|
528
551
|
*/
|
|
529
|
-
function (questionnaire, currentQuestionnaireForm, skipFilter) {
|
|
552
|
+
function (questionnaire, currentQuestionnaireForm, additionalData, skipFilter) {
|
|
530
553
|
/** @type {?} */
|
|
531
554
|
var sections = skipFilter ?
|
|
532
555
|
questionnaire.sections :
|
|
533
|
-
this.filterService.filterSections(questionnaire.sections, currentQuestionnaireForm);
|
|
556
|
+
this.filterService.filterSections(questionnaire.sections, currentQuestionnaireForm, additionalData);
|
|
534
557
|
/** @type {?} */
|
|
535
558
|
var questionnaireForms = this.generateFormsForSections(sections, currentQuestionnaireForm);
|
|
536
559
|
return { sections: sections, forms: questionnaireForms };
|
|
@@ -953,6 +976,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
953
976
|
* @author Will Poulson
|
|
954
977
|
* @param {?} questionnaire The questionnaire data to load, often parsed JSON from the editor.
|
|
955
978
|
* @param {?=} savedState The saved state of the questionnaire, often from localstorage.
|
|
979
|
+
* @param {?=} additionalData
|
|
956
980
|
* @return {?} null
|
|
957
981
|
*/
|
|
958
982
|
QuestionnaireService.prototype.loadQuestionnaire = /**
|
|
@@ -960,9 +984,10 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
960
984
|
* @author Will Poulson
|
|
961
985
|
* @param {?} questionnaire The questionnaire data to load, often parsed JSON from the editor.
|
|
962
986
|
* @param {?=} savedState The saved state of the questionnaire, often from localstorage.
|
|
987
|
+
* @param {?=} additionalData
|
|
963
988
|
* @return {?} null
|
|
964
989
|
*/
|
|
965
|
-
function (questionnaire, savedState) {
|
|
990
|
+
function (questionnaire, savedState, additionalData) {
|
|
966
991
|
return __awaiter(this, void 0, void 0, function () {
|
|
967
992
|
var e_1, _a, e_2, _b, newData, _c, _d, section, _e, _f, question, control;
|
|
968
993
|
return __generator(this, function (_g) {
|
|
@@ -970,8 +995,9 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
970
995
|
case 0:
|
|
971
996
|
this.originalQuestionnaire = cloneDeep(questionnaire);
|
|
972
997
|
this.currentQuestionnaire = cloneDeep(questionnaire);
|
|
998
|
+
this.additionalData = additionalData;
|
|
973
999
|
if (savedState && Object.keys(savedState).length > 0) {
|
|
974
|
-
newData = this.formConstuctor.generateFormsForQuestionnaire(cloneDeep(this.originalQuestionnaire), this.currentQuestionnaireForm, true);
|
|
1000
|
+
newData = this.formConstuctor.generateFormsForQuestionnaire(cloneDeep(this.originalQuestionnaire), this.currentQuestionnaireForm, this.additionalData, true);
|
|
975
1001
|
this.formConstuctor.constructRepeaterFromsFromState(savedState, newData.sections, newData.forms);
|
|
976
1002
|
this.currentQuestionnaireForm = newData.forms;
|
|
977
1003
|
this.currentQuestionnaireForm.patchValue(savedState);
|
|
@@ -1039,7 +1065,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1039
1065
|
function (savedState) {
|
|
1040
1066
|
var _this = this;
|
|
1041
1067
|
/** @type {?} */
|
|
1042
|
-
var newData = this.formConstuctor.generateFormsForQuestionnaire(cloneDeep(this.originalQuestionnaire), this.currentQuestionnaireForm);
|
|
1068
|
+
var newData = this.formConstuctor.generateFormsForQuestionnaire(cloneDeep(this.originalQuestionnaire), this.currentQuestionnaireForm, this.additionalData);
|
|
1043
1069
|
this.currentQuestionnaireForm = newData.forms;
|
|
1044
1070
|
this.currentQuestionnaire.sections = newData.sections;
|
|
1045
1071
|
if (savedState && Object.keys(savedState).length > 0) {
|
|
@@ -1154,6 +1180,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1154
1180
|
this.currentQuestionnaire = undefined;
|
|
1155
1181
|
this.currentSectionName = undefined;
|
|
1156
1182
|
this.currentQuestionName = undefined;
|
|
1183
|
+
this.additionalData = undefined;
|
|
1157
1184
|
};
|
|
1158
1185
|
Object.defineProperty(QuestionnaireService.prototype, "currentSection", {
|
|
1159
1186
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowgreen-gg-questionnaire-v2.js.map","sources":["ng://@glowgreen/gg-questionnaire-v2/lib/enums/question-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/condition-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/condition-relationship.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/services/filter.service.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/validation-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/services/form-constructor.service.ts","ng://@glowgreen/gg-questionnaire-v2/lib/services/questionnaire.service.ts","ng://@glowgreen/gg-questionnaire-v2/lib/gg-questionnaire-v2.module.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/input-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/repeater-question-type.enum.ts"],"sourcesContent":["export enum QuestionType {\n Input = 'input',\n Select = 'select',\n Textarea = 'textarea',\n Repeater = 'repeater',\n Checklist = 'checklist',\n Attachment = 'attachment',\n Upload = 'upload',\n Signature = 'signature',\n}\n","export enum ConditionType {\n EqualTo = 'equalTo',\n NotEqualTo = 'notEqualTo',\n LessThan = 'lessThan',\n GreaterThan = 'greaterThan',\n Includes = 'includes',\n Excludes = 'excludes'\n}\n","export enum ConditionRelationship {\n Every = 'every',\n Any = 'any',\n}\n","import { Injectable } from '@angular/core';\nimport { Section } from '../interfaces/section';\nimport { FormGroup } from '@angular/forms';\nimport { Condition } from '../interfaces/condition';\nimport { ConditionGroup } from '../interfaces/condition-group';\nimport { ConditionType } from '../enums/condition-type.enum';\nimport { ConditionRelationship } from '../enums/condition-relationship.enum';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FilterService {\n\n constructor() { }\n\n /**\n * Filters an array of sections based on their condition groups.\n * @param sections The array of sections to filter.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns An array of filtered sections with their filtered questions.\n * @author Will Poulson\n */\n public filterSections(sections: Array<Section>, currentQuestionnaireForm: FormGroup | null): Array<Section> {\n const filteredSections = [];\n for (const section of sections) {\n if (this.meetsConditionGroups(section.conditionGroups, currentQuestionnaireForm)) {\n const filteredQuestions = [];\n for (const question of section.questions) {\n if (this.meetsConditionGroups(question.conditionGroups, currentQuestionnaireForm)) {\n\n if (question.repeaterQuestions) {\n const filteredRepeaterQuestions = [];\n for (const repeaterQuestion of question.repeaterQuestions) {\n if (this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm)) {\n filteredRepeaterQuestions.push(repeaterQuestion);\n }\n }\n }\n\n filteredQuestions.push(question);\n }\n }\n section.questions = filteredQuestions;\n filteredSections.push(section);\n }\n }\n return filteredSections;\n }\n\n /**\n * Checks if each condition groups conditions have been met.\n * @param conditionGroups The array of condition groups.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A boolean stating if the condition groups conditions has been met.\n * @author Will Poulson\n */\n private meetsConditionGroups(conditionGroups: Array<ConditionGroup>, currentQuestionnaireForm: FormGroup | null): boolean {\n if (!conditionGroups || conditionGroups.length === 0) {\n return true;\n }\n return conditionGroups.every((x) => {\n return this.meetsConditionGroup(x, currentQuestionnaireForm) === true;\n });\n }\n\n /**\n * Checks if a condition groups conditions have been met.\n * @param conditionGroup The condition group to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A boolean stating if the condition group conditions has been met.\n * @author Will Poulson\n */\n private meetsConditionGroup(conditionGroup: ConditionGroup, currentQuestionnaireForm: FormGroup | null): boolean {\n if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {\n return true;\n }\n\n const results = [];\n\n for (const condition of conditionGroup.conditions) {\n results.push(this.meetsCondition(condition, currentQuestionnaireForm));\n }\n\n switch (conditionGroup.relationship) {\n case ConditionRelationship.Every:\n return results.every((x) => {\n return x === true;\n });\n case ConditionRelationship.Any:\n return !!results.find((x) => {\n return x === true;\n });\n default:\n return true;\n }\n }\n\n /**\n * Checks if a condition has been met.\n * @param condition The condition to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A boolean stating if the condition group conditions has been met.\n * @author Will Poulson\n */\n private meetsCondition(condition: Condition, currentQuestionnaireForm: FormGroup): boolean {\n const v1s: Array<any> = this.getValuesForArray(condition.v1s, currentQuestionnaireForm);\n const v2s: Array<any> = this.getValuesForArray(condition.v2s, currentQuestionnaireForm);\n\n let result = false;\n\n switch (condition.type) {\n case ConditionType.Excludes:\n result = v1s.filter((v1) => {\n return v2s.indexOf(v1) > -1;\n }).length === 0;\n break;\n case ConditionType.Includes:\n result = v1s.filter((v1) => {\n return v2s.indexOf(v1) > -1;\n }).length !== 0;\n break;\n default:\n for (let v2 of v2s) {\n for (let v1 of v1s) {\n switch (condition.type) {\n case ConditionType.EqualTo:\n v1 = this.getStringForValue(v1);\n v2 = this.getStringForValue(v2);\n if (v1 === v2) { result = true; }\n break;\n case ConditionType.NotEqualTo:\n v1 = this.getStringForValue(v1);\n v2 = this.getStringForValue(v2);\n if (v1 !== v2) { result = true; }\n break;\n case ConditionType.GreaterThan:\n v1 = parseFloat(v1);\n v2 = parseFloat(v2);\n if (v1 >= v2) { result = true; }\n break;\n case ConditionType.LessThan:\n v1 = parseFloat(v1);\n v2 = parseFloat(v2);\n if (v1 <= v2) { result = true; }\n break;\n }\n }\n }\n }\n\n return result;\n }\n\n private getStringForValue(value) {\n switch (value) {\n case null:\n return 'null';\n default:\n return value.toString();\n }\n }\n\n /**\n * Gets the current values for an array of strings.\n * @param paths The array of strings to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns An array of strings/values\n * @author Will Poulson\n */\n private getValuesForArray(paths: Array<string>, currentQuestionnaireForm: FormGroup): Array<any> {\n if (currentQuestionnaireForm) {\n const values = [];\n for (const path of paths) {\n const value = this.getValueForString(path, currentQuestionnaireForm);\n values.push(value);\n }\n return values;\n } else {\n return paths;\n }\n }\n\n /**\n * Gets a current value for a string.\n * @param path The string value to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A string/value.\n * @author Will Poulson\n */\n private getValueForString(path: string, currentQuestionnaireForm: FormGroup) {\n if (currentQuestionnaireForm) {\n const control = currentQuestionnaireForm.get(path);\n return control ? control.value : this.convertStringToValue(path);\n } else {\n return this.convertStringToValue(path);\n }\n }\n\n /**\n * Converts a string to a value.\n * Eg. true/false.\n * @param path The string value to check for conversion;\n * @returns Either a string or the converted value.\n * @author Will Poulson\n */\n private convertStringToValue(path: string) {\n switch (path) {\n case 'true':\n return true;\n case 'false':\n return false;\n case 'null':\n return null;\n default:\n return path;\n }\n }\n}\n","export enum ValidationType {\n Required = 'required',\n Boolean = 'boolean',\n Number = 'number',\n String = 'string',\n Email = 'email',\n Telephone = 'telephone',\n}\n","import { Injectable } from '@angular/core';\nimport { FormBuilder, FormGroup, FormControl, AbstractControl, ValidatorFn, Validators, FormArray } from '@angular/forms';\nimport { Section } from '../interfaces/section';\nimport { Question } from '../interfaces/question';\nimport { Questionnaire } from '../interfaces/questionnaire';\nimport { QuestionType } from '../enums/question-type.enum';\nimport { FilterService } from './filter.service';\nimport { Validator } from '../interfaces/validator';\nimport { ValidationType } from '../enums/validation-type.enum';\nimport * as _ from 'lodash';\nimport { RepeaterQuestion } from '../interfaces/repeater-question';\nimport { ChecklistItem } from '../interfaces/checklist-item';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormConstructorService {\n\n constructor(\n private fb: FormBuilder,\n private filterService: FilterService\n ) { }\n\n /**\n * Constructs a form group based on the questionnaire data.\n * This form group has been filtered down based on the conditions of the sections and questions.\n * @param questionnaire The questionnaire data to build the form group on.\n * @returns A filted form group.\n * @author Will Poulson\n */\n public generateFormsForQuestionnaire(\n questionnaire: Questionnaire,\n currentQuestionnaireForm: FormGroup,\n skipFilter?: boolean\n ): {sections: Array<Section>; forms: FormGroup} {\n const sections = skipFilter ?\n questionnaire.sections :\n this.filterService.filterSections(questionnaire.sections, currentQuestionnaireForm);\n const questionnaireForms = this.generateFormsForSections(sections, currentQuestionnaireForm);\n return {sections: sections, forms: questionnaireForms};\n }\n\n private generateFormsForSections(sections: Array<Section>, currentQuestionnaireForm: FormGroup) {\n const questionnaireForms: FormGroup = this.fb.group({});\n for (const section of sections) {\n const sectionForms = this.generateFormsForSection(section, currentQuestionnaireForm);\n questionnaireForms.addControl(section.name, sectionForms);\n }\n return questionnaireForms;\n }\n\n /**\n * Constructs a form group based on the section data.\n * This form group has been filtered down based on the conditions of the questions.\n * @param section The section data to build the form group on.\n * @returns A filtered form group.\n * @author Will Poulson\n */\n private generateFormsForSection(section: Section, currentQuestionnaireForm: FormGroup): FormGroup {\n const sectionForms: FormGroup = this.fb.group({});\n for (const question of section.questions) {\n const questionControl = this.generateControlForQuestion(question, section, currentQuestionnaireForm);\n sectionForms.addControl(question.name, questionControl);\n }\n return sectionForms;\n }\n\n /**\n * Constructs an astract form control based on the question data.\n * @param question The question data to build the abstract control on.\n * @returns An abstract control.\n * @author Will Poulson\n */\n private generateControlForQuestion(question: Question, section: Section, currentQuestionnaireForm: FormGroup): AbstractControl {\n const convertedValidators = this.convertValidators(question.validators);\n switch (question.type) {\n case QuestionType.Repeater:\n const currentArray = currentQuestionnaireForm ? (currentQuestionnaireForm.get([section.name, question.name]) as FormArray) : false;\n const newArray = currentArray ? currentArray.controls : [];\n return this.fb.array(newArray, convertedValidators);\n case QuestionType.Checklist:\n return this.generateGroupForChecklist(question, convertedValidators);\n default:\n return this.fb.control(null, { validators: convertedValidators, updateOn: 'blur' });\n }\n }\n\n /**\n * Generates the form group for a checklist question.\n * @param question The question. Must be of type checklist or else null is returned.\n * @returns A form group.\n * @author Will Poulson\n */\n private generateGroupForChecklist(question: Question, convertedValidators) {\n if (question.type !== QuestionType.Checklist || question.checklistItems.length === 0) {\n return null;\n }\n\n const checklistForms: FormGroup = this.fb.group({});\n for (const checklistItem of question.checklistItems) {\n const checklistItemControl = this.fb.control(null, convertedValidators);\n checklistForms.addControl(checklistItem.name, checklistItemControl);\n }\n return checklistForms;\n }\n\n\n /**\n * Generates the form template for a repeater question.\n * @param question The question. Must be of type repeater or else null is returned.\n * @returns A form group.\n * @author Will Poulson\n */\n public generateFormsForRepeater(question: Question): FormGroup {\n if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {\n console.log('Question isnt a repeater or has no questions, returning null');\n return null;\n }\n\n const repeaterForms: FormGroup = this.fb.group({});\n for (const repeaterQuestion of question.repeaterQuestions) {\n const repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);\n repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);\n }\n return repeaterForms;\n }\n\n /**\n * Generates a control for a repeaters question.\n * @param repeaterQuestion A repeater question.\n * @returns An abstract control.\n * @author Will Poulson\n */\n private generateControlForRepeaterQuestion(repeaterQuestion: RepeaterQuestion): AbstractControl {\n const convertedValidators = this.convertValidators(repeaterQuestion.validators);\n return this.fb.control(null, { validators: convertedValidators, updateOn: 'blur' });\n }\n\n /**\n * Converts an array of validators into form validators.\n * @param validators The uncoverted array of validators.\n * @returns A convered array of form validators.\n * @author Will Poulson\n */\n private convertValidators(validators: Array<Validator>): Array<ValidatorFn> {\n if (!validators || validators.length === 0) {\n return [];\n }\n const convertedValidators: Array<ValidatorFn> = [];\n for (const validator of validators) {\n const convertedValidator = this.convertValidator(validator);\n if (convertedValidator) {\n convertedValidators.push(convertedValidator);\n }\n }\n return convertedValidators;\n }\n\n /**\n * Converts a single validator into a form validator.\n * @param validator The unconverted validator.\n * @returns A converted form validator.\n * @author Will Poulson\n */\n private convertValidator(validator: Validator): ValidatorFn | null {\n switch (validator.type) {\n case ValidationType.Required:\n return Validators.required;\n default:\n return null;\n }\n }\n\n /**\n * Constructs the forms for repeaters from saved state.\n * @param savedState The saved state to load.\n * @param sections The sections already generated by the form constructor.\n */\n public constructRepeaterFromsFromState(savedState: any, sections: Array<Section>, currentQuestionnaireForm: FormGroup) {\n for (const section of sections) {\n for (const question of section.questions) {\n if (question.type !== QuestionType.Repeater) {\n continue;\n }\n\n const repeaterArray = savedState[section.name][question.name];\n if (!repeaterArray || repeaterArray.length === 0) {\n continue;\n }\n\n const repeaterFormArray = currentQuestionnaireForm.get([section.name, question.name]) as FormArray;\n\n if (repeaterFormArray.controls.length === repeaterArray.length) {\n continue;\n }\n\n for (const repeaterItem of repeaterArray) {\n const repeaterItemTemplate = this.generateFormsForRepeater(question);\n repeaterFormArray.push(repeaterItemTemplate);\n }\n }\n }\n }\n}\n","import { Injectable, Inject, EventEmitter } from '@angular/core';\nimport { FormConstructorService } from './form-constructor.service';\nimport { Questionnaire } from '../interfaces/questionnaire';\nimport { FormGroup, AbstractControl, FormArray, FormBuilder } from '@angular/forms';\nimport { Section } from '../interfaces/section';\nimport { Question } from '../interfaces/question';\nimport { Subscription } from 'rxjs';\nimport * as _ from 'lodash';\nimport { QuestionnaireOptions } from '../interfaces/questionnaire-options';\nimport { QuestionType } from '../enums/question-type.enum';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class QuestionnaireService {\n public dataChangedEvent: EventEmitter<any> = new EventEmitter<any>();\n\n private originalQuestionnaire: Questionnaire;\n\n private currentQuestionnaire: Questionnaire;\n private currentQuestionnaireForm: FormGroup;\n\n private currentSectionName: string;\n private currentQuestionName: string;\n\n private questionnaireValueChangeSubscription: Subscription;\n private questionValueChangeSubscription: Subscription;\n\n private skippable = false;\n\n constructor(\n private formConstuctor: FormConstructorService,\n @Inject('options') private options: QuestionnaireOptions\n ) { }\n\n /**\n * Loads a questionnaire from data.\n * @param questionnaire The questionnaire data to load, often parsed JSON from the editor.\n * @param savedState The saved state of the questionnaire, often from localstorage.\n * @returns null\n * @author Will Poulson\n */\n public async loadQuestionnaire(questionnaire: Questionnaire, savedState?: Object): Promise<any> {\n this.originalQuestionnaire = _.cloneDeep(questionnaire);\n this.currentQuestionnaire = _.cloneDeep(questionnaire);\n\n if (savedState && Object.keys(savedState).length > 0) {\n const newData = this.formConstuctor.generateFormsForQuestionnaire(\n _.cloneDeep(this.originalQuestionnaire),\n this.currentQuestionnaireForm,\n true\n );\n this.formConstuctor.constructRepeaterFromsFromState(savedState, newData.sections, newData.forms);\n this.currentQuestionnaireForm = newData.forms;\n this.currentQuestionnaireForm.patchValue(savedState);\n }\n\n await this.updateQuestionnaire(savedState);\n\n for (const section of this.currentQuestionnaire.sections) {\n for (const question of section.questions) {\n const control = this.currentQuestionnaireForm.get([section.name, question.name]);\n if (!control.value && question.defaultValue) {\n control.setValue(question.defaultValue);\n }\n }\n }\n\n if (this.options.skipToFirstSection) {\n this.currentSectionName = Object.keys(this.currentQuestionnaireForm.controls)[0];\n }\n\n if (this.options.skipToFirstQuestion) {\n this.currentQuestionName = Object.keys(this.currentSection.formGroup.controls)[0];\n }\n\n return;\n }\n\n /**\n * Updates the current questionnaire, used when a value is updated to check conditions.\n * @param savedState The saved state of the questionnaire, often from localstorage.\n * @returns null\n * @author Will Poulson\n */\n public updateQuestionnaire(savedState?: Object): Promise<any> {\n const newData = this.formConstuctor.generateFormsForQuestionnaire(\n _.cloneDeep(this.originalQuestionnaire),\n this.currentQuestionnaireForm\n );\n this.currentQuestionnaireForm = newData.forms;\n this.currentQuestionnaire.sections = newData.sections;\n\n if (savedState && Object.keys(savedState).length > 0) {\n this.currentQuestionnaireForm.patchValue(savedState);\n }\n\n if (this.questionnaireValueChangeSubscription) {\n this.questionnaireValueChangeSubscription.unsubscribe();\n }\n\n if (this.questionValueChangeSubscription) {\n this.questionValueChangeSubscription.unsubscribe();\n }\n\n this.questionnaireValueChangeSubscription = this.currentQuestionnaireForm.valueChanges.subscribe(() => {\n this.dataChangedEvent.emit();\n this.updateQuestionnaire(this.currentQuestionnaireForm.getRawValue());\n });\n\n if (this.currentQuestion) {\n this.questionValueChangeSubscription = this.currentQuestion.formControl.valueChanges.subscribe(() => {\n this.clearFields(this.currentQuestion.data.clearfields);\n });\n }\n\n return;\n }\n\n public get isValid() {\n return this.currentQuestionnaireForm.valid;\n }\n\n public sectionValid(name: string) {\n return this.currentQuestionnaireForm.get(name).valid;\n }\n\n /**\n * Clears all the fields parsed\n * @param clearfields An array of strings, paths to clear.\n * @author Will Poulson\n */\n private clearFields(clearfields: Array<string>) {\n if (!clearfields || clearfields.length === 0) {\n return;\n }\n\n for (const clearfield of clearfields) {\n const control = this.currentQuestionnaireForm.get(clearfield);\n\n if (control) {\n control.reset(undefined);\n }\n }\n }\n\n /**\n * Unloads the current questionnaire.\n * Useful when exiting a questionnaire page or completing a questionnaire.\n * @author Will Poulson\n */\n public unloadQuestionnaire() {\n this.originalQuestionnaire = undefined;\n this.currentQuestionnaireForm = undefined;\n this.currentQuestionnaire = undefined;\n this.currentSectionName = undefined;\n this.currentQuestionName = undefined;\n }\n\n /**\n * Gets the current selected section.\n * @returns An object containing the section data and the related form group.\n * @author Will Poulson\n */\n public get currentSection(): { data: Section; formGroup: FormGroup; } | null {\n if (!this.currentSectionName) {\n return null;\n }\n\n const data = this.currentQuestionnaire.sections.find((x) => {\n return x.name === this.currentSectionName;\n });\n\n if (!data) {\n return null;\n }\n\n return {\n data: data,\n formGroup: this.currentQuestionnaireForm.get(data.name) as FormGroup\n };\n }\n\n /**\n * Gets all the avaialble sections.\n * @returns An array of all avaialble sections.\n * @author Will Poulson\n */\n public get availableSections(): Array<Section> {\n if (!this.currentQuestionnaire || !this.currentQuestionnaire.sections) {\n return [];\n }\n return this.currentQuestionnaire.sections;\n }\n\n /**\n * Gets the current data for the entire questionnaire.\n * @returns An object of data.\n * @author Will Poulson\n */\n public get currentData() {\n return this.currentQuestionnaireForm.getRawValue();\n }\n\n\n /**\n * Gets the current selected question.\n * @returns An object containing the question data and the related form control.\n * @author Will Poulson\n */\n public get currentQuestion(): { data: Question; formControl: AbstractControl; } | null {\n if (!this.currentQuestionName) {\n return null;\n }\n\n const data = this.currentSection.data.questions.find((x) => {\n return x.name === this.currentQuestionName;\n });\n\n if (!data) {\n return null;\n }\n\n return {\n data: data,\n formControl: this.currentSection.formGroup.get(data.name) as AbstractControl\n };\n }\n\n /**\n * Navigates to the next question.\n * If there is no question to navigate to it will reject with a out of bounds exception.\n * If allowSkipRequiredField is false then it will reject if the current question is invalid.\n * If emitSectionFinishEvent is true then it will emit an event if it's navigating past the length of questions.\n * @returns A promise which will resolve when the question has been navigated to.\n * @author Will Poulson\n */\n public nextQuestion() {\n return new Promise((resolve, reject) => {\n if (!this.options.allowSkipRequiredField) {\n if (!this.currentQuestion.formControl.valid) {\n return reject('Current question is invalid');\n }\n }\n\n this.getCurrentQuestionIndex().then((currentIndex) => {\n const newIndex = currentIndex + 1;\n\n this.navigateToQuestion(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Navigates to the previous question.\n * If there is no question to navigate to it will reject with a out of bounds exception.\n * If allowNavigateBackwards is false then it will reject.\n * @returns A promise which will resolve when the question has been navigated to.\n * @author Will Poulson\n */\n public prevQuestion() {\n return new Promise((resolve, reject) => {\n if (!this.options.allowNavigateBackwards) {\n return reject('This questionnaire does not allow for backwards navigation');\n }\n\n this.getCurrentQuestionIndex().then((currentIndex) => {\n const newIndex = currentIndex - 1;\n\n this.navigateToQuestion(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Gets the current questions index.\n * @returns A promise which resolves a number.\n * @author Will Poulson\n */\n private getCurrentQuestionIndex(): Promise<number> {\n return new Promise((resolve, reject) => {\n const currentIndex = this.currentSection.data.questions.indexOf(this.currentQuestion.data);\n\n if (currentIndex === -1) {\n return reject('Could not find current question');\n }\n\n return resolve(currentIndex);\n });\n }\n\n /**\n * Checks a question is in bounds then navigates to it.\n * @param index The index to navigate to.\n * @returns A promise which will resolve when the question has been navigated to.\n * @author Will Poulson\n */\n public navigateToQuestion(index: number) {\n return new Promise((resolve, reject) => {\n if (this.currentSection.data.questions.length - 1 < index || index < 0) {\n return reject('Out of bounds exception');\n }\n\n this.currentQuestionName = this.currentSection.data.questions[index].name;\n return resolve();\n });\n }\n\n /**\n * Navigates to the next section.\n * @returns A promise which will resolve when the section has been navigated to.\n * @author Will Poulson\n */\n public nextSection() {\n return new Promise((resolve, reject) => {\n this.getCurrentSectionIndex().then((currentIndex) => {\n const newIndex = currentIndex + 1;\n this.navigateToSection(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Navigates to the previous section.\n * @returns A promise which will resolve when the section has been navigated to.\n * @author Will Poulson\n */\n public prevSection() {\n return new Promise((resolve, reject) => {\n this.getCurrentSectionIndex().then((currentIndex) => {\n const newIndex = currentIndex - 1;\n this.navigateToQuestion(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Gets the current section index.\n * @returns A promise which resolves a number.\n * @author Will Poulson\n */\n private getCurrentSectionIndex(): Promise<number> {\n return new Promise((resolve, reject) => {\n const currentIndex = this.currentQuestionnaire.sections.indexOf(this.currentSection.data);\n\n if (currentIndex === -1) {\n return reject('Could not find current section');\n }\n\n return resolve(currentIndex);\n });\n }\n\n /**\n * Checks a section is in bounds then navigates to it.\n * @param index The index to navigate to.\n * @returns A promise which will resolve when the section has been navigated to.\n * @author Will Poulson\n */\n public navigateToSection(index: number) {\n return new Promise((resolve, reject) => {\n if (this.currentQuestionnaire.sections.length - 1 < index || index < 0) {\n return reject('Out of bounds exception');\n }\n\n this.currentSectionName = this.currentQuestionnaire.sections[index].name;\n return resolve();\n });\n }\n\n /**\n * Answers the current question with the parsed value.\n * @param answer The value to answer the question with.\n * @author Will Poulson\n */\n public answerCurrentQuestion(answer: any, sendToNextQuestion?: boolean) {\n this.currentQuestion.formControl.setValue(answer);\n if (sendToNextQuestion && this.skippable) { // Timeout to prevent skipping glitch.\n this.skippable = false;\n setTimeout(() => {\n this.nextQuestion();\n this.skippable = true;\n }, 150);\n }\n }\n\n /**\n * Adds a repeater item to the current question.\n * Current question must be of type Repeater.\n * @returns A promise which resolves when the repeater item has been added.\n * @author Will Poulson\n */\n public addRepeaterItem() {\n return new Promise((resolve, reject) => {\n if (this.currentQuestion.data.type !== QuestionType.Repeater) {\n return reject(`Current question isn't a repeater`);\n }\n const repeaterForm = this.formConstuctor.generateFormsForRepeater(this.currentQuestion.data);\n\n if (!repeaterForm) {\n return reject(`Repeater template failed to generate. May be due to the repeater having no items in the editor.`);\n }\n\n\n if (!(this.currentQuestion.formControl instanceof FormArray)) {\n return reject(`The current questions control isn't of type FormArray`);\n }\n\n this.currentQuestion.formControl.push(repeaterForm);\n return resolve();\n });\n }\n\n /**\n * Removes a repeater item on the current question.\n * Current question must be of type Repeater.\n * @param index The index at which to remove.\n * @returns A promise which resolves when the repeater item has been removed.\n * @author Will Poulson\n */\n public removeRepeaterItem(index: number) {\n return new Promise((resolve, reject) => {\n if (this.currentQuestion.data.type !== QuestionType.Repeater) {\n return reject(`Current question isn't a repeater`);\n }\n\n if (!(this.currentQuestion.formControl instanceof FormArray)) {\n return reject(`The current questions control isn't of type FormArray`);\n }\n\n this.currentQuestion.formControl.removeAt(index);\n return resolve();\n });\n }\n\n /**\n * Returns the display text for a given repeater item\n * @param index The index at which to get the label for.\n * @returns A string which is the display text.\n * @author Will Poulson\n */\n public getRepeaterItemLabel(index: number): string {\n if (!this.currentQuestion.formControl || !(this.currentQuestion.formControl instanceof FormArray)) {\n return '';\n }\n\n const repeaterItem = this.currentQuestion.formControl.controls[index];\n\n if (!repeaterItem) {\n return '';\n }\n\n const template = this.currentQuestion.data.repeaterDisplayName;\n const splitTemplate = template.split(' ');\n\n const displayArray = [];\n for (const templateItem of splitTemplate) {\n if (templateItem.match(/\\[.*?\\]/)) {\n const path = templateItem.replace(/[\\[\\]']+/g, '');\n const item = repeaterItem.get(path);\n const value = item.value ? item.value : '?';\n displayArray.push(value);\n } else {\n displayArray.push(templateItem);\n }\n }\n\n const display = displayArray.join(' ');\n return display;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { FormConstructorService } from './services/form-constructor.service';\nimport { QuestionnaireService } from './services/questionnaire.service';\nimport { FilterService } from './services/filter.service';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { QuestionnaireOptions } from './interfaces/questionnaire-options';\nimport { ModuleWithProviders } from '@angular/compiler/src/core';\n\n@NgModule({\n declarations: [],\n providers: [\n FormConstructorService,\n FilterService\n ],\n imports: [\n FormsModule,\n ReactiveFormsModule\n ],\n})\nexport class GgQuestionnaireV2Module {\n public static forRoot(options: QuestionnaireOptions): ModuleWithProviders {\n return {\n ngModule: GgQuestionnaireV2Module,\n providers: [\n QuestionnaireService,\n {\n provide: 'options',\n useValue: options\n }\n ]\n };\n }\n}\n","export enum InputType {\n Text = 'text',\n Number = 'number',\n Email = 'email',\n Telephone = 'tel',\n Password = 'password',\n Color = 'color',\n Date = 'date',\n DateTimeLocal = 'datetime-local',\n Time = 'time',\n Month = 'month',\n Week = 'week',\n}\n","export enum RepeaterQuestionType {\n Input = 'input',\n Select = 'select',\n}\n"],"names":["tslib_1.__values","_.cloneDeep"],"mappings":";;;;;;;;;;;IACI,OAAQ,OAAO;IACf,QAAS,QAAQ;IACjB,UAAW,UAAU;IACrB,UAAW,UAAU;IACrB,WAAY,WAAW;IACvB,YAAa,YAAY;IACzB,QAAS,QAAQ;IACjB,WAAY,WAAW;;;;;;;;;ICPvB,S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;iBACpB;aACJ;SACJ,CAAC;KACH;;gBAvBF,QAAQ,SAAC;oBACR,YAAY,EAAE,EAAE;oBAChB,SAAS,EAAE;wBACT,sBAAsB;wBACtB,aAAa;qBACd;oBACD,OAAO,EAAE;wBACP,WAAW;wBACX,mBAAmB;qBACpB;iBACF;;IAcD,8BAAC;CAxBD;;;;;;;;ICPI,MAAO,MAAM;IACb,QAAS,QAAQ;IACjB,OAAQ,OAAO;IACf,WAAY,KAAK;IACjB,UAAW,UAAU;IACrB,OAAQ,OAAO;IACf,MAAO,MAAM;IACb,eAAgB,gBAAgB;IAChC,MAAO,MAAM;IACb,OAAQ,OAAO;IACf,MAAO,MAAM;;;;;;;;;ICVb,OAAQ,OAAO;IACf,QAAS,QAAQ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"glowgreen-gg-questionnaire-v2.js.map","sources":["ng://@glowgreen/gg-questionnaire-v2/lib/enums/question-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/condition-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/condition-relationship.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/services/filter.service.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/validation-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/services/form-constructor.service.ts","ng://@glowgreen/gg-questionnaire-v2/lib/services/questionnaire.service.ts","ng://@glowgreen/gg-questionnaire-v2/lib/gg-questionnaire-v2.module.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/input-type.enum.ts","ng://@glowgreen/gg-questionnaire-v2/lib/enums/repeater-question-type.enum.ts"],"sourcesContent":["export enum QuestionType {\n Input = 'input',\n Select = 'select',\n Textarea = 'textarea',\n Repeater = 'repeater',\n Checklist = 'checklist',\n Attachment = 'attachment',\n Upload = 'upload',\n Signature = 'signature',\n}\n","export enum ConditionType {\n EqualTo = 'equalTo',\n NotEqualTo = 'notEqualTo',\n LessThan = 'lessThan',\n GreaterThan = 'greaterThan',\n Includes = 'includes',\n Excludes = 'excludes'\n}\n","export enum ConditionRelationship {\n Every = 'every',\n Any = 'any',\n}\n","import { Injectable } from '@angular/core';\nimport { Section } from '../interfaces/section';\nimport { FormGroup } from '@angular/forms';\nimport { Condition } from '../interfaces/condition';\nimport { ConditionGroup } from '../interfaces/condition-group';\nimport { ConditionType } from '../enums/condition-type.enum';\nimport { ConditionRelationship } from '../enums/condition-relationship.enum';\nimport * as _ from 'lodash';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FilterService {\n\n constructor() { }\n\n /**\n * Filters an array of sections based on their condition groups.\n * @param sections The array of sections to filter.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns An array of filtered sections with their filtered questions.\n * @author Will Poulson\n */\n public filterSections(sections: Array<Section>, currentQuestionnaireForm: FormGroup | null, additionalData?: Object): Array<Section> {\n const filteredSections = [];\n for (const section of sections) {\n if (this.meetsConditionGroups(section.conditionGroups, currentQuestionnaireForm, additionalData)) {\n const filteredQuestions = [];\n for (const question of section.questions) {\n if (this.meetsConditionGroups(question.conditionGroups, currentQuestionnaireForm, additionalData)) {\n\n if (question.repeaterQuestions) {\n const filteredRepeaterQuestions = [];\n for (const repeaterQuestion of question.repeaterQuestions) {\n if (this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData)) {\n filteredRepeaterQuestions.push(repeaterQuestion);\n }\n }\n }\n\n filteredQuestions.push(question);\n }\n }\n section.questions = filteredQuestions;\n filteredSections.push(section);\n }\n }\n return filteredSections;\n }\n\n /**\n * Checks if each condition groups conditions have been met.\n * @param conditionGroups The array of condition groups.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A boolean stating if the condition groups conditions has been met.\n * @author Will Poulson\n */\n private meetsConditionGroups(\n conditionGroups: Array<ConditionGroup>,\n currentQuestionnaireForm: FormGroup | null,\n additionalData?: Object\n ): boolean {\n if (!conditionGroups || conditionGroups.length === 0) {\n return true;\n }\n return conditionGroups.every((x) => {\n return this.meetsConditionGroup(x, currentQuestionnaireForm, additionalData) === true;\n });\n }\n\n /**\n * Checks if a condition groups conditions have been met.\n * @param conditionGroup The condition group to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A boolean stating if the condition group conditions has been met.\n * @author Will Poulson\n */\n private meetsConditionGroup(\n conditionGroup: ConditionGroup,\n currentQuestionnaireForm: FormGroup | null,\n additionalData?: Object\n ): boolean {\n if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {\n return true;\n }\n\n const results = [];\n\n for (const condition of conditionGroup.conditions) {\n results.push(this.meetsCondition(condition, currentQuestionnaireForm, additionalData));\n }\n\n switch (conditionGroup.relationship) {\n case ConditionRelationship.Every:\n return results.every((x) => {\n return x === true;\n });\n case ConditionRelationship.Any:\n return !!results.find((x) => {\n return x === true;\n });\n default:\n return true;\n }\n }\n\n /**\n * Checks if a condition has been met.\n * @param condition The condition to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A boolean stating if the condition group conditions has been met.\n * @author Will Poulson\n */\n private meetsCondition(condition: Condition, currentQuestionnaireForm: FormGroup, additionalData?: Object): boolean {\n const v1s: Array<any> = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData);\n const v2s: Array<any> = this.getValuesForArray(condition.v2s, currentQuestionnaireForm, additionalData);\n\n let result = false;\n\n switch (condition.type) {\n case ConditionType.Excludes:\n result = v1s.filter((v1) => {\n return v2s.indexOf(v1) > -1;\n }).length === 0;\n break;\n case ConditionType.Includes:\n result = v1s.filter((v1) => {\n return v2s.indexOf(v1) > -1;\n }).length !== 0;\n break;\n default:\n for (let v2 of v2s) {\n for (let v1 of v1s) {\n switch (condition.type) {\n case ConditionType.EqualTo:\n v1 = this.getStringForValue(v1);\n v2 = this.getStringForValue(v2);\n if (v1 === v2) { result = true; }\n break;\n case ConditionType.NotEqualTo:\n v1 = this.getStringForValue(v1);\n v2 = this.getStringForValue(v2);\n if (v1 !== v2) { result = true; }\n break;\n case ConditionType.GreaterThan:\n v1 = parseFloat(v1);\n v2 = parseFloat(v2);\n if (v1 >= v2) { result = true; }\n break;\n case ConditionType.LessThan:\n v1 = parseFloat(v1);\n v2 = parseFloat(v2);\n if (v1 <= v2) { result = true; }\n break;\n }\n }\n }\n }\n\n return result;\n }\n\n private getStringForValue(value) {\n switch (value) {\n case null:\n return 'null';\n default:\n return value.toString();\n }\n }\n\n /**\n * Gets the current values for an array of strings.\n * @param paths The array of strings to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns An array of strings/values\n * @author Will Poulson\n */\n private getValuesForArray(paths: Array<string>, currentQuestionnaireForm: FormGroup, additionalData?: Object): Array<any> {\n if (currentQuestionnaireForm) {\n const values = [];\n for (const path of paths) {\n const value = this.getValueForString(path, currentQuestionnaireForm, additionalData);\n values.push(value);\n }\n return values;\n } else {\n return paths;\n }\n }\n\n /**\n * Gets a current value for a string.\n * @param path The string value to check.\n * @param currentQuestionnaireForm The current form data, can be null/undefined.\n * @returns A string/value.\n * @author Will Poulson\n */\n private getValueForString(path: string, currentQuestionnaireForm: FormGroup, additionalData?: Object) {\n if (currentQuestionnaireForm) {\n if (additionalData) {\n const data = _.get(additionalData, path);\n if (data) {\n return data;\n }\n } else {\n const control = currentQuestionnaireForm.get(path);\n return control ? control.value : this.convertStringToValue(path);\n }\n } else {\n return this.convertStringToValue(path);\n }\n }\n\n /**\n * Converts a string to a value.\n * Eg. true/false.\n * @param path The string value to check for conversion;\n * @returns Either a string or the converted value.\n * @author Will Poulson\n */\n private convertStringToValue(path: string) {\n switch (path) {\n case 'true':\n return true;\n case 'false':\n return false;\n case 'null':\n return null;\n default:\n return path;\n }\n }\n}\n","export enum ValidationType {\n Required = 'required',\n Boolean = 'boolean',\n Number = 'number',\n String = 'string',\n Email = 'email',\n Telephone = 'telephone',\n}\n","import { Injectable } from '@angular/core';\nimport { FormBuilder, FormGroup, FormControl, AbstractControl, ValidatorFn, Validators, FormArray } from '@angular/forms';\nimport { Section } from '../interfaces/section';\nimport { Question } from '../interfaces/question';\nimport { Questionnaire } from '../interfaces/questionnaire';\nimport { QuestionType } from '../enums/question-type.enum';\nimport { FilterService } from './filter.service';\nimport { Validator } from '../interfaces/validator';\nimport { ValidationType } from '../enums/validation-type.enum';\nimport * as _ from 'lodash';\nimport { RepeaterQuestion } from '../interfaces/repeater-question';\nimport { ChecklistItem } from '../interfaces/checklist-item';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class FormConstructorService {\n\n constructor(\n private fb: FormBuilder,\n private filterService: FilterService\n ) { }\n\n /**\n * Constructs a form group based on the questionnaire data.\n * This form group has been filtered down based on the conditions of the sections and questions.\n * @param questionnaire The questionnaire data to build the form group on.\n * @returns A filted form group.\n * @author Will Poulson\n */\n public generateFormsForQuestionnaire(\n questionnaire: Questionnaire,\n currentQuestionnaireForm: FormGroup,\n additionalData?: Object,\n skipFilter?: boolean\n ): {sections: Array<Section>; forms: FormGroup} {\n const sections = skipFilter ?\n questionnaire.sections :\n this.filterService.filterSections(questionnaire.sections, currentQuestionnaireForm, additionalData);\n const questionnaireForms = this.generateFormsForSections(sections, currentQuestionnaireForm);\n return {sections: sections, forms: questionnaireForms};\n }\n\n private generateFormsForSections(sections: Array<Section>, currentQuestionnaireForm: FormGroup) {\n const questionnaireForms: FormGroup = this.fb.group({});\n for (const section of sections) {\n const sectionForms = this.generateFormsForSection(section, currentQuestionnaireForm);\n questionnaireForms.addControl(section.name, sectionForms);\n }\n return questionnaireForms;\n }\n\n /**\n * Constructs a form group based on the section data.\n * This form group has been filtered down based on the conditions of the questions.\n * @param section The section data to build the form group on.\n * @returns A filtered form group.\n * @author Will Poulson\n */\n private generateFormsForSection(section: Section, currentQuestionnaireForm: FormGroup): FormGroup {\n const sectionForms: FormGroup = this.fb.group({});\n for (const question of section.questions) {\n const questionControl = this.generateControlForQuestion(question, section, currentQuestionnaireForm);\n sectionForms.addControl(question.name, questionControl);\n }\n return sectionForms;\n }\n\n /**\n * Constructs an astract form control based on the question data.\n * @param question The question data to build the abstract control on.\n * @returns An abstract control.\n * @author Will Poulson\n */\n private generateControlForQuestion(question: Question, section: Section, currentQuestionnaireForm: FormGroup): AbstractControl {\n const convertedValidators = this.convertValidators(question.validators);\n switch (question.type) {\n case QuestionType.Repeater:\n const currentArray = currentQuestionnaireForm ? (currentQuestionnaireForm.get([section.name, question.name]) as FormArray) : false;\n const newArray = currentArray ? currentArray.controls : [];\n return this.fb.array(newArray, convertedValidators);\n case QuestionType.Checklist:\n return this.generateGroupForChecklist(question, convertedValidators);\n default:\n return this.fb.control(null, { validators: convertedValidators, updateOn: 'blur' });\n }\n }\n\n /**\n * Generates the form group for a checklist question.\n * @param question The question. Must be of type checklist or else null is returned.\n * @returns A form group.\n * @author Will Poulson\n */\n private generateGroupForChecklist(question: Question, convertedValidators) {\n if (question.type !== QuestionType.Checklist || question.checklistItems.length === 0) {\n return null;\n }\n\n const checklistForms: FormGroup = this.fb.group({});\n for (const checklistItem of question.checklistItems) {\n const checklistItemControl = this.fb.control(null, convertedValidators);\n checklistForms.addControl(checklistItem.name, checklistItemControl);\n }\n return checklistForms;\n }\n\n\n /**\n * Generates the form template for a repeater question.\n * @param question The question. Must be of type repeater or else null is returned.\n * @returns A form group.\n * @author Will Poulson\n */\n public generateFormsForRepeater(question: Question): FormGroup {\n if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {\n console.log('Question isnt a repeater or has no questions, returning null');\n return null;\n }\n\n const repeaterForms: FormGroup = this.fb.group({});\n for (const repeaterQuestion of question.repeaterQuestions) {\n const repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);\n repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);\n }\n return repeaterForms;\n }\n\n /**\n * Generates a control for a repeaters question.\n * @param repeaterQuestion A repeater question.\n * @returns An abstract control.\n * @author Will Poulson\n */\n private generateControlForRepeaterQuestion(repeaterQuestion: RepeaterQuestion): AbstractControl {\n const convertedValidators = this.convertValidators(repeaterQuestion.validators);\n return this.fb.control(null, { validators: convertedValidators, updateOn: 'blur' });\n }\n\n /**\n * Converts an array of validators into form validators.\n * @param validators The uncoverted array of validators.\n * @returns A convered array of form validators.\n * @author Will Poulson\n */\n private convertValidators(validators: Array<Validator>): Array<ValidatorFn> {\n if (!validators || validators.length === 0) {\n return [];\n }\n const convertedValidators: Array<ValidatorFn> = [];\n for (const validator of validators) {\n const convertedValidator = this.convertValidator(validator);\n if (convertedValidator) {\n convertedValidators.push(convertedValidator);\n }\n }\n return convertedValidators;\n }\n\n /**\n * Converts a single validator into a form validator.\n * @param validator The unconverted validator.\n * @returns A converted form validator.\n * @author Will Poulson\n */\n private convertValidator(validator: Validator): ValidatorFn | null {\n switch (validator.type) {\n case ValidationType.Required:\n return Validators.required;\n default:\n return null;\n }\n }\n\n /**\n * Constructs the forms for repeaters from saved state.\n * @param savedState The saved state to load.\n * @param sections The sections already generated by the form constructor.\n */\n public constructRepeaterFromsFromState(savedState: any, sections: Array<Section>, currentQuestionnaireForm: FormGroup) {\n for (const section of sections) {\n for (const question of section.questions) {\n if (question.type !== QuestionType.Repeater) {\n continue;\n }\n\n const repeaterArray = savedState[section.name][question.name];\n if (!repeaterArray || repeaterArray.length === 0) {\n continue;\n }\n\n const repeaterFormArray = currentQuestionnaireForm.get([section.name, question.name]) as FormArray;\n\n if (repeaterFormArray.controls.length === repeaterArray.length) {\n continue;\n }\n\n for (const repeaterItem of repeaterArray) {\n const repeaterItemTemplate = this.generateFormsForRepeater(question);\n repeaterFormArray.push(repeaterItemTemplate);\n }\n }\n }\n }\n}\n","import { Injectable, Inject, EventEmitter } from '@angular/core';\nimport { FormConstructorService } from './form-constructor.service';\nimport { Questionnaire } from '../interfaces/questionnaire';\nimport { FormGroup, AbstractControl, FormArray, FormBuilder } from '@angular/forms';\nimport { Section } from '../interfaces/section';\nimport { Question } from '../interfaces/question';\nimport { Subscription } from 'rxjs';\nimport * as _ from 'lodash';\nimport { QuestionnaireOptions } from '../interfaces/questionnaire-options';\nimport { QuestionType } from '../enums/question-type.enum';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class QuestionnaireService {\n public dataChangedEvent: EventEmitter<any> = new EventEmitter<any>();\n\n private originalQuestionnaire: Questionnaire;\n\n private currentQuestionnaire: Questionnaire;\n private currentQuestionnaireForm: FormGroup;\n\n private currentSectionName: string;\n private currentQuestionName: string;\n\n private questionnaireValueChangeSubscription: Subscription;\n private questionValueChangeSubscription: Subscription;\n\n private additionalData: Object;\n\n private skippable = false;\n\n constructor(\n private formConstuctor: FormConstructorService,\n @Inject('options') private options: QuestionnaireOptions\n ) { }\n\n /**\n * Loads a questionnaire from data.\n * @param questionnaire The questionnaire data to load, often parsed JSON from the editor.\n * @param savedState The saved state of the questionnaire, often from localstorage.\n * @returns null\n * @author Will Poulson\n */\n public async loadQuestionnaire(questionnaire: Questionnaire, savedState?: Object, additionalData?: Object): Promise<any> {\n this.originalQuestionnaire = _.cloneDeep(questionnaire);\n this.currentQuestionnaire = _.cloneDeep(questionnaire);\n\n this.additionalData = additionalData;\n\n if (savedState && Object.keys(savedState).length > 0) {\n const newData = this.formConstuctor.generateFormsForQuestionnaire(\n _.cloneDeep(this.originalQuestionnaire),\n this.currentQuestionnaireForm,\n this.additionalData,\n true\n );\n this.formConstuctor.constructRepeaterFromsFromState(savedState, newData.sections, newData.forms);\n this.currentQuestionnaireForm = newData.forms;\n this.currentQuestionnaireForm.patchValue(savedState);\n }\n\n await this.updateQuestionnaire(savedState);\n\n for (const section of this.currentQuestionnaire.sections) {\n for (const question of section.questions) {\n const control = this.currentQuestionnaireForm.get([section.name, question.name]);\n if (!control.value && question.defaultValue) {\n control.setValue(question.defaultValue);\n }\n }\n }\n\n if (this.options.skipToFirstSection) {\n this.currentSectionName = Object.keys(this.currentQuestionnaireForm.controls)[0];\n }\n\n if (this.options.skipToFirstQuestion) {\n this.currentQuestionName = Object.keys(this.currentSection.formGroup.controls)[0];\n }\n\n return;\n }\n\n /**\n * Updates the current questionnaire, used when a value is updated to check conditions.\n * @param savedState The saved state of the questionnaire, often from localstorage.\n * @returns null\n * @author Will Poulson\n */\n public updateQuestionnaire(savedState?: Object): Promise<any> {\n const newData = this.formConstuctor.generateFormsForQuestionnaire(\n _.cloneDeep(this.originalQuestionnaire),\n this.currentQuestionnaireForm,\n this.additionalData\n );\n this.currentQuestionnaireForm = newData.forms;\n this.currentQuestionnaire.sections = newData.sections;\n\n if (savedState && Object.keys(savedState).length > 0) {\n this.currentQuestionnaireForm.patchValue(savedState);\n }\n\n if (this.questionnaireValueChangeSubscription) {\n this.questionnaireValueChangeSubscription.unsubscribe();\n }\n\n if (this.questionValueChangeSubscription) {\n this.questionValueChangeSubscription.unsubscribe();\n }\n\n this.questionnaireValueChangeSubscription = this.currentQuestionnaireForm.valueChanges.subscribe(() => {\n this.dataChangedEvent.emit();\n this.updateQuestionnaire(this.currentQuestionnaireForm.getRawValue());\n });\n\n if (this.currentQuestion) {\n this.questionValueChangeSubscription = this.currentQuestion.formControl.valueChanges.subscribe(() => {\n this.clearFields(this.currentQuestion.data.clearfields);\n });\n }\n\n return;\n }\n\n public get isValid() {\n return this.currentQuestionnaireForm.valid;\n }\n\n public sectionValid(name: string) {\n return this.currentQuestionnaireForm.get(name).valid;\n }\n\n /**\n * Clears all the fields parsed\n * @param clearfields An array of strings, paths to clear.\n * @author Will Poulson\n */\n private clearFields(clearfields: Array<string>) {\n if (!clearfields || clearfields.length === 0) {\n return;\n }\n\n for (const clearfield of clearfields) {\n const control = this.currentQuestionnaireForm.get(clearfield);\n\n if (control) {\n control.reset(undefined);\n }\n }\n }\n\n /**\n * Unloads the current questionnaire.\n * Useful when exiting a questionnaire page or completing a questionnaire.\n * @author Will Poulson\n */\n public unloadQuestionnaire() {\n this.originalQuestionnaire = undefined;\n this.currentQuestionnaireForm = undefined;\n this.currentQuestionnaire = undefined;\n this.currentSectionName = undefined;\n this.currentQuestionName = undefined;\n this.additionalData = undefined;\n }\n\n /**\n * Gets the current selected section.\n * @returns An object containing the section data and the related form group.\n * @author Will Poulson\n */\n public get currentSection(): { data: Section; formGroup: FormGroup; } | null {\n if (!this.currentSectionName) {\n return null;\n }\n\n const data = this.currentQuestionnaire.sections.find((x) => {\n return x.name === this.currentSectionName;\n });\n\n if (!data) {\n return null;\n }\n\n return {\n data: data,\n formGroup: this.currentQuestionnaireForm.get(data.name) as FormGroup\n };\n }\n\n /**\n * Gets all the avaialble sections.\n * @returns An array of all avaialble sections.\n * @author Will Poulson\n */\n public get availableSections(): Array<Section> {\n if (!this.currentQuestionnaire || !this.currentQuestionnaire.sections) {\n return [];\n }\n return this.currentQuestionnaire.sections;\n }\n\n /**\n * Gets the current data for the entire questionnaire.\n * @returns An object of data.\n * @author Will Poulson\n */\n public get currentData() {\n return this.currentQuestionnaireForm.getRawValue();\n }\n\n\n /**\n * Gets the current selected question.\n * @returns An object containing the question data and the related form control.\n * @author Will Poulson\n */\n public get currentQuestion(): { data: Question; formControl: AbstractControl; } | null {\n if (!this.currentQuestionName) {\n return null;\n }\n\n const data = this.currentSection.data.questions.find((x) => {\n return x.name === this.currentQuestionName;\n });\n\n if (!data) {\n return null;\n }\n\n return {\n data: data,\n formControl: this.currentSection.formGroup.get(data.name) as AbstractControl\n };\n }\n\n /**\n * Navigates to the next question.\n * If there is no question to navigate to it will reject with a out of bounds exception.\n * If allowSkipRequiredField is false then it will reject if the current question is invalid.\n * If emitSectionFinishEvent is true then it will emit an event if it's navigating past the length of questions.\n * @returns A promise which will resolve when the question has been navigated to.\n * @author Will Poulson\n */\n public nextQuestion() {\n return new Promise((resolve, reject) => {\n if (!this.options.allowSkipRequiredField) {\n if (!this.currentQuestion.formControl.valid) {\n return reject('Current question is invalid');\n }\n }\n\n this.getCurrentQuestionIndex().then((currentIndex) => {\n const newIndex = currentIndex + 1;\n\n this.navigateToQuestion(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Navigates to the previous question.\n * If there is no question to navigate to it will reject with a out of bounds exception.\n * If allowNavigateBackwards is false then it will reject.\n * @returns A promise which will resolve when the question has been navigated to.\n * @author Will Poulson\n */\n public prevQuestion() {\n return new Promise((resolve, reject) => {\n if (!this.options.allowNavigateBackwards) {\n return reject('This questionnaire does not allow for backwards navigation');\n }\n\n this.getCurrentQuestionIndex().then((currentIndex) => {\n const newIndex = currentIndex - 1;\n\n this.navigateToQuestion(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Gets the current questions index.\n * @returns A promise which resolves a number.\n * @author Will Poulson\n */\n private getCurrentQuestionIndex(): Promise<number> {\n return new Promise((resolve, reject) => {\n const currentIndex = this.currentSection.data.questions.indexOf(this.currentQuestion.data);\n\n if (currentIndex === -1) {\n return reject('Could not find current question');\n }\n\n return resolve(currentIndex);\n });\n }\n\n /**\n * Checks a question is in bounds then navigates to it.\n * @param index The index to navigate to.\n * @returns A promise which will resolve when the question has been navigated to.\n * @author Will Poulson\n */\n public navigateToQuestion(index: number) {\n return new Promise((resolve, reject) => {\n if (this.currentSection.data.questions.length - 1 < index || index < 0) {\n return reject('Out of bounds exception');\n }\n\n this.currentQuestionName = this.currentSection.data.questions[index].name;\n return resolve();\n });\n }\n\n /**\n * Navigates to the next section.\n * @returns A promise which will resolve when the section has been navigated to.\n * @author Will Poulson\n */\n public nextSection() {\n return new Promise((resolve, reject) => {\n this.getCurrentSectionIndex().then((currentIndex) => {\n const newIndex = currentIndex + 1;\n this.navigateToSection(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Navigates to the previous section.\n * @returns A promise which will resolve when the section has been navigated to.\n * @author Will Poulson\n */\n public prevSection() {\n return new Promise((resolve, reject) => {\n this.getCurrentSectionIndex().then((currentIndex) => {\n const newIndex = currentIndex - 1;\n this.navigateToQuestion(newIndex).then(() => {\n return resolve();\n }).catch((error) => {\n return reject(error);\n });\n }).catch((error) => {\n return reject(error);\n });\n });\n }\n\n /**\n * Gets the current section index.\n * @returns A promise which resolves a number.\n * @author Will Poulson\n */\n private getCurrentSectionIndex(): Promise<number> {\n return new Promise((resolve, reject) => {\n const currentIndex = this.currentQuestionnaire.sections.indexOf(this.currentSection.data);\n\n if (currentIndex === -1) {\n return reject('Could not find current section');\n }\n\n return resolve(currentIndex);\n });\n }\n\n /**\n * Checks a section is in bounds then navigates to it.\n * @param index The index to navigate to.\n * @returns A promise which will resolve when the section has been navigated to.\n * @author Will Poulson\n */\n public navigateToSection(index: number) {\n return new Promise((resolve, reject) => {\n if (this.currentQuestionnaire.sections.length - 1 < index || index < 0) {\n return reject('Out of bounds exception');\n }\n\n this.currentSectionName = this.currentQuestionnaire.sections[index].name;\n return resolve();\n });\n }\n\n /**\n * Answers the current question with the parsed value.\n * @param answer The value to answer the question with.\n * @author Will Poulson\n */\n public answerCurrentQuestion(answer: any, sendToNextQuestion?: boolean) {\n this.currentQuestion.formControl.setValue(answer);\n if (sendToNextQuestion && this.skippable) { // Timeout to prevent skipping glitch.\n this.skippable = false;\n setTimeout(() => {\n this.nextQuestion();\n this.skippable = true;\n }, 150);\n }\n }\n\n /**\n * Adds a repeater item to the current question.\n * Current question must be of type Repeater.\n * @returns A promise which resolves when the repeater item has been added.\n * @author Will Poulson\n */\n public addRepeaterItem() {\n return new Promise((resolve, reject) => {\n if (this.currentQuestion.data.type !== QuestionType.Repeater) {\n return reject(`Current question isn't a repeater`);\n }\n const repeaterForm = this.formConstuctor.generateFormsForRepeater(this.currentQuestion.data);\n\n if (!repeaterForm) {\n return reject(`Repeater template failed to generate. May be due to the repeater having no items in the editor.`);\n }\n\n\n if (!(this.currentQuestion.formControl instanceof FormArray)) {\n return reject(`The current questions control isn't of type FormArray`);\n }\n\n this.currentQuestion.formControl.push(repeaterForm);\n return resolve();\n });\n }\n\n /**\n * Removes a repeater item on the current question.\n * Current question must be of type Repeater.\n * @param index The index at which to remove.\n * @returns A promise which resolves when the repeater item has been removed.\n * @author Will Poulson\n */\n public removeRepeaterItem(index: number) {\n return new Promise((resolve, reject) => {\n if (this.currentQuestion.data.type !== QuestionType.Repeater) {\n return reject(`Current question isn't a repeater`);\n }\n\n if (!(this.currentQuestion.formControl instanceof FormArray)) {\n return reject(`The current questions control isn't of type FormArray`);\n }\n\n this.currentQuestion.formControl.removeAt(index);\n return resolve();\n });\n }\n\n /**\n * Returns the display text for a given repeater item\n * @param index The index at which to get the label for.\n * @returns A string which is the display text.\n * @author Will Poulson\n */\n public getRepeaterItemLabel(index: number): string {\n if (!this.currentQuestion.formControl || !(this.currentQuestion.formControl instanceof FormArray)) {\n return '';\n }\n\n const repeaterItem = this.currentQuestion.formControl.controls[index];\n\n if (!repeaterItem) {\n return '';\n }\n\n const template = this.currentQuestion.data.repeaterDisplayName;\n const splitTemplate = template.split(' ');\n\n const displayArray = [];\n for (const templateItem of splitTemplate) {\n if (templateItem.match(/\\[.*?\\]/)) {\n const path = templateItem.replace(/[\\[\\]']+/g, '');\n const item = repeaterItem.get(path);\n const value = item.value ? item.value : '?';\n displayArray.push(value);\n } else {\n displayArray.push(templateItem);\n }\n }\n\n const display = displayArray.join(' ');\n return display;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { FormConstructorService } from './services/form-constructor.service';\nimport { QuestionnaireService } from './services/questionnaire.service';\nimport { FilterService } from './services/filter.service';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { QuestionnaireOptions } from './interfaces/questionnaire-options';\nimport { ModuleWithProviders } from '@angular/compiler/src/core';\n\n@NgModule({\n declarations: [],\n providers: [\n FormConstructorService,\n FilterService\n ],\n imports: [\n FormsModule,\n ReactiveFormsModule\n ],\n})\nexport class GgQuestionnaireV2Module {\n public static forRoot(options: QuestionnaireOptions): ModuleWithProviders {\n return {\n ngModule: GgQuestionnaireV2Module,\n providers: [\n QuestionnaireService,\n {\n provide: 'options',\n useValue: options\n }\n ]\n };\n }\n}\n","export enum InputType {\n Text = 'text',\n Number = 'number',\n Email = 'email',\n Telephone = 'tel',\n Password = 'password',\n Color = 'color',\n Date = 'date',\n DateTimeLocal = 'datetime-local',\n Time = 'time',\n Month = 'month',\n Week = 'week',\n}\n","export enum RepeaterQuestionType {\n Input = 'input',\n Select = 'select',\n}\n"],"names":["tslib_1.__values","_.get","_.cloneDeep"],"mappings":";;;;;;;;;;;IACI,OAAQ,OAAO;IACf,QAAS,QAAQ;IACjB,UAAW,UAAU;IACrB,UAAW,UAAU;IACrB,WAAY,WAAW;IACvB,YAAa,YAAY;IACzB,QAAS,QAAQ;IACjB,WAAY,WAAW;;;;;;;;;ICPvB,SAAU,SAAS;IACnB,YAAa,YAAY;IACzB,UAAW,UAAU;IACrB,aAAc,aAAa;IAC3B,UAAW,UAAU;IACrB,UAAW,UAAU;;;;;;;;;ICLrB,OAAQ,OAAO;IACf,KAAM,KAAK;;;;;;;;ICYb;KAAiB;;;;;;;;;;;;;;;;IASV,sCAAc;;;;;;;;IAArB,UAAsB,QAAwB,EAAE,wBAA0C,EAAE,cAAuB;;;YAC3G,gBAAgB,GAAG,EAAE;;YAC3B,KAAsB,IAAA,aAAAA,SAAA,QAAQ,CAAA,kCAAA,wDAAE;gBAA3B,IAAM,OAAO,qBAAA;gBAChB,IAAI,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,eAAe,EAAE,wBAAwB,EAAE,cAAc,CAAC,EAAE;;wBAC1F,iBAAiB,GAAG,EAAE;;wBAC5B,KAAuB,IAAA,KAAAA,SAAA,OAAO,CAAC,SAAS,CAAA,gBAAA,4BAAE;4BAArC,IAAM,QAAQ,WAAA;4BACjB,IAAI,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,eAAe,EAAE,wBAAwB,EAAE,cAAc,CAAC,EAAE;gCAEjG,IAAI,QAAQ,CAAC,iBAAiB,EAAE;;wCAE9B,KAA+B,IAAA,KAAAA,SAAA,QAAQ,CAAC,iBA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IACf,WAAY,KAAK;IACjB,UAAW,UAAU;IACrB,OAAQ,OAAO;IACf,MAAO,MAAM;IACb,eAAgB,gBAAgB;IAChC,MAAO,MAAM;IACb,OAAQ,OAAO;IACf,MAAO,MAAM;;;;;;;;;ICVb,OAAQ,OAAO;IACf,QAAS,QAAQ;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"QuestionnaireService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"QuestionnaireService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":34,"character":5},"arguments":["options"]}]],"parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","name":"QuestionnaireOptions"}]}],"loadQuestionnaire":[{"__symbolic":"method"}],"updateQuestionnaire":[{"__symbolic":"method"}],"sectionValid":[{"__symbolic":"method"}],"clearFields":[{"__symbolic":"method"}],"unloadQuestionnaire":[{"__symbolic":"method"}],"nextQuestion":[{"__symbolic":"method"}],"prevQuestion":[{"__symbolic":"method"}],"getCurrentQuestionIndex":[{"__symbolic":"method"}],"navigateToQuestion":[{"__symbolic":"method"}],"nextSection":[{"__symbolic":"method"}],"prevSection":[{"__symbolic":"method"}],"getCurrentSectionIndex":[{"__symbolic":"method"}],"navigateToSection":[{"__symbolic":"method"}],"answerCurrentQuestion":[{"__symbolic":"method"}],"addRepeaterItem":[{"__symbolic":"method"}],"removeRepeaterItem":[{"__symbolic":"method"}],"getRepeaterItemLabel":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}},"GgQuestionnaireV2Module":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":8,"character":1},"arguments":[{"declarations":[],"providers":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","name":"ɵb"}],"imports":[{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":15,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":16,"character":4}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"GgQuestionnaireV2Module"},"providers":[{"__symbolic":"reference","name":"QuestionnaireService"},{"provide":"options","useValue":{"__symbolic":"reference","name":"options"}}]}}}},"ConditionGroup":{"__symbolic":"interface"},"Condition":{"__symbolic":"interface"},"Question":{"__symbolic":"interface"},"RepeaterQuestion":{"__symbolic":"interface"},"Section":{"__symbolic":"interface"},"Validator":{"__symbolic":"interface"},"Questionnaire":{"__symbolic":"interface"},"QuestionnaireOptions":{"__symbolic":"interface"},"SelectOption":{"__symbolic":"interface"},"ConditionRelationship":{"Every":"every","Any":"any"},"ConditionType":{"EqualTo":"equalTo","NotEqualTo":"notEqualTo","LessThan":"lessThan","GreaterThan":"greaterThan","Includes":"includes","Excludes":"excludes"},"QuestionType":{"Input":"input","Select":"select","Textarea":"textarea","Repeater":"repeater","Checklist":"checklist","Attachment":"attachment","Upload":"upload","Signature":"signature"},"ValidationType":{"Required":"required","Boolean":"boolean","Number":"number","String":"string","Email":"email","Telephone":"telephone"},"InputType":{"Text":"text","Number":"number","Email":"email","Telephone":"tel","Password":"password","Color":"color","Date":"date","DateTimeLocal":"datetime-local","Time":"time","Month":"month","Week":"week"},"RepeaterQuestionType":{"Input":"input","Select":"select"},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":13,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/forms","name":"FormBuilder","line":19,"character":16},{"__symbolic":"reference","name":"ɵb"}]}],"generateFormsForQuestionnaire":[{"__symbolic":"method"}],"generateFormsForSections":[{"__symbolic":"method"}],"generateFormsForSection":[{"__symbolic":"method"}],"generateControlForQuestion":[{"__symbolic":"method"}],"generateGroupForChecklist":[{"__symbolic":"method"}],"generateFormsForRepeater":[{"__symbolic":"method"}],"generateControlForRepeaterQuestion":[{"__symbolic":"method"}],"convertValidators":[{"__symbolic":"method"}],"convertValidator":[{"__symbolic":"method"}],"constructRepeaterFromsFromState":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}},"ɵb":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"filterSections":[{"__symbolic":"method"}],"meetsConditionGroups":[{"__symbolic":"method"}],"meetsConditionGroup":[{"__symbolic":"method"}],"meetsCondition":[{"__symbolic":"method"}],"getStringForValue":[{"__symbolic":"method"}],"getValuesForArray":[{"__symbolic":"method"}],"getValueForString":[{"__symbolic":"method"}],"convertStringToValue":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}}},"origins":{"QuestionnaireService":"./lib/services/questionnaire.service","GgQuestionnaireV2Module":"./lib/gg-questionnaire-v2.module","ConditionGroup":"./lib/interfaces/condition-group","Condition":"./lib/interfaces/condition","Question":"./lib/interfaces/question","RepeaterQuestion":"./lib/interfaces/repeater-question","Section":"./lib/interfaces/section","Validator":"./lib/interfaces/validator","Questionnaire":"./lib/interfaces/questionnaire","QuestionnaireOptions":"./lib/interfaces/questionnaire-options","SelectOption":"./lib/interfaces/select-option","ConditionRelationship":"./lib/enums/condition-relationship.enum","ConditionType":"./lib/enums/condition-type.enum","QuestionType":"./lib/enums/question-type.enum","ValidationType":"./lib/enums/validation-type.enum","InputType":"./lib/enums/input-type.enum","RepeaterQuestionType":"./lib/enums/repeater-question-type.enum","ɵa":"./lib/services/form-constructor.service","ɵb":"./lib/services/filter.service"},"importAs":"@glowgreen/gg-questionnaire-v2"}
|
|
@@ -9,7 +9,7 @@ export declare class FilterService {
|
|
|
9
9
|
* @returns An array of filtered sections with their filtered questions.
|
|
10
10
|
* @author Will Poulson
|
|
11
11
|
*/
|
|
12
|
-
filterSections(sections: Array<Section>, currentQuestionnaireForm: FormGroup | null): Array<Section>;
|
|
12
|
+
filterSections(sections: Array<Section>, currentQuestionnaireForm: FormGroup | null, additionalData?: Object): Array<Section>;
|
|
13
13
|
/**
|
|
14
14
|
* Checks if each condition groups conditions have been met.
|
|
15
15
|
* @param conditionGroups The array of condition groups.
|
|
@@ -14,7 +14,7 @@ export declare class FormConstructorService {
|
|
|
14
14
|
* @returns A filted form group.
|
|
15
15
|
* @author Will Poulson
|
|
16
16
|
*/
|
|
17
|
-
generateFormsForQuestionnaire(questionnaire: Questionnaire, currentQuestionnaireForm: FormGroup, skipFilter?: boolean): {
|
|
17
|
+
generateFormsForQuestionnaire(questionnaire: Questionnaire, currentQuestionnaireForm: FormGroup, additionalData?: Object, skipFilter?: boolean): {
|
|
18
18
|
sections: Array<Section>;
|
|
19
19
|
forms: FormGroup;
|
|
20
20
|
};
|
|
@@ -16,6 +16,7 @@ export declare class QuestionnaireService {
|
|
|
16
16
|
private currentQuestionName;
|
|
17
17
|
private questionnaireValueChangeSubscription;
|
|
18
18
|
private questionValueChangeSubscription;
|
|
19
|
+
private additionalData;
|
|
19
20
|
private skippable;
|
|
20
21
|
constructor(formConstuctor: FormConstructorService, options: QuestionnaireOptions);
|
|
21
22
|
/**
|
|
@@ -25,7 +26,7 @@ export declare class QuestionnaireService {
|
|
|
25
26
|
* @returns null
|
|
26
27
|
* @author Will Poulson
|
|
27
28
|
*/
|
|
28
|
-
loadQuestionnaire(questionnaire: Questionnaire, savedState?: Object): Promise<any>;
|
|
29
|
+
loadQuestionnaire(questionnaire: Questionnaire, savedState?: Object, additionalData?: Object): Promise<any>;
|
|
29
30
|
/**
|
|
30
31
|
* Updates the current questionnaire, used when a value is updated to check conditions.
|
|
31
32
|
* @param savedState The saved state of the questionnaire, often from localstorage.
|