@glowgreen/gg-questionnaire-v2 0.0.69 → 0.0.71
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 +86 -63
- package/bundles/glowgreen-gg-questionnaire-v2.umd.js.map +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js +1 -1
- package/bundles/glowgreen-gg-questionnaire-v2.umd.min.js.map +1 -1
- package/esm2015/lib/services/form-constructor.service.js +29 -32
- package/esm5/lib/services/form-constructor.service.js +87 -65
- package/fesm2015/glowgreen-gg-questionnaire-v2.js +28 -30
- package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/fesm5/glowgreen-gg-questionnaire-v2.js +86 -63
- package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/package.json +1 -1
|
@@ -1011,42 +1011,77 @@
|
|
|
1011
1011
|
var newArray = this.fb.array([], convertedValidators);
|
|
1012
1012
|
/** @type {?} */
|
|
1013
1013
|
var currentArray = currentQuestionnaireForm ? ((/** @type {?} */ (currentQuestionnaireForm.get([section.name, question.name])))) : false;
|
|
1014
|
-
if (currentArray) {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1014
|
+
if (currentArray && question.filteredRepeaterQuestions) {
|
|
1015
|
+
var _loop_1 = function (control) {
|
|
1016
|
+
var e_4, _a, e_5, _b;
|
|
1017
|
+
/** @type {?} */
|
|
1018
|
+
var index = currentArray.controls.indexOf(control);
|
|
1019
|
+
if (!index) {
|
|
1020
|
+
return "continue";
|
|
1021
|
+
}
|
|
1022
|
+
/** @type {?} */
|
|
1023
|
+
var filteredQuestions = question.filteredRepeaterQuestions[index];
|
|
1024
|
+
if (!filteredQuestions) {
|
|
1025
|
+
return "continue";
|
|
1026
|
+
}
|
|
1027
|
+
/** @type {?} */
|
|
1028
|
+
var filteredQuestionNames = filteredQuestions.map((/**
|
|
1029
|
+
* @param {?} x
|
|
1030
|
+
* @return {?}
|
|
1031
|
+
*/
|
|
1032
|
+
function (x) { return x.name; }));
|
|
1033
|
+
/** @type {?} */
|
|
1034
|
+
var filteredOutQuestions = question.repeaterQuestions.filter((/**
|
|
1035
|
+
* @param {?} x
|
|
1036
|
+
* @return {?}
|
|
1037
|
+
*/
|
|
1038
|
+
function (x) { return !filteredQuestionNames.includes(x.name); }));
|
|
1039
|
+
try {
|
|
1040
|
+
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()) {
|
|
1041
|
+
var filteredOutQuestion = filteredOutQuestions_1_1.value;
|
|
1042
|
+
/** @type {?} */
|
|
1043
|
+
var childControl = control.get(filteredOutQuestion.name);
|
|
1044
|
+
childControl.setValidators([]);
|
|
1045
|
+
childControl.updateValueAndValidity();
|
|
1043
1046
|
}
|
|
1044
1047
|
}
|
|
1048
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1049
|
+
finally {
|
|
1050
|
+
try {
|
|
1051
|
+
if (filteredOutQuestions_1_1 && !filteredOutQuestions_1_1.done && (_a = filteredOutQuestions_1.return)) _a.call(filteredOutQuestions_1);
|
|
1052
|
+
}
|
|
1053
|
+
finally { if (e_4) throw e_4.error; }
|
|
1054
|
+
}
|
|
1055
|
+
try {
|
|
1056
|
+
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()) {
|
|
1057
|
+
var filteredQuestion = filteredQuestions_1_1.value;
|
|
1058
|
+
/** @type {?} */
|
|
1059
|
+
var childControl = control.get(filteredQuestion.name);
|
|
1060
|
+
/** @type {?} */
|
|
1061
|
+
var convertedValidators_1 = this_1.convertValidators(filteredQuestion.validators);
|
|
1062
|
+
childControl.setValidators(convertedValidators_1);
|
|
1063
|
+
childControl.updateValueAndValidity();
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1067
|
+
finally {
|
|
1068
|
+
try {
|
|
1069
|
+
if (filteredQuestions_1_1 && !filteredQuestions_1_1.done && (_b = filteredQuestions_1.return)) _b.call(filteredQuestions_1);
|
|
1070
|
+
}
|
|
1071
|
+
finally { if (e_5) throw e_5.error; }
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
var this_1 = this;
|
|
1075
|
+
try {
|
|
1076
|
+
for (var _b = __values(currentArray.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1077
|
+
var control = _c.value;
|
|
1078
|
+
_loop_1(control);
|
|
1079
|
+
}
|
|
1045
1080
|
}
|
|
1046
1081
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1047
1082
|
finally {
|
|
1048
1083
|
try {
|
|
1049
|
-
if (
|
|
1084
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1050
1085
|
}
|
|
1051
1086
|
finally { if (e_3) throw e_3.error; }
|
|
1052
1087
|
}
|
|
@@ -1083,7 +1118,7 @@
|
|
|
1083
1118
|
* @return {?} A form group.
|
|
1084
1119
|
*/
|
|
1085
1120
|
function (question, convertedValidators) {
|
|
1086
|
-
var
|
|
1121
|
+
var e_6, _a;
|
|
1087
1122
|
if (question.type !== QuestionType.Checklist || question.checklistItems.length === 0) {
|
|
1088
1123
|
return null;
|
|
1089
1124
|
}
|
|
@@ -1097,12 +1132,12 @@
|
|
|
1097
1132
|
checklistForms.addControl(checklistItem.name, checklistItemControl);
|
|
1098
1133
|
}
|
|
1099
1134
|
}
|
|
1100
|
-
catch (
|
|
1135
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1101
1136
|
finally {
|
|
1102
1137
|
try {
|
|
1103
1138
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1104
1139
|
}
|
|
1105
|
-
finally { if (
|
|
1140
|
+
finally { if (e_6) throw e_6.error; }
|
|
1106
1141
|
}
|
|
1107
1142
|
return checklistForms;
|
|
1108
1143
|
};
|
|
@@ -1127,39 +1162,27 @@
|
|
|
1127
1162
|
* @return {?} A form group.
|
|
1128
1163
|
*/
|
|
1129
1164
|
function (question, index) {
|
|
1130
|
-
var
|
|
1165
|
+
var e_7, _a;
|
|
1131
1166
|
if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {
|
|
1132
1167
|
console.log('Question isnt a repeater or has no questions, returning null');
|
|
1133
1168
|
return null;
|
|
1134
1169
|
}
|
|
1135
1170
|
/** @type {?} */
|
|
1136
|
-
var repeaterQuestions = question.repeaterQuestions;
|
|
1137
|
-
if (question.filteredRepeaterQuestions && question.filteredRepeaterQuestions[index]) {
|
|
1138
|
-
repeaterQuestions = question.filteredRepeaterQuestions[index];
|
|
1139
|
-
}
|
|
1140
|
-
console.log('Index passed', index);
|
|
1141
|
-
console.log('All filtered questions', question.filteredRepeaterQuestions);
|
|
1142
|
-
console.log('Got the following repeater questions', repeaterQuestions.map((/**
|
|
1143
|
-
* @param {?} x
|
|
1144
|
-
* @return {?}
|
|
1145
|
-
*/
|
|
1146
|
-
function (x) { return x.name; })));
|
|
1147
|
-
/** @type {?} */
|
|
1148
1171
|
var repeaterForms = this.fb.group({});
|
|
1149
1172
|
try {
|
|
1150
|
-
for (var
|
|
1151
|
-
var repeaterQuestion =
|
|
1173
|
+
for (var _b = __values(question.repeaterQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1174
|
+
var repeaterQuestion = _c.value;
|
|
1152
1175
|
/** @type {?} */
|
|
1153
1176
|
var repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);
|
|
1154
1177
|
repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);
|
|
1155
1178
|
}
|
|
1156
1179
|
}
|
|
1157
|
-
catch (
|
|
1180
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1158
1181
|
finally {
|
|
1159
1182
|
try {
|
|
1160
|
-
if (
|
|
1183
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1161
1184
|
}
|
|
1162
|
-
finally { if (
|
|
1185
|
+
finally { if (e_7) throw e_7.error; }
|
|
1163
1186
|
}
|
|
1164
1187
|
return repeaterForms;
|
|
1165
1188
|
};
|
|
@@ -1209,7 +1232,7 @@
|
|
|
1209
1232
|
* @return {?} A convered array of form validators.
|
|
1210
1233
|
*/
|
|
1211
1234
|
function (validators) {
|
|
1212
|
-
var
|
|
1235
|
+
var e_8, _a;
|
|
1213
1236
|
if (!validators || validators.length === 0) {
|
|
1214
1237
|
return [];
|
|
1215
1238
|
}
|
|
@@ -1225,12 +1248,12 @@
|
|
|
1225
1248
|
}
|
|
1226
1249
|
}
|
|
1227
1250
|
}
|
|
1228
|
-
catch (
|
|
1251
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1229
1252
|
finally {
|
|
1230
1253
|
try {
|
|
1231
1254
|
if (validators_1_1 && !validators_1_1.done && (_a = validators_1.return)) _a.call(validators_1);
|
|
1232
1255
|
}
|
|
1233
|
-
finally { if (
|
|
1256
|
+
finally { if (e_8) throw e_8.error; }
|
|
1234
1257
|
}
|
|
1235
1258
|
return convertedValidators;
|
|
1236
1259
|
};
|
|
@@ -1282,12 +1305,12 @@
|
|
|
1282
1305
|
* @return {?}
|
|
1283
1306
|
*/
|
|
1284
1307
|
function (savedState, sections, currentQuestionnaireForm) {
|
|
1285
|
-
var
|
|
1308
|
+
var e_9, _a, e_10, _b, e_11, _c;
|
|
1286
1309
|
try {
|
|
1287
1310
|
for (var sections_2 = __values(sections), sections_2_1 = sections_2.next(); !sections_2_1.done; sections_2_1 = sections_2.next()) {
|
|
1288
1311
|
var section = sections_2_1.value;
|
|
1289
1312
|
try {
|
|
1290
|
-
for (var _d = (
|
|
1313
|
+
for (var _d = (e_10 = void 0, __values(section.questions)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1291
1314
|
var question = _e.value;
|
|
1292
1315
|
if (question.type !== QuestionType.Repeater) {
|
|
1293
1316
|
continue;
|
|
@@ -1304,7 +1327,7 @@
|
|
|
1304
1327
|
}
|
|
1305
1328
|
try {
|
|
1306
1329
|
// For each item that used to be there push a new empty template there to be populated.
|
|
1307
|
-
for (var repeaterArray_1 = (
|
|
1330
|
+
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()) {
|
|
1308
1331
|
var repeaterItem = repeaterArray_1_1.value;
|
|
1309
1332
|
/** @type {?} */
|
|
1310
1333
|
var index = repeaterArray.indexOf(repeaterItem);
|
|
@@ -1313,30 +1336,30 @@
|
|
|
1313
1336
|
repeaterFormArray.push(repeaterItemTemplate);
|
|
1314
1337
|
}
|
|
1315
1338
|
}
|
|
1316
|
-
catch (
|
|
1339
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1317
1340
|
finally {
|
|
1318
1341
|
try {
|
|
1319
1342
|
if (repeaterArray_1_1 && !repeaterArray_1_1.done && (_c = repeaterArray_1.return)) _c.call(repeaterArray_1);
|
|
1320
1343
|
}
|
|
1321
|
-
finally { if (
|
|
1344
|
+
finally { if (e_11) throw e_11.error; }
|
|
1322
1345
|
}
|
|
1323
1346
|
}
|
|
1324
1347
|
}
|
|
1325
|
-
catch (
|
|
1348
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1326
1349
|
finally {
|
|
1327
1350
|
try {
|
|
1328
1351
|
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
1329
1352
|
}
|
|
1330
|
-
finally { if (
|
|
1353
|
+
finally { if (e_10) throw e_10.error; }
|
|
1331
1354
|
}
|
|
1332
1355
|
}
|
|
1333
1356
|
}
|
|
1334
|
-
catch (
|
|
1357
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1335
1358
|
finally {
|
|
1336
1359
|
try {
|
|
1337
1360
|
if (sections_2_1 && !sections_2_1.done && (_a = sections_2.return)) _a.call(sections_2);
|
|
1338
1361
|
}
|
|
1339
|
-
finally { if (
|
|
1362
|
+
finally { if (e_9) throw e_9.error; }
|
|
1340
1363
|
}
|
|
1341
1364
|
};
|
|
1342
1365
|
FormConstructorService.decorators = [
|