@glowgreen/gg-questionnaire-v2 0.0.82 → 0.0.84
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 +306 -1240
- package/bundles/glowgreen-gg-questionnaire-v2.umd.js.map +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js +15 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js.map +1 -1
- package/esm2015/glowgreen-gg-questionnaire-v2.js +2 -8
- package/esm2015/lib/enums/condition-relationship.enum.js +6 -11
- package/esm2015/lib/enums/condition-type.enum.js +10 -15
- package/esm2015/lib/enums/input-type.enum.js +15 -20
- package/esm2015/lib/enums/question-type.enum.js +15 -20
- package/esm2015/lib/enums/repeater-question-type.enum.js +7 -12
- package/esm2015/lib/enums/validation-type.enum.js +10 -15
- package/esm2015/lib/gg-questionnaire-v2.module.js +17 -13
- package/esm2015/lib/interfaces/attachment.js +1 -15
- package/esm2015/lib/interfaces/checklist-item.js +1 -15
- package/esm2015/lib/interfaces/condition-group.js +1 -15
- package/esm2015/lib/interfaces/condition.js +1 -17
- package/esm2015/lib/interfaces/question.js +1 -59
- package/esm2015/lib/interfaces/questionnaire-options.js +1 -21
- package/esm2015/lib/interfaces/questionnaire.js +1 -15
- package/esm2015/lib/interfaces/repeater-question.js +1 -33
- package/esm2015/lib/interfaces/section.js +1 -19
- package/esm2015/lib/interfaces/select-option.js +1 -19
- package/esm2015/lib/interfaces/validator.js +1 -15
- package/esm2015/lib/services/filter.service.js +45 -124
- package/esm2015/lib/services/form-constructor.service.js +30 -113
- package/esm2015/lib/services/questionnaire.service.js +97 -377
- package/esm2015/public_api.js +1 -5
- package/esm5/glowgreen-gg-questionnaire-v2.js +2 -8
- package/esm5/lib/enums/condition-relationship.enum.js +6 -11
- package/esm5/lib/enums/condition-type.enum.js +10 -15
- package/esm5/lib/enums/input-type.enum.js +15 -20
- package/esm5/lib/enums/question-type.enum.js +15 -20
- package/esm5/lib/enums/repeater-question-type.enum.js +7 -12
- package/esm5/lib/enums/validation-type.enum.js +10 -15
- package/esm5/lib/gg-questionnaire-v2.module.js +27 -27
- package/esm5/lib/interfaces/attachment.js +1 -15
- package/esm5/lib/interfaces/checklist-item.js +1 -15
- package/esm5/lib/interfaces/condition-group.js +1 -15
- package/esm5/lib/interfaces/condition.js +1 -17
- package/esm5/lib/interfaces/question.js +1 -59
- package/esm5/lib/interfaces/questionnaire-options.js +1 -21
- package/esm5/lib/interfaces/questionnaire.js +1 -15
- package/esm5/lib/interfaces/repeater-question.js +1 -33
- package/esm5/lib/interfaces/section.js +1 -19
- package/esm5/lib/interfaces/select-option.js +1 -19
- package/esm5/lib/interfaces/validator.js +1 -15
- package/esm5/lib/services/filter.service.js +47 -264
- package/esm5/lib/services/form-constructor.service.js +35 -247
- package/esm5/lib/services/questionnaire.service.js +105 -608
- package/esm5/public_api.js +1 -5
- package/fesm2015/glowgreen-gg-questionnaire-v2.js +245 -712
- package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/fesm5/glowgreen-gg-questionnaire-v2.js +243 -1204
- package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/glowgreen-gg-questionnaire-v2.d.ts +1 -2
- package/lib/gg-questionnaire-v2.module.d.ts +5 -1
- package/lib/services/filter.service.d.ts +3 -0
- package/lib/services/form-constructor.service.d.ts +3 -0
- package/lib/services/questionnaire.service.d.ts +12 -9
- package/package.json +5 -3
- package/glowgreen-gg-questionnaire-v2.metadata.json +0 -1
|
@@ -1,55 +1,39 @@
|
|
|
1
1
|
import { __values } from 'tslib';
|
|
2
|
-
import {
|
|
2
|
+
import { ɵɵdefineInjectable, ɵsetClassMetadata, Injectable, ɵɵinject, EventEmitter, Inject, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
|
|
3
3
|
import { Validators, FormBuilder, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { clone, get, keys, cloneDeep } from 'lodash';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Slider: 'slider',
|
|
21
|
-
Info: 'info',
|
|
22
|
-
Feedback: 'feedback',
|
|
23
|
-
};
|
|
6
|
+
var QuestionType;
|
|
7
|
+
(function (QuestionType) {
|
|
8
|
+
QuestionType["Input"] = "input";
|
|
9
|
+
QuestionType["Select"] = "select";
|
|
10
|
+
QuestionType["Textarea"] = "textarea";
|
|
11
|
+
QuestionType["Repeater"] = "repeater";
|
|
12
|
+
QuestionType["Checklist"] = "checklist";
|
|
13
|
+
QuestionType["Attachment"] = "attachment";
|
|
14
|
+
QuestionType["Upload"] = "upload";
|
|
15
|
+
QuestionType["Signature"] = "signature";
|
|
16
|
+
QuestionType["Slider"] = "slider";
|
|
17
|
+
QuestionType["Info"] = "info";
|
|
18
|
+
QuestionType["Feedback"] = "feedback";
|
|
19
|
+
})(QuestionType || (QuestionType = {}));
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
GreaterThan: 'greaterThan',
|
|
35
|
-
Includes: 'includes',
|
|
36
|
-
Excludes: 'excludes',
|
|
37
|
-
};
|
|
21
|
+
var ConditionType;
|
|
22
|
+
(function (ConditionType) {
|
|
23
|
+
ConditionType["EqualTo"] = "equalTo";
|
|
24
|
+
ConditionType["NotEqualTo"] = "notEqualTo";
|
|
25
|
+
ConditionType["LessThan"] = "lessThan";
|
|
26
|
+
ConditionType["GreaterThan"] = "greaterThan";
|
|
27
|
+
ConditionType["Includes"] = "includes";
|
|
28
|
+
ConditionType["Excludes"] = "excludes";
|
|
29
|
+
})(ConditionType || (ConditionType = {}));
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var ConditionRelationship = {
|
|
45
|
-
Every: 'every',
|
|
46
|
-
Any: 'any',
|
|
47
|
-
};
|
|
31
|
+
var ConditionRelationship;
|
|
32
|
+
(function (ConditionRelationship) {
|
|
33
|
+
ConditionRelationship["Every"] = "every";
|
|
34
|
+
ConditionRelationship["Any"] = "any";
|
|
35
|
+
})(ConditionRelationship || (ConditionRelationship = {}));
|
|
48
36
|
|
|
49
|
-
/**
|
|
50
|
-
* @fileoverview added by tsickle
|
|
51
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
52
|
-
*/
|
|
53
37
|
var FilterService = /** @class */ (function () {
|
|
54
38
|
function FilterService() {
|
|
55
39
|
}
|
|
@@ -60,25 +44,8 @@ var FilterService = /** @class */ (function () {
|
|
|
60
44
|
* @returns An array of filtered sections with their filtered questions.
|
|
61
45
|
* @author Will Poulson
|
|
62
46
|
*/
|
|
63
|
-
|
|
64
|
-
* Filters an array of sections based on their condition groups.
|
|
65
|
-
* @author Will Poulson
|
|
66
|
-
* @param {?} sections The array of sections to filter.
|
|
67
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
68
|
-
* @param {?=} additionalData
|
|
69
|
-
* @return {?} An array of filtered sections with their filtered questions.
|
|
70
|
-
*/
|
|
71
|
-
FilterService.prototype.filterSections = /**
|
|
72
|
-
* Filters an array of sections based on their condition groups.
|
|
73
|
-
* @author Will Poulson
|
|
74
|
-
* @param {?} sections The array of sections to filter.
|
|
75
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
76
|
-
* @param {?=} additionalData
|
|
77
|
-
* @return {?} An array of filtered sections with their filtered questions.
|
|
78
|
-
*/
|
|
79
|
-
function (sections, currentQuestionnaireForm, additionalData) {
|
|
47
|
+
FilterService.prototype.filterSections = function (sections, currentQuestionnaireForm, additionalData) {
|
|
80
48
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
81
|
-
/** @type {?} */
|
|
82
49
|
var filteredSections = [];
|
|
83
50
|
try {
|
|
84
51
|
for (var sections_1 = __values(sections), sections_1_1 = sections_1.next(); !sections_1_1.done; sections_1_1 = sections_1.next()) {
|
|
@@ -86,7 +53,6 @@ var FilterService = /** @class */ (function () {
|
|
|
86
53
|
if (!this.meetsConditionGroups(section.conditionGroups, currentQuestionnaireForm, additionalData)) {
|
|
87
54
|
continue;
|
|
88
55
|
}
|
|
89
|
-
/** @type {?} */
|
|
90
56
|
var filteredQuestions = [];
|
|
91
57
|
try {
|
|
92
58
|
for (var _e = (e_2 = void 0, __values(section.questions)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -96,23 +62,19 @@ var FilterService = /** @class */ (function () {
|
|
|
96
62
|
}
|
|
97
63
|
// If it's a repeater we need to do a lot of extra filtering due to per item conditions.
|
|
98
64
|
if (question.type === 'repeater' && currentQuestionnaireForm) {
|
|
99
|
-
|
|
100
|
-
var items = (/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])));
|
|
65
|
+
var items = currentQuestionnaireForm.get([section.name, question.name]);
|
|
101
66
|
if (items && items.controls) {
|
|
102
67
|
try {
|
|
103
68
|
for (var _g = (e_3 = void 0, __values(items.controls)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
104
69
|
var repeaterItem = _h.value;
|
|
105
|
-
/** @type {?} */
|
|
106
70
|
var filteredRepeaterItemQuestions = [];
|
|
107
71
|
try {
|
|
108
72
|
for (var _j = (e_4 = void 0, __values(question.repeaterQuestions)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
109
73
|
var repeaterQuestion = _k.value;
|
|
110
|
-
|
|
111
|
-
var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, (/** @type {?} */ (repeaterItem)));
|
|
74
|
+
var meetsConditions = this.meetsConditionGroups(repeaterQuestion.conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
112
75
|
if (meetsConditions) {
|
|
113
|
-
/** @type {?} */
|
|
114
76
|
var cloneQuestion = clone(repeaterQuestion);
|
|
115
|
-
cloneQuestion.selectOptions = this.getFetchOptionsForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm,
|
|
77
|
+
cloneQuestion.selectOptions = this.getFetchOptionsForQuestion(repeaterQuestion, additionalData, currentQuestionnaireForm, repeaterItem);
|
|
116
78
|
filteredRepeaterItemQuestions.push(cloneQuestion);
|
|
117
79
|
}
|
|
118
80
|
}
|
|
@@ -124,7 +86,6 @@ var FilterService = /** @class */ (function () {
|
|
|
124
86
|
}
|
|
125
87
|
finally { if (e_4) throw e_4.error; }
|
|
126
88
|
}
|
|
127
|
-
/** @type {?} */
|
|
128
89
|
var index = items.controls.indexOf(repeaterItem);
|
|
129
90
|
if (!question.filteredRepeaterQuestions) {
|
|
130
91
|
question.filteredRepeaterQuestions = [];
|
|
@@ -168,30 +129,12 @@ var FilterService = /** @class */ (function () {
|
|
|
168
129
|
}
|
|
169
130
|
return filteredSections;
|
|
170
131
|
};
|
|
171
|
-
|
|
172
|
-
* @private
|
|
173
|
-
* @param {?} question
|
|
174
|
-
* @param {?} additionalData
|
|
175
|
-
* @param {?} currentQuestionnaireForm
|
|
176
|
-
* @param {?=} repeaterItem
|
|
177
|
-
* @return {?}
|
|
178
|
-
*/
|
|
179
|
-
FilterService.prototype.getFetchOptionsForQuestion = /**
|
|
180
|
-
* @private
|
|
181
|
-
* @param {?} question
|
|
182
|
-
* @param {?} additionalData
|
|
183
|
-
* @param {?} currentQuestionnaireForm
|
|
184
|
-
* @param {?=} repeaterItem
|
|
185
|
-
* @return {?}
|
|
186
|
-
*/
|
|
187
|
-
function (question, additionalData, currentQuestionnaireForm, repeaterItem) {
|
|
132
|
+
FilterService.prototype.getFetchOptionsForQuestion = function (question, additionalData, currentQuestionnaireForm, repeaterItem) {
|
|
188
133
|
if (!question.fetchPath) {
|
|
189
134
|
return question.selectOptions;
|
|
190
135
|
}
|
|
191
|
-
/** @type {?} */
|
|
192
136
|
var options = additionalData[question.fetchPath];
|
|
193
137
|
if (question.fetchSelectors && question.fetchSelectors.length > 0) {
|
|
194
|
-
/** @type {?} */
|
|
195
138
|
var values = this.getValuesForArray(question.fetchSelectors, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
196
139
|
options = get(additionalData[question.fetchPath], values);
|
|
197
140
|
}
|
|
@@ -201,17 +144,7 @@ var FilterService = /** @class */ (function () {
|
|
|
201
144
|
}
|
|
202
145
|
return question.selectOptions.concat(options);
|
|
203
146
|
};
|
|
204
|
-
|
|
205
|
-
* @private
|
|
206
|
-
* @param {?} items
|
|
207
|
-
* @return {?}
|
|
208
|
-
*/
|
|
209
|
-
FilterService.prototype.getFinalFetchArray = /**
|
|
210
|
-
* @private
|
|
211
|
-
* @param {?} items
|
|
212
|
-
* @return {?}
|
|
213
|
-
*/
|
|
214
|
-
function (items) {
|
|
147
|
+
FilterService.prototype.getFinalFetchArray = function (items) {
|
|
215
148
|
var e_5, _a;
|
|
216
149
|
if (!items) {
|
|
217
150
|
return null;
|
|
@@ -222,13 +155,12 @@ var FilterService = /** @class */ (function () {
|
|
|
222
155
|
if (items.length <= 0) {
|
|
223
156
|
return null;
|
|
224
157
|
}
|
|
225
|
-
/** @type {?} */
|
|
226
158
|
var convertedArray = [];
|
|
227
159
|
try {
|
|
228
160
|
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
229
161
|
var item = items_1_1.value;
|
|
230
162
|
if (item) {
|
|
231
|
-
if (item instanceof Object && item.value && item.label) {
|
|
163
|
+
if (item instanceof Object && (item.value !== undefined) && item.label) {
|
|
232
164
|
convertedArray.push(item);
|
|
233
165
|
}
|
|
234
166
|
else {
|
|
@@ -246,17 +178,10 @@ var FilterService = /** @class */ (function () {
|
|
|
246
178
|
}
|
|
247
179
|
return convertedArray;
|
|
248
180
|
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
*/
|
|
254
|
-
FilterService.prototype.uppercase = /**
|
|
255
|
-
* @private
|
|
256
|
-
* @param {?} item
|
|
257
|
-
* @return {?}
|
|
258
|
-
*/
|
|
259
|
-
function (item) {
|
|
181
|
+
FilterService.prototype.uppercase = function (item) {
|
|
182
|
+
if (!isNaN(item)) {
|
|
183
|
+
return item;
|
|
184
|
+
}
|
|
260
185
|
return item.charAt(0).toUpperCase() + item.slice(1);
|
|
261
186
|
};
|
|
262
187
|
/**
|
|
@@ -266,38 +191,14 @@ var FilterService = /** @class */ (function () {
|
|
|
266
191
|
* @returns A boolean stating if the condition groups conditions has been met.
|
|
267
192
|
* @author Will Poulson
|
|
268
193
|
*/
|
|
269
|
-
|
|
270
|
-
* Checks if each condition groups conditions have been met.
|
|
271
|
-
* @author Will Poulson
|
|
272
|
-
* @private
|
|
273
|
-
* @param {?} conditionGroups The array of condition groups.
|
|
274
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
275
|
-
* @param {?=} additionalData
|
|
276
|
-
* @param {?=} repeaterItem
|
|
277
|
-
* @return {?} A boolean stating if the condition groups conditions has been met.
|
|
278
|
-
*/
|
|
279
|
-
FilterService.prototype.meetsConditionGroups = /**
|
|
280
|
-
* Checks if each condition groups conditions have been met.
|
|
281
|
-
* @author Will Poulson
|
|
282
|
-
* @private
|
|
283
|
-
* @param {?} conditionGroups The array of condition groups.
|
|
284
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
285
|
-
* @param {?=} additionalData
|
|
286
|
-
* @param {?=} repeaterItem
|
|
287
|
-
* @return {?} A boolean stating if the condition groups conditions has been met.
|
|
288
|
-
*/
|
|
289
|
-
function (conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
194
|
+
FilterService.prototype.meetsConditionGroups = function (conditionGroups, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
290
195
|
var _this = this;
|
|
291
196
|
if (!conditionGroups || conditionGroups.length === 0) {
|
|
292
197
|
return true;
|
|
293
198
|
}
|
|
294
|
-
return conditionGroups.every((
|
|
295
|
-
* @param {?} x
|
|
296
|
-
* @return {?}
|
|
297
|
-
*/
|
|
298
|
-
function (x) {
|
|
199
|
+
return conditionGroups.every(function (x) {
|
|
299
200
|
return _this.meetsConditionGroup(x, currentQuestionnaireForm, additionalData, repeaterItem) === true;
|
|
300
|
-
})
|
|
201
|
+
});
|
|
301
202
|
};
|
|
302
203
|
/**
|
|
303
204
|
* Checks if a condition groups conditions have been met.
|
|
@@ -306,32 +207,11 @@ var FilterService = /** @class */ (function () {
|
|
|
306
207
|
* @returns A boolean stating if the condition group conditions has been met.
|
|
307
208
|
* @author Will Poulson
|
|
308
209
|
*/
|
|
309
|
-
|
|
310
|
-
* Checks if a condition groups conditions have been met.
|
|
311
|
-
* @author Will Poulson
|
|
312
|
-
* @private
|
|
313
|
-
* @param {?} conditionGroup The condition group to check.
|
|
314
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
315
|
-
* @param {?=} additionalData
|
|
316
|
-
* @param {?=} repeaterItem
|
|
317
|
-
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
318
|
-
*/
|
|
319
|
-
FilterService.prototype.meetsConditionGroup = /**
|
|
320
|
-
* Checks if a condition groups conditions have been met.
|
|
321
|
-
* @author Will Poulson
|
|
322
|
-
* @private
|
|
323
|
-
* @param {?} conditionGroup The condition group to check.
|
|
324
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
325
|
-
* @param {?=} additionalData
|
|
326
|
-
* @param {?=} repeaterItem
|
|
327
|
-
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
328
|
-
*/
|
|
329
|
-
function (conditionGroup, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
210
|
+
FilterService.prototype.meetsConditionGroup = function (conditionGroup, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
330
211
|
var e_6, _a;
|
|
331
212
|
if (!conditionGroup.conditions || conditionGroup.conditions.length === 0) {
|
|
332
213
|
return true;
|
|
333
214
|
}
|
|
334
|
-
/** @type {?} */
|
|
335
215
|
var results = [];
|
|
336
216
|
try {
|
|
337
217
|
for (var _b = __values(conditionGroup.conditions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -348,21 +228,13 @@ var FilterService = /** @class */ (function () {
|
|
|
348
228
|
}
|
|
349
229
|
switch (conditionGroup.relationship) {
|
|
350
230
|
case ConditionRelationship.Every:
|
|
351
|
-
return results.every((
|
|
352
|
-
* @param {?} x
|
|
353
|
-
* @return {?}
|
|
354
|
-
*/
|
|
355
|
-
function (x) {
|
|
231
|
+
return results.every(function (x) {
|
|
356
232
|
return x === true;
|
|
357
|
-
})
|
|
233
|
+
});
|
|
358
234
|
case ConditionRelationship.Any:
|
|
359
|
-
return !!results.find((
|
|
360
|
-
* @param {?} x
|
|
361
|
-
* @return {?}
|
|
362
|
-
*/
|
|
363
|
-
function (x) {
|
|
235
|
+
return !!results.find(function (x) {
|
|
364
236
|
return x === true;
|
|
365
|
-
})
|
|
237
|
+
});
|
|
366
238
|
default:
|
|
367
239
|
return true;
|
|
368
240
|
}
|
|
@@ -374,52 +246,21 @@ var FilterService = /** @class */ (function () {
|
|
|
374
246
|
* @returns A boolean stating if the condition group conditions has been met.
|
|
375
247
|
* @author Will Poulson
|
|
376
248
|
*/
|
|
377
|
-
|
|
378
|
-
* Checks if a condition has been met.
|
|
379
|
-
* @author Will Poulson
|
|
380
|
-
* @private
|
|
381
|
-
* @param {?} condition The condition to check.
|
|
382
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
383
|
-
* @param {?=} additionalData
|
|
384
|
-
* @param {?=} repeaterItem
|
|
385
|
-
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
386
|
-
*/
|
|
387
|
-
FilterService.prototype.meetsCondition = /**
|
|
388
|
-
* Checks if a condition has been met.
|
|
389
|
-
* @author Will Poulson
|
|
390
|
-
* @private
|
|
391
|
-
* @param {?} condition The condition to check.
|
|
392
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
393
|
-
* @param {?=} additionalData
|
|
394
|
-
* @param {?=} repeaterItem
|
|
395
|
-
* @return {?} A boolean stating if the condition group conditions has been met.
|
|
396
|
-
*/
|
|
397
|
-
function (condition, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
249
|
+
FilterService.prototype.meetsCondition = function (condition, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
398
250
|
var e_7, _a, e_8, _b;
|
|
399
|
-
/** @type {?} */
|
|
400
251
|
var v1s = this.getValuesForArray(condition.v1s, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
401
|
-
/** @type {?} */
|
|
402
252
|
var v2s = this.getValuesForArray(condition.v2s, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
403
|
-
/** @type {?} */
|
|
404
253
|
var result = false;
|
|
405
254
|
switch (condition.type) {
|
|
406
255
|
case ConditionType.Excludes:
|
|
407
|
-
result = v1s.filter((
|
|
408
|
-
* @param {?} v1
|
|
409
|
-
* @return {?}
|
|
410
|
-
*/
|
|
411
|
-
function (v1) {
|
|
256
|
+
result = v1s.filter(function (v1) {
|
|
412
257
|
return v2s.indexOf(v1) > -1;
|
|
413
|
-
})
|
|
258
|
+
}).length === 0;
|
|
414
259
|
break;
|
|
415
260
|
case ConditionType.Includes:
|
|
416
|
-
result = v1s.filter((
|
|
417
|
-
* @param {?} v1
|
|
418
|
-
* @return {?}
|
|
419
|
-
*/
|
|
420
|
-
function (v1) {
|
|
261
|
+
result = v1s.filter(function (v1) {
|
|
421
262
|
return v2s.indexOf(v1) > -1;
|
|
422
|
-
})
|
|
263
|
+
}).length !== 0;
|
|
423
264
|
break;
|
|
424
265
|
default: try {
|
|
425
266
|
for (var v2s_1 = __values(v2s), v2s_1_1 = v2s_1.next(); !v2s_1_1.done; v2s_1_1 = v2s_1.next()) {
|
|
@@ -478,17 +319,7 @@ var FilterService = /** @class */ (function () {
|
|
|
478
319
|
}
|
|
479
320
|
return result;
|
|
480
321
|
};
|
|
481
|
-
|
|
482
|
-
* @private
|
|
483
|
-
* @param {?} value
|
|
484
|
-
* @return {?}
|
|
485
|
-
*/
|
|
486
|
-
FilterService.prototype.getStringForValue = /**
|
|
487
|
-
* @private
|
|
488
|
-
* @param {?} value
|
|
489
|
-
* @return {?}
|
|
490
|
-
*/
|
|
491
|
-
function (value) {
|
|
322
|
+
FilterService.prototype.getStringForValue = function (value) {
|
|
492
323
|
switch (value) {
|
|
493
324
|
case null:
|
|
494
325
|
return 'null';
|
|
@@ -503,35 +334,13 @@ var FilterService = /** @class */ (function () {
|
|
|
503
334
|
* @returns An array of strings/values
|
|
504
335
|
* @author Will Poulson
|
|
505
336
|
*/
|
|
506
|
-
|
|
507
|
-
* Gets the current values for an array of strings.
|
|
508
|
-
* @author Will Poulson
|
|
509
|
-
* @private
|
|
510
|
-
* @param {?} paths The array of strings to check.
|
|
511
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
512
|
-
* @param {?=} additionalData
|
|
513
|
-
* @param {?=} repeaterItem
|
|
514
|
-
* @return {?} An array of strings/values
|
|
515
|
-
*/
|
|
516
|
-
FilterService.prototype.getValuesForArray = /**
|
|
517
|
-
* Gets the current values for an array of strings.
|
|
518
|
-
* @author Will Poulson
|
|
519
|
-
* @private
|
|
520
|
-
* @param {?} paths The array of strings to check.
|
|
521
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
522
|
-
* @param {?=} additionalData
|
|
523
|
-
* @param {?=} repeaterItem
|
|
524
|
-
* @return {?} An array of strings/values
|
|
525
|
-
*/
|
|
526
|
-
function (paths, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
337
|
+
FilterService.prototype.getValuesForArray = function (paths, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
527
338
|
var e_9, _a;
|
|
528
339
|
if (currentQuestionnaireForm) {
|
|
529
|
-
/** @type {?} */
|
|
530
340
|
var values = [];
|
|
531
341
|
try {
|
|
532
342
|
for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
|
|
533
343
|
var path = paths_1_1.value;
|
|
534
|
-
/** @type {?} */
|
|
535
344
|
var value = this.getValueForString(path, currentQuestionnaireForm, additionalData, repeaterItem);
|
|
536
345
|
values.push(value);
|
|
537
346
|
}
|
|
@@ -556,37 +365,15 @@ var FilterService = /** @class */ (function () {
|
|
|
556
365
|
* @returns A string/value.
|
|
557
366
|
* @author Will Poulson
|
|
558
367
|
*/
|
|
559
|
-
|
|
560
|
-
* Gets a current value for a string.
|
|
561
|
-
* @author Will Poulson
|
|
562
|
-
* @private
|
|
563
|
-
* @param {?} path The string value to check.
|
|
564
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
565
|
-
* @param {?=} additionalData
|
|
566
|
-
* @param {?=} repeaterItem
|
|
567
|
-
* @return {?} A string/value.
|
|
568
|
-
*/
|
|
569
|
-
FilterService.prototype.getValueForString = /**
|
|
570
|
-
* Gets a current value for a string.
|
|
571
|
-
* @author Will Poulson
|
|
572
|
-
* @private
|
|
573
|
-
* @param {?} path The string value to check.
|
|
574
|
-
* @param {?} currentQuestionnaireForm The current form data, can be null/undefined.
|
|
575
|
-
* @param {?=} additionalData
|
|
576
|
-
* @param {?=} repeaterItem
|
|
577
|
-
* @return {?} A string/value.
|
|
578
|
-
*/
|
|
579
|
-
function (path, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
368
|
+
FilterService.prototype.getValueForString = function (path, currentQuestionnaireForm, additionalData, repeaterItem) {
|
|
580
369
|
if (currentQuestionnaireForm) {
|
|
581
370
|
if (!additionalData) {
|
|
582
371
|
additionalData = {};
|
|
583
372
|
}
|
|
584
|
-
/** @type {?} */
|
|
585
373
|
var control = currentQuestionnaireForm.get(path.toString());
|
|
586
374
|
if (!control && repeaterItem) {
|
|
587
375
|
control = repeaterItem.get(path);
|
|
588
376
|
}
|
|
589
|
-
/** @type {?} */
|
|
590
377
|
var value = control ? control.value : this.convertStringToValue(path);
|
|
591
378
|
return get(additionalData, path, value);
|
|
592
379
|
}
|
|
@@ -601,23 +388,7 @@ var FilterService = /** @class */ (function () {
|
|
|
601
388
|
* @returns Either a string or the converted value.
|
|
602
389
|
* @author Will Poulson
|
|
603
390
|
*/
|
|
604
|
-
|
|
605
|
-
* Converts a string to a value.
|
|
606
|
-
* Eg. true/false.
|
|
607
|
-
* @author Will Poulson
|
|
608
|
-
* @private
|
|
609
|
-
* @param {?} path The string value to check for conversion;
|
|
610
|
-
* @return {?} Either a string or the converted value.
|
|
611
|
-
*/
|
|
612
|
-
FilterService.prototype.convertStringToValue = /**
|
|
613
|
-
* Converts a string to a value.
|
|
614
|
-
* Eg. true/false.
|
|
615
|
-
* @author Will Poulson
|
|
616
|
-
* @private
|
|
617
|
-
* @param {?} path The string value to check for conversion;
|
|
618
|
-
* @return {?} Either a string or the converted value.
|
|
619
|
-
*/
|
|
620
|
-
function (path) {
|
|
391
|
+
FilterService.prototype.convertStringToValue = function (path) {
|
|
621
392
|
switch (path) {
|
|
622
393
|
case 'true':
|
|
623
394
|
return true;
|
|
@@ -629,35 +400,27 @@ var FilterService = /** @class */ (function () {
|
|
|
629
400
|
return path;
|
|
630
401
|
}
|
|
631
402
|
};
|
|
632
|
-
FilterService
|
|
633
|
-
|
|
634
|
-
providedIn: 'root'
|
|
635
|
-
},] }
|
|
636
|
-
];
|
|
637
|
-
/** @nocollapse */
|
|
638
|
-
FilterService.ctorParameters = function () { return []; };
|
|
639
|
-
/** @nocollapse */ FilterService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FilterService_Factory() { return new FilterService(); }, token: FilterService, providedIn: "root" });
|
|
403
|
+
FilterService.ɵfac = function FilterService_Factory(t) { return new (t || FilterService)(); };
|
|
404
|
+
FilterService.ɵprov = ɵɵdefineInjectable({ token: FilterService, factory: FilterService.ɵfac, providedIn: 'root' });
|
|
640
405
|
return FilterService;
|
|
641
406
|
}());
|
|
407
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(FilterService, [{
|
|
408
|
+
type: Injectable,
|
|
409
|
+
args: [{
|
|
410
|
+
providedIn: 'root'
|
|
411
|
+
}]
|
|
412
|
+
}], function () { return []; }, null); })();
|
|
642
413
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
String: 'string',
|
|
653
|
-
Email: 'email',
|
|
654
|
-
Telephone: 'telephone',
|
|
655
|
-
};
|
|
414
|
+
var ValidationType;
|
|
415
|
+
(function (ValidationType) {
|
|
416
|
+
ValidationType["Required"] = "required";
|
|
417
|
+
ValidationType["Boolean"] = "boolean";
|
|
418
|
+
ValidationType["Number"] = "number";
|
|
419
|
+
ValidationType["String"] = "string";
|
|
420
|
+
ValidationType["Email"] = "email";
|
|
421
|
+
ValidationType["Telephone"] = "telephone";
|
|
422
|
+
})(ValidationType || (ValidationType = {}));
|
|
656
423
|
|
|
657
|
-
/**
|
|
658
|
-
* @fileoverview added by tsickle
|
|
659
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
660
|
-
*/
|
|
661
424
|
var FormConstructorService = /** @class */ (function () {
|
|
662
425
|
function FormConstructorService(fb, filterService) {
|
|
663
426
|
this.fb = fb;
|
|
@@ -670,62 +433,23 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
670
433
|
* @returns A filted form group.
|
|
671
434
|
* @author Will Poulson
|
|
672
435
|
*/
|
|
673
|
-
|
|
674
|
-
* Constructs a form group based on the questionnaire data.
|
|
675
|
-
* This form group has been filtered down based on the conditions of the sections and questions.
|
|
676
|
-
* @author Will Poulson
|
|
677
|
-
* @param {?} questionnaire The questionnaire data to build the form group on.
|
|
678
|
-
* @param {?} currentQuestionnaire
|
|
679
|
-
* @param {?} currentQuestionnaireForm
|
|
680
|
-
* @param {?=} additionalData
|
|
681
|
-
* @param {?=} skipFilter
|
|
682
|
-
* @return {?} A filted form group.
|
|
683
|
-
*/
|
|
684
|
-
FormConstructorService.prototype.generateFormsForQuestionnaire = /**
|
|
685
|
-
* Constructs a form group based on the questionnaire data.
|
|
686
|
-
* This form group has been filtered down based on the conditions of the sections and questions.
|
|
687
|
-
* @author Will Poulson
|
|
688
|
-
* @param {?} questionnaire The questionnaire data to build the form group on.
|
|
689
|
-
* @param {?} currentQuestionnaire
|
|
690
|
-
* @param {?} currentQuestionnaireForm
|
|
691
|
-
* @param {?=} additionalData
|
|
692
|
-
* @param {?=} skipFilter
|
|
693
|
-
* @return {?} A filted form group.
|
|
694
|
-
*/
|
|
695
|
-
function (questionnaire, currentQuestionnaire, currentQuestionnaireForm, additionalData, skipFilter) {
|
|
696
|
-
/** @type {?} */
|
|
436
|
+
FormConstructorService.prototype.generateFormsForQuestionnaire = function (questionnaire, currentQuestionnaire, currentQuestionnaireForm, additionalData, skipFilter) {
|
|
697
437
|
var sections = skipFilter ?
|
|
698
438
|
questionnaire.sections :
|
|
699
439
|
this.filterService.filterSections(questionnaire.sections, currentQuestionnaireForm, additionalData);
|
|
700
|
-
/** @type {?} */
|
|
701
440
|
var noChange = currentQuestionnaireForm && (sections === currentQuestionnaire.sections);
|
|
702
441
|
if (noChange && !skipFilter) {
|
|
703
442
|
return null;
|
|
704
443
|
}
|
|
705
|
-
/** @type {?} */
|
|
706
444
|
var questionnaireForms = this.generateFormsForSections(sections, currentQuestionnaireForm);
|
|
707
445
|
return { sections: sections, forms: questionnaireForms };
|
|
708
446
|
};
|
|
709
|
-
|
|
710
|
-
* @private
|
|
711
|
-
* @param {?} sections
|
|
712
|
-
* @param {?} currentQuestionnaireForm
|
|
713
|
-
* @return {?}
|
|
714
|
-
*/
|
|
715
|
-
FormConstructorService.prototype.generateFormsForSections = /**
|
|
716
|
-
* @private
|
|
717
|
-
* @param {?} sections
|
|
718
|
-
* @param {?} currentQuestionnaireForm
|
|
719
|
-
* @return {?}
|
|
720
|
-
*/
|
|
721
|
-
function (sections, currentQuestionnaireForm) {
|
|
447
|
+
FormConstructorService.prototype.generateFormsForSections = function (sections, currentQuestionnaireForm) {
|
|
722
448
|
var e_1, _a;
|
|
723
|
-
/** @type {?} */
|
|
724
449
|
var questionnaireForms = this.fb.group({});
|
|
725
450
|
try {
|
|
726
451
|
for (var sections_1 = __values(sections), sections_1_1 = sections_1.next(); !sections_1_1.done; sections_1_1 = sections_1.next()) {
|
|
727
452
|
var section = sections_1_1.value;
|
|
728
|
-
/** @type {?} */
|
|
729
453
|
var sectionForms = this.generateFormsForSection(section, currentQuestionnaireForm);
|
|
730
454
|
questionnaireForms.addControl(section.name, sectionForms);
|
|
731
455
|
}
|
|
@@ -746,27 +470,8 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
746
470
|
* @returns A filtered form group.
|
|
747
471
|
* @author Will Poulson
|
|
748
472
|
*/
|
|
749
|
-
|
|
750
|
-
* Constructs a form group based on the section data.
|
|
751
|
-
* This form group has been filtered down based on the conditions of the questions.
|
|
752
|
-
* @author Will Poulson
|
|
753
|
-
* @private
|
|
754
|
-
* @param {?} section The section data to build the form group on.
|
|
755
|
-
* @param {?} currentQuestionnaireForm
|
|
756
|
-
* @return {?} A filtered form group.
|
|
757
|
-
*/
|
|
758
|
-
FormConstructorService.prototype.generateFormsForSection = /**
|
|
759
|
-
* Constructs a form group based on the section data.
|
|
760
|
-
* This form group has been filtered down based on the conditions of the questions.
|
|
761
|
-
* @author Will Poulson
|
|
762
|
-
* @private
|
|
763
|
-
* @param {?} section The section data to build the form group on.
|
|
764
|
-
* @param {?} currentQuestionnaireForm
|
|
765
|
-
* @return {?} A filtered form group.
|
|
766
|
-
*/
|
|
767
|
-
function (section, currentQuestionnaireForm) {
|
|
473
|
+
FormConstructorService.prototype.generateFormsForSection = function (section, currentQuestionnaireForm) {
|
|
768
474
|
var e_2, _a;
|
|
769
|
-
/** @type {?} */
|
|
770
475
|
var sectionForms = this.fb.group({});
|
|
771
476
|
try {
|
|
772
477
|
for (var _b = __values(section.questions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -774,7 +479,6 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
774
479
|
if (question.type === QuestionType.Info) {
|
|
775
480
|
continue;
|
|
776
481
|
}
|
|
777
|
-
/** @type {?} */
|
|
778
482
|
var questionControl = this.generateControlForQuestion(question, section, currentQuestionnaireForm);
|
|
779
483
|
sectionForms.addControl(question.name, questionControl);
|
|
780
484
|
}
|
|
@@ -794,65 +498,30 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
794
498
|
* @returns An abstract control.
|
|
795
499
|
* @author Will Poulson
|
|
796
500
|
*/
|
|
797
|
-
|
|
798
|
-
* Constructs an astract form control based on the question data.
|
|
799
|
-
* @author Will Poulson
|
|
800
|
-
* @private
|
|
801
|
-
* @param {?} question The question data to build the abstract control on.
|
|
802
|
-
* @param {?} section
|
|
803
|
-
* @param {?} currentQuestionnaireForm
|
|
804
|
-
* @return {?} An abstract control.
|
|
805
|
-
*/
|
|
806
|
-
FormConstructorService.prototype.generateControlForQuestion = /**
|
|
807
|
-
* Constructs an astract form control based on the question data.
|
|
808
|
-
* @author Will Poulson
|
|
809
|
-
* @private
|
|
810
|
-
* @param {?} question The question data to build the abstract control on.
|
|
811
|
-
* @param {?} section
|
|
812
|
-
* @param {?} currentQuestionnaireForm
|
|
813
|
-
* @return {?} An abstract control.
|
|
814
|
-
*/
|
|
815
|
-
function (question, section, currentQuestionnaireForm) {
|
|
501
|
+
FormConstructorService.prototype.generateControlForQuestion = function (question, section, currentQuestionnaireForm) {
|
|
816
502
|
var e_3, _a;
|
|
817
|
-
/** @type {?} */
|
|
818
503
|
var convertedValidators = this.convertValidators(question.validators);
|
|
819
|
-
/** @type {?} */
|
|
820
504
|
var defaultValue = question.defaultValue ? question.defaultValue : null;
|
|
821
505
|
switch (question.type) {
|
|
822
506
|
case QuestionType.Repeater:
|
|
823
|
-
/** @type {?} */
|
|
824
507
|
var newArray = this.fb.array([], convertedValidators);
|
|
825
|
-
|
|
826
|
-
var currentArray = currentQuestionnaireForm ? ((/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])))) : false;
|
|
508
|
+
var currentArray = currentQuestionnaireForm ? currentQuestionnaireForm.get([section.name, question.name]) : false;
|
|
827
509
|
if (currentArray && question.filteredRepeaterQuestions) {
|
|
828
510
|
var _loop_1 = function (control) {
|
|
829
511
|
var e_4, _a, e_5, _b;
|
|
830
|
-
/** @type {?} */
|
|
831
512
|
var index = currentArray.controls.indexOf(control);
|
|
832
513
|
if (index === -1) {
|
|
833
514
|
return "continue";
|
|
834
515
|
}
|
|
835
|
-
/** @type {?} */
|
|
836
516
|
var filteredQuestions = question.filteredRepeaterQuestions[index];
|
|
837
517
|
if (!filteredQuestions) {
|
|
838
518
|
return "continue";
|
|
839
519
|
}
|
|
840
|
-
|
|
841
|
-
var
|
|
842
|
-
* @param {?} x
|
|
843
|
-
* @return {?}
|
|
844
|
-
*/
|
|
845
|
-
function (x) { return x.name; }));
|
|
846
|
-
/** @type {?} */
|
|
847
|
-
var filteredOutQuestions = question.repeaterQuestions.filter((/**
|
|
848
|
-
* @param {?} x
|
|
849
|
-
* @return {?}
|
|
850
|
-
*/
|
|
851
|
-
function (x) { return !filteredQuestionNames.includes(x.name); }));
|
|
520
|
+
var filteredQuestionNames = filteredQuestions.map(function (x) { return x.name; });
|
|
521
|
+
var filteredOutQuestions = question.repeaterQuestions.filter(function (x) { return !filteredQuestionNames.includes(x.name); });
|
|
852
522
|
try {
|
|
853
523
|
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()) {
|
|
854
524
|
var filteredOutQuestion = filteredOutQuestions_1_1.value;
|
|
855
|
-
/** @type {?} */
|
|
856
525
|
var childControl = control.get(filteredOutQuestion.name);
|
|
857
526
|
childControl.setValidators([]);
|
|
858
527
|
childControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });
|
|
@@ -868,13 +537,11 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
868
537
|
try {
|
|
869
538
|
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()) {
|
|
870
539
|
var filteredQuestion = filteredQuestions_1_1.value;
|
|
871
|
-
/** @type {?} */
|
|
872
540
|
var childControl = control.get(filteredQuestion.name);
|
|
873
541
|
if (childControl.value) {
|
|
874
542
|
// If there's a value just skip it, no need to redo the validators each time.
|
|
875
543
|
continue;
|
|
876
544
|
}
|
|
877
|
-
/** @type {?} */
|
|
878
545
|
var convertedValidators_1 = this_1.convertValidators(filteredQuestion.validators);
|
|
879
546
|
childControl.setValidators(convertedValidators_1);
|
|
880
547
|
childControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });
|
|
@@ -918,33 +585,15 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
918
585
|
* @returns A form group.
|
|
919
586
|
* @author Will Poulson
|
|
920
587
|
*/
|
|
921
|
-
|
|
922
|
-
* Generates the form group for a checklist question.
|
|
923
|
-
* @author Will Poulson
|
|
924
|
-
* @private
|
|
925
|
-
* @param {?} question The question. Must be of type checklist or else null is returned.
|
|
926
|
-
* @param {?} convertedValidators
|
|
927
|
-
* @return {?} A form group.
|
|
928
|
-
*/
|
|
929
|
-
FormConstructorService.prototype.generateGroupForChecklist = /**
|
|
930
|
-
* Generates the form group for a checklist question.
|
|
931
|
-
* @author Will Poulson
|
|
932
|
-
* @private
|
|
933
|
-
* @param {?} question The question. Must be of type checklist or else null is returned.
|
|
934
|
-
* @param {?} convertedValidators
|
|
935
|
-
* @return {?} A form group.
|
|
936
|
-
*/
|
|
937
|
-
function (question, convertedValidators) {
|
|
588
|
+
FormConstructorService.prototype.generateGroupForChecklist = function (question, convertedValidators) {
|
|
938
589
|
var e_6, _a;
|
|
939
590
|
if (question.type !== QuestionType.Checklist || question.checklistItems.length === 0) {
|
|
940
591
|
return null;
|
|
941
592
|
}
|
|
942
|
-
/** @type {?} */
|
|
943
593
|
var checklistForms = this.fb.group({});
|
|
944
594
|
try {
|
|
945
595
|
for (var _b = __values(question.checklistItems), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
946
596
|
var checklistItem = _c.value;
|
|
947
|
-
/** @type {?} */
|
|
948
597
|
var checklistItemControl = this.fb.control(null, convertedValidators);
|
|
949
598
|
checklistForms.addControl(checklistItem.name, checklistItemControl);
|
|
950
599
|
}
|
|
@@ -964,32 +613,16 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
964
613
|
* @returns A form group.
|
|
965
614
|
* @author Will Poulson
|
|
966
615
|
*/
|
|
967
|
-
|
|
968
|
-
* Generates the form template for a repeater question.
|
|
969
|
-
* @author Will Poulson
|
|
970
|
-
* @param {?} question The question. Must be of type repeater or else null is returned.
|
|
971
|
-
* @param {?=} index
|
|
972
|
-
* @return {?} A form group.
|
|
973
|
-
*/
|
|
974
|
-
FormConstructorService.prototype.generateFormsForRepeater = /**
|
|
975
|
-
* Generates the form template for a repeater question.
|
|
976
|
-
* @author Will Poulson
|
|
977
|
-
* @param {?} question The question. Must be of type repeater or else null is returned.
|
|
978
|
-
* @param {?=} index
|
|
979
|
-
* @return {?} A form group.
|
|
980
|
-
*/
|
|
981
|
-
function (question, index) {
|
|
616
|
+
FormConstructorService.prototype.generateFormsForRepeater = function (question, index) {
|
|
982
617
|
var e_7, _a;
|
|
983
618
|
if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {
|
|
984
619
|
console.log('Question isnt a repeater or has no questions, returning null');
|
|
985
620
|
return null;
|
|
986
621
|
}
|
|
987
|
-
/** @type {?} */
|
|
988
622
|
var repeaterForms = this.fb.group({});
|
|
989
623
|
try {
|
|
990
624
|
for (var _b = __values(question.repeaterQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
991
625
|
var repeaterQuestion = _c.value;
|
|
992
|
-
/** @type {?} */
|
|
993
626
|
var repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);
|
|
994
627
|
repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);
|
|
995
628
|
}
|
|
@@ -1009,22 +642,7 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1009
642
|
* @returns An abstract control.
|
|
1010
643
|
* @author Will Poulson
|
|
1011
644
|
*/
|
|
1012
|
-
|
|
1013
|
-
* Generates a control for a repeaters question.
|
|
1014
|
-
* @author Will Poulson
|
|
1015
|
-
* @private
|
|
1016
|
-
* @param {?} repeaterQuestion A repeater question.
|
|
1017
|
-
* @return {?} An abstract control.
|
|
1018
|
-
*/
|
|
1019
|
-
FormConstructorService.prototype.generateControlForRepeaterQuestion = /**
|
|
1020
|
-
* Generates a control for a repeaters question.
|
|
1021
|
-
* @author Will Poulson
|
|
1022
|
-
* @private
|
|
1023
|
-
* @param {?} repeaterQuestion A repeater question.
|
|
1024
|
-
* @return {?} An abstract control.
|
|
1025
|
-
*/
|
|
1026
|
-
function (repeaterQuestion) {
|
|
1027
|
-
/** @type {?} */
|
|
645
|
+
FormConstructorService.prototype.generateControlForRepeaterQuestion = function (repeaterQuestion) {
|
|
1028
646
|
var convertedValidators = this.convertValidators(repeaterQuestion.validators);
|
|
1029
647
|
return this.fb.control(null, { validators: convertedValidators, updateOn: repeaterQuestion.type === 'select' ? 'change' : 'blur' });
|
|
1030
648
|
};
|
|
@@ -1034,31 +652,15 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1034
652
|
* @returns A convered array of form validators.
|
|
1035
653
|
* @author Will Poulson
|
|
1036
654
|
*/
|
|
1037
|
-
|
|
1038
|
-
* Converts an array of validators into form validators.
|
|
1039
|
-
* @author Will Poulson
|
|
1040
|
-
* @private
|
|
1041
|
-
* @param {?} validators The uncoverted array of validators.
|
|
1042
|
-
* @return {?} A convered array of form validators.
|
|
1043
|
-
*/
|
|
1044
|
-
FormConstructorService.prototype.convertValidators = /**
|
|
1045
|
-
* Converts an array of validators into form validators.
|
|
1046
|
-
* @author Will Poulson
|
|
1047
|
-
* @private
|
|
1048
|
-
* @param {?} validators The uncoverted array of validators.
|
|
1049
|
-
* @return {?} A convered array of form validators.
|
|
1050
|
-
*/
|
|
1051
|
-
function (validators) {
|
|
655
|
+
FormConstructorService.prototype.convertValidators = function (validators) {
|
|
1052
656
|
var e_8, _a;
|
|
1053
657
|
if (!validators || validators.length === 0) {
|
|
1054
658
|
return [];
|
|
1055
659
|
}
|
|
1056
|
-
/** @type {?} */
|
|
1057
660
|
var convertedValidators = [];
|
|
1058
661
|
try {
|
|
1059
662
|
for (var validators_1 = __values(validators), validators_1_1 = validators_1.next(); !validators_1_1.done; validators_1_1 = validators_1.next()) {
|
|
1060
663
|
var validator = validators_1_1.value;
|
|
1061
|
-
/** @type {?} */
|
|
1062
664
|
var convertedValidator = this.convertValidator(validator);
|
|
1063
665
|
if (convertedValidator) {
|
|
1064
666
|
convertedValidators.push(convertedValidator);
|
|
@@ -1080,21 +682,7 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1080
682
|
* @returns A converted form validator.
|
|
1081
683
|
* @author Will Poulson
|
|
1082
684
|
*/
|
|
1083
|
-
|
|
1084
|
-
* Converts a single validator into a form validator.
|
|
1085
|
-
* @author Will Poulson
|
|
1086
|
-
* @private
|
|
1087
|
-
* @param {?} validator The unconverted validator.
|
|
1088
|
-
* @return {?} A converted form validator.
|
|
1089
|
-
*/
|
|
1090
|
-
FormConstructorService.prototype.convertValidator = /**
|
|
1091
|
-
* Converts a single validator into a form validator.
|
|
1092
|
-
* @author Will Poulson
|
|
1093
|
-
* @private
|
|
1094
|
-
* @param {?} validator The unconverted validator.
|
|
1095
|
-
* @return {?} A converted form validator.
|
|
1096
|
-
*/
|
|
1097
|
-
function (validator) {
|
|
685
|
+
FormConstructorService.prototype.convertValidator = function (validator) {
|
|
1098
686
|
switch (validator.type) {
|
|
1099
687
|
case ValidationType.Required:
|
|
1100
688
|
return Validators.required;
|
|
@@ -1107,21 +695,7 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1107
695
|
* @param savedState The saved state to load.
|
|
1108
696
|
* @param sections The sections already generated by the form constructor.
|
|
1109
697
|
*/
|
|
1110
|
-
|
|
1111
|
-
* Constructs the forms for repeaters from saved state.
|
|
1112
|
-
* @param {?} savedState The saved state to load.
|
|
1113
|
-
* @param {?} sections The sections already generated by the form constructor.
|
|
1114
|
-
* @param {?} currentQuestionnaireForm
|
|
1115
|
-
* @return {?}
|
|
1116
|
-
*/
|
|
1117
|
-
FormConstructorService.prototype.constructRepeaterFromsFromState = /**
|
|
1118
|
-
* Constructs the forms for repeaters from saved state.
|
|
1119
|
-
* @param {?} savedState The saved state to load.
|
|
1120
|
-
* @param {?} sections The sections already generated by the form constructor.
|
|
1121
|
-
* @param {?} currentQuestionnaireForm
|
|
1122
|
-
* @return {?}
|
|
1123
|
-
*/
|
|
1124
|
-
function (savedState, sections, currentQuestionnaireForm) {
|
|
698
|
+
FormConstructorService.prototype.constructRepeaterFromsFromState = function (savedState, sections, currentQuestionnaireForm) {
|
|
1125
699
|
var e_9, _a, e_10, _b, e_11, _c;
|
|
1126
700
|
try {
|
|
1127
701
|
for (var sections_2 = __values(sections), sections_2_1 = sections_2.next(); !sections_2_1.done; sections_2_1 = sections_2.next()) {
|
|
@@ -1132,13 +706,11 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1132
706
|
if (question.type !== QuestionType.Repeater) {
|
|
1133
707
|
continue;
|
|
1134
708
|
}
|
|
1135
|
-
/** @type {?} */
|
|
1136
709
|
var repeaterArray = savedState[section.name][question.name];
|
|
1137
710
|
if (!repeaterArray || repeaterArray.length === 0) {
|
|
1138
711
|
continue;
|
|
1139
712
|
}
|
|
1140
|
-
|
|
1141
|
-
var repeaterFormArray = (/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])));
|
|
713
|
+
var repeaterFormArray = currentQuestionnaireForm.get([section.name, question.name]);
|
|
1142
714
|
if (repeaterFormArray.controls.length === repeaterArray.length) {
|
|
1143
715
|
continue;
|
|
1144
716
|
}
|
|
@@ -1146,9 +718,7 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1146
718
|
// For each item that used to be there push a new empty template there to be populated.
|
|
1147
719
|
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()) {
|
|
1148
720
|
var repeaterItem = repeaterArray_1_1.value;
|
|
1149
|
-
/** @type {?} */
|
|
1150
721
|
var index = repeaterArray.indexOf(repeaterItem);
|
|
1151
|
-
/** @type {?} */
|
|
1152
722
|
var repeaterItemTemplate = this.generateFormsForRepeater(question, index);
|
|
1153
723
|
repeaterFormArray.push(repeaterItemTemplate);
|
|
1154
724
|
}
|
|
@@ -1179,36 +749,17 @@ var FormConstructorService = /** @class */ (function () {
|
|
|
1179
749
|
finally { if (e_9) throw e_9.error; }
|
|
1180
750
|
}
|
|
1181
751
|
};
|
|
1182
|
-
FormConstructorService
|
|
1183
|
-
|
|
1184
|
-
providedIn: 'root'
|
|
1185
|
-
},] }
|
|
1186
|
-
];
|
|
1187
|
-
/** @nocollapse */
|
|
1188
|
-
FormConstructorService.ctorParameters = function () { return [
|
|
1189
|
-
{ type: FormBuilder },
|
|
1190
|
-
{ type: FilterService }
|
|
1191
|
-
]; };
|
|
1192
|
-
/** @nocollapse */ FormConstructorService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FormConstructorService_Factory() { return new FormConstructorService(ɵɵinject(FormBuilder), ɵɵinject(FilterService)); }, token: FormConstructorService, providedIn: "root" });
|
|
752
|
+
FormConstructorService.ɵfac = function FormConstructorService_Factory(t) { return new (t || FormConstructorService)(ɵɵinject(FormBuilder), ɵɵinject(FilterService)); };
|
|
753
|
+
FormConstructorService.ɵprov = ɵɵdefineInjectable({ token: FormConstructorService, factory: FormConstructorService.ɵfac, providedIn: 'root' });
|
|
1193
754
|
return FormConstructorService;
|
|
1194
755
|
}());
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* @type {?}
|
|
1203
|
-
* @private
|
|
1204
|
-
*/
|
|
1205
|
-
FormConstructorService.prototype.filterService;
|
|
1206
|
-
}
|
|
756
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(FormConstructorService, [{
|
|
757
|
+
type: Injectable,
|
|
758
|
+
args: [{
|
|
759
|
+
providedIn: 'root'
|
|
760
|
+
}]
|
|
761
|
+
}], function () { return [{ type: FormBuilder }, { type: FilterService }]; }, null); })();
|
|
1207
762
|
|
|
1208
|
-
/**
|
|
1209
|
-
* @fileoverview added by tsickle
|
|
1210
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1211
|
-
*/
|
|
1212
763
|
var QuestionnaireService = /** @class */ (function () {
|
|
1213
764
|
function QuestionnaireService(formConstuctor, options) {
|
|
1214
765
|
this.formConstuctor = formConstuctor;
|
|
@@ -1224,28 +775,11 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1224
775
|
* @returns null
|
|
1225
776
|
* @author Will Poulson
|
|
1226
777
|
*/
|
|
1227
|
-
|
|
1228
|
-
* Loads a questionnaire from data.
|
|
1229
|
-
* @author Will Poulson
|
|
1230
|
-
* @param {?} questionnaire The questionnaire data to load, often parsed JSON from the editor.
|
|
1231
|
-
* @param {?=} savedState The saved state of the questionnaire, often from localstorage.
|
|
1232
|
-
* @param {?=} additionalData
|
|
1233
|
-
* @return {?} null
|
|
1234
|
-
*/
|
|
1235
|
-
QuestionnaireService.prototype.loadQuestionnaire = /**
|
|
1236
|
-
* Loads a questionnaire from data.
|
|
1237
|
-
* @author Will Poulson
|
|
1238
|
-
* @param {?} questionnaire The questionnaire data to load, often parsed JSON from the editor.
|
|
1239
|
-
* @param {?=} savedState The saved state of the questionnaire, often from localstorage.
|
|
1240
|
-
* @param {?=} additionalData
|
|
1241
|
-
* @return {?} null
|
|
1242
|
-
*/
|
|
1243
|
-
function (questionnaire, savedState, additionalData) {
|
|
778
|
+
QuestionnaireService.prototype.loadQuestionnaire = function (questionnaire, savedState, additionalData) {
|
|
1244
779
|
this.originalQuestionnaire = cloneDeep(questionnaire);
|
|
1245
780
|
this.currentQuestionnaire = cloneDeep(questionnaire);
|
|
1246
781
|
this.additionalData = additionalData;
|
|
1247
782
|
if (savedState && Object.keys(savedState).length > 0) {
|
|
1248
|
-
/** @type {?} */
|
|
1249
783
|
var newData = this.formConstuctor.generateFormsForQuestionnaire(cloneDeep(this.originalQuestionnaire), cloneDeep(this.currentQuestionnaire), this.currentQuestionnaireForm, this.additionalData, true);
|
|
1250
784
|
if (newData) {
|
|
1251
785
|
this.formConstuctor.constructRepeaterFromsFromState(savedState, newData.sections, newData.forms);
|
|
@@ -1267,33 +801,10 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1267
801
|
* @returns null
|
|
1268
802
|
* @author Will Poulson
|
|
1269
803
|
*/
|
|
1270
|
-
|
|
1271
|
-
* Updates the current questionnaire, used when a value is updated to check conditions.
|
|
1272
|
-
* @author Will Poulson
|
|
1273
|
-
* @param {?=} savedState The saved state of the questionnaire, often from localstorage.
|
|
1274
|
-
* @return {?} null
|
|
1275
|
-
*/
|
|
1276
|
-
QuestionnaireService.prototype.updateQuestionnaire = /**
|
|
1277
|
-
* Updates the current questionnaire, used when a value is updated to check conditions.
|
|
1278
|
-
* @author Will Poulson
|
|
1279
|
-
* @param {?=} savedState The saved state of the questionnaire, often from localstorage.
|
|
1280
|
-
* @return {?} null
|
|
1281
|
-
*/
|
|
1282
|
-
function (savedState) {
|
|
804
|
+
QuestionnaireService.prototype.updateQuestionnaire = function (savedState) {
|
|
1283
805
|
var e_1, _a, e_2, _b;
|
|
1284
806
|
var _this = this;
|
|
1285
|
-
|
|
1286
|
-
var oldLength = this.currentQuestionnaire.sections.map((/**
|
|
1287
|
-
* @param {?} x
|
|
1288
|
-
* @return {?}
|
|
1289
|
-
*/
|
|
1290
|
-
function (x) { return x.questions.length; })).reduce((/**
|
|
1291
|
-
* @param {?} a
|
|
1292
|
-
* @param {?} b
|
|
1293
|
-
* @return {?}
|
|
1294
|
-
*/
|
|
1295
|
-
function (a, b) { return a + b; }), 0);
|
|
1296
|
-
/** @type {?} */
|
|
807
|
+
var oldLength = this.currentQuestionnaire.sections.map(function (x) { return x.questions.length; }).reduce(function (a, b) { return a + b; }, 0);
|
|
1297
808
|
var newData = this.formConstuctor.generateFormsForQuestionnaire(cloneDeep(this.originalQuestionnaire), cloneDeep(this.currentQuestionnaire), this.currentQuestionnaireForm, this.additionalData);
|
|
1298
809
|
if (newData) {
|
|
1299
810
|
this.currentQuestionnaireForm = newData.forms;
|
|
@@ -1308,32 +819,16 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1308
819
|
if (this.questionValueChangeSubscription) {
|
|
1309
820
|
this.questionValueChangeSubscription.unsubscribe();
|
|
1310
821
|
}
|
|
1311
|
-
this.questionnaireValueChangeSubscription = this.currentQuestionnaireForm.valueChanges.subscribe((
|
|
1312
|
-
* @return {?}
|
|
1313
|
-
*/
|
|
1314
|
-
function () {
|
|
822
|
+
this.questionnaireValueChangeSubscription = this.currentQuestionnaireForm.valueChanges.subscribe(function () {
|
|
1315
823
|
_this.dataChangedEvent.emit();
|
|
1316
824
|
_this.updateQuestionnaire(_this.currentQuestionnaireForm.getRawValue());
|
|
1317
|
-
})
|
|
825
|
+
});
|
|
1318
826
|
if (this.currentQuestion && this.currentQuestion.formControl) {
|
|
1319
|
-
this.questionValueChangeSubscription = this.currentQuestion.formControl.valueChanges.subscribe((
|
|
1320
|
-
* @return {?}
|
|
1321
|
-
*/
|
|
1322
|
-
function () {
|
|
827
|
+
this.questionValueChangeSubscription = this.currentQuestion.formControl.valueChanges.subscribe(function () {
|
|
1323
828
|
_this.clearFields(_this.currentQuestion.data.clearfields);
|
|
1324
|
-
})
|
|
829
|
+
});
|
|
1325
830
|
}
|
|
1326
|
-
|
|
1327
|
-
var newLength = this.currentQuestionnaire.sections.map((/**
|
|
1328
|
-
* @param {?} x
|
|
1329
|
-
* @return {?}
|
|
1330
|
-
*/
|
|
1331
|
-
function (x) { return x.questions.length; })).reduce((/**
|
|
1332
|
-
* @param {?} a
|
|
1333
|
-
* @param {?} b
|
|
1334
|
-
* @return {?}
|
|
1335
|
-
*/
|
|
1336
|
-
function (a, b) { return a + b; }), 0);
|
|
831
|
+
var newLength = this.currentQuestionnaire.sections.map(function (x) { return x.questions.length; }).reduce(function (a, b) { return a + b; }, 0);
|
|
1337
832
|
if (oldLength !== newLength) {
|
|
1338
833
|
try {
|
|
1339
834
|
for (var _c = __values(this.currentQuestionnaire.sections), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1341,7 +836,6 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1341
836
|
try {
|
|
1342
837
|
for (var _e = (e_2 = void 0, __values(section.questions)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1343
838
|
var question = _f.value;
|
|
1344
|
-
/** @type {?} */
|
|
1345
839
|
var control = this.currentQuestionnaireForm.get([section.name, question.name]);
|
|
1346
840
|
if (control && control.value === null && question.defaultValue) {
|
|
1347
841
|
control.setValue(question.defaultValue);
|
|
@@ -1366,47 +860,26 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1366
860
|
}
|
|
1367
861
|
}
|
|
1368
862
|
};
|
|
1369
|
-
|
|
1370
|
-
* @param {?} payload
|
|
1371
|
-
* @return {?}
|
|
1372
|
-
*/
|
|
1373
|
-
QuestionnaireService.prototype.updateAdditionalData = /**
|
|
1374
|
-
* @param {?} payload
|
|
1375
|
-
* @return {?}
|
|
1376
|
-
*/
|
|
1377
|
-
function (payload) {
|
|
863
|
+
QuestionnaireService.prototype.updateAdditionalData = function (payload) {
|
|
1378
864
|
this.additionalData = Object.assign(this.additionalData, payload);
|
|
1379
865
|
this.updateQuestionnaire(this.currentQuestionnaireForm.getRawValue());
|
|
1380
866
|
};
|
|
1381
|
-
|
|
1382
|
-
* @return {?}
|
|
1383
|
-
*/
|
|
1384
|
-
QuestionnaireService.prototype.clearAdditionalData = /**
|
|
1385
|
-
* @return {?}
|
|
1386
|
-
*/
|
|
1387
|
-
function () {
|
|
867
|
+
QuestionnaireService.prototype.clearAdditionalData = function () {
|
|
1388
868
|
this.additionalData = {};
|
|
1389
869
|
this.updateQuestionnaire(this.currentQuestionnaireForm.getRawValue());
|
|
1390
870
|
};
|
|
1391
871
|
Object.defineProperty(QuestionnaireService.prototype, "isValid", {
|
|
1392
|
-
get:
|
|
1393
|
-
* @return {?}
|
|
1394
|
-
*/
|
|
1395
|
-
function () {
|
|
872
|
+
get: function () {
|
|
1396
873
|
return this.currentQuestionnaireForm.valid;
|
|
1397
874
|
},
|
|
1398
875
|
enumerable: true,
|
|
1399
876
|
configurable: true
|
|
1400
877
|
});
|
|
1401
878
|
Object.defineProperty(QuestionnaireService.prototype, "isFirstQuestion", {
|
|
1402
|
-
get:
|
|
1403
|
-
* @return {?}
|
|
1404
|
-
*/
|
|
1405
|
-
function () {
|
|
879
|
+
get: function () {
|
|
1406
880
|
if (!this.currentSection || !this.currentQuestion) {
|
|
1407
881
|
return false;
|
|
1408
882
|
}
|
|
1409
|
-
/** @type {?} */
|
|
1410
883
|
var currentIndex = this.currentSection.data.questions.indexOf(this.currentQuestion.data);
|
|
1411
884
|
return currentIndex === 0;
|
|
1412
885
|
},
|
|
@@ -1414,16 +887,11 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1414
887
|
configurable: true
|
|
1415
888
|
});
|
|
1416
889
|
Object.defineProperty(QuestionnaireService.prototype, "isLastQuestion", {
|
|
1417
|
-
get:
|
|
1418
|
-
* @return {?}
|
|
1419
|
-
*/
|
|
1420
|
-
function () {
|
|
890
|
+
get: function () {
|
|
1421
891
|
if (!this.currentSection || !this.currentQuestion) {
|
|
1422
892
|
return false;
|
|
1423
893
|
}
|
|
1424
|
-
/** @type {?} */
|
|
1425
894
|
var currentIndex = this.currentSection.data.questions.indexOf(this.currentQuestion.data);
|
|
1426
|
-
/** @type {?} */
|
|
1427
895
|
var maxIndex = this.currentSection.data.questions.length - 1;
|
|
1428
896
|
return currentIndex === maxIndex;
|
|
1429
897
|
},
|
|
@@ -1431,14 +899,10 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1431
899
|
configurable: true
|
|
1432
900
|
});
|
|
1433
901
|
Object.defineProperty(QuestionnaireService.prototype, "isFirstSection", {
|
|
1434
|
-
get:
|
|
1435
|
-
* @return {?}
|
|
1436
|
-
*/
|
|
1437
|
-
function () {
|
|
902
|
+
get: function () {
|
|
1438
903
|
if (!this.currentSection) {
|
|
1439
904
|
return false;
|
|
1440
905
|
}
|
|
1441
|
-
/** @type {?} */
|
|
1442
906
|
var currentIndex = this.currentQuestionnaire.sections.indexOf(this.currentSection.data);
|
|
1443
907
|
return currentIndex === 0;
|
|
1444
908
|
},
|
|
@@ -1446,31 +910,18 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1446
910
|
configurable: true
|
|
1447
911
|
});
|
|
1448
912
|
Object.defineProperty(QuestionnaireService.prototype, "isLastSection", {
|
|
1449
|
-
get:
|
|
1450
|
-
* @return {?}
|
|
1451
|
-
*/
|
|
1452
|
-
function () {
|
|
913
|
+
get: function () {
|
|
1453
914
|
if (!this.currentSection) {
|
|
1454
915
|
return false;
|
|
1455
916
|
}
|
|
1456
|
-
/** @type {?} */
|
|
1457
917
|
var currentIndex = this.currentQuestionnaire.sections.indexOf(this.currentSection.data);
|
|
1458
|
-
/** @type {?} */
|
|
1459
918
|
var maxIndex = this.currentQuestionnaire.sections.length - 1;
|
|
1460
919
|
return currentIndex === maxIndex;
|
|
1461
920
|
},
|
|
1462
921
|
enumerable: true,
|
|
1463
922
|
configurable: true
|
|
1464
923
|
});
|
|
1465
|
-
|
|
1466
|
-
* @param {?} name
|
|
1467
|
-
* @return {?}
|
|
1468
|
-
*/
|
|
1469
|
-
QuestionnaireService.prototype.sectionValid = /**
|
|
1470
|
-
* @param {?} name
|
|
1471
|
-
* @return {?}
|
|
1472
|
-
*/
|
|
1473
|
-
function (name) {
|
|
924
|
+
QuestionnaireService.prototype.sectionValid = function (name) {
|
|
1474
925
|
return this.currentQuestionnaireForm.get(name).valid;
|
|
1475
926
|
};
|
|
1476
927
|
/**
|
|
@@ -1478,21 +929,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1478
929
|
* @param clearfields An array of strings, paths to clear.
|
|
1479
930
|
* @author Will Poulson
|
|
1480
931
|
*/
|
|
1481
|
-
|
|
1482
|
-
* Clears all the fields parsed
|
|
1483
|
-
* @author Will Poulson
|
|
1484
|
-
* @private
|
|
1485
|
-
* @param {?} clearfields An array of strings, paths to clear.
|
|
1486
|
-
* @return {?}
|
|
1487
|
-
*/
|
|
1488
|
-
QuestionnaireService.prototype.clearFields = /**
|
|
1489
|
-
* Clears all the fields parsed
|
|
1490
|
-
* @author Will Poulson
|
|
1491
|
-
* @private
|
|
1492
|
-
* @param {?} clearfields An array of strings, paths to clear.
|
|
1493
|
-
* @return {?}
|
|
1494
|
-
*/
|
|
1495
|
-
function (clearfields) {
|
|
932
|
+
QuestionnaireService.prototype.clearFields = function (clearfields) {
|
|
1496
933
|
var e_3, _a;
|
|
1497
934
|
if (!clearfields || clearfields.length === 0) {
|
|
1498
935
|
return;
|
|
@@ -1500,7 +937,6 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1500
937
|
try {
|
|
1501
938
|
for (var clearfields_1 = __values(clearfields), clearfields_1_1 = clearfields_1.next(); !clearfields_1_1.done; clearfields_1_1 = clearfields_1.next()) {
|
|
1502
939
|
var clearfield = clearfields_1_1.value;
|
|
1503
|
-
/** @type {?} */
|
|
1504
940
|
var control = this.currentQuestionnaireForm.get(clearfield);
|
|
1505
941
|
if (control) {
|
|
1506
942
|
control.reset(undefined);
|
|
@@ -1520,19 +956,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1520
956
|
* Useful when exiting a questionnaire page or completing a questionnaire.
|
|
1521
957
|
* @author Will Poulson
|
|
1522
958
|
*/
|
|
1523
|
-
|
|
1524
|
-
* Unloads the current questionnaire.
|
|
1525
|
-
* Useful when exiting a questionnaire page or completing a questionnaire.
|
|
1526
|
-
* @author Will Poulson
|
|
1527
|
-
* @return {?}
|
|
1528
|
-
*/
|
|
1529
|
-
QuestionnaireService.prototype.unloadQuestionnaire = /**
|
|
1530
|
-
* Unloads the current questionnaire.
|
|
1531
|
-
* Useful when exiting a questionnaire page or completing a questionnaire.
|
|
1532
|
-
* @author Will Poulson
|
|
1533
|
-
* @return {?}
|
|
1534
|
-
*/
|
|
1535
|
-
function () {
|
|
959
|
+
QuestionnaireService.prototype.unloadQuestionnaire = function () {
|
|
1536
960
|
this.originalQuestionnaire = undefined;
|
|
1537
961
|
this.currentQuestionnaireForm = undefined;
|
|
1538
962
|
this.currentQuestionnaire = undefined;
|
|
@@ -1546,30 +970,20 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1546
970
|
* @returns An object containing the section data and the related form group.
|
|
1547
971
|
* @author Will Poulson
|
|
1548
972
|
*/
|
|
1549
|
-
get:
|
|
1550
|
-
* Gets the current selected section.
|
|
1551
|
-
* @author Will Poulson
|
|
1552
|
-
* @return {?} An object containing the section data and the related form group.
|
|
1553
|
-
*/
|
|
1554
|
-
function () {
|
|
973
|
+
get: function () {
|
|
1555
974
|
var _this = this;
|
|
1556
975
|
if (!this.currentSectionName) {
|
|
1557
976
|
return null;
|
|
1558
977
|
}
|
|
1559
|
-
|
|
1560
|
-
var data = this.currentQuestionnaire.sections.find((/**
|
|
1561
|
-
* @param {?} x
|
|
1562
|
-
* @return {?}
|
|
1563
|
-
*/
|
|
1564
|
-
function (x) {
|
|
978
|
+
var data = this.currentQuestionnaire.sections.find(function (x) {
|
|
1565
979
|
return x.name === _this.currentSectionName;
|
|
1566
|
-
})
|
|
980
|
+
});
|
|
1567
981
|
if (!data) {
|
|
1568
982
|
return null;
|
|
1569
983
|
}
|
|
1570
984
|
return {
|
|
1571
985
|
data: data,
|
|
1572
|
-
formGroup:
|
|
986
|
+
formGroup: this.currentQuestionnaireForm.get(data.name)
|
|
1573
987
|
};
|
|
1574
988
|
},
|
|
1575
989
|
enumerable: true,
|
|
@@ -1581,12 +995,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1581
995
|
* @returns An array of all avaialble sections.
|
|
1582
996
|
* @author Will Poulson
|
|
1583
997
|
*/
|
|
1584
|
-
get:
|
|
1585
|
-
* Gets all the avaialble sections.
|
|
1586
|
-
* @author Will Poulson
|
|
1587
|
-
* @return {?} An array of all avaialble sections.
|
|
1588
|
-
*/
|
|
1589
|
-
function () {
|
|
998
|
+
get: function () {
|
|
1590
999
|
if (!this.currentQuestionnaire || !this.currentQuestionnaire.sections) {
|
|
1591
1000
|
return [];
|
|
1592
1001
|
}
|
|
@@ -1601,12 +1010,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1601
1010
|
* @returns An object of data.
|
|
1602
1011
|
* @author Will Poulson
|
|
1603
1012
|
*/
|
|
1604
|
-
get:
|
|
1605
|
-
* Gets the current data for the entire questionnaire.
|
|
1606
|
-
* @author Will Poulson
|
|
1607
|
-
* @return {?} An object of data.
|
|
1608
|
-
*/
|
|
1609
|
-
function () {
|
|
1013
|
+
get: function () {
|
|
1610
1014
|
return this.currentQuestionnaireForm ? this.currentQuestionnaireForm.getRawValue() : {};
|
|
1611
1015
|
},
|
|
1612
1016
|
enumerable: true,
|
|
@@ -1618,29 +1022,18 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1618
1022
|
* @returns An object containing the question data and the related form control.
|
|
1619
1023
|
* @author Will Poulson
|
|
1620
1024
|
*/
|
|
1621
|
-
get:
|
|
1622
|
-
* Gets the current selected question.
|
|
1623
|
-
* @author Will Poulson
|
|
1624
|
-
* @return {?} An object containing the question data and the related form control.
|
|
1625
|
-
*/
|
|
1626
|
-
function () {
|
|
1025
|
+
get: function () {
|
|
1627
1026
|
var _this = this;
|
|
1628
1027
|
if (!this.currentQuestionName) {
|
|
1629
1028
|
return null;
|
|
1630
1029
|
}
|
|
1631
|
-
|
|
1632
|
-
var data = this.currentSection.data.questions.find((/**
|
|
1633
|
-
* @param {?} x
|
|
1634
|
-
* @return {?}
|
|
1635
|
-
*/
|
|
1636
|
-
function (x) {
|
|
1030
|
+
var data = this.currentSection.data.questions.find(function (x) {
|
|
1637
1031
|
return x.name === _this.currentQuestionName;
|
|
1638
|
-
})
|
|
1032
|
+
});
|
|
1639
1033
|
if (!data) {
|
|
1640
1034
|
return null;
|
|
1641
1035
|
}
|
|
1642
|
-
|
|
1643
|
-
var formControl = (/** @type {?} */ (this.currentSection.formGroup.get(data.name)));
|
|
1036
|
+
var formControl = this.currentSection.formGroup.get(data.name);
|
|
1644
1037
|
return {
|
|
1645
1038
|
data: data,
|
|
1646
1039
|
formControl: formControl
|
|
@@ -1657,70 +1050,31 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1657
1050
|
* @returns A promise which will resolve when the question has been navigated to.
|
|
1658
1051
|
* @author Will Poulson
|
|
1659
1052
|
*/
|
|
1660
|
-
|
|
1661
|
-
* Navigates to the next question.
|
|
1662
|
-
* If there is no question to navigate to it will reject with a out of bounds exception.
|
|
1663
|
-
* If allowSkipRequiredField is false then it will reject if the current question is invalid.
|
|
1664
|
-
* If emitSectionFinishEvent is true then it will emit an event if it's navigating past the length of questions.
|
|
1665
|
-
* @author Will Poulson
|
|
1666
|
-
* @return {?} A promise which will resolve when the question has been navigated to.
|
|
1667
|
-
*/
|
|
1668
|
-
QuestionnaireService.prototype.nextQuestion = /**
|
|
1669
|
-
* Navigates to the next question.
|
|
1670
|
-
* If there is no question to navigate to it will reject with a out of bounds exception.
|
|
1671
|
-
* If allowSkipRequiredField is false then it will reject if the current question is invalid.
|
|
1672
|
-
* If emitSectionFinishEvent is true then it will emit an event if it's navigating past the length of questions.
|
|
1673
|
-
* @author Will Poulson
|
|
1674
|
-
* @return {?} A promise which will resolve when the question has been navigated to.
|
|
1675
|
-
*/
|
|
1676
|
-
function () {
|
|
1053
|
+
QuestionnaireService.prototype.nextQuestion = function () {
|
|
1677
1054
|
var _this = this;
|
|
1678
|
-
return new Promise((
|
|
1679
|
-
* @param {?} resolve
|
|
1680
|
-
* @param {?} reject
|
|
1681
|
-
* @return {?}
|
|
1682
|
-
*/
|
|
1683
|
-
function (resolve, reject) {
|
|
1055
|
+
return new Promise(function (resolve, reject) {
|
|
1684
1056
|
if (!_this.options.allowSkipRequiredField) {
|
|
1685
1057
|
if (_this.currentQuestion.formControl && !_this.currentQuestion.formControl.valid) {
|
|
1686
1058
|
return reject('Current question is invalid');
|
|
1687
1059
|
}
|
|
1688
1060
|
}
|
|
1689
|
-
_this.getCurrentQuestionIndex().then((
|
|
1690
|
-
* @param {?} currentIndex
|
|
1691
|
-
* @return {?}
|
|
1692
|
-
*/
|
|
1693
|
-
function (currentIndex) {
|
|
1694
|
-
/** @type {?} */
|
|
1061
|
+
_this.getCurrentQuestionIndex().then(function (currentIndex) {
|
|
1695
1062
|
var lastQuestionIndex = _this.currentSection.data.questions.length - 1;
|
|
1696
|
-
/** @type {?} */
|
|
1697
1063
|
var isLastQuestion = lastQuestionIndex === currentIndex;
|
|
1698
1064
|
if (isLastQuestion) {
|
|
1699
1065
|
_this.sectionFinishedEvent.emit();
|
|
1700
1066
|
return resolve();
|
|
1701
1067
|
}
|
|
1702
|
-
/** @type {?} */
|
|
1703
1068
|
var newIndex = currentIndex + 1;
|
|
1704
|
-
_this.navigateToQuestion(newIndex).then((
|
|
1705
|
-
* @return {?}
|
|
1706
|
-
*/
|
|
1707
|
-
function () {
|
|
1069
|
+
_this.navigateToQuestion(newIndex).then(function () {
|
|
1708
1070
|
return resolve();
|
|
1709
|
-
})
|
|
1710
|
-
* @param {?} error
|
|
1711
|
-
* @return {?}
|
|
1712
|
-
*/
|
|
1713
|
-
function (error) {
|
|
1071
|
+
}).catch(function (error) {
|
|
1714
1072
|
return reject(error);
|
|
1715
|
-
})
|
|
1716
|
-
})
|
|
1717
|
-
* @param {?} error
|
|
1718
|
-
* @return {?}
|
|
1719
|
-
*/
|
|
1720
|
-
function (error) {
|
|
1073
|
+
});
|
|
1074
|
+
}).catch(function (error) {
|
|
1721
1075
|
return reject(error);
|
|
1722
|
-
})
|
|
1723
|
-
})
|
|
1076
|
+
});
|
|
1077
|
+
});
|
|
1724
1078
|
};
|
|
1725
1079
|
/**
|
|
1726
1080
|
* Navigates to the previous question.
|
|
@@ -1729,91 +1083,38 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1729
1083
|
* @returns A promise which will resolve when the question has been navigated to.
|
|
1730
1084
|
* @author Will Poulson
|
|
1731
1085
|
*/
|
|
1732
|
-
|
|
1733
|
-
* Navigates to the previous question.
|
|
1734
|
-
* If there is no question to navigate to it will reject with a out of bounds exception.
|
|
1735
|
-
* If allowNavigateBackwards is false then it will reject.
|
|
1736
|
-
* @author Will Poulson
|
|
1737
|
-
* @return {?} A promise which will resolve when the question has been navigated to.
|
|
1738
|
-
*/
|
|
1739
|
-
QuestionnaireService.prototype.prevQuestion = /**
|
|
1740
|
-
* Navigates to the previous question.
|
|
1741
|
-
* If there is no question to navigate to it will reject with a out of bounds exception.
|
|
1742
|
-
* If allowNavigateBackwards is false then it will reject.
|
|
1743
|
-
* @author Will Poulson
|
|
1744
|
-
* @return {?} A promise which will resolve when the question has been navigated to.
|
|
1745
|
-
*/
|
|
1746
|
-
function () {
|
|
1086
|
+
QuestionnaireService.prototype.prevQuestion = function () {
|
|
1747
1087
|
var _this = this;
|
|
1748
|
-
return new Promise((
|
|
1749
|
-
* @param {?} resolve
|
|
1750
|
-
* @param {?} reject
|
|
1751
|
-
* @return {?}
|
|
1752
|
-
*/
|
|
1753
|
-
function (resolve, reject) {
|
|
1088
|
+
return new Promise(function (resolve, reject) {
|
|
1754
1089
|
if (!_this.options.allowNavigateBackwards) {
|
|
1755
1090
|
return reject('This questionnaire does not allow for backwards navigation');
|
|
1756
1091
|
}
|
|
1757
|
-
_this.getCurrentQuestionIndex().then((
|
|
1758
|
-
* @param {?} currentIndex
|
|
1759
|
-
* @return {?}
|
|
1760
|
-
*/
|
|
1761
|
-
function (currentIndex) {
|
|
1762
|
-
/** @type {?} */
|
|
1092
|
+
_this.getCurrentQuestionIndex().then(function (currentIndex) {
|
|
1763
1093
|
var newIndex = currentIndex - 1;
|
|
1764
|
-
_this.navigateToQuestion(newIndex).then((
|
|
1765
|
-
* @return {?}
|
|
1766
|
-
*/
|
|
1767
|
-
function () {
|
|
1094
|
+
_this.navigateToQuestion(newIndex).then(function () {
|
|
1768
1095
|
return resolve();
|
|
1769
|
-
})
|
|
1770
|
-
* @param {?} error
|
|
1771
|
-
* @return {?}
|
|
1772
|
-
*/
|
|
1773
|
-
function (error) {
|
|
1096
|
+
}).catch(function (error) {
|
|
1774
1097
|
return reject(error);
|
|
1775
|
-
})
|
|
1776
|
-
})
|
|
1777
|
-
* @param {?} error
|
|
1778
|
-
* @return {?}
|
|
1779
|
-
*/
|
|
1780
|
-
function (error) {
|
|
1098
|
+
});
|
|
1099
|
+
}).catch(function (error) {
|
|
1781
1100
|
return reject(error);
|
|
1782
|
-
})
|
|
1783
|
-
})
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1784
1103
|
};
|
|
1785
1104
|
/**
|
|
1786
1105
|
* Gets the current questions index.
|
|
1787
1106
|
* @returns A promise which resolves a number.
|
|
1788
1107
|
* @author Will Poulson
|
|
1789
1108
|
*/
|
|
1790
|
-
|
|
1791
|
-
* Gets the current questions index.
|
|
1792
|
-
* @author Will Poulson
|
|
1793
|
-
* @private
|
|
1794
|
-
* @return {?} A promise which resolves a number.
|
|
1795
|
-
*/
|
|
1796
|
-
QuestionnaireService.prototype.getCurrentQuestionIndex = /**
|
|
1797
|
-
* Gets the current questions index.
|
|
1798
|
-
* @author Will Poulson
|
|
1799
|
-
* @private
|
|
1800
|
-
* @return {?} A promise which resolves a number.
|
|
1801
|
-
*/
|
|
1802
|
-
function () {
|
|
1109
|
+
QuestionnaireService.prototype.getCurrentQuestionIndex = function () {
|
|
1803
1110
|
var _this = this;
|
|
1804
|
-
return new Promise((
|
|
1805
|
-
* @param {?} resolve
|
|
1806
|
-
* @param {?} reject
|
|
1807
|
-
* @return {?}
|
|
1808
|
-
*/
|
|
1809
|
-
function (resolve, reject) {
|
|
1810
|
-
/** @type {?} */
|
|
1111
|
+
return new Promise(function (resolve, reject) {
|
|
1811
1112
|
var currentIndex = _this.currentSection.data.questions.indexOf(_this.currentQuestion.data);
|
|
1812
1113
|
if (currentIndex === -1) {
|
|
1813
1114
|
return reject('Could not find current question');
|
|
1814
1115
|
}
|
|
1815
1116
|
return resolve(currentIndex);
|
|
1816
|
-
})
|
|
1117
|
+
});
|
|
1817
1118
|
};
|
|
1818
1119
|
/**
|
|
1819
1120
|
* Checks a question is in bounds then navigates to it.
|
|
@@ -1821,167 +1122,70 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1821
1122
|
* @returns A promise which will resolve when the question has been navigated to.
|
|
1822
1123
|
* @author Will Poulson
|
|
1823
1124
|
*/
|
|
1824
|
-
|
|
1825
|
-
* Checks a question is in bounds then navigates to it.
|
|
1826
|
-
* @author Will Poulson
|
|
1827
|
-
* @param {?} index The index to navigate to.
|
|
1828
|
-
* @return {?} A promise which will resolve when the question has been navigated to.
|
|
1829
|
-
*/
|
|
1830
|
-
QuestionnaireService.prototype.navigateToQuestion = /**
|
|
1831
|
-
* Checks a question is in bounds then navigates to it.
|
|
1832
|
-
* @author Will Poulson
|
|
1833
|
-
* @param {?} index The index to navigate to.
|
|
1834
|
-
* @return {?} A promise which will resolve when the question has been navigated to.
|
|
1835
|
-
*/
|
|
1836
|
-
function (index) {
|
|
1125
|
+
QuestionnaireService.prototype.navigateToQuestion = function (index) {
|
|
1837
1126
|
var _this = this;
|
|
1838
|
-
return new Promise((
|
|
1839
|
-
* @param {?} resolve
|
|
1840
|
-
* @param {?} reject
|
|
1841
|
-
* @return {?}
|
|
1842
|
-
*/
|
|
1843
|
-
function (resolve, reject) {
|
|
1127
|
+
return new Promise(function (resolve, reject) {
|
|
1844
1128
|
if (_this.currentSection.data.questions.length - 1 < index || index < 0) {
|
|
1845
1129
|
return reject('Out of bounds exception');
|
|
1846
1130
|
}
|
|
1847
1131
|
_this.currentQuestionName = _this.currentSection.data.questions[index].name;
|
|
1848
1132
|
return resolve();
|
|
1849
|
-
})
|
|
1133
|
+
});
|
|
1850
1134
|
};
|
|
1851
1135
|
/**
|
|
1852
1136
|
* Navigates to the next section.
|
|
1853
1137
|
* @returns A promise which will resolve when the section has been navigated to.
|
|
1854
1138
|
* @author Will Poulson
|
|
1855
1139
|
*/
|
|
1856
|
-
|
|
1857
|
-
* Navigates to the next section.
|
|
1858
|
-
* @author Will Poulson
|
|
1859
|
-
* @return {?} A promise which will resolve when the section has been navigated to.
|
|
1860
|
-
*/
|
|
1861
|
-
QuestionnaireService.prototype.nextSection = /**
|
|
1862
|
-
* Navigates to the next section.
|
|
1863
|
-
* @author Will Poulson
|
|
1864
|
-
* @return {?} A promise which will resolve when the section has been navigated to.
|
|
1865
|
-
*/
|
|
1866
|
-
function () {
|
|
1140
|
+
QuestionnaireService.prototype.nextSection = function () {
|
|
1867
1141
|
var _this = this;
|
|
1868
|
-
return new Promise((
|
|
1869
|
-
|
|
1870
|
-
* @param {?} reject
|
|
1871
|
-
* @return {?}
|
|
1872
|
-
*/
|
|
1873
|
-
function (resolve, reject) {
|
|
1874
|
-
_this.getCurrentSectionIndex().then((/**
|
|
1875
|
-
* @param {?} currentIndex
|
|
1876
|
-
* @return {?}
|
|
1877
|
-
*/
|
|
1878
|
-
function (currentIndex) {
|
|
1879
|
-
/** @type {?} */
|
|
1142
|
+
return new Promise(function (resolve, reject) {
|
|
1143
|
+
_this.getCurrentSectionIndex().then(function (currentIndex) {
|
|
1880
1144
|
var newIndex = currentIndex + 1;
|
|
1881
|
-
_this.navigateToSection(newIndex).then((
|
|
1882
|
-
* @return {?}
|
|
1883
|
-
*/
|
|
1884
|
-
function () {
|
|
1145
|
+
_this.navigateToSection(newIndex).then(function () {
|
|
1885
1146
|
return resolve();
|
|
1886
|
-
})
|
|
1887
|
-
* @param {?} error
|
|
1888
|
-
* @return {?}
|
|
1889
|
-
*/
|
|
1890
|
-
function (error) {
|
|
1147
|
+
}).catch(function (error) {
|
|
1891
1148
|
return reject(error);
|
|
1892
|
-
})
|
|
1893
|
-
})
|
|
1894
|
-
* @param {?} error
|
|
1895
|
-
* @return {?}
|
|
1896
|
-
*/
|
|
1897
|
-
function (error) {
|
|
1149
|
+
});
|
|
1150
|
+
}).catch(function (error) {
|
|
1898
1151
|
return reject(error);
|
|
1899
|
-
})
|
|
1900
|
-
})
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1901
1154
|
};
|
|
1902
1155
|
/**
|
|
1903
1156
|
* Navigates to the previous section.
|
|
1904
1157
|
* @returns A promise which will resolve when the section has been navigated to.
|
|
1905
1158
|
* @author Will Poulson
|
|
1906
1159
|
*/
|
|
1907
|
-
|
|
1908
|
-
* Navigates to the previous section.
|
|
1909
|
-
* @author Will Poulson
|
|
1910
|
-
* @return {?} A promise which will resolve when the section has been navigated to.
|
|
1911
|
-
*/
|
|
1912
|
-
QuestionnaireService.prototype.prevSection = /**
|
|
1913
|
-
* Navigates to the previous section.
|
|
1914
|
-
* @author Will Poulson
|
|
1915
|
-
* @return {?} A promise which will resolve when the section has been navigated to.
|
|
1916
|
-
*/
|
|
1917
|
-
function () {
|
|
1160
|
+
QuestionnaireService.prototype.prevSection = function () {
|
|
1918
1161
|
var _this = this;
|
|
1919
|
-
return new Promise((
|
|
1920
|
-
|
|
1921
|
-
* @param {?} reject
|
|
1922
|
-
* @return {?}
|
|
1923
|
-
*/
|
|
1924
|
-
function (resolve, reject) {
|
|
1925
|
-
_this.getCurrentSectionIndex().then((/**
|
|
1926
|
-
* @param {?} currentIndex
|
|
1927
|
-
* @return {?}
|
|
1928
|
-
*/
|
|
1929
|
-
function (currentIndex) {
|
|
1930
|
-
/** @type {?} */
|
|
1162
|
+
return new Promise(function (resolve, reject) {
|
|
1163
|
+
_this.getCurrentSectionIndex().then(function (currentIndex) {
|
|
1931
1164
|
var newIndex = currentIndex - 1;
|
|
1932
|
-
_this.navigateToSection(newIndex).then((
|
|
1933
|
-
* @return {?}
|
|
1934
|
-
*/
|
|
1935
|
-
function () {
|
|
1165
|
+
_this.navigateToSection(newIndex).then(function () {
|
|
1936
1166
|
return resolve();
|
|
1937
|
-
})
|
|
1938
|
-
* @param {?} error
|
|
1939
|
-
* @return {?}
|
|
1940
|
-
*/
|
|
1941
|
-
function (error) {
|
|
1167
|
+
}).catch(function (error) {
|
|
1942
1168
|
return reject(error);
|
|
1943
|
-
})
|
|
1944
|
-
})
|
|
1945
|
-
* @param {?} error
|
|
1946
|
-
* @return {?}
|
|
1947
|
-
*/
|
|
1948
|
-
function (error) {
|
|
1169
|
+
});
|
|
1170
|
+
}).catch(function (error) {
|
|
1949
1171
|
return reject(error);
|
|
1950
|
-
})
|
|
1951
|
-
})
|
|
1172
|
+
});
|
|
1173
|
+
});
|
|
1952
1174
|
};
|
|
1953
1175
|
/**
|
|
1954
1176
|
* Gets the current section index.
|
|
1955
1177
|
* @returns A promise which resolves a number.
|
|
1956
1178
|
* @author Will Poulson
|
|
1957
1179
|
*/
|
|
1958
|
-
|
|
1959
|
-
* Gets the current section index.
|
|
1960
|
-
* @author Will Poulson
|
|
1961
|
-
* @private
|
|
1962
|
-
* @return {?} A promise which resolves a number.
|
|
1963
|
-
*/
|
|
1964
|
-
QuestionnaireService.prototype.getCurrentSectionIndex = /**
|
|
1965
|
-
* Gets the current section index.
|
|
1966
|
-
* @author Will Poulson
|
|
1967
|
-
* @private
|
|
1968
|
-
* @return {?} A promise which resolves a number.
|
|
1969
|
-
*/
|
|
1970
|
-
function () {
|
|
1180
|
+
QuestionnaireService.prototype.getCurrentSectionIndex = function () {
|
|
1971
1181
|
var _this = this;
|
|
1972
|
-
return new Promise((
|
|
1973
|
-
* @param {?} resolve
|
|
1974
|
-
* @param {?} reject
|
|
1975
|
-
* @return {?}
|
|
1976
|
-
*/
|
|
1977
|
-
function (resolve, reject) {
|
|
1978
|
-
/** @type {?} */
|
|
1182
|
+
return new Promise(function (resolve, reject) {
|
|
1979
1183
|
var currentIndex = _this.currentQuestionnaire.sections.indexOf(_this.currentSection.data);
|
|
1980
1184
|
if (currentIndex === -1) {
|
|
1981
1185
|
return reject('Could not find current section');
|
|
1982
1186
|
}
|
|
1983
1187
|
return resolve(currentIndex);
|
|
1984
|
-
})
|
|
1188
|
+
});
|
|
1985
1189
|
};
|
|
1986
1190
|
/**
|
|
1987
1191
|
* Checks a section is in bounds then navigates to it.
|
|
@@ -1989,53 +1193,22 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
1989
1193
|
* @returns A promise which will resolve when the section has been navigated to.
|
|
1990
1194
|
* @author Will Poulson
|
|
1991
1195
|
*/
|
|
1992
|
-
|
|
1993
|
-
* Checks a section is in bounds then navigates to it.
|
|
1994
|
-
* @author Will Poulson
|
|
1995
|
-
* @param {?} index The index to navigate to.
|
|
1996
|
-
* @return {?} A promise which will resolve when the section has been navigated to.
|
|
1997
|
-
*/
|
|
1998
|
-
QuestionnaireService.prototype.navigateToSection = /**
|
|
1999
|
-
* Checks a section is in bounds then navigates to it.
|
|
2000
|
-
* @author Will Poulson
|
|
2001
|
-
* @param {?} index The index to navigate to.
|
|
2002
|
-
* @return {?} A promise which will resolve when the section has been navigated to.
|
|
2003
|
-
*/
|
|
2004
|
-
function (index) {
|
|
1196
|
+
QuestionnaireService.prototype.navigateToSection = function (index) {
|
|
2005
1197
|
var _this = this;
|
|
2006
|
-
return new Promise((
|
|
2007
|
-
* @param {?} resolve
|
|
2008
|
-
* @param {?} reject
|
|
2009
|
-
* @return {?}
|
|
2010
|
-
*/
|
|
2011
|
-
function (resolve, reject) {
|
|
1198
|
+
return new Promise(function (resolve, reject) {
|
|
2012
1199
|
if (_this.currentQuestionnaire.sections.length - 1 < index || index < 0) {
|
|
2013
1200
|
return reject('Out of bounds exception');
|
|
2014
1201
|
}
|
|
2015
1202
|
_this.currentSectionName = _this.currentQuestionnaire.sections[index].name;
|
|
2016
1203
|
return resolve();
|
|
2017
|
-
})
|
|
1204
|
+
});
|
|
2018
1205
|
};
|
|
2019
1206
|
/**
|
|
2020
1207
|
* Answers the current question with the parsed value.
|
|
2021
1208
|
* @param answer The value to answer the question with.
|
|
2022
1209
|
* @author Will Poulson
|
|
2023
1210
|
*/
|
|
2024
|
-
|
|
2025
|
-
* Answers the current question with the parsed value.
|
|
2026
|
-
* @author Will Poulson
|
|
2027
|
-
* @param {?} answer The value to answer the question with.
|
|
2028
|
-
* @param {?=} sendToNextQuestion
|
|
2029
|
-
* @return {?}
|
|
2030
|
-
*/
|
|
2031
|
-
QuestionnaireService.prototype.answerCurrentQuestion = /**
|
|
2032
|
-
* Answers the current question with the parsed value.
|
|
2033
|
-
* @author Will Poulson
|
|
2034
|
-
* @param {?} answer The value to answer the question with.
|
|
2035
|
-
* @param {?=} sendToNextQuestion
|
|
2036
|
-
* @return {?}
|
|
2037
|
-
*/
|
|
2038
|
-
function (answer, sendToNextQuestion) {
|
|
1211
|
+
QuestionnaireService.prototype.answerCurrentQuestion = function (answer, sendToNextQuestion) {
|
|
2039
1212
|
var _this = this;
|
|
2040
1213
|
if (!sendToNextQuestion) {
|
|
2041
1214
|
this.currentQuestion.formControl.setValue(answer);
|
|
@@ -2043,18 +1216,12 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2043
1216
|
}
|
|
2044
1217
|
if (this.skippable) { // Timeout to prevent skipping glitch.
|
|
2045
1218
|
this.skippable = false;
|
|
2046
|
-
setTimeout((
|
|
2047
|
-
* @return {?}
|
|
2048
|
-
*/
|
|
2049
|
-
function () {
|
|
1219
|
+
setTimeout(function () {
|
|
2050
1220
|
_this.currentQuestion.formControl.setValue(answer);
|
|
2051
|
-
_this.nextQuestion().then((
|
|
2052
|
-
* @return {?}
|
|
2053
|
-
*/
|
|
2054
|
-
function () {
|
|
1221
|
+
_this.nextQuestion().then(function () {
|
|
2055
1222
|
_this.skippable = true;
|
|
2056
|
-
})
|
|
2057
|
-
}
|
|
1223
|
+
});
|
|
1224
|
+
}, 150);
|
|
2058
1225
|
}
|
|
2059
1226
|
};
|
|
2060
1227
|
/**
|
|
@@ -2063,30 +1230,12 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2063
1230
|
* @returns A promise which resolves when the repeater item has been added.
|
|
2064
1231
|
* @author Will Poulson
|
|
2065
1232
|
*/
|
|
2066
|
-
|
|
2067
|
-
* Adds a repeater item to the current question.
|
|
2068
|
-
* Current question must be of type Repeater.
|
|
2069
|
-
* @author Will Poulson
|
|
2070
|
-
* @return {?} A promise which resolves when the repeater item has been added.
|
|
2071
|
-
*/
|
|
2072
|
-
QuestionnaireService.prototype.addRepeaterItem = /**
|
|
2073
|
-
* Adds a repeater item to the current question.
|
|
2074
|
-
* Current question must be of type Repeater.
|
|
2075
|
-
* @author Will Poulson
|
|
2076
|
-
* @return {?} A promise which resolves when the repeater item has been added.
|
|
2077
|
-
*/
|
|
2078
|
-
function () {
|
|
1233
|
+
QuestionnaireService.prototype.addRepeaterItem = function () {
|
|
2079
1234
|
var _this = this;
|
|
2080
|
-
return new Promise((
|
|
2081
|
-
* @param {?} resolve
|
|
2082
|
-
* @param {?} reject
|
|
2083
|
-
* @return {?}
|
|
2084
|
-
*/
|
|
2085
|
-
function (resolve, reject) {
|
|
1235
|
+
return new Promise(function (resolve, reject) {
|
|
2086
1236
|
if (_this.currentQuestion.data.type !== QuestionType.Repeater) {
|
|
2087
1237
|
return reject("Current question isn't a repeater");
|
|
2088
1238
|
}
|
|
2089
|
-
/** @type {?} */
|
|
2090
1239
|
var repeaterForm = _this.formConstuctor.generateFormsForRepeater(_this.currentQuestion.data);
|
|
2091
1240
|
if (!repeaterForm) {
|
|
2092
1241
|
return reject("Repeater template failed to generate. May be due to the repeater having no items in the editor.");
|
|
@@ -2096,7 +1245,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2096
1245
|
}
|
|
2097
1246
|
_this.currentQuestion.formControl.push(repeaterForm);
|
|
2098
1247
|
return resolve();
|
|
2099
|
-
})
|
|
1248
|
+
});
|
|
2100
1249
|
};
|
|
2101
1250
|
/**
|
|
2102
1251
|
* Removes a repeater item on the current question.
|
|
@@ -2105,28 +1254,9 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2105
1254
|
* @returns A promise which resolves when the repeater item has been removed.
|
|
2106
1255
|
* @author Will Poulson
|
|
2107
1256
|
*/
|
|
2108
|
-
|
|
2109
|
-
* Removes a repeater item on the current question.
|
|
2110
|
-
* Current question must be of type Repeater.
|
|
2111
|
-
* @author Will Poulson
|
|
2112
|
-
* @param {?} index The index at which to remove.
|
|
2113
|
-
* @return {?} A promise which resolves when the repeater item has been removed.
|
|
2114
|
-
*/
|
|
2115
|
-
QuestionnaireService.prototype.removeRepeaterItem = /**
|
|
2116
|
-
* Removes a repeater item on the current question.
|
|
2117
|
-
* Current question must be of type Repeater.
|
|
2118
|
-
* @author Will Poulson
|
|
2119
|
-
* @param {?} index The index at which to remove.
|
|
2120
|
-
* @return {?} A promise which resolves when the repeater item has been removed.
|
|
2121
|
-
*/
|
|
2122
|
-
function (index) {
|
|
1257
|
+
QuestionnaireService.prototype.removeRepeaterItem = function (index) {
|
|
2123
1258
|
var _this = this;
|
|
2124
|
-
return new Promise((
|
|
2125
|
-
* @param {?} resolve
|
|
2126
|
-
* @param {?} reject
|
|
2127
|
-
* @return {?}
|
|
2128
|
-
*/
|
|
2129
|
-
function (resolve, reject) {
|
|
1259
|
+
return new Promise(function (resolve, reject) {
|
|
2130
1260
|
if (_this.currentQuestion.data.type !== QuestionType.Repeater) {
|
|
2131
1261
|
return reject("Current question isn't a repeater");
|
|
2132
1262
|
}
|
|
@@ -2135,7 +1265,7 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2135
1265
|
}
|
|
2136
1266
|
_this.currentQuestion.formControl.removeAt(index);
|
|
2137
1267
|
return resolve();
|
|
2138
|
-
})
|
|
1268
|
+
});
|
|
2139
1269
|
};
|
|
2140
1270
|
/**
|
|
2141
1271
|
* Returns the display text for a given repeater item
|
|
@@ -2143,43 +1273,24 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2143
1273
|
* @returns A string which is the display text.
|
|
2144
1274
|
* @author Will Poulson
|
|
2145
1275
|
*/
|
|
2146
|
-
|
|
2147
|
-
* Returns the display text for a given repeater item
|
|
2148
|
-
* @author Will Poulson
|
|
2149
|
-
* @param {?} index The index at which to get the label for.
|
|
2150
|
-
* @return {?} A string which is the display text.
|
|
2151
|
-
*/
|
|
2152
|
-
QuestionnaireService.prototype.getRepeaterItemLabel = /**
|
|
2153
|
-
* Returns the display text for a given repeater item
|
|
2154
|
-
* @author Will Poulson
|
|
2155
|
-
* @param {?} index The index at which to get the label for.
|
|
2156
|
-
* @return {?} A string which is the display text.
|
|
2157
|
-
*/
|
|
2158
|
-
function (index) {
|
|
1276
|
+
QuestionnaireService.prototype.getRepeaterItemLabel = function (index) {
|
|
2159
1277
|
var e_4, _a;
|
|
2160
1278
|
if (!this.currentQuestion.formControl || !(this.currentQuestion.formControl instanceof FormArray)) {
|
|
2161
1279
|
return '';
|
|
2162
1280
|
}
|
|
2163
|
-
/** @type {?} */
|
|
2164
1281
|
var repeaterItem = this.currentQuestion.formControl.controls[index];
|
|
2165
1282
|
if (!repeaterItem) {
|
|
2166
1283
|
return '';
|
|
2167
1284
|
}
|
|
2168
|
-
/** @type {?} */
|
|
2169
1285
|
var template = this.currentQuestion.data.repeaterDisplayName;
|
|
2170
|
-
/** @type {?} */
|
|
2171
1286
|
var splitTemplate = template.split(' ');
|
|
2172
|
-
/** @type {?} */
|
|
2173
1287
|
var displayArray = [];
|
|
2174
1288
|
try {
|
|
2175
1289
|
for (var splitTemplate_1 = __values(splitTemplate), splitTemplate_1_1 = splitTemplate_1.next(); !splitTemplate_1_1.done; splitTemplate_1_1 = splitTemplate_1.next()) {
|
|
2176
1290
|
var templateItem = splitTemplate_1_1.value;
|
|
2177
1291
|
if (templateItem.match(/\[.*?\]/)) {
|
|
2178
|
-
/** @type {?} */
|
|
2179
1292
|
var path = templateItem.replace(/[\[\]']+/g, '');
|
|
2180
|
-
/** @type {?} */
|
|
2181
1293
|
var item = repeaterItem.get(path);
|
|
2182
|
-
/** @type {?} */
|
|
2183
1294
|
var value = (item && item.value ? item.value : '?');
|
|
2184
1295
|
displayArray.push(value);
|
|
2185
1296
|
}
|
|
@@ -2195,98 +1306,27 @@ var QuestionnaireService = /** @class */ (function () {
|
|
|
2195
1306
|
}
|
|
2196
1307
|
finally { if (e_4) throw e_4.error; }
|
|
2197
1308
|
}
|
|
2198
|
-
/** @type {?} */
|
|
2199
1309
|
var display = displayArray.join(' ');
|
|
2200
1310
|
return display;
|
|
2201
1311
|
};
|
|
2202
|
-
QuestionnaireService
|
|
2203
|
-
|
|
2204
|
-
providedIn: 'root'
|
|
2205
|
-
},] }
|
|
2206
|
-
];
|
|
2207
|
-
/** @nocollapse */
|
|
2208
|
-
QuestionnaireService.ctorParameters = function () { return [
|
|
2209
|
-
{ type: FormConstructorService },
|
|
2210
|
-
{ type: undefined, decorators: [{ type: Inject, args: ['options',] }] }
|
|
2211
|
-
]; };
|
|
2212
|
-
/** @nocollapse */ QuestionnaireService.ngInjectableDef = ɵɵdefineInjectable({ factory: function QuestionnaireService_Factory() { return new QuestionnaireService(ɵɵinject(FormConstructorService), ɵɵinject("options")); }, token: QuestionnaireService, providedIn: "root" });
|
|
1312
|
+
QuestionnaireService.ɵfac = function QuestionnaireService_Factory(t) { return new (t || QuestionnaireService)(ɵɵinject(FormConstructorService), ɵɵinject('options')); };
|
|
1313
|
+
QuestionnaireService.ɵprov = ɵɵdefineInjectable({ token: QuestionnaireService, factory: QuestionnaireService.ɵfac, providedIn: 'root' });
|
|
2213
1314
|
return QuestionnaireService;
|
|
2214
1315
|
}());
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
QuestionnaireService.prototype.originalQuestionnaire;
|
|
2225
|
-
/**
|
|
2226
|
-
* @type {?}
|
|
2227
|
-
* @private
|
|
2228
|
-
*/
|
|
2229
|
-
QuestionnaireService.prototype.currentQuestionnaire;
|
|
2230
|
-
/**
|
|
2231
|
-
* @type {?}
|
|
2232
|
-
* @private
|
|
2233
|
-
*/
|
|
2234
|
-
QuestionnaireService.prototype.currentQuestionnaireForm;
|
|
2235
|
-
/**
|
|
2236
|
-
* @type {?}
|
|
2237
|
-
* @private
|
|
2238
|
-
*/
|
|
2239
|
-
QuestionnaireService.prototype.currentSectionName;
|
|
2240
|
-
/**
|
|
2241
|
-
* @type {?}
|
|
2242
|
-
* @private
|
|
2243
|
-
*/
|
|
2244
|
-
QuestionnaireService.prototype.currentQuestionName;
|
|
2245
|
-
/**
|
|
2246
|
-
* @type {?}
|
|
2247
|
-
* @private
|
|
2248
|
-
*/
|
|
2249
|
-
QuestionnaireService.prototype.questionnaireValueChangeSubscription;
|
|
2250
|
-
/**
|
|
2251
|
-
* @type {?}
|
|
2252
|
-
* @private
|
|
2253
|
-
*/
|
|
2254
|
-
QuestionnaireService.prototype.questionValueChangeSubscription;
|
|
2255
|
-
/** @type {?} */
|
|
2256
|
-
QuestionnaireService.prototype.additionalData;
|
|
2257
|
-
/**
|
|
2258
|
-
* @type {?}
|
|
2259
|
-
* @private
|
|
2260
|
-
*/
|
|
2261
|
-
QuestionnaireService.prototype.skippable;
|
|
2262
|
-
/**
|
|
2263
|
-
* @type {?}
|
|
2264
|
-
* @private
|
|
2265
|
-
*/
|
|
2266
|
-
QuestionnaireService.prototype.formConstuctor;
|
|
2267
|
-
/**
|
|
2268
|
-
* @type {?}
|
|
2269
|
-
* @private
|
|
2270
|
-
*/
|
|
2271
|
-
QuestionnaireService.prototype.options;
|
|
2272
|
-
}
|
|
1316
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(QuestionnaireService, [{
|
|
1317
|
+
type: Injectable,
|
|
1318
|
+
args: [{
|
|
1319
|
+
providedIn: 'root'
|
|
1320
|
+
}]
|
|
1321
|
+
}], function () { return [{ type: FormConstructorService }, { type: undefined, decorators: [{
|
|
1322
|
+
type: Inject,
|
|
1323
|
+
args: ['options']
|
|
1324
|
+
}] }]; }, null); })();
|
|
2273
1325
|
|
|
2274
|
-
/**
|
|
2275
|
-
* @fileoverview added by tsickle
|
|
2276
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2277
|
-
*/
|
|
2278
1326
|
var GgQuestionnaireV2Module = /** @class */ (function () {
|
|
2279
1327
|
function GgQuestionnaireV2Module() {
|
|
2280
1328
|
}
|
|
2281
|
-
|
|
2282
|
-
* @param {?} options
|
|
2283
|
-
* @return {?}
|
|
2284
|
-
*/
|
|
2285
|
-
GgQuestionnaireV2Module.forRoot = /**
|
|
2286
|
-
* @param {?} options
|
|
2287
|
-
* @return {?}
|
|
2288
|
-
*/
|
|
2289
|
-
function (options) {
|
|
1329
|
+
GgQuestionnaireV2Module.forRoot = function (options) {
|
|
2290
1330
|
return {
|
|
2291
1331
|
ngModule: GgQuestionnaireV2Module,
|
|
2292
1332
|
providers: [
|
|
@@ -2298,61 +1338,60 @@ var GgQuestionnaireV2Module = /** @class */ (function () {
|
|
|
2298
1338
|
]
|
|
2299
1339
|
};
|
|
2300
1340
|
};
|
|
2301
|
-
GgQuestionnaireV2Module
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
FormsModule,
|
|
2310
|
-
ReactiveFormsModule
|
|
2311
|
-
],
|
|
2312
|
-
},] }
|
|
2313
|
-
];
|
|
1341
|
+
GgQuestionnaireV2Module.ɵmod = ɵɵdefineNgModule({ type: GgQuestionnaireV2Module });
|
|
1342
|
+
GgQuestionnaireV2Module.ɵinj = ɵɵdefineInjector({ factory: function GgQuestionnaireV2Module_Factory(t) { return new (t || GgQuestionnaireV2Module)(); }, providers: [
|
|
1343
|
+
FormConstructorService,
|
|
1344
|
+
FilterService
|
|
1345
|
+
], imports: [[
|
|
1346
|
+
FormsModule,
|
|
1347
|
+
ReactiveFormsModule
|
|
1348
|
+
]] });
|
|
2314
1349
|
return GgQuestionnaireV2Module;
|
|
2315
1350
|
}());
|
|
1351
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(GgQuestionnaireV2Module, { imports: [FormsModule,
|
|
1352
|
+
ReactiveFormsModule] }); })();
|
|
1353
|
+
/*@__PURE__*/ (function () { ɵsetClassMetadata(GgQuestionnaireV2Module, [{
|
|
1354
|
+
type: NgModule,
|
|
1355
|
+
args: [{
|
|
1356
|
+
declarations: [],
|
|
1357
|
+
providers: [
|
|
1358
|
+
FormConstructorService,
|
|
1359
|
+
FilterService
|
|
1360
|
+
],
|
|
1361
|
+
imports: [
|
|
1362
|
+
FormsModule,
|
|
1363
|
+
ReactiveFormsModule
|
|
1364
|
+
],
|
|
1365
|
+
}]
|
|
1366
|
+
}], null, null); })();
|
|
2316
1367
|
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
Time: 'time',
|
|
2332
|
-
Month: 'month',
|
|
2333
|
-
Week: 'week',
|
|
2334
|
-
};
|
|
1368
|
+
var InputType;
|
|
1369
|
+
(function (InputType) {
|
|
1370
|
+
InputType["Text"] = "text";
|
|
1371
|
+
InputType["Number"] = "number";
|
|
1372
|
+
InputType["Email"] = "email";
|
|
1373
|
+
InputType["Telephone"] = "tel";
|
|
1374
|
+
InputType["Password"] = "password";
|
|
1375
|
+
InputType["Color"] = "color";
|
|
1376
|
+
InputType["Date"] = "date";
|
|
1377
|
+
InputType["DateTimeLocal"] = "datetime-local";
|
|
1378
|
+
InputType["Time"] = "time";
|
|
1379
|
+
InputType["Month"] = "month";
|
|
1380
|
+
InputType["Week"] = "week";
|
|
1381
|
+
})(InputType || (InputType = {}));
|
|
2335
1382
|
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
Input: 'input',
|
|
2343
|
-
Select: 'select',
|
|
2344
|
-
Upload: 'upload',
|
|
2345
|
-
};
|
|
1383
|
+
var RepeaterQuestionType;
|
|
1384
|
+
(function (RepeaterQuestionType) {
|
|
1385
|
+
RepeaterQuestionType["Input"] = "input";
|
|
1386
|
+
RepeaterQuestionType["Select"] = "select";
|
|
1387
|
+
RepeaterQuestionType["Upload"] = "upload";
|
|
1388
|
+
})(RepeaterQuestionType || (RepeaterQuestionType = {}));
|
|
2346
1389
|
|
|
2347
|
-
|
|
2348
|
-
* @fileoverview added by tsickle
|
|
2349
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2350
|
-
*/
|
|
1390
|
+
// Services
|
|
2351
1391
|
|
|
2352
1392
|
/**
|
|
2353
|
-
*
|
|
2354
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1393
|
+
* Generated bundle index. Do not edit.
|
|
2355
1394
|
*/
|
|
2356
1395
|
|
|
2357
|
-
export { ConditionRelationship, ConditionType, GgQuestionnaireV2Module, InputType, QuestionType, QuestionnaireService, RepeaterQuestionType, ValidationType
|
|
1396
|
+
export { ConditionRelationship, ConditionType, GgQuestionnaireV2Module, InputType, QuestionType, QuestionnaireService, RepeaterQuestionType, ValidationType };
|
|
2358
1397
|
//# sourceMappingURL=glowgreen-gg-questionnaire-v2.js.map
|