@touchpoll/tp-survey 0.0.25 → 0.0.27
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/fesm2022/touchpoll-tp-survey.mjs +26 -15
- package/fesm2022/touchpoll-tp-survey.mjs.map +1 -1
- package/lib/component/answer/answer.master/answer.master.component.d.ts +1 -0
- package/lib/component/answer/answer.ol/answer.ol.component.d.ts +3 -2
- package/lib/component/answer/container.answer/container.answer.validator.d.ts +1 -1
- package/lib/tp.survey.interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -171,13 +171,13 @@ const answerODValidator = (minValue, maxValue) => (control) => {
|
|
|
171
171
|
//ошибок нет, всё корректно
|
|
172
172
|
return null;
|
|
173
173
|
};
|
|
174
|
-
const answerOLValidator = (isPhoneNumber) => (control) => {
|
|
174
|
+
const answerOLValidator = (isPhoneNumber, canSkip) => (control) => {
|
|
175
175
|
const text = typeof control.value !== 'string' ? '' : control.value.trim();
|
|
176
176
|
//Нужно чтобы в поле ввели хоть что-то.
|
|
177
|
-
if (text.length === 0) {
|
|
177
|
+
if (text.length === 0 && !canSkip) {
|
|
178
178
|
return { answerOlAnswerError: true };
|
|
179
179
|
}
|
|
180
|
-
if (isPhoneNumber) {
|
|
180
|
+
if (isPhoneNumber && !canSkip) {
|
|
181
181
|
const res = text.length === 9 && !isNaN(Number(text));
|
|
182
182
|
if (!res) {
|
|
183
183
|
return { answerOlTelephoneFormatError: true };
|
|
@@ -434,6 +434,9 @@ class AnswerMasterComponent {
|
|
|
434
434
|
writeValue(value) {
|
|
435
435
|
this.control.patchValue(value, { emitEvent: false });
|
|
436
436
|
}
|
|
437
|
+
skipClick() {
|
|
438
|
+
this.control.patchValue('skip', { emitEvent: true });
|
|
439
|
+
}
|
|
437
440
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: AnswerMasterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
438
441
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.7", type: AnswerMasterComponent, isStandalone: true, selector: "app-answer-master", inputs: { language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: true, transformFunction: null }, viewModel: { classPropertyName: "viewModel", publicName: "viewModel", isSignal: true, isRequired: true, transformFunction: null }, findVariable: { classPropertyName: "findVariable", publicName: "findVariable", isSignal: true, isRequired: true, transformFunction: null }, repositoryPath: { classPropertyName: "repositoryPath", publicName: "repositoryPath", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
439
442
|
{
|
|
@@ -928,15 +931,16 @@ class AnswerOLComponent extends AnswerMasterComponent {
|
|
|
928
931
|
constructor() {
|
|
929
932
|
super(...arguments);
|
|
930
933
|
this.telephoneInput = input(false);
|
|
934
|
+
this.canSkip = input(false);
|
|
931
935
|
}
|
|
932
936
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: AnswerOLComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
933
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.7", type: AnswerOLComponent, isStandalone: true, selector: "tp-survey-answer-ol", inputs: { telephoneInput: { classPropertyName: "telephoneInput", publicName: "telephoneInput", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
937
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.7", type: AnswerOLComponent, isStandalone: true, selector: "tp-survey-answer-ol", inputs: { telephoneInput: { classPropertyName: "telephoneInput", publicName: "telephoneInput", isSignal: true, isRequired: false, transformFunction: null }, canSkip: { classPropertyName: "canSkip", publicName: "canSkip", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
934
938
|
{
|
|
935
939
|
provide: NG_VALUE_ACCESSOR,
|
|
936
940
|
useExisting: forwardRef(() => AnswerOLComponent),
|
|
937
941
|
multi: true
|
|
938
942
|
},
|
|
939
|
-
], usesInheritance: true, ngImport: i0, template: "<div class=\"container-main\">\r\n @if (telephoneInput()) {\r\n <mat-form-field appearance=\"outline\">\r\n <input\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n matInput\r\n [formControl]=\"control\" tpSurveyFocusAndSelect>\r\n <span matTextPrefix>+380 </span>\r\n </mat-form-field>\r\n } @else {\r\n <mat-form-field appearance=\"outline\" class=\"input-text\">\r\n <textarea rows=\"10\" matInput [formControl]=\"control\" tpSurveyFocusAndSelect></textarea>\r\n </mat-form-field>\r\n\r\n<!-- <mat-form-field class=\"container-controls\" appearance=\"outline\">-->\r\n<!-- <textarea rows=\"10\" autofocus matInput [(ngModel)]=\"answer.AnswerValue\" (ngModelChange)=\"answerChange()\" appFocusAndSelect></textarea>-->\r\n<!-- </mat-form-field>-->\r\n }\r\n\r\n<!-- <mat-form-field appearance=\"outline\" class=\"input-od-number\">-->\r\n<!-- <input [formControl]=\"control\" tpSurveyFocusAndSelect matInput type=\"number\">-->\r\n<!-- </mat-form-field>-->\r\n</div>\r\n", styles: [":host{width:100%}.container-main{display:flex;width:100%;justify-content:center;align-items:center;flex-flow:column;gap:2em;padding:0 2em;box-sizing:border-box}.input-text{width:100%}\n"], dependencies: [{ kind: "directive", type: FocusAndSelectDirective, selector: "[tpSurveyFocusAndSelect]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }] }); }
|
|
943
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"container-main\">\r\n @if (telephoneInput()) {\r\n <mat-form-field appearance=\"outline\">\r\n <input\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n matInput\r\n [formControl]=\"control\" tpSurveyFocusAndSelect>\r\n <span matTextPrefix>+380 </span>\r\n </mat-form-field>\r\n @if(canSkip()) {\r\n <button mat-button (click)=\"skipClick()\">\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u0438</button>\r\n }\r\n\r\n } @else {\r\n <mat-form-field appearance=\"outline\" class=\"input-text\">\r\n <textarea rows=\"10\" matInput [formControl]=\"control\" tpSurveyFocusAndSelect></textarea>\r\n </mat-form-field>\r\n\r\n<!-- <mat-form-field class=\"container-controls\" appearance=\"outline\">-->\r\n<!-- <textarea rows=\"10\" autofocus matInput [(ngModel)]=\"answer.AnswerValue\" (ngModelChange)=\"answerChange()\" appFocusAndSelect></textarea>-->\r\n<!-- </mat-form-field>-->\r\n }\r\n\r\n<!-- <mat-form-field appearance=\"outline\" class=\"input-od-number\">-->\r\n<!-- <input [formControl]=\"control\" tpSurveyFocusAndSelect matInput type=\"number\">-->\r\n<!-- </mat-form-field>-->\r\n</div>\r\n", styles: [":host{width:100%}.container-main{display:flex;width:100%;justify-content:center;align-items:center;flex-flow:column;gap:2em;padding:0 2em;box-sizing:border-box}.input-text{width:100%}\n"], dependencies: [{ kind: "directive", type: FocusAndSelectDirective, selector: "[tpSurveyFocusAndSelect]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
|
|
940
944
|
}
|
|
941
945
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: AnswerOLComponent, decorators: [{
|
|
942
946
|
type: Component,
|
|
@@ -946,14 +950,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
946
950
|
MatFormField,
|
|
947
951
|
MatInput,
|
|
948
952
|
ReactiveFormsModule,
|
|
949
|
-
MatPrefix
|
|
953
|
+
MatPrefix,
|
|
954
|
+
MatButton
|
|
950
955
|
], providers: [
|
|
951
956
|
{
|
|
952
957
|
provide: NG_VALUE_ACCESSOR,
|
|
953
958
|
useExisting: forwardRef(() => AnswerOLComponent),
|
|
954
959
|
multi: true
|
|
955
960
|
},
|
|
956
|
-
], template: "<div class=\"container-main\">\r\n @if (telephoneInput()) {\r\n <mat-form-field appearance=\"outline\">\r\n <input\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n matInput\r\n [formControl]=\"control\" tpSurveyFocusAndSelect>\r\n <span matTextPrefix>+380 </span>\r\n </mat-form-field>\r\n } @else {\r\n <mat-form-field appearance=\"outline\" class=\"input-text\">\r\n <textarea rows=\"10\" matInput [formControl]=\"control\" tpSurveyFocusAndSelect></textarea>\r\n </mat-form-field>\r\n\r\n<!-- <mat-form-field class=\"container-controls\" appearance=\"outline\">-->\r\n<!-- <textarea rows=\"10\" autofocus matInput [(ngModel)]=\"answer.AnswerValue\" (ngModelChange)=\"answerChange()\" appFocusAndSelect></textarea>-->\r\n<!-- </mat-form-field>-->\r\n }\r\n\r\n<!-- <mat-form-field appearance=\"outline\" class=\"input-od-number\">-->\r\n<!-- <input [formControl]=\"control\" tpSurveyFocusAndSelect matInput type=\"number\">-->\r\n<!-- </mat-form-field>-->\r\n</div>\r\n", styles: [":host{width:100%}.container-main{display:flex;width:100%;justify-content:center;align-items:center;flex-flow:column;gap:2em;padding:0 2em;box-sizing:border-box}.input-text{width:100%}\n"] }]
|
|
961
|
+
], template: "<div class=\"container-main\">\r\n @if (telephoneInput()) {\r\n <mat-form-field appearance=\"outline\">\r\n <input\r\n type=\"text\"\r\n inputmode=\"numeric\"\r\n matInput\r\n [formControl]=\"control\" tpSurveyFocusAndSelect>\r\n <span matTextPrefix>+380 </span>\r\n </mat-form-field>\r\n @if(canSkip()) {\r\n <button mat-button (click)=\"skipClick()\">\u041F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u0438</button>\r\n }\r\n\r\n } @else {\r\n <mat-form-field appearance=\"outline\" class=\"input-text\">\r\n <textarea rows=\"10\" matInput [formControl]=\"control\" tpSurveyFocusAndSelect></textarea>\r\n </mat-form-field>\r\n\r\n<!-- <mat-form-field class=\"container-controls\" appearance=\"outline\">-->\r\n<!-- <textarea rows=\"10\" autofocus matInput [(ngModel)]=\"answer.AnswerValue\" (ngModelChange)=\"answerChange()\" appFocusAndSelect></textarea>-->\r\n<!-- </mat-form-field>-->\r\n }\r\n\r\n<!-- <mat-form-field appearance=\"outline\" class=\"input-od-number\">-->\r\n<!-- <input [formControl]=\"control\" tpSurveyFocusAndSelect matInput type=\"number\">-->\r\n<!-- </mat-form-field>-->\r\n</div>\r\n", styles: [":host{width:100%}.container-main{display:flex;width:100%;justify-content:center;align-items:center;flex-flow:column;gap:2em;padding:0 2em;box-sizing:border-box}.input-text{width:100%}\n"] }]
|
|
957
962
|
}] });
|
|
958
963
|
|
|
959
964
|
class AsFormArrayPipe {
|
|
@@ -1277,7 +1282,7 @@ class ContainerAnswerComponent {
|
|
|
1277
1282
|
break;
|
|
1278
1283
|
}
|
|
1279
1284
|
case QuestionsType.eqOL: {
|
|
1280
|
-
this.answerForm.controls.answer.addValidators(answerOLValidator(question.OLTypeTel));
|
|
1285
|
+
this.answerForm.controls.answer.addValidators(answerOLValidator(question.OLTypeTel, question.CanSkip ?? false));
|
|
1281
1286
|
break;
|
|
1282
1287
|
}
|
|
1283
1288
|
case QuestionsType.eqSL: {
|
|
@@ -1459,7 +1464,7 @@ class ContainerAnswerComponent {
|
|
|
1459
1464
|
return resArray;
|
|
1460
1465
|
}
|
|
1461
1466
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ContainerAnswerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1462
|
-
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
|
|
1467
|
+
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 }); }
|
|
1463
1468
|
}
|
|
1464
1469
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ContainerAnswerComponent, decorators: [{
|
|
1465
1470
|
type: Component,
|
|
@@ -1477,7 +1482,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
1477
1482
|
GetAdditionalValueByValuePipe,
|
|
1478
1483
|
KeyValuesPipe,
|
|
1479
1484
|
AnswerLangComponent
|
|
1480
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, 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
|
|
1485
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
|
|
1481
1486
|
}], ctorParameters: () => [] });
|
|
1482
1487
|
|
|
1483
1488
|
class GetActiveLanguagePipe {
|
|
@@ -1751,10 +1756,12 @@ class TpSurveyCoreService {
|
|
|
1751
1756
|
this.#initiateQuestions(this.#questionary.Questions);
|
|
1752
1757
|
// Может быть 2 варианта запуска интервью, 1-новое интервью, 2-перезапуск старого интервью. В первом случае начало это lang или первый вопрос. Во втором, с последнего вопроса на который ответили.
|
|
1753
1758
|
let startQuestionNum = undefined;
|
|
1759
|
+
//загружаем старые логические переменные и переменные которые указали из вне.
|
|
1760
|
+
this.#fillOldLogic(logicVars ?? []);
|
|
1754
1761
|
//если загружаем ранее не законченное интервью, продолжаем с места последнего вопроса (случай номер 2)
|
|
1755
|
-
if (!!
|
|
1762
|
+
if (!!answerList && !!questionGuid) {
|
|
1756
1763
|
//загружаем старые логические переменные и ответы
|
|
1757
|
-
this.#fillOldInterviewData(
|
|
1764
|
+
this.#fillOldInterviewData(answerList);
|
|
1758
1765
|
//ищем номер вопроса, который был последний перед сохранением.
|
|
1759
1766
|
const questionLastSave = this.#findQuestionByGuid(questionGuid);
|
|
1760
1767
|
//Вопрос могли удалить, тогда начнем сначала.
|
|
@@ -1835,13 +1842,15 @@ class TpSurveyCoreService {
|
|
|
1835
1842
|
default: return '';
|
|
1836
1843
|
}
|
|
1837
1844
|
}
|
|
1838
|
-
#
|
|
1845
|
+
#fillOldLogic(logicVars) {
|
|
1839
1846
|
//пропишем старые логические переменные
|
|
1840
1847
|
if (Array.isArray(logicVars)) {
|
|
1841
1848
|
logicVars.forEach(logicVarObj => {
|
|
1842
1849
|
this._logic.setLogicValue(logicVarObj.nm, logicVarObj.vl);
|
|
1843
1850
|
});
|
|
1844
1851
|
}
|
|
1852
|
+
}
|
|
1853
|
+
#fillOldInterviewData(answerList) {
|
|
1845
1854
|
//пропишем старые ответы
|
|
1846
1855
|
this._interview.overrideAnswers(answerList);
|
|
1847
1856
|
//нужно вернуть время начала интервью, отдельно оно не сохраняется, поэтому возьмём минимальное время начала из ответов
|
|
@@ -1942,8 +1951,10 @@ class TpSurveyCoreService {
|
|
|
1942
1951
|
this.#eventBus.next({ key: SurveyEvents.seQuestionAnswersChange, data: { question: this.#currentQuestion.value, answerIsComplete: answer.answerIsComplete } });
|
|
1943
1952
|
//может возникнуть ситуация, когда нет ни одной альтернативы или секции для отображения.в этом случае вопрос показывать не нужно, как ответ записываем 0 и переходим на следующий
|
|
1944
1953
|
const question = this.#findQuestionByGuid(eventData.guid);
|
|
1945
|
-
//ситуация для ss/ms вопросов и для неявных вопросов
|
|
1946
|
-
|
|
1954
|
+
//ситуация когда можно сразу перейти на следующий вопрос для ss/ms вопросов и для неявных вопросов
|
|
1955
|
+
const canTransitionSSMS = (!!question && answer.answerIsComplete && (question.QuestionType === 'SS' || question.QuestionType === 'MS') && ((eventData.viewedAlternativeValues.length === 0) || question.Implicit));
|
|
1956
|
+
const canTransitionOl = ((!!question && question?.QuestionType === QuestionsType.eqOL && (question.CanSkip ?? true) && answer.AnswerValue === 'skip'));
|
|
1957
|
+
if (canTransitionSSMS || canTransitionOl) {
|
|
1947
1958
|
this.goToNextQuestion();
|
|
1948
1959
|
}
|
|
1949
1960
|
}
|