@glowgreen/gg-questionnaire-v2 0.0.70 → 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 -55
- 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 +35 -30
- package/esm5/lib/services/form-constructor.service.js +87 -57
- package/fesm2015/glowgreen-gg-questionnaire-v2.js +34 -28
- package/fesm2015/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/fesm5/glowgreen-gg-questionnaire-v2.js +86 -55
- package/fesm5/glowgreen-gg-questionnaire-v2.js.map +1 -1
- package/package.json +1 -1
|
@@ -1011,34 +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
|
-
|
|
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();
|
|
1035
1046
|
}
|
|
1036
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
|
+
}
|
|
1037
1080
|
}
|
|
1038
1081
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1039
1082
|
finally {
|
|
1040
1083
|
try {
|
|
1041
|
-
if (
|
|
1084
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1042
1085
|
}
|
|
1043
1086
|
finally { if (e_3) throw e_3.error; }
|
|
1044
1087
|
}
|
|
@@ -1075,7 +1118,7 @@
|
|
|
1075
1118
|
* @return {?} A form group.
|
|
1076
1119
|
*/
|
|
1077
1120
|
function (question, convertedValidators) {
|
|
1078
|
-
var
|
|
1121
|
+
var e_6, _a;
|
|
1079
1122
|
if (question.type !== QuestionType.Checklist || question.checklistItems.length === 0) {
|
|
1080
1123
|
return null;
|
|
1081
1124
|
}
|
|
@@ -1089,12 +1132,12 @@
|
|
|
1089
1132
|
checklistForms.addControl(checklistItem.name, checklistItemControl);
|
|
1090
1133
|
}
|
|
1091
1134
|
}
|
|
1092
|
-
catch (
|
|
1135
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1093
1136
|
finally {
|
|
1094
1137
|
try {
|
|
1095
1138
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1096
1139
|
}
|
|
1097
|
-
finally { if (
|
|
1140
|
+
finally { if (e_6) throw e_6.error; }
|
|
1098
1141
|
}
|
|
1099
1142
|
return checklistForms;
|
|
1100
1143
|
};
|
|
@@ -1119,39 +1162,27 @@
|
|
|
1119
1162
|
* @return {?} A form group.
|
|
1120
1163
|
*/
|
|
1121
1164
|
function (question, index) {
|
|
1122
|
-
var
|
|
1165
|
+
var e_7, _a;
|
|
1123
1166
|
if (question.type !== QuestionType.Repeater || question.repeaterQuestions.length === 0) {
|
|
1124
1167
|
console.log('Question isnt a repeater or has no questions, returning null');
|
|
1125
1168
|
return null;
|
|
1126
1169
|
}
|
|
1127
1170
|
/** @type {?} */
|
|
1128
|
-
var repeaterQuestions = question.repeaterQuestions;
|
|
1129
|
-
if (question.filteredRepeaterQuestions && question.filteredRepeaterQuestions[index]) {
|
|
1130
|
-
repeaterQuestions = question.filteredRepeaterQuestions[index];
|
|
1131
|
-
}
|
|
1132
|
-
console.log('Index passed', index);
|
|
1133
|
-
console.log('All filtered questions', question.filteredRepeaterQuestions);
|
|
1134
|
-
console.log('Got the following repeater questions', repeaterQuestions.map((/**
|
|
1135
|
-
* @param {?} x
|
|
1136
|
-
* @return {?}
|
|
1137
|
-
*/
|
|
1138
|
-
function (x) { return x.name; })));
|
|
1139
|
-
/** @type {?} */
|
|
1140
1171
|
var repeaterForms = this.fb.group({});
|
|
1141
1172
|
try {
|
|
1142
|
-
for (var
|
|
1143
|
-
var repeaterQuestion =
|
|
1173
|
+
for (var _b = __values(question.repeaterQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1174
|
+
var repeaterQuestion = _c.value;
|
|
1144
1175
|
/** @type {?} */
|
|
1145
1176
|
var repeaterQuestionControl = this.generateControlForRepeaterQuestion(repeaterQuestion);
|
|
1146
1177
|
repeaterForms.addControl(repeaterQuestion.name, repeaterQuestionControl);
|
|
1147
1178
|
}
|
|
1148
1179
|
}
|
|
1149
|
-
catch (
|
|
1180
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1150
1181
|
finally {
|
|
1151
1182
|
try {
|
|
1152
|
-
if (
|
|
1183
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1153
1184
|
}
|
|
1154
|
-
finally { if (
|
|
1185
|
+
finally { if (e_7) throw e_7.error; }
|
|
1155
1186
|
}
|
|
1156
1187
|
return repeaterForms;
|
|
1157
1188
|
};
|
|
@@ -1201,7 +1232,7 @@
|
|
|
1201
1232
|
* @return {?} A convered array of form validators.
|
|
1202
1233
|
*/
|
|
1203
1234
|
function (validators) {
|
|
1204
|
-
var
|
|
1235
|
+
var e_8, _a;
|
|
1205
1236
|
if (!validators || validators.length === 0) {
|
|
1206
1237
|
return [];
|
|
1207
1238
|
}
|
|
@@ -1217,12 +1248,12 @@
|
|
|
1217
1248
|
}
|
|
1218
1249
|
}
|
|
1219
1250
|
}
|
|
1220
|
-
catch (
|
|
1251
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1221
1252
|
finally {
|
|
1222
1253
|
try {
|
|
1223
1254
|
if (validators_1_1 && !validators_1_1.done && (_a = validators_1.return)) _a.call(validators_1);
|
|
1224
1255
|
}
|
|
1225
|
-
finally { if (
|
|
1256
|
+
finally { if (e_8) throw e_8.error; }
|
|
1226
1257
|
}
|
|
1227
1258
|
return convertedValidators;
|
|
1228
1259
|
};
|
|
@@ -1274,12 +1305,12 @@
|
|
|
1274
1305
|
* @return {?}
|
|
1275
1306
|
*/
|
|
1276
1307
|
function (savedState, sections, currentQuestionnaireForm) {
|
|
1277
|
-
var
|
|
1308
|
+
var e_9, _a, e_10, _b, e_11, _c;
|
|
1278
1309
|
try {
|
|
1279
1310
|
for (var sections_2 = __values(sections), sections_2_1 = sections_2.next(); !sections_2_1.done; sections_2_1 = sections_2.next()) {
|
|
1280
1311
|
var section = sections_2_1.value;
|
|
1281
1312
|
try {
|
|
1282
|
-
for (var _d = (
|
|
1313
|
+
for (var _d = (e_10 = void 0, __values(section.questions)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1283
1314
|
var question = _e.value;
|
|
1284
1315
|
if (question.type !== QuestionType.Repeater) {
|
|
1285
1316
|
continue;
|
|
@@ -1296,7 +1327,7 @@
|
|
|
1296
1327
|
}
|
|
1297
1328
|
try {
|
|
1298
1329
|
// For each item that used to be there push a new empty template there to be populated.
|
|
1299
|
-
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()) {
|
|
1300
1331
|
var repeaterItem = repeaterArray_1_1.value;
|
|
1301
1332
|
/** @type {?} */
|
|
1302
1333
|
var index = repeaterArray.indexOf(repeaterItem);
|
|
@@ -1305,30 +1336,30 @@
|
|
|
1305
1336
|
repeaterFormArray.push(repeaterItemTemplate);
|
|
1306
1337
|
}
|
|
1307
1338
|
}
|
|
1308
|
-
catch (
|
|
1339
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1309
1340
|
finally {
|
|
1310
1341
|
try {
|
|
1311
1342
|
if (repeaterArray_1_1 && !repeaterArray_1_1.done && (_c = repeaterArray_1.return)) _c.call(repeaterArray_1);
|
|
1312
1343
|
}
|
|
1313
|
-
finally { if (
|
|
1344
|
+
finally { if (e_11) throw e_11.error; }
|
|
1314
1345
|
}
|
|
1315
1346
|
}
|
|
1316
1347
|
}
|
|
1317
|
-
catch (
|
|
1348
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1318
1349
|
finally {
|
|
1319
1350
|
try {
|
|
1320
1351
|
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
1321
1352
|
}
|
|
1322
|
-
finally { if (
|
|
1353
|
+
finally { if (e_10) throw e_10.error; }
|
|
1323
1354
|
}
|
|
1324
1355
|
}
|
|
1325
1356
|
}
|
|
1326
|
-
catch (
|
|
1357
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1327
1358
|
finally {
|
|
1328
1359
|
try {
|
|
1329
1360
|
if (sections_2_1 && !sections_2_1.done && (_a = sections_2.return)) _a.call(sections_2);
|
|
1330
1361
|
}
|
|
1331
|
-
finally { if (
|
|
1362
|
+
finally { if (e_9) throw e_9.error; }
|
|
1332
1363
|
}
|
|
1333
1364
|
};
|
|
1334
1365
|
FormConstructorService.decorators = [
|