survery-lib 0.1.7 → 0.1.9
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/esm2022/lib/components/question-boolean-template/question-boolean-template.component.mjs +18 -17
- package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +21 -18
- package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +17 -16
- package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +31 -17
- package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +18 -17
- package/esm2022/lib/components/question-text-template/question-text-template.component.mjs +19 -18
- package/esm2022/lib/pipes/default-question-answer.pipe.mjs +2 -2
- package/esm2022/lib/pipes/default-question-answers.pipe.mjs +2 -2
- package/esm2022/lib/survery-lib.component.mjs +23 -11
- package/fesm2022/survery-lib.mjs +156 -130
- package/fesm2022/survery-lib.mjs.map +1 -1
- package/lib/components/question-boolean-template/question-boolean-template.component.d.ts +4 -4
- package/lib/components/question-check-box-template/question-check-box-template.component.d.ts +4 -4
- package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +4 -4
- package/lib/components/question-matrix-template/question-matrix-template.component.d.ts +7 -6
- package/lib/components/question-radio-button-template/question-radio-button-template.component.d.ts +4 -4
- package/lib/components/question-text-template/question-text-template.component.d.ts +4 -4
- package/lib/pipes/default-question-answer.pipe.d.ts +1 -1
- package/lib/pipes/default-question-answers.pipe.d.ts +1 -1
- package/lib/survery-lib.component.d.ts +2 -0
- package/package.json +1 -1
package/fesm2022/survery-lib.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, EventEmitter, Component, Output, Input, Pipe, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
import { Subject, of, debounceTime, map, filter } from 'rxjs';
|
|
4
5
|
import * as i1 from '@ng-stack/forms';
|
|
5
6
|
import { NgsFormsModule } from '@ng-stack/forms';
|
|
6
|
-
import * as
|
|
7
|
+
import * as i3 from '@angular/common';
|
|
7
8
|
import { CommonModule } from '@angular/common';
|
|
8
|
-
import * as
|
|
9
|
+
import * as i4 from '@angular/forms';
|
|
9
10
|
import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
10
|
-
import { v4 } from 'uuid';
|
|
11
11
|
import { HttpClientModule } from '@angular/common/http';
|
|
12
12
|
|
|
13
13
|
var QuestionTypeEnum;
|
|
@@ -252,13 +252,9 @@ class QuestionTextTemplateComponent {
|
|
|
252
252
|
set isDisabled(value) {
|
|
253
253
|
this.toggleEnableAnswer(value);
|
|
254
254
|
}
|
|
255
|
-
|
|
256
|
-
if (defaultAnswer != null) {
|
|
257
|
-
this.fCtrls.answer.setValue(defaultAnswer.AnswerText);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
constructor(_formBuilder) {
|
|
255
|
+
constructor(_formBuilder, _surveyLibService) {
|
|
261
256
|
this._formBuilder = _formBuilder;
|
|
257
|
+
this._surveyLibService = _surveyLibService;
|
|
262
258
|
this.emitter = new EventEmitter();
|
|
263
259
|
this.isShow = true;
|
|
264
260
|
this.rForm = this._formBuilder.group({
|
|
@@ -270,7 +266,9 @@ class QuestionTextTemplateComponent {
|
|
|
270
266
|
surveyAnswerId: [null],
|
|
271
267
|
answer: [null]
|
|
272
268
|
});
|
|
273
|
-
|
|
269
|
+
}
|
|
270
|
+
ngOnInit() {
|
|
271
|
+
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
274
272
|
const formValue = this.rForm.value;
|
|
275
273
|
this.emitter.emit({
|
|
276
274
|
QuestionId: formValue.id,
|
|
@@ -279,8 +277,12 @@ class QuestionTextTemplateComponent {
|
|
|
279
277
|
SurveyAnswerId: formValue.surveyAnswerId
|
|
280
278
|
});
|
|
281
279
|
});
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
this.fCtrls.answer.setValue(null);
|
|
281
|
+
this._surveyLibService.surveyAnswersObsrv.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
282
|
+
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
283
|
+
.subscribe(answer => {
|
|
284
|
+
this.fCtrls.answer.setValue(answer.AnswerText);
|
|
285
|
+
});
|
|
284
286
|
}
|
|
285
287
|
convertToFormControl(element) {
|
|
286
288
|
return element;
|
|
@@ -294,13 +296,13 @@ class QuestionTextTemplateComponent {
|
|
|
294
296
|
}
|
|
295
297
|
this.fCtrls.answer.updateValueAndValidity();
|
|
296
298
|
}
|
|
297
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
298
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: { isShow: "isShow", isTextArea: "isTextArea", setQuestion: "setQuestion", isDisabled: "isDisabled"
|
|
299
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
300
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: { isShow: "isShow", isTextArea: "isTextArea", setQuestion: "setQuestion", isDisabled: "isDisabled" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\n [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <input class=\"form-control\" type=\"text\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n [disabled]=\"isDisabled\" *ngIf=\"isTextArea == false else textAreaTemplate\">\n <ng-template #textAreaTemplate>\n <textarea class=\"form-control\" rows=\"5\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n [disabled]=\"isDisabled\" ></textarea>\n </ng-template>\n </div>", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
|
299
301
|
}
|
|
300
302
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, decorators: [{
|
|
301
303
|
type: Component,
|
|
302
304
|
args: [{ selector: 'lib-question-text-template', template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\n [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <input class=\"form-control\" type=\"text\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n [disabled]=\"isDisabled\" *ngIf=\"isTextArea == false else textAreaTemplate\">\n <ng-template #textAreaTemplate>\n <textarea class=\"form-control\" rows=\"5\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n [disabled]=\"isDisabled\" ></textarea>\n </ng-template>\n </div>" }]
|
|
303
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
305
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
304
306
|
type: Output
|
|
305
307
|
}], isShow: [{
|
|
306
308
|
type: Input
|
|
@@ -310,8 +312,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
310
312
|
type: Input
|
|
311
313
|
}], isDisabled: [{
|
|
312
314
|
type: Input
|
|
313
|
-
}], setAnswer: [{
|
|
314
|
-
type: Input
|
|
315
315
|
}] } });
|
|
316
316
|
|
|
317
317
|
class QuestionRadioButtonTemplateComponent {
|
|
@@ -344,15 +344,9 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
344
344
|
this.isShow = value.isVisable;
|
|
345
345
|
this.isDisabled = value.isReadOnly;
|
|
346
346
|
}
|
|
347
|
-
|
|
348
|
-
if (defaultAnswer != null) {
|
|
349
|
-
this.fCtrls.answer.setValue(defaultAnswer.AnswerId);
|
|
350
|
-
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == defaultAnswer.AnswerId);
|
|
351
|
-
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
constructor(_formBuilder) {
|
|
347
|
+
constructor(_formBuilder, _surveyLibService) {
|
|
355
348
|
this._formBuilder = _formBuilder;
|
|
349
|
+
this._surveyLibService = _surveyLibService;
|
|
356
350
|
this.elemId = v4();
|
|
357
351
|
this.emitter = new EventEmitter();
|
|
358
352
|
this.isShow = true;
|
|
@@ -368,7 +362,8 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
368
362
|
});
|
|
369
363
|
}
|
|
370
364
|
ngOnInit() {
|
|
371
|
-
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(
|
|
365
|
+
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
366
|
+
console.log(value);
|
|
372
367
|
const formValue = this.rForm.value;
|
|
373
368
|
this.emitter.emit({
|
|
374
369
|
QuestionId: formValue.id,
|
|
@@ -377,6 +372,13 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
377
372
|
});
|
|
378
373
|
});
|
|
379
374
|
this.fCtrls.answer.setValue(null);
|
|
375
|
+
this._surveyLibService.surveyAnswersObsrv.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
376
|
+
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
377
|
+
.subscribe(answer => {
|
|
378
|
+
this.fCtrls.answer.setValue(answer.AnswerId);
|
|
379
|
+
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == answer.AnswerId);
|
|
380
|
+
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
381
|
+
});
|
|
380
382
|
}
|
|
381
383
|
onChangeAnswer(item) {
|
|
382
384
|
this.fCtrls.answer.setValue(item.id);
|
|
@@ -384,13 +386,13 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
384
386
|
convertToFormControl(element) {
|
|
385
387
|
return element;
|
|
386
388
|
}
|
|
387
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
388
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion"
|
|
389
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
390
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of fCtrls.answerArray.controls;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item.value)\" [disabled]=\"isDisabled\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" [checked]=\"item.value.isSelected == true? true : null\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.value.title}}</label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
389
391
|
}
|
|
390
392
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, decorators: [{
|
|
391
393
|
type: Component,
|
|
392
394
|
args: [{ selector: 'lib-question-radio-button-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of fCtrls.answerArray.controls;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item.value)\" [disabled]=\"isDisabled\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" [checked]=\"item.value.isSelected == true? true : null\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.value.title}}</label>\n </div>\n </div>\n</div>\n" }]
|
|
393
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
395
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
394
396
|
type: Output
|
|
395
397
|
}], isShow: [{
|
|
396
398
|
type: Input
|
|
@@ -398,8 +400,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
398
400
|
type: Input
|
|
399
401
|
}], setQuestion: [{
|
|
400
402
|
type: Input
|
|
401
|
-
}], setAnswer: [{
|
|
402
|
-
type: Input
|
|
403
403
|
}] } });
|
|
404
404
|
|
|
405
405
|
class QuestionCheckBoxTemplateComponent {
|
|
@@ -432,17 +432,9 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
432
432
|
this.isShow = value.isVisable;
|
|
433
433
|
this.isDisabled = value.isReadOnly;
|
|
434
434
|
}
|
|
435
|
-
|
|
436
|
-
if (defaultAnswer != null) {
|
|
437
|
-
this.fCtrls.answer.setValue(defaultAnswer.AnswerIdArr);
|
|
438
|
-
defaultAnswer.AnswerIdArr.forEach(answerId => {
|
|
439
|
-
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == defaultAnswer.AnswerId);
|
|
440
|
-
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
constructor(_formBuilder) {
|
|
435
|
+
constructor(_formBuilder, _surveyLibService) {
|
|
445
436
|
this._formBuilder = _formBuilder;
|
|
437
|
+
this._surveyLibService = _surveyLibService;
|
|
446
438
|
this.elemId = v4();
|
|
447
439
|
this.emitter = new EventEmitter();
|
|
448
440
|
this.isShow = true;
|
|
@@ -458,7 +450,7 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
458
450
|
});
|
|
459
451
|
}
|
|
460
452
|
ngOnInit() {
|
|
461
|
-
this.fCtrls.answer.valueChanges.subscribe(value => {
|
|
453
|
+
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
462
454
|
const formValue = this.rForm.value;
|
|
463
455
|
this.emitter.emit({
|
|
464
456
|
QuestionId: formValue.id,
|
|
@@ -467,6 +459,17 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
467
459
|
});
|
|
468
460
|
});
|
|
469
461
|
this.fCtrls.answer.setValue(null);
|
|
462
|
+
this._surveyLibService.surveyAnswersObsrv
|
|
463
|
+
.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
464
|
+
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
465
|
+
.subscribe(answer => {
|
|
466
|
+
const distinctArray = answer.AnswerIdArr.filter((n, i) => answer.AnswerIdArr.indexOf(n) === i);
|
|
467
|
+
this.fCtrls.answer.setValue(distinctArray);
|
|
468
|
+
answer.AnswerIdArr.forEach(answerId => {
|
|
469
|
+
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == answerId);
|
|
470
|
+
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
471
|
+
});
|
|
472
|
+
});
|
|
470
473
|
}
|
|
471
474
|
onChangeAnswer(item, event) {
|
|
472
475
|
var answerArr = this.fCtrls.answer.value || [];
|
|
@@ -482,13 +485,13 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
482
485
|
convertToFormControl(element) {
|
|
483
486
|
return element;
|
|
484
487
|
}
|
|
485
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
486
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion"
|
|
488
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
489
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n\n <div class=\"checkbox-button-quastion\">\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" [disabled]=\"isDisabled\"\n (change)=\"onChangeAnswer(item.value ,$event)\" [checked]=\"item.value.isSelected == true? true : null\">\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\">{{item.value.title}}</label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
487
490
|
}
|
|
488
491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, decorators: [{
|
|
489
492
|
type: Component,
|
|
490
493
|
args: [{ selector: 'lib-question-check-box-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n\n <div class=\"checkbox-button-quastion\">\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" [disabled]=\"isDisabled\"\n (change)=\"onChangeAnswer(item.value ,$event)\" [checked]=\"item.value.isSelected == true? true : null\">\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\">{{item.value.title}}</label>\n </div>\n </div>\n</div>\n" }]
|
|
491
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
494
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
492
495
|
type: Output
|
|
493
496
|
}], isShow: [{
|
|
494
497
|
type: Input
|
|
@@ -496,8 +499,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
496
499
|
type: Input
|
|
497
500
|
}], setQuestion: [{
|
|
498
501
|
type: Input
|
|
499
|
-
}], setAnswer: [{
|
|
500
|
-
type: Input
|
|
501
502
|
}] } });
|
|
502
503
|
|
|
503
504
|
class QuestionDropdownTemplateComponent {
|
|
@@ -523,13 +524,9 @@ class QuestionDropdownTemplateComponent {
|
|
|
523
524
|
this.isShow = value.isVisable;
|
|
524
525
|
this.isDisabled = value.isReadOnly;
|
|
525
526
|
}
|
|
526
|
-
|
|
527
|
-
if (defaultAnswer != null) {
|
|
528
|
-
this.fCtrls.answer.setValue(defaultAnswer.AnswerId);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
constructor(_formBuilder) {
|
|
527
|
+
constructor(_formBuilder, _surveyLibService) {
|
|
532
528
|
this._formBuilder = _formBuilder;
|
|
529
|
+
this._surveyLibService = _surveyLibService;
|
|
533
530
|
this.emitter = new EventEmitter();
|
|
534
531
|
this.isShow = true;
|
|
535
532
|
this.isDisabled = false;
|
|
@@ -543,7 +540,7 @@ class QuestionDropdownTemplateComponent {
|
|
|
543
540
|
});
|
|
544
541
|
}
|
|
545
542
|
ngOnInit() {
|
|
546
|
-
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(
|
|
543
|
+
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
547
544
|
const formValue = this.rForm.value;
|
|
548
545
|
this.emitter.emit({
|
|
549
546
|
QuestionId: formValue.id,
|
|
@@ -552,17 +549,23 @@ class QuestionDropdownTemplateComponent {
|
|
|
552
549
|
});
|
|
553
550
|
});
|
|
554
551
|
this.fCtrls.answer.setValue(null);
|
|
552
|
+
this._surveyLibService.surveyAnswersObsrv
|
|
553
|
+
.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
554
|
+
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
555
|
+
.subscribe(answer => {
|
|
556
|
+
this.fCtrls.answer.setValue(answer.AnswerId);
|
|
557
|
+
});
|
|
555
558
|
}
|
|
556
559
|
convertToFormControl(element) {
|
|
557
560
|
return element;
|
|
558
561
|
}
|
|
559
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
560
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion"
|
|
562
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
563
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <select class=\"form-control\" [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\">\n <option *ngFor=\"let item of surveyQuestion?.surveyAnswers\" [value]=\"item.answerId\">{{item.answerTitle}}</option>\n </select>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
561
564
|
}
|
|
562
565
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, decorators: [{
|
|
563
566
|
type: Component,
|
|
564
567
|
args: [{ selector: 'lib-question-dropdown-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <select class=\"form-control\" [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\">\n <option *ngFor=\"let item of surveyQuestion?.surveyAnswers\" [value]=\"item.answerId\">{{item.answerTitle}}</option>\n </select>\n </div>\n</div>\n" }]
|
|
565
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
568
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
566
569
|
type: Output
|
|
567
570
|
}], isShow: [{
|
|
568
571
|
type: Input
|
|
@@ -570,8 +573,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
570
573
|
type: Input
|
|
571
574
|
}], setQuestion: [{
|
|
572
575
|
type: Input
|
|
573
|
-
}], setAnswer: [{
|
|
574
|
-
type: Input
|
|
575
576
|
}] } });
|
|
576
577
|
|
|
577
578
|
class QuestionMatrixTemplateComponent {
|
|
@@ -597,21 +598,22 @@ class QuestionMatrixTemplateComponent {
|
|
|
597
598
|
group.controls.answer.addValidators([Validators.required]);
|
|
598
599
|
group.controls.answer.updateValueAndValidity();
|
|
599
600
|
}
|
|
601
|
+
group.controls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
602
|
+
const formValue = this.rForm.value;
|
|
603
|
+
this.emitter.emit({
|
|
604
|
+
QuestionId: group.value.subQuestionId,
|
|
605
|
+
Answer: group.value.answer,
|
|
606
|
+
IsValid: group.controls.answer.valid
|
|
607
|
+
});
|
|
608
|
+
});
|
|
600
609
|
this.fCtrls.subQuestionArray.push(group);
|
|
601
610
|
});
|
|
602
611
|
this.isShow = value.isVisable;
|
|
603
612
|
this.isDisabled = value.isReadOnly;
|
|
604
613
|
}
|
|
605
|
-
|
|
606
|
-
this.fCtrls.subQuestionArray.controls.forEach(group => {
|
|
607
|
-
var answer = defaultAnswerArr.find(x => x.QuestionId == group.value.subQuestionId);
|
|
608
|
-
if (answer != null) {
|
|
609
|
-
group.controls.answer.setValue(answer.AnswerId);
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
constructor(_formBuilder) {
|
|
614
|
+
constructor(_formBuilder, _surveyLibService) {
|
|
614
615
|
this._formBuilder = _formBuilder;
|
|
616
|
+
this._surveyLibService = _surveyLibService;
|
|
615
617
|
this.elemId = v4();
|
|
616
618
|
this.emitter = new EventEmitter();
|
|
617
619
|
this.isShow = true;
|
|
@@ -622,6 +624,19 @@ class QuestionMatrixTemplateComponent {
|
|
|
622
624
|
subQuestionArray: this._formBuilder.array([])
|
|
623
625
|
});
|
|
624
626
|
}
|
|
627
|
+
ngOnInit() {
|
|
628
|
+
this._surveyLibService.surveyAnswersObsrv
|
|
629
|
+
.pipe(map(x => x.defaultAnswers.filter(x => x.ParentQuestionId == this.fCtrls.id.value)))
|
|
630
|
+
.pipe(filter(x => x.length > 0))
|
|
631
|
+
.subscribe(answers => {
|
|
632
|
+
this.fCtrls.subQuestionArray.controls.forEach(group => {
|
|
633
|
+
var answer = answers.find(x => x.QuestionId == group.value.subQuestionId);
|
|
634
|
+
if (answer != null) {
|
|
635
|
+
group.controls.answer.setValue(answer.AnswerId);
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
}
|
|
625
640
|
onChangeAnswer(question, answer) {
|
|
626
641
|
const index = this.fCtrls.subQuestionArray.value.findIndex(x => x.subQuestionId == question.subQuestionId);
|
|
627
642
|
var subQuestionGroup = this.fCtrls.subQuestionArray.controls[index];
|
|
@@ -635,13 +650,13 @@ class QuestionMatrixTemplateComponent {
|
|
|
635
650
|
convertToFormControl(element) {
|
|
636
651
|
return element;
|
|
637
652
|
}
|
|
638
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
639
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion"
|
|
653
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
654
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" style=\" border-collapse: collapse;\"\n[ngClass]=\"{'d-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{surveyQuestion?.questionTitle}}\n </h3>\n <div class=\"matrix-question\" [formGroup]=\"rForm\">\n <div class=\"matrix-table\" formArrayName=\"subQuestionArray\">\n <div class=\"matrix-head-row\">\n <div class=\"matrix-col\">\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answers of surveyQuestion?.surveyAnswers\">\n {{answers.answerTitle}}\n </div>\n </div>\n\n <div class=\"matrix-row\"\n *ngFor=\"let questionGroup of fCtrls.subQuestionArray.controls ;let subQuestionIndex = index\"\n [ngClass]=\"{'invalid-question': questionGroup.controls.answer.invalid}\">\n <div class=\"matrix-col matrix-sub-quastion\">\n {{questionGroup.value.questionTitle}}\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answer of surveyQuestion?.surveyAnswers;let answerIndex = index\">\n <div class=\"form-check form-check-radio form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" name=\"{{elemId}}__radio-btn-option_{{subQuestionIndex}}\"\n id=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\" (change)=\"onChangeAnswer(questionGroup.value ,answer)\"\n value=\"{{answer.answerId}}\" [checked]=\"answer.answerId == questionGroup.value.answer\">\n <label class=\"form-check-label d-md-inline d-lg-none\"\n for=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\"> {{answer.answerTitle}}</label>\n </div>\n </div>\n </div>\n\n </div>\n\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] }); }
|
|
640
655
|
}
|
|
641
656
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, decorators: [{
|
|
642
657
|
type: Component,
|
|
643
658
|
args: [{ selector: 'lib-question-matrix-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" style=\" border-collapse: collapse;\"\n[ngClass]=\"{'d-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{surveyQuestion?.questionTitle}}\n </h3>\n <div class=\"matrix-question\" [formGroup]=\"rForm\">\n <div class=\"matrix-table\" formArrayName=\"subQuestionArray\">\n <div class=\"matrix-head-row\">\n <div class=\"matrix-col\">\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answers of surveyQuestion?.surveyAnswers\">\n {{answers.answerTitle}}\n </div>\n </div>\n\n <div class=\"matrix-row\"\n *ngFor=\"let questionGroup of fCtrls.subQuestionArray.controls ;let subQuestionIndex = index\"\n [ngClass]=\"{'invalid-question': questionGroup.controls.answer.invalid}\">\n <div class=\"matrix-col matrix-sub-quastion\">\n {{questionGroup.value.questionTitle}}\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answer of surveyQuestion?.surveyAnswers;let answerIndex = index\">\n <div class=\"form-check form-check-radio form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" name=\"{{elemId}}__radio-btn-option_{{subQuestionIndex}}\"\n id=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\" (change)=\"onChangeAnswer(questionGroup.value ,answer)\"\n value=\"{{answer.answerId}}\" [checked]=\"answer.answerId == questionGroup.value.answer\">\n <label class=\"form-check-label d-md-inline d-lg-none\"\n for=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\"> {{answer.answerTitle}}</label>\n </div>\n </div>\n </div>\n\n </div>\n\n </div>\n</div>" }]
|
|
644
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
659
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
645
660
|
type: Output
|
|
646
661
|
}], isShow: [{
|
|
647
662
|
type: Input
|
|
@@ -649,8 +664,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
649
664
|
type: Input
|
|
650
665
|
}], setQuestion: [{
|
|
651
666
|
type: Input
|
|
652
|
-
}], setAnswers: [{
|
|
653
|
-
type: Input
|
|
654
667
|
}] } });
|
|
655
668
|
|
|
656
669
|
class QuestionBooleanTemplateComponent {
|
|
@@ -683,15 +696,9 @@ class QuestionBooleanTemplateComponent {
|
|
|
683
696
|
this.isShow = value.isVisable;
|
|
684
697
|
this.isDisabled = value.isReadOnly;
|
|
685
698
|
}
|
|
686
|
-
|
|
687
|
-
if (defaultAnswer != null) {
|
|
688
|
-
this.fCtrls.answer.setValue(defaultAnswer.AnswerId);
|
|
689
|
-
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == defaultAnswer.AnswerId);
|
|
690
|
-
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
constructor(_formBuilder) {
|
|
699
|
+
constructor(_formBuilder, _surveyLibService) {
|
|
694
700
|
this._formBuilder = _formBuilder;
|
|
701
|
+
this._surveyLibService = _surveyLibService;
|
|
695
702
|
this.elemId = v4();
|
|
696
703
|
this.emitter = new EventEmitter();
|
|
697
704
|
this.isShow = true;
|
|
@@ -707,7 +714,7 @@ class QuestionBooleanTemplateComponent {
|
|
|
707
714
|
});
|
|
708
715
|
}
|
|
709
716
|
ngOnInit() {
|
|
710
|
-
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(
|
|
717
|
+
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
711
718
|
const formValue = this.rForm.value;
|
|
712
719
|
this.emitter.emit({
|
|
713
720
|
QuestionId: formValue.id,
|
|
@@ -716,6 +723,14 @@ class QuestionBooleanTemplateComponent {
|
|
|
716
723
|
});
|
|
717
724
|
});
|
|
718
725
|
this.fCtrls.answer.setValue(null);
|
|
726
|
+
this._surveyLibService.surveyAnswersObsrv
|
|
727
|
+
.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
728
|
+
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
729
|
+
.subscribe(answer => {
|
|
730
|
+
this.fCtrls.answer.setValue(answer.AnswerId);
|
|
731
|
+
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == answer.AnswerId);
|
|
732
|
+
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
733
|
+
});
|
|
719
734
|
}
|
|
720
735
|
onChangeAnswer(item) {
|
|
721
736
|
this.fCtrls.answer.setValue(item.id);
|
|
@@ -723,13 +738,13 @@ class QuestionBooleanTemplateComponent {
|
|
|
723
738
|
convertToFormControl(element) {
|
|
724
739
|
return element;
|
|
725
740
|
}
|
|
726
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
727
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion"
|
|
741
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
742
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item.value)\" [disabled]=\"isDisabled\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" [checked]=\"item.value.isSelected == true? true : null\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.value.title}}</label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
728
743
|
}
|
|
729
744
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, decorators: [{
|
|
730
745
|
type: Component,
|
|
731
746
|
args: [{ selector: 'lib-question-boolean-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item.value)\" [disabled]=\"isDisabled\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" [checked]=\"item.value.isSelected == true? true : null\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.value.title}}</label>\n </div>\n </div>\n</div>\n" }]
|
|
732
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
747
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
733
748
|
type: Output
|
|
734
749
|
}], isShow: [{
|
|
735
750
|
type: Input
|
|
@@ -737,8 +752,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
737
752
|
type: Input
|
|
738
753
|
}], setQuestion: [{
|
|
739
754
|
type: Input
|
|
740
|
-
}], setAnswer: [{
|
|
741
|
-
type: Input
|
|
742
755
|
}] } });
|
|
743
756
|
|
|
744
757
|
class FilterQuestionPipe {
|
|
@@ -755,40 +768,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
755
768
|
}]
|
|
756
769
|
}] });
|
|
757
770
|
|
|
758
|
-
class DefaultQuestionAnswerPipe {
|
|
759
|
-
transform(value, questionId) {
|
|
760
|
-
if (value != null) {
|
|
761
|
-
return value.find(x => x.QuestionId == questionId);
|
|
762
|
-
}
|
|
763
|
-
return null;
|
|
764
|
-
}
|
|
765
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
766
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, name: "defaultQuestionAnswer" }); }
|
|
767
|
-
}
|
|
768
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, decorators: [{
|
|
769
|
-
type: Pipe,
|
|
770
|
-
args: [{
|
|
771
|
-
name: 'defaultQuestionAnswer'
|
|
772
|
-
}]
|
|
773
|
-
}] });
|
|
774
|
-
|
|
775
|
-
class DefaultQuestionAnswersPipe {
|
|
776
|
-
transform(value, questionId) {
|
|
777
|
-
if (value != null) {
|
|
778
|
-
return value.filter(x => x.ParentQuestionId == questionId);
|
|
779
|
-
}
|
|
780
|
-
return [];
|
|
781
|
-
}
|
|
782
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
783
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, name: "defaultQuestionAnswers" }); }
|
|
784
|
-
}
|
|
785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, decorators: [{
|
|
786
|
-
type: Pipe,
|
|
787
|
-
args: [{
|
|
788
|
-
name: 'defaultQuestionAnswers'
|
|
789
|
-
}]
|
|
790
|
-
}] });
|
|
791
|
-
|
|
792
771
|
class SurveryLibComponent {
|
|
793
772
|
get fCtrls() {
|
|
794
773
|
return this.rForm.controls;
|
|
@@ -796,6 +775,9 @@ class SurveryLibComponent {
|
|
|
796
775
|
get questionTypeEnum() {
|
|
797
776
|
return QuestionTypeEnum;
|
|
798
777
|
}
|
|
778
|
+
get isFirstPage() {
|
|
779
|
+
return this.fCtrls.currentPageIndex.value == 0;
|
|
780
|
+
}
|
|
799
781
|
get isLastPage() {
|
|
800
782
|
return this.fCtrls.currentPageIndex.value == (this.surveyData?.surveyPages.length - 1);
|
|
801
783
|
}
|
|
@@ -818,6 +800,7 @@ class SurveryLibComponent {
|
|
|
818
800
|
this._surveyLibService = _surveyLibService;
|
|
819
801
|
this._formBuilder = _formBuilder;
|
|
820
802
|
this._checkRuleExpsUsecase = _checkRuleExpsUsecase;
|
|
803
|
+
this.reloadDefaultAnswerId = v4();
|
|
821
804
|
this.surveyResultEmit = new EventEmitter();
|
|
822
805
|
this.rForm = this._formBuilder.group({
|
|
823
806
|
currentPageIndex: [0],
|
|
@@ -827,17 +810,23 @@ class SurveryLibComponent {
|
|
|
827
810
|
}
|
|
828
811
|
ngOnInit() {
|
|
829
812
|
this._surveyLibService.surveyDataObsrv.subscribe(survey => {
|
|
830
|
-
this.
|
|
813
|
+
this.fCtrls.questionArray.clear();
|
|
814
|
+
this.fCtrls.ruleQuestionArray.clear();
|
|
815
|
+
this.surveyData = null;
|
|
831
816
|
if (survey != null) {
|
|
817
|
+
this.surveyData = survey;
|
|
832
818
|
this.loadQuestions(survey);
|
|
833
819
|
}
|
|
834
|
-
else {
|
|
835
|
-
this.fCtrls.questionArray.clear();
|
|
836
|
-
}
|
|
837
820
|
});
|
|
838
821
|
this._surveyLibService.surveyAnswersObsrv.subscribe(value => {
|
|
839
|
-
this.defaultAnswers =
|
|
840
|
-
|
|
822
|
+
this.defaultAnswers = [];
|
|
823
|
+
if (value != null) {
|
|
824
|
+
this.defaultAnswers = [...value.defaultAnswers];
|
|
825
|
+
this.fCtrls.currentPageIndex.setValue(value.currentpage);
|
|
826
|
+
}
|
|
827
|
+
console.log(this.reloadDefaultAnswerId);
|
|
828
|
+
this.reloadDefaultAnswerId = v4();
|
|
829
|
+
console.log(this.reloadDefaultAnswerId);
|
|
841
830
|
});
|
|
842
831
|
}
|
|
843
832
|
onPaggingNext() {
|
|
@@ -978,6 +967,9 @@ class SurveryLibComponent {
|
|
|
978
967
|
if (invalidRecords.length > 0) {
|
|
979
968
|
$(`#survey-page_${currentPageIndex}`).addClass('survey-page_submitted');
|
|
980
969
|
}
|
|
970
|
+
if (invalidRecords.length > 0) {
|
|
971
|
+
console.log(invalidRecords);
|
|
972
|
+
}
|
|
981
973
|
return invalidRecords.length > 0;
|
|
982
974
|
}
|
|
983
975
|
checkRules() {
|
|
@@ -1021,15 +1013,49 @@ class SurveryLibComponent {
|
|
|
1021
1013
|
});
|
|
1022
1014
|
}
|
|
1023
1015
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, deps: [{ token: SurveyLibService }, { token: i1.FormBuilder }, { token: CheckRuleExpsUsecase }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1024
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", outputs: { surveyResultEmit: "surveyResultEmit" }, ngImport: i0, template: "<div class=\"survay-card\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\" [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"
|
|
1016
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", outputs: { surveyResultEmit: "surveyResultEmit" }, ngImport: i0, template: "<div class=\"survay-card\" *ngIf=\"surveyData != null\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\" [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\" ></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-dropdown-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-matrix-template>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"survay-card-footr\" *ngIf=\"surveyData != null\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\" >\r\n <span>{{fCtrls.currentPageIndex.value + 1}}</span>\r\n <span class=\"ms-2 me-2\">of</span>\r\n <span>{{surveyData.surveyPages.length}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isShow", "isTextArea", "setQuestion", "isDisabled"], outputs: ["emitter"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
|
|
1025
1017
|
}
|
|
1026
1018
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
|
|
1027
1019
|
type: Component,
|
|
1028
|
-
args: [{ selector: 'lib-survery-lib', template: "<div class=\"survay-card\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\" [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"
|
|
1020
|
+
args: [{ selector: 'lib-survery-lib', template: "<div class=\"survay-card\" *ngIf=\"surveyData != null\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\" [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\" ></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-dropdown-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\" ></lib-question-matrix-template>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"survay-card-footr\" *ngIf=\"surveyData != null\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\" >\r\n <span>{{fCtrls.currentPageIndex.value + 1}}</span>\r\n <span class=\"ms-2 me-2\">of</span>\r\n <span>{{surveyData.surveyPages.length}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}\n"] }]
|
|
1029
1021
|
}], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { surveyResultEmit: [{
|
|
1030
1022
|
type: Output
|
|
1031
1023
|
}] } });
|
|
1032
1024
|
|
|
1025
|
+
class DefaultQuestionAnswerPipe {
|
|
1026
|
+
transform(value, questionId, reloadId) {
|
|
1027
|
+
if (value != null) {
|
|
1028
|
+
return value.find(x => x.QuestionId == questionId);
|
|
1029
|
+
}
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|
|
1032
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1033
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, name: "defaultQuestionAnswer" }); }
|
|
1034
|
+
}
|
|
1035
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, decorators: [{
|
|
1036
|
+
type: Pipe,
|
|
1037
|
+
args: [{
|
|
1038
|
+
name: 'defaultQuestionAnswer'
|
|
1039
|
+
}]
|
|
1040
|
+
}] });
|
|
1041
|
+
|
|
1042
|
+
class DefaultQuestionAnswersPipe {
|
|
1043
|
+
transform(value, questionId, reloadId) {
|
|
1044
|
+
if (value != null) {
|
|
1045
|
+
return value.filter(x => x.ParentQuestionId == questionId);
|
|
1046
|
+
}
|
|
1047
|
+
return [];
|
|
1048
|
+
}
|
|
1049
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1050
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, name: "defaultQuestionAnswers" }); }
|
|
1051
|
+
}
|
|
1052
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, decorators: [{
|
|
1053
|
+
type: Pipe,
|
|
1054
|
+
args: [{
|
|
1055
|
+
name: 'defaultQuestionAnswers'
|
|
1056
|
+
}]
|
|
1057
|
+
}] });
|
|
1058
|
+
|
|
1033
1059
|
class SurveryLibModule {
|
|
1034
1060
|
static forRoot() {
|
|
1035
1061
|
return {
|