@touchpoll/tp-survey 0.0.27 → 0.0.28
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.
|
@@ -1231,7 +1231,7 @@ class ContainerAnswerComponent {
|
|
|
1231
1231
|
this.#updateAlternativesAndSections();
|
|
1232
1232
|
this.#updateAdditionalAnswers(true);
|
|
1233
1233
|
this.#addValidator();
|
|
1234
|
-
this.answerForm.valueChanges.pipe(debounceTime(250), tap(() => this
|
|
1234
|
+
this.answerForm.valueChanges.pipe(debounceTime(250), tap(() => this.#emitLogicChanged()), //шлём новые логические переменные(может обновиться список additionalAnswers)
|
|
1235
1235
|
tap(() => this.#updateAdditionalAnswers(false)), //перестраиваем additionalAnswers
|
|
1236
1236
|
map(values => {
|
|
1237
1237
|
const formGroup = this.answerForm.controls.additionalAnswers;
|
|
@@ -1264,6 +1264,14 @@ class ContainerAnswerComponent {
|
|
|
1264
1264
|
});
|
|
1265
1265
|
});
|
|
1266
1266
|
this.#setDefaultAnswers();
|
|
1267
|
+
/*Update 19.03.2005
|
|
1268
|
+
Когда нажимают кнопку back, ответы остаются, но логические переменные удаляются, см. TpSurveyCoreService.clearAnswerForCurrentQuestion
|
|
1269
|
+
Но если респондент ничего в ответе не меняет и нажимает кнопку далее, то логические переменные не обновляются.
|
|
1270
|
+
Поэтому если ответ на вопрос не равен MISSING_VALUE(-97), то нужно обновить логические переменные
|
|
1271
|
+
*/
|
|
1272
|
+
if (answerValue !== MISSING_VALUE) {
|
|
1273
|
+
this.#emitLogicChanged();
|
|
1274
|
+
}
|
|
1267
1275
|
}
|
|
1268
1276
|
#addValidator() {
|
|
1269
1277
|
const question = this.question();
|
|
@@ -1463,6 +1471,9 @@ class ContainerAnswerComponent {
|
|
|
1463
1471
|
});
|
|
1464
1472
|
return resArray;
|
|
1465
1473
|
}
|
|
1474
|
+
#emitLogicChanged() {
|
|
1475
|
+
this.logicChanged.emit(this.#getLogicVars());
|
|
1476
|
+
}
|
|
1466
1477
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ContainerAnswerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1467
1478
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.7", type: ContainerAnswerComponent, isStandalone: true, selector: "tp-survey-container-answer", inputs: { findVariable: { classPropertyName: "findVariable", publicName: "findVariable", isSignal: true, isRequired: true, transformFunction: null }, question: { classPropertyName: "question", publicName: "question", isSignal: true, isRequired: true, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: true, transformFunction: null }, viewModel: { classPropertyName: "viewModel", publicName: "viewModel", isSignal: true, isRequired: true, transformFunction: null }, answers: { classPropertyName: "answers", publicName: "answers", isSignal: true, isRequired: false, transformFunction: null }, developerMode: { classPropertyName: "developerMode", publicName: "developerMode", isSignal: true, isRequired: false, transformFunction: null }, languageList: { classPropertyName: "languageList", publicName: "languageList", isSignal: true, isRequired: true, transformFunction: null }, repositoryPath: { classPropertyName: "repositoryPath", publicName: "repositoryPath", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { logicChanged: "logicChanged", answerChanged: "answerChanged", onLanguageChange: "onLanguageChange" }, ngImport: i0, template: "<div class=\"container-main\" [formGroup]=\"answerForm\">\r\n @switch (question().QuestionType) {\r\n\r\n @case (questionsType.eqLANG) {\r\n <tp-survey-answer-lang\r\n [languageList]=\"languageList()\"\r\n [findVariable]=\"findVariable()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [language]=\"2\"\r\n [viewModel]=\"viewModel()\"\r\n (onLanguageChange)=\"onLanguageChange.emit($event)\"/>\r\n }\r\n\r\n @case (questionsType.eqINFO) {\r\n <tp-survey-answer-info\r\n formControlName=\"answer\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [findVariable]=\"findVariable()\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"/>\r\n }\r\n\r\n @case (questionsType.eqSS) {\r\n <tp-survey-answer-ss\r\n formControlName=\"answer\"\r\n [question]=\"question()\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"\r\n [findVariable]=\"findVariable()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [alternativeList]=\"visibleAlternativeList()\"\r\n (onAlternativeClick)=\"onAlternativeClick($event)\"\r\n />\r\n }\r\n\r\n @case (questionsType.eqMS) {\r\n <tp-survey-answer-ms\r\n formControlName=\"answer\"\r\n [question]=\"question()\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"\r\n [findVariable]=\"findVariable()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [alternativeMaxAnswersCount]=\"question().AlternativeMaxAnswersCount\"\r\n [alternativeList]=\"visibleAlternativeList()\"\r\n (onAlternativeClick)=\"onAlternativeClick($event)\"/>\r\n }\r\n\r\n @case (questionsType.eqOD) {\r\n <tp-survey-answer-od\r\n formControlName=\"answer\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"\r\n [findVariable]=\"findVariable()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [minValue]=\"question().ODMinValue\"\r\n [maxValue]=\"question().ODMaxValue\"\r\n />\r\n }\r\n\r\n @case (questionsType.eqOL) {\r\n <tp-survey-answer-ol\r\n formControlName=\"answer\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [findVariable]=\"findVariable()\"\r\n [telephoneInput]=\"question().OLTypeTel\"\r\n [canSkip]=\"question().CanSkip\"/>\r\n }\r\n\r\n @case (questionsType.eqSL) {\r\n <tp-survey-answer-sl\r\n formControlName=\"answer\"\r\n [alternativeList]=\"visibleAlternativeList()\"\r\n [sectionList]=\"visibleSectionList()\"\r\n [multiSelect]=\"question().MultiSelect\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [findVariable]=\"findVariable()\"\r\n [maxCount]=\"this.question().SLSectionMaxAnswersCount\"\r\n />\r\n }\r\n\r\n @case (questionsType.eqEND) {\r\n <tp-survey-answer-end\r\n formControlName=\"answer\"\r\n [findVariable]=\"findVariable()\"\r\n [repositoryPath]=\"repositoryPath()\"\r\n [language]=\"language()\"\r\n [viewModel]=\"viewModel()\"\r\n />\r\n }\r\n }\r\n\r\n <div class=\"container-additional-answer\">\r\n @for (addAnswer of answerForm.controls.additionalAnswers.controls | keyValues; track addAnswer) {\r\n @if (addAnswer.name | getAdditionalValueByValue:visibleAdditionalAnswerList(); as additionalAnswerObject ) {\r\n <tp-survey-answer-additional\r\n [control]=\"addAnswer.control\"\r\n [class.full-width]=\"additionalAnswerObject.AnswerType===AdditionalAnswerType.aatText\"\r\n [answerType]=\"additionalAnswerObject.AnswerType\"\r\n [caption]=\"additionalAnswerObject.MultiLangCaptions | multiLangObjectToHtml:language()\"\r\n [numberMinValue]=\"additionalAnswerObject.NumberMinValue\"\r\n [numberMaxValue]=\"additionalAnswerObject.NumberMaxValue\"\r\n [textMultiline]=\"additionalAnswerObject.TextMultiline\"\r\n [captionPosition]=\"additionalAnswerObject.CaptionPosition\"/>\r\n }\r\n }\r\n </div>\r\n</div>\r\n\r\n", styles: [".container-main{display:flex;flex-flow:column;align-items:center}tp-survey-answer-sl{width:100%}.full-width{width:100%}:host-context(.tp-view-desktop) .container-main{margin:0 auto;padding:0 1em}:host-context(.tp-view-desktop) .container-additional-answer{padding:1em;display:flex;flex-flow:column;align-items:baseline;gap:2em}:host-context(.tp-view-tablet) .container-main{width:100%;height:100%;overflow:auto}:host-context(.tp-view-tablet) .container-additional-answer{padding:1em;display:flex;flex-flow:column;align-items:baseline;gap:2em}@media (max-width: 480px){:host-context(.tp-view-desktop) .container-additional-answer{width:100%}}\n"], dependencies: [{ kind: "component", type: AnswerODComponent, selector: "tp-survey-answer-od", inputs: ["minValue", "maxValue"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: AnswerSSComponent, selector: "tp-survey-answer-ss", inputs: ["question", "alternativeList"], outputs: ["onAlternativeClick"] }, { kind: "component", type: AnswerInfoComponent, selector: "tp-survey-answer-info" }, { kind: "component", type: AnswerMSComponent, selector: "tp-survey-answer-ms", inputs: ["question", "alternativeList", "alternativeMaxAnswersCount"], outputs: ["onAlternativeClick"] }, { kind: "component", type: AnswerAdditionalComponent, selector: "tp-survey-answer-additional", inputs: ["control", "answerType", "caption", "numberMinValue", "numberMaxValue", "textMultiline", "captionPosition"] }, { kind: "pipe", type: MultiLangObjectToHtmlPipe, name: "multiLangObjectToHtml" }, { kind: "component", type: AnswerEndComponent, selector: "tp-survey-answer-end" }, { kind: "component", type: AnswerOLComponent, selector: "tp-survey-answer-ol", inputs: ["telephoneInput", "canSkip"] }, { kind: "component", type: AnswerSLComponent, selector: "tp-survey-answer-sl", inputs: ["alternativeList", "sectionList", "multiSelect", "maxCount"] }, { kind: "pipe", type: GetAdditionalValueByValuePipe, name: "getAdditionalValueByValue" }, { kind: "pipe", type: KeyValuesPipe, name: "keyValues" }, { kind: "component", type: AnswerLangComponent, selector: "tp-survey-answer-lang", inputs: ["languageList"], outputs: ["onLanguageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1468
1479
|
}
|