survery-lib 0.1.4 → 0.1.6
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 +23 -6
- package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +25 -6
- package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +9 -2
- package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +20 -12
- package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +22 -5
- package/esm2022/lib/components/question-text-template/question-text-template.component.mjs +15 -8
- package/esm2022/lib/pipes/default-question-answer.pipe.mjs +19 -0
- package/esm2022/lib/pipes/default-question-answers.pipe.mjs +19 -0
- package/esm2022/lib/services/survey-lib.service.mjs +8 -1
- package/esm2022/lib/survery-lib.component.mjs +25 -3
- package/esm2022/lib/survery-lib.module.mjs +9 -3
- package/esm2022/shared/dtos/default-question-answers.dto.mjs +3 -0
- package/esm2022/shared/dtos/survey-answers-subject.dto.mjs +3 -0
- package/esm2022/shared/form-interfaces/question-boolean-template.form-interface.mjs +1 -1
- package/esm2022/shared/form-interfaces/question-check-box-template.form-interface.mjs +1 -1
- package/esm2022/shared/form-interfaces/question-dropdown-template.form-interface.mjs +1 -1
- package/esm2022/shared/form-interfaces/question-matrix-template.form-interface.mjs +1 -1
- package/esm2022/shared/form-interfaces/question-radio-button-template.form-interface.mjs +1 -1
- package/esm2022/shared/models/survery-question-result.model.mjs +1 -1
- package/fesm2022/survery-lib.mjs +177 -37
- package/fesm2022/survery-lib.mjs.map +1 -1
- package/lib/components/question-boolean-template/question-boolean-template.component.d.ts +6 -4
- package/lib/components/question-check-box-template/question-check-box-template.component.d.ts +7 -4
- package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +3 -1
- package/lib/components/question-matrix-template/question-matrix-template.component.d.ts +4 -2
- package/lib/components/question-radio-button-template/question-radio-button-template.component.d.ts +6 -4
- package/lib/components/question-text-template/question-text-template.component.d.ts +3 -1
- package/lib/pipes/default-question-answer.pipe.d.ts +8 -0
- package/lib/pipes/default-question-answers.pipe.d.ts +8 -0
- package/lib/services/survey-lib.service.d.ts +4 -0
- package/lib/survery-lib.component.d.ts +6 -0
- package/lib/survery-lib.module.d.ts +7 -5
- package/package.json +1 -1
- package/shared/dtos/default-question-answers.dto.d.ts +9 -0
- package/shared/dtos/survey-answers-subject.dto.d.ts +5 -0
- package/shared/form-interfaces/question-boolean-template.form-interface.d.ts +6 -0
- package/shared/form-interfaces/question-check-box-template.form-interface.d.ts +6 -0
- package/shared/form-interfaces/question-radio-button-template.form-interface.d.ts +6 -0
- package/shared/models/survery-question-result.model.d.ts +1 -0
package/fesm2022/survery-lib.mjs
CHANGED
|
@@ -33,12 +33,19 @@ class SurveyLibService {
|
|
|
33
33
|
get surveyDataObsrv() {
|
|
34
34
|
return this.surveyDataSubject.asObservable();
|
|
35
35
|
}
|
|
36
|
+
get surveyAnswersObsrv() {
|
|
37
|
+
return this.surveyAnswersSubject.asObservable();
|
|
38
|
+
}
|
|
36
39
|
constructor() {
|
|
37
40
|
this.surveyDataSubject = new Subject();
|
|
41
|
+
this.surveyAnswersSubject = new Subject();
|
|
38
42
|
}
|
|
39
43
|
setSurveyData(survey) {
|
|
40
44
|
this.surveyDataSubject.next(survey);
|
|
41
45
|
}
|
|
46
|
+
setsurveyAnswers(model) {
|
|
47
|
+
this.surveyAnswersSubject.next(model);
|
|
48
|
+
}
|
|
42
49
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
43
50
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, providedIn: 'root' }); }
|
|
44
51
|
}
|
|
@@ -232,9 +239,9 @@ class QuestionTextTemplateComponent {
|
|
|
232
239
|
typeId: value.questionTypeId,
|
|
233
240
|
description: value.questionDescription
|
|
234
241
|
});
|
|
235
|
-
if (value.surveyAnswers[0]?.answerId != null && value.surveyAnswers[0]?.answerId != undefined) {
|
|
236
|
-
|
|
237
|
-
}
|
|
242
|
+
// if (value.surveyAnswers[0]?.answerId != null && value.surveyAnswers[0]?.answerId != undefined) {
|
|
243
|
+
// this.fCtrls.surveyAnswerId.setValue(value.surveyAnswers[0].answerId);
|
|
244
|
+
// }
|
|
238
245
|
if (value.isRequired == true) {
|
|
239
246
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
240
247
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -245,6 +252,12 @@ class QuestionTextTemplateComponent {
|
|
|
245
252
|
set isDisabled(value) {
|
|
246
253
|
this.toggleEnableAnswer(value);
|
|
247
254
|
}
|
|
255
|
+
set setAnswer(defaultAnswer) {
|
|
256
|
+
if (defaultAnswer != null) {
|
|
257
|
+
this.fCtrls.answer.setValue(defaultAnswer.AnswerText);
|
|
258
|
+
console.log(this.fCtrls.answer.value);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
248
261
|
constructor(_formBuilder) {
|
|
249
262
|
this._formBuilder = _formBuilder;
|
|
250
263
|
this.emitter = new EventEmitter();
|
|
@@ -258,8 +271,6 @@ class QuestionTextTemplateComponent {
|
|
|
258
271
|
surveyAnswerId: [null],
|
|
259
272
|
answer: [null]
|
|
260
273
|
});
|
|
261
|
-
}
|
|
262
|
-
ngOnInit() {
|
|
263
274
|
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
|
|
264
275
|
const formValue = this.rForm.value;
|
|
265
276
|
this.emitter.emit({
|
|
@@ -269,7 +280,8 @@ class QuestionTextTemplateComponent {
|
|
|
269
280
|
SurveyAnswerId: formValue.surveyAnswerId
|
|
270
281
|
});
|
|
271
282
|
});
|
|
272
|
-
|
|
283
|
+
}
|
|
284
|
+
ngOnInit() {
|
|
273
285
|
}
|
|
274
286
|
convertToFormControl(element) {
|
|
275
287
|
return element;
|
|
@@ -284,7 +296,7 @@ class QuestionTextTemplateComponent {
|
|
|
284
296
|
this.fCtrls.answer.updateValueAndValidity();
|
|
285
297
|
}
|
|
286
298
|
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 }); }
|
|
287
|
-
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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
|
299
|
+
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", setAnswer: "setAnswer" }, 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
|
288
300
|
}
|
|
289
301
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, decorators: [{
|
|
290
302
|
type: Component,
|
|
@@ -299,6 +311,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
299
311
|
type: Input
|
|
300
312
|
}], isDisabled: [{
|
|
301
313
|
type: Input
|
|
314
|
+
}], setAnswer: [{
|
|
315
|
+
type: Input
|
|
302
316
|
}] } });
|
|
303
317
|
|
|
304
318
|
class QuestionRadioButtonTemplateComponent {
|
|
@@ -317,6 +331,13 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
317
331
|
typeId: value.questionTypeId,
|
|
318
332
|
description: value.questionDescription
|
|
319
333
|
});
|
|
334
|
+
value.surveyAnswers.forEach(surveryAnswer => {
|
|
335
|
+
this.fCtrls.answerArray.push(this._formBuilder.group({
|
|
336
|
+
id: [surveryAnswer.answerId],
|
|
337
|
+
title: [surveryAnswer.answerTitle],
|
|
338
|
+
isSelected: [false]
|
|
339
|
+
}));
|
|
340
|
+
});
|
|
320
341
|
if (value.isRequired == true) {
|
|
321
342
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
322
343
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -324,6 +345,13 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
324
345
|
this.isShow = value.isVisable;
|
|
325
346
|
this.isDisabled = value.isReadOnly;
|
|
326
347
|
}
|
|
348
|
+
set setAnswer(defaultAnswer) {
|
|
349
|
+
if (defaultAnswer != null) {
|
|
350
|
+
this.fCtrls.answer.setValue(defaultAnswer.AnswerId);
|
|
351
|
+
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == defaultAnswer.AnswerId);
|
|
352
|
+
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
327
355
|
constructor(_formBuilder) {
|
|
328
356
|
this._formBuilder = _formBuilder;
|
|
329
357
|
this.elemId = v4();
|
|
@@ -336,7 +364,8 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
336
364
|
title: [null],
|
|
337
365
|
typeId: [null],
|
|
338
366
|
description: [null],
|
|
339
|
-
answer: [null]
|
|
367
|
+
answer: [null],
|
|
368
|
+
answerArray: this._formBuilder.array([])
|
|
340
369
|
});
|
|
341
370
|
}
|
|
342
371
|
ngOnInit() {
|
|
@@ -351,17 +380,17 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
351
380
|
this.fCtrls.answer.setValue(null);
|
|
352
381
|
}
|
|
353
382
|
onChangeAnswer(item) {
|
|
354
|
-
this.fCtrls.answer.setValue(item.
|
|
383
|
+
this.fCtrls.answer.setValue(item.id);
|
|
355
384
|
}
|
|
356
385
|
convertToFormControl(element) {
|
|
357
386
|
return element;
|
|
358
387
|
}
|
|
359
388
|
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 }); }
|
|
360
|
-
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
|
|
389
|
+
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", setAnswer: "setAnswer" }, 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
361
390
|
}
|
|
362
391
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, decorators: [{
|
|
363
392
|
type: Component,
|
|
364
|
-
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
|
|
393
|
+
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" }]
|
|
365
394
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
366
395
|
type: Output
|
|
367
396
|
}], isShow: [{
|
|
@@ -370,6 +399,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
370
399
|
type: Input
|
|
371
400
|
}], setQuestion: [{
|
|
372
401
|
type: Input
|
|
402
|
+
}], setAnswer: [{
|
|
403
|
+
type: Input
|
|
373
404
|
}] } });
|
|
374
405
|
|
|
375
406
|
class QuestionCheckBoxTemplateComponent {
|
|
@@ -388,6 +419,13 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
388
419
|
typeId: value.questionTypeId,
|
|
389
420
|
description: value.questionDescription
|
|
390
421
|
});
|
|
422
|
+
value.surveyAnswers.forEach(surveryAnswer => {
|
|
423
|
+
this.fCtrls.answerArray.push(this._formBuilder.group({
|
|
424
|
+
id: [surveryAnswer.answerId],
|
|
425
|
+
title: [surveryAnswer.answerTitle],
|
|
426
|
+
isSelected: [false]
|
|
427
|
+
}));
|
|
428
|
+
});
|
|
391
429
|
if (value.isRequired == true) {
|
|
392
430
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
393
431
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -395,6 +433,15 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
395
433
|
this.isShow = value.isVisable;
|
|
396
434
|
this.isDisabled = value.isReadOnly;
|
|
397
435
|
}
|
|
436
|
+
set setAnswer(defaultAnswer) {
|
|
437
|
+
if (defaultAnswer != null) {
|
|
438
|
+
this.fCtrls.answer.setValue(defaultAnswer.AnswerIdArr);
|
|
439
|
+
defaultAnswer.AnswerIdArr.forEach(answerId => {
|
|
440
|
+
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == defaultAnswer.AnswerId);
|
|
441
|
+
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
398
445
|
constructor(_formBuilder) {
|
|
399
446
|
this._formBuilder = _formBuilder;
|
|
400
447
|
this.elemId = v4();
|
|
@@ -407,7 +454,8 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
407
454
|
title: [null],
|
|
408
455
|
typeId: [null],
|
|
409
456
|
description: [null],
|
|
410
|
-
answer: [null]
|
|
457
|
+
answer: [null],
|
|
458
|
+
answerArray: this._formBuilder.array([])
|
|
411
459
|
});
|
|
412
460
|
}
|
|
413
461
|
ngOnInit() {
|
|
@@ -424,10 +472,10 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
424
472
|
onChangeAnswer(item, event) {
|
|
425
473
|
var answerArr = this.fCtrls.answer.value || [];
|
|
426
474
|
if (event.target.checked == true) {
|
|
427
|
-
answerArr.push(item.
|
|
475
|
+
answerArr.push(item.id);
|
|
428
476
|
}
|
|
429
477
|
else {
|
|
430
|
-
answerArr = answerArr.filter(x => x != item.
|
|
478
|
+
answerArr = answerArr.filter(x => x != item.id);
|
|
431
479
|
}
|
|
432
480
|
answerArr = answerArr.length == 0 ? [] : answerArr;
|
|
433
481
|
this.fCtrls.answer.setValue(answerArr);
|
|
@@ -436,11 +484,11 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
436
484
|
return element;
|
|
437
485
|
}
|
|
438
486
|
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 }); }
|
|
439
|
-
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
|
|
487
|
+
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", setAnswer: "setAnswer" }, 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
440
488
|
}
|
|
441
489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, decorators: [{
|
|
442
490
|
type: Component,
|
|
443
|
-
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
|
|
491
|
+
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" }]
|
|
444
492
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
445
493
|
type: Output
|
|
446
494
|
}], isShow: [{
|
|
@@ -449,6 +497,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
449
497
|
type: Input
|
|
450
498
|
}], setQuestion: [{
|
|
451
499
|
type: Input
|
|
500
|
+
}], setAnswer: [{
|
|
501
|
+
type: Input
|
|
452
502
|
}] } });
|
|
453
503
|
|
|
454
504
|
class QuestionDropdownTemplateComponent {
|
|
@@ -474,6 +524,11 @@ class QuestionDropdownTemplateComponent {
|
|
|
474
524
|
this.isShow = value.isVisable;
|
|
475
525
|
this.isDisabled = value.isReadOnly;
|
|
476
526
|
}
|
|
527
|
+
set setAnswer(defaultAnswer) {
|
|
528
|
+
if (defaultAnswer != null) {
|
|
529
|
+
this.fCtrls.answer.setValue(defaultAnswer.AnswerId);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
477
532
|
constructor(_formBuilder) {
|
|
478
533
|
this._formBuilder = _formBuilder;
|
|
479
534
|
this.emitter = new EventEmitter();
|
|
@@ -503,7 +558,7 @@ class QuestionDropdownTemplateComponent {
|
|
|
503
558
|
return element;
|
|
504
559
|
}
|
|
505
560
|
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 }); }
|
|
506
|
-
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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
561
|
+
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", setAnswer: "setAnswer" }, 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
507
562
|
}
|
|
508
563
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, decorators: [{
|
|
509
564
|
type: Component,
|
|
@@ -516,6 +571,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
516
571
|
type: Input
|
|
517
572
|
}], setQuestion: [{
|
|
518
573
|
type: Input
|
|
574
|
+
}], setAnswer: [{
|
|
575
|
+
type: Input
|
|
519
576
|
}] } });
|
|
520
577
|
|
|
521
578
|
class QuestionMatrixTemplateComponent {
|
|
@@ -535,7 +592,7 @@ class QuestionMatrixTemplateComponent {
|
|
|
535
592
|
var group = this._formBuilder.group({
|
|
536
593
|
subQuestionId: [x.questionId],
|
|
537
594
|
questionTitle: [x.questionTitle],
|
|
538
|
-
answer: [null]
|
|
595
|
+
answer: [null],
|
|
539
596
|
});
|
|
540
597
|
if (value.isRequired == true) {
|
|
541
598
|
group.controls.answer.addValidators([Validators.required]);
|
|
@@ -546,6 +603,14 @@ class QuestionMatrixTemplateComponent {
|
|
|
546
603
|
this.isShow = value.isVisable;
|
|
547
604
|
this.isDisabled = value.isReadOnly;
|
|
548
605
|
}
|
|
606
|
+
set setAnswers(defaultAnswerArr) {
|
|
607
|
+
this.fCtrls.subQuestionArray.controls.forEach(group => {
|
|
608
|
+
var answer = defaultAnswerArr.find(x => x.QuestionId == group.value.subQuestionId);
|
|
609
|
+
if (answer != null) {
|
|
610
|
+
group.controls.answer.setValue(answer.AnswerId);
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
}
|
|
549
614
|
constructor(_formBuilder) {
|
|
550
615
|
this._formBuilder = _formBuilder;
|
|
551
616
|
this.elemId = v4();
|
|
@@ -560,25 +625,23 @@ class QuestionMatrixTemplateComponent {
|
|
|
560
625
|
}
|
|
561
626
|
onChangeAnswer(question, answer) {
|
|
562
627
|
const index = this.fCtrls.subQuestionArray.value.findIndex(x => x.subQuestionId == question.subQuestionId);
|
|
563
|
-
this.fCtrls.subQuestionArray.controls[index]
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
};
|
|
628
|
+
var subQuestionGroup = this.fCtrls.subQuestionArray.controls[index];
|
|
629
|
+
subQuestionGroup.controls.answer.setValue(answer.answerId);
|
|
630
|
+
this.emitter.emit({
|
|
631
|
+
QuestionId: subQuestionGroup.value.subQuestionId,
|
|
632
|
+
Answer: subQuestionGroup.value.answer,
|
|
633
|
+
IsValid: subQuestionGroup.controls.answer.valid
|
|
570
634
|
});
|
|
571
|
-
this.emitter.emit(model);
|
|
572
635
|
}
|
|
573
636
|
convertToFormControl(element) {
|
|
574
637
|
return element;
|
|
575
638
|
}
|
|
576
639
|
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 }); }
|
|
577
|
-
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}}\">\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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] }); }
|
|
640
|
+
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", setAnswers: "setAnswers" }, 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] }); }
|
|
578
641
|
}
|
|
579
642
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, decorators: [{
|
|
580
643
|
type: Component,
|
|
581
|
-
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}}\">\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
|
+
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>" }]
|
|
582
645
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
583
646
|
type: Output
|
|
584
647
|
}], isShow: [{
|
|
@@ -587,6 +650,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
587
650
|
type: Input
|
|
588
651
|
}], setQuestion: [{
|
|
589
652
|
type: Input
|
|
653
|
+
}], setAnswers: [{
|
|
654
|
+
type: Input
|
|
590
655
|
}] } });
|
|
591
656
|
|
|
592
657
|
class QuestionBooleanTemplateComponent {
|
|
@@ -605,6 +670,13 @@ class QuestionBooleanTemplateComponent {
|
|
|
605
670
|
typeId: value.questionTypeId,
|
|
606
671
|
description: value.questionDescription
|
|
607
672
|
});
|
|
673
|
+
value.surveyAnswers.forEach(surveryAnswer => {
|
|
674
|
+
this.fCtrls.answerArray.push(this._formBuilder.group({
|
|
675
|
+
id: [surveryAnswer.answerId],
|
|
676
|
+
title: [surveryAnswer.answerTitle],
|
|
677
|
+
isSelected: [false]
|
|
678
|
+
}));
|
|
679
|
+
});
|
|
608
680
|
if (value.isRequired == true) {
|
|
609
681
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
610
682
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -612,6 +684,13 @@ class QuestionBooleanTemplateComponent {
|
|
|
612
684
|
this.isShow = value.isVisable;
|
|
613
685
|
this.isDisabled = value.isReadOnly;
|
|
614
686
|
}
|
|
687
|
+
set setAnswer(defaultAnswer) {
|
|
688
|
+
if (defaultAnswer != null) {
|
|
689
|
+
this.fCtrls.answer.setValue(defaultAnswer.AnswerId);
|
|
690
|
+
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == defaultAnswer.AnswerId);
|
|
691
|
+
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
615
694
|
constructor(_formBuilder) {
|
|
616
695
|
this._formBuilder = _formBuilder;
|
|
617
696
|
this.elemId = v4();
|
|
@@ -624,7 +703,8 @@ class QuestionBooleanTemplateComponent {
|
|
|
624
703
|
title: [null],
|
|
625
704
|
typeId: [null],
|
|
626
705
|
description: [null],
|
|
627
|
-
answer: [null]
|
|
706
|
+
answer: [null],
|
|
707
|
+
answerArray: this._formBuilder.array([])
|
|
628
708
|
});
|
|
629
709
|
}
|
|
630
710
|
ngOnInit() {
|
|
@@ -638,18 +718,18 @@ class QuestionBooleanTemplateComponent {
|
|
|
638
718
|
});
|
|
639
719
|
this.fCtrls.answer.setValue(null);
|
|
640
720
|
}
|
|
641
|
-
onChangeAnswer(
|
|
642
|
-
this.fCtrls.answer.setValue(
|
|
721
|
+
onChangeAnswer(item) {
|
|
722
|
+
this.fCtrls.answer.setValue(item.id);
|
|
643
723
|
}
|
|
644
724
|
convertToFormControl(element) {
|
|
645
725
|
return element;
|
|
646
726
|
}
|
|
647
727
|
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 }); }
|
|
648
|
-
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
|
|
728
|
+
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", setAnswer: "setAnswer" }, 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
649
729
|
}
|
|
650
730
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, decorators: [{
|
|
651
731
|
type: Component,
|
|
652
|
-
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
|
|
732
|
+
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" }]
|
|
653
733
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
|
|
654
734
|
type: Output
|
|
655
735
|
}], isShow: [{
|
|
@@ -658,6 +738,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
658
738
|
type: Input
|
|
659
739
|
}], setQuestion: [{
|
|
660
740
|
type: Input
|
|
741
|
+
}], setAnswer: [{
|
|
742
|
+
type: Input
|
|
661
743
|
}] } });
|
|
662
744
|
|
|
663
745
|
class FilterQuestionPipe {
|
|
@@ -674,6 +756,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
674
756
|
}]
|
|
675
757
|
}] });
|
|
676
758
|
|
|
759
|
+
class DefaultQuestionAnswerPipe {
|
|
760
|
+
transform(value, questionId) {
|
|
761
|
+
if (value != null) {
|
|
762
|
+
return value.find(x => x.QuestionId == questionId);
|
|
763
|
+
}
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
767
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, name: "defaultQuestionAnswer" }); }
|
|
768
|
+
}
|
|
769
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswerPipe, decorators: [{
|
|
770
|
+
type: Pipe,
|
|
771
|
+
args: [{
|
|
772
|
+
name: 'defaultQuestionAnswer'
|
|
773
|
+
}]
|
|
774
|
+
}] });
|
|
775
|
+
|
|
776
|
+
class DefaultQuestionAnswersPipe {
|
|
777
|
+
transform(value, questionId) {
|
|
778
|
+
if (value != null) {
|
|
779
|
+
return value.filter(x => x.ParentQuestionId == questionId);
|
|
780
|
+
}
|
|
781
|
+
return [];
|
|
782
|
+
}
|
|
783
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
784
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, name: "defaultQuestionAnswers" }); }
|
|
785
|
+
}
|
|
786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: DefaultQuestionAnswersPipe, decorators: [{
|
|
787
|
+
type: Pipe,
|
|
788
|
+
args: [{
|
|
789
|
+
name: 'defaultQuestionAnswers'
|
|
790
|
+
}]
|
|
791
|
+
}] });
|
|
792
|
+
|
|
677
793
|
class SurveryLibComponent {
|
|
678
794
|
get fCtrls() {
|
|
679
795
|
return this.rForm.controls;
|
|
@@ -684,6 +800,21 @@ class SurveryLibComponent {
|
|
|
684
800
|
get isLastPage() {
|
|
685
801
|
return this.fCtrls.currentPageIndex.value == (this.surveyData?.surveyPages.length - 1);
|
|
686
802
|
}
|
|
803
|
+
get surveyResult() {
|
|
804
|
+
return {
|
|
805
|
+
currentPageIndex: this.fCtrls.currentPageIndex.value,
|
|
806
|
+
answers: this.fCtrls.questionArray.value.filter(x => x.isMatrixGroup != true).map(x => {
|
|
807
|
+
return {
|
|
808
|
+
SurveyPageIndex: x.surveyPageIndex,
|
|
809
|
+
QuestionId: x.questionId,
|
|
810
|
+
QuestionType: x.questionType,
|
|
811
|
+
AnswerId: x.answerId,
|
|
812
|
+
AnswerText: x.answerText,
|
|
813
|
+
AnswerIdArr: x.answerIdArr
|
|
814
|
+
};
|
|
815
|
+
})
|
|
816
|
+
};
|
|
817
|
+
}
|
|
687
818
|
constructor(_surveyLibService, _formBuilder, _checkRuleExpsUsecase) {
|
|
688
819
|
this._surveyLibService = _surveyLibService;
|
|
689
820
|
this._formBuilder = _formBuilder;
|
|
@@ -705,6 +836,10 @@ class SurveryLibComponent {
|
|
|
705
836
|
this.fCtrls.questionArray.clear();
|
|
706
837
|
}
|
|
707
838
|
});
|
|
839
|
+
this._surveyLibService.surveyAnswersObsrv.subscribe(value => {
|
|
840
|
+
this.defaultAnswers = value.defaultAnswers;
|
|
841
|
+
this.fCtrls.currentPageIndex.setValue(value.currentpage);
|
|
842
|
+
});
|
|
708
843
|
}
|
|
709
844
|
onPaggingNext() {
|
|
710
845
|
var isHaveInvalidRecords = this.haveInValidateQuestions();
|
|
@@ -719,6 +854,7 @@ class SurveryLibComponent {
|
|
|
719
854
|
return {
|
|
720
855
|
SurveyPageIndex: x.surveyPageIndex,
|
|
721
856
|
QuestionId: x.questionId,
|
|
857
|
+
QuestionType: x.questionType,
|
|
722
858
|
AnswerId: x.answerId,
|
|
723
859
|
AnswerText: x.answerText,
|
|
724
860
|
AnswerIdArr: x.answerIdArr
|
|
@@ -886,11 +1022,11 @@ class SurveryLibComponent {
|
|
|
886
1022
|
});
|
|
887
1023
|
}
|
|
888
1024
|
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 }); }
|
|
889
|
-
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 [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 [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 [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 [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 [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 [setQuestion]=\"question\" (emitter)=\"
|
|
1025
|
+
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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswers]=\"(defaultAnswers|defaultQuestionAnswers :question.questionId)\"></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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isShow", "isTextArea", "setQuestion", "isDisabled", "setAnswer"], outputs: ["emitter"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["isShow", "isDisabled", "setQuestion", "setAnswer"], outputs: ["emitter"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["isShow", "isDisabled", "setQuestion", "setAnswer"], outputs: ["emitter"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["isShow", "isDisabled", "setQuestion", "setAnswer"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["isShow", "isDisabled", "setQuestion", "setAnswers"], outputs: ["emitter"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["isShow", "isDisabled", "setQuestion", "setAnswer"], outputs: ["emitter"] }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }, { kind: "pipe", type: DefaultQuestionAnswerPipe, name: "defaultQuestionAnswer" }, { kind: "pipe", type: DefaultQuestionAnswersPipe, name: "defaultQuestionAnswers" }] }); }
|
|
890
1026
|
}
|
|
891
1027
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
|
|
892
1028
|
type: Component,
|
|
893
|
-
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 [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 [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 [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 [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 [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 [setQuestion]=\"question\" (emitter)=\"
|
|
1029
|
+
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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswer]=\"(defaultAnswers|defaultQuestionAnswer :question.questionId)\"></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\"\r\n [setAnswers]=\"(defaultAnswers|defaultQuestionAnswers :question.questionId)\"></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"] }]
|
|
894
1030
|
}], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { surveyResultEmit: [{
|
|
895
1031
|
type: Output
|
|
896
1032
|
}] } });
|
|
@@ -909,7 +1045,9 @@ class SurveryLibModule {
|
|
|
909
1045
|
QuestionDropdownTemplateComponent,
|
|
910
1046
|
QuestionMatrixTemplateComponent,
|
|
911
1047
|
QuestionBooleanTemplateComponent,
|
|
912
|
-
FilterQuestionPipe
|
|
1048
|
+
FilterQuestionPipe,
|
|
1049
|
+
DefaultQuestionAnswerPipe,
|
|
1050
|
+
DefaultQuestionAnswersPipe], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule], exports: [SurveryLibComponent] }); }
|
|
913
1051
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule] }); }
|
|
914
1052
|
}
|
|
915
1053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, decorators: [{
|
|
@@ -923,7 +1061,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
923
1061
|
QuestionDropdownTemplateComponent,
|
|
924
1062
|
QuestionMatrixTemplateComponent,
|
|
925
1063
|
QuestionBooleanTemplateComponent,
|
|
926
|
-
FilterQuestionPipe
|
|
1064
|
+
FilterQuestionPipe,
|
|
1065
|
+
DefaultQuestionAnswerPipe,
|
|
1066
|
+
DefaultQuestionAnswersPipe
|
|
927
1067
|
],
|
|
928
1068
|
imports: [
|
|
929
1069
|
CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule
|