@piserve-tech/form-submission 0.0.0-watch
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/README.md +24 -0
- package/element-type/element-type.module.d.ts +12 -0
- package/element-type/form-elements/form-elements.component.d.ts +7 -0
- package/element-type/question/question.component.d.ts +14 -0
- package/element-type/sub-form/sub-form.component.d.ts +6 -0
- package/esm2022/element-type/element-type.module.mjs +36 -0
- package/esm2022/element-type/form-elements/form-elements.component.mjs +23 -0
- package/esm2022/element-type/question/question.component.mjs +52 -0
- package/esm2022/element-type/sub-form/sub-form.component.mjs +17 -0
- package/esm2022/form-fields/check-box-fields/check-box-fields.component.mjs +198 -0
- package/esm2022/form-fields/date-time-fields/date-time-fields.component.mjs +155 -0
- package/esm2022/form-fields/drop-down-fields/drop-down-fields.component.mjs +147 -0
- package/esm2022/form-fields/file-picker-fields/file-picker-fields.component.mjs +77 -0
- package/esm2022/form-fields/form-fields.module.mjs +154 -0
- package/esm2022/form-fields/location-fields/location-fields.component.mjs +79 -0
- package/esm2022/form-fields/mail-fields/mail-fields.component.mjs +75 -0
- package/esm2022/form-fields/mobile-fields/mobile-fields.component.mjs +81 -0
- package/esm2022/form-fields/number-fields/number-fields.component.mjs +59 -0
- package/esm2022/form-fields/password-fields/password-fields.component.mjs +172 -0
- package/esm2022/form-fields/radio-button-fields/radio-button-fields.component.mjs +129 -0
- package/esm2022/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.mjs +89 -0
- package/esm2022/form-fields/section-fields/section-fields.component.mjs +16 -0
- package/esm2022/form-fields/selection-matrix-fields/selection-matrix-fields.component.mjs +27 -0
- package/esm2022/form-fields/signature-fields/signature-fields.component.mjs +29 -0
- package/esm2022/form-fields/slider-fields/slider-fields.component.mjs +60 -0
- package/esm2022/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.mjs +27 -0
- package/esm2022/form-fields/text-area-fields/text-area-fields.component.mjs +61 -0
- package/esm2022/form-fields/text-fields/text-fields.component.mjs +86 -0
- package/esm2022/form-fields/toggle-switch-fields/toggle-switch-fields.component.mjs +42 -0
- package/esm2022/form-fields/url-fields/url-fields.component.mjs +59 -0
- package/esm2022/form-submission/form-submission.module.mjs +42 -0
- package/esm2022/form-submission/header/header.component.mjs +16 -0
- package/esm2022/form-submission/logic/logic.component.mjs +17 -0
- package/esm2022/form-submission/navigation-tabs/navigation-tabs.component.mjs +27 -0
- package/esm2022/form-submission/next-prev-navigation/next-prev-navigation.component.mjs +42 -0
- package/esm2022/form-submission/submit-form/submit-form.component.mjs +157 -0
- package/esm2022/lib/form-submission.component.mjs +23 -0
- package/esm2022/lib/form-submission.module.mjs +45 -0
- package/esm2022/lib/form-submission.service.mjs +14 -0
- package/esm2022/logic/logic/logic.component.mjs +17 -0
- package/esm2022/logic/logic.module.mjs +20 -0
- package/esm2022/models/appearance.model.mjs +2 -0
- package/esm2022/models/elementOptionAPI.model.mjs +2 -0
- package/esm2022/models/elementOptionAPIData.model.mjs +2 -0
- package/esm2022/models/elementOptionDB.model.mjs +2 -0
- package/esm2022/models/elementOptionDBCriteria.model.mjs +2 -0
- package/esm2022/models/enum/condition.enum.mjs +18 -0
- package/esm2022/models/enum/elementType .enum.mjs +24 -0
- package/esm2022/models/enum/entityType.enum.mjs +12 -0
- package/esm2022/models/formConfiguration.model.mjs +2 -0
- package/esm2022/models/formElement.model.mjs +2 -0
- package/esm2022/models/formElementType.model.mjs +2 -0
- package/esm2022/models/grid.model.mjs +2 -0
- package/esm2022/models/logic.model.mjs +2 -0
- package/esm2022/models/option.model.mjs +2 -0
- package/esm2022/models/page.model.mjs +2 -0
- package/esm2022/models/publicForm.model.mjs +2 -0
- package/esm2022/models/question.model.mjs +2 -0
- package/esm2022/models/row.model.mjs +2 -0
- package/esm2022/models/section.model.mjs +2 -0
- package/esm2022/models/subForm.model.mjs +2 -0
- package/esm2022/models/validation.model.mjs +2 -0
- package/esm2022/piserve-tech-form-submission.mjs +5 -0
- package/esm2022/public-api.mjs +7 -0
- package/esm2022/services/countryService.mjs +65 -0
- package/esm2022/services/data.service.mjs +26 -0
- package/esm2022/services/form.service.mjs +43 -0
- package/esm2022/services/mapper.service.mjs +256 -0
- package/fesm2022/piserve-tech-form-submission.mjs +2558 -0
- package/fesm2022/piserve-tech-form-submission.mjs.map +1 -0
- package/form-fields/check-box-fields/check-box-fields.component.d.ts +42 -0
- package/form-fields/date-time-fields/date-time-fields.component.d.ts +41 -0
- package/form-fields/drop-down-fields/drop-down-fields.component.d.ts +45 -0
- package/form-fields/file-picker-fields/file-picker-fields.component.d.ts +24 -0
- package/form-fields/form-fields.module.d.ts +36 -0
- package/form-fields/location-fields/location-fields.component.d.ts +24 -0
- package/form-fields/mail-fields/mail-fields.component.d.ts +21 -0
- package/form-fields/mobile-fields/mobile-fields.component.d.ts +45 -0
- package/form-fields/number-fields/number-fields.component.d.ts +22 -0
- package/form-fields/password-fields/password-fields.component.d.ts +35 -0
- package/form-fields/radio-button-fields/radio-button-fields.component.d.ts +39 -0
- package/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.d.ts +24 -0
- package/form-fields/section-fields/section-fields.component.d.ts +6 -0
- package/form-fields/selection-matrix-fields/selection-matrix-fields.component.d.ts +10 -0
- package/form-fields/signature-fields/signature-fields.component.d.ts +12 -0
- package/form-fields/slider-fields/slider-fields.component.d.ts +25 -0
- package/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.d.ts +10 -0
- package/form-fields/text-area-fields/text-area-fields.component.d.ts +22 -0
- package/form-fields/text-fields/text-fields.component.d.ts +30 -0
- package/form-fields/toggle-switch-fields/toggle-switch-fields.component.d.ts +16 -0
- package/form-fields/url-fields/url-fields.component.d.ts +22 -0
- package/form-submission/form-submission.module.d.ts +14 -0
- package/form-submission/header/header.component.d.ts +6 -0
- package/form-submission/logic/logic.component.d.ts +6 -0
- package/form-submission/navigation-tabs/navigation-tabs.component.d.ts +10 -0
- package/form-submission/next-prev-navigation/next-prev-navigation.component.d.ts +15 -0
- package/form-submission/submit-form/submit-form.component.d.ts +43 -0
- package/index.d.ts +5 -0
- package/lib/form-submission.component.d.ts +10 -0
- package/lib/form-submission.module.d.ts +14 -0
- package/lib/form-submission.service.d.ts +6 -0
- package/logic/logic/logic.component.d.ts +6 -0
- package/logic/logic.module.d.ts +8 -0
- package/models/appearance.model.d.ts +48 -0
- package/models/elementOptionAPI.model.d.ts +11 -0
- package/models/elementOptionAPIData.model.d.ts +5 -0
- package/models/elementOptionDB.model.d.ts +7 -0
- package/models/elementOptionDBCriteria.model.d.ts +7 -0
- package/models/enum/condition.enum.d.ts +16 -0
- package/models/enum/elementType .enum.d.ts +22 -0
- package/models/enum/entityType.enum.d.ts +10 -0
- package/models/formConfiguration.model.d.ts +16 -0
- package/models/formElement.model.d.ts +12 -0
- package/models/formElementType.model.d.ts +5 -0
- package/models/grid.model.d.ts +8 -0
- package/models/logic.model.d.ts +8 -0
- package/models/option.model.d.ts +11 -0
- package/models/page.model.d.ts +5 -0
- package/models/publicForm.model.d.ts +7 -0
- package/models/question.model.d.ts +14 -0
- package/models/row.model.d.ts +4 -0
- package/models/section.model.d.ts +5 -0
- package/models/subForm.model.d.ts +8 -0
- package/models/validation.model.d.ts +44 -0
- package/package.json +43 -0
- package/public-api.d.ts +3 -0
- package/services/countryService.d.ts +21 -0
- package/services/data.service.d.ts +13 -0
- package/services/form.service.d.ts +17 -0
- package/services/mapper.service.d.ts +10 -0
|
@@ -0,0 +1,2558 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, Input, EventEmitter, Output, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
|
+
import * as i1 from '@angular/common/http';
|
|
5
|
+
import { HttpHeaders } from '@angular/common/http';
|
|
6
|
+
import * as i1$1 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
import * as i2 from '@angular/forms';
|
|
9
|
+
import { FormsModule } from '@angular/forms';
|
|
10
|
+
import * as i3 from 'ngx-bootstrap/datepicker';
|
|
11
|
+
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
|
|
12
|
+
import * as i3$1 from '@piserve-tech/drop-down';
|
|
13
|
+
import { DropdownModule } from '@piserve-tech/drop-down';
|
|
14
|
+
import * as i2$1 from '@piserve-tech/file-upload';
|
|
15
|
+
import { DocUploadModule } from '@piserve-tech/file-upload';
|
|
16
|
+
import * as i2$2 from '@angular/google-maps';
|
|
17
|
+
import { GoogleMap, GoogleMapsModule } from '@angular/google-maps';
|
|
18
|
+
import * as i3$2 from '@kolkov/angular-editor';
|
|
19
|
+
import { AngularEditorModule } from '@kolkov/angular-editor';
|
|
20
|
+
import * as i3$3 from '@angular/material/slider';
|
|
21
|
+
import { MatSliderModule } from '@angular/material/slider';
|
|
22
|
+
import { FilePreviewModule } from '@piserve-tech/file-preview';
|
|
23
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
|
24
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
25
|
+
|
|
26
|
+
class FormSubmissionService {
|
|
27
|
+
constructor() { }
|
|
28
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
29
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionService, providedIn: 'root' }); }
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionService, decorators: [{
|
|
32
|
+
type: Injectable,
|
|
33
|
+
args: [{
|
|
34
|
+
providedIn: 'root'
|
|
35
|
+
}]
|
|
36
|
+
}], ctorParameters: function () { return []; } });
|
|
37
|
+
|
|
38
|
+
class DataService {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.dataSubject = new BehaviorSubject('');
|
|
41
|
+
this.apiUrl$ = this.dataSubject.asObservable();
|
|
42
|
+
this.headerSubject = new BehaviorSubject({});
|
|
43
|
+
this.header$ = this.headerSubject.asObservable();
|
|
44
|
+
}
|
|
45
|
+
setApiUrl(data) {
|
|
46
|
+
this.dataSubject.next(data);
|
|
47
|
+
}
|
|
48
|
+
setHeader(data) {
|
|
49
|
+
this.headerSubject.next(data);
|
|
50
|
+
}
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
52
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataService, providedIn: 'root' }); }
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataService, decorators: [{
|
|
55
|
+
type: Injectable,
|
|
56
|
+
args: [{
|
|
57
|
+
providedIn: 'root',
|
|
58
|
+
}]
|
|
59
|
+
}], ctorParameters: function () { return []; } });
|
|
60
|
+
|
|
61
|
+
function mapPublicFormToModel(apiPublicForm) {
|
|
62
|
+
return {
|
|
63
|
+
name: apiPublicForm.result.name,
|
|
64
|
+
formConfiguration: mapFormConfigurationToModel(apiPublicForm.result.formConfiguration),
|
|
65
|
+
pages: apiPublicForm.result.pages.map((apiPage) => mapPageToModel(apiPage)),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function mapFormConfigurationToModel(apiFormConfiguration) {
|
|
69
|
+
return {
|
|
70
|
+
saveAutomatically: apiFormConfiguration.saveAutomatically,
|
|
71
|
+
saveInterval: apiFormConfiguration.saveInterval,
|
|
72
|
+
customizeFont: apiFormConfiguration.customizeFont,
|
|
73
|
+
fontFamily: apiFormConfiguration.fontFamily,
|
|
74
|
+
fontSize: apiFormConfiguration.fontSize,
|
|
75
|
+
enableDataExport: apiFormConfiguration.enableDataExport,
|
|
76
|
+
fileFormats: apiFormConfiguration.fileFormats,
|
|
77
|
+
enableQuestionNumbering: apiFormConfiguration.enableQuestionNumbering,
|
|
78
|
+
questionNumbering: apiFormConfiguration.questionNumbering,
|
|
79
|
+
enableGoogleRecaptcha: apiFormConfiguration.enableGoogleRecaptcha,
|
|
80
|
+
googleRecaptchaKey: apiFormConfiguration.googleRecaptchaKey,
|
|
81
|
+
googleRecaptchaSecret: apiFormConfiguration.googleRecaptchaSecret,
|
|
82
|
+
navigation: apiFormConfiguration.navigation,
|
|
83
|
+
markAllQuestionsAsRequired: apiFormConfiguration.markAllQuestionsAsRequired,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function mapPageToModel(apiPage) {
|
|
87
|
+
return {
|
|
88
|
+
title: apiPage.title,
|
|
89
|
+
rows: apiPage.rows.map((apiRow) => mapRowToModel(apiRow)),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function mapRowToModel(apiRow) {
|
|
93
|
+
return {
|
|
94
|
+
grid: apiRow.grid.map((apiGrid) => mapGridToModel(apiGrid)),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function mapGridToModel(apiGrid) {
|
|
98
|
+
let entity;
|
|
99
|
+
switch (apiGrid.entityType) {
|
|
100
|
+
case 'QUESTION':
|
|
101
|
+
entity = mapQuestionToModel(apiGrid.formElementType);
|
|
102
|
+
break;
|
|
103
|
+
case 'SECTION':
|
|
104
|
+
entity = mapSectionToModel(apiGrid.formElementType);
|
|
105
|
+
break;
|
|
106
|
+
case 'SUBFORM':
|
|
107
|
+
entity = mapSubFormToModel(apiGrid.formElementType);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
throw new Error(`Unknown entity type: ${apiGrid.entityType}`);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
entityType: apiGrid.entityType,
|
|
114
|
+
formElementType: entity,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function mapSectionToModel(apiSection) {
|
|
118
|
+
return {
|
|
119
|
+
id: apiSection.id,
|
|
120
|
+
title: apiSection.title,
|
|
121
|
+
description: apiSection.description,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function mapQuestionToModel(apiQuestion) {
|
|
125
|
+
return {
|
|
126
|
+
count: apiQuestion.count,
|
|
127
|
+
id: apiQuestion.id,
|
|
128
|
+
questionNumber: apiQuestion.questionNumber,
|
|
129
|
+
required: apiQuestion.required,
|
|
130
|
+
hint: apiQuestion.hint,
|
|
131
|
+
question: apiQuestion.question,
|
|
132
|
+
answer: {},
|
|
133
|
+
validation: true,
|
|
134
|
+
formElement: mapFormElementToModel(apiQuestion.formElement),
|
|
135
|
+
childLogics: apiQuestion?.childLogics?.map((logic) => mapLogicToModel(logic)),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function mapFormElementToModel(apiFormElement) {
|
|
139
|
+
return {
|
|
140
|
+
elementType: apiFormElement.elementType,
|
|
141
|
+
appearance: mapAppearanceToModel(apiFormElement.appearance),
|
|
142
|
+
validation: mapValidationToModel(apiFormElement.validation),
|
|
143
|
+
option: mapOptionToModel(apiFormElement?.option),
|
|
144
|
+
selectionMatrixLabel: apiFormElement.selectionMatrixLabel,
|
|
145
|
+
selectionMatrixColumn: apiFormElement.selectionMatrixColumn,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function mapLogicToModel(apiLogic) {
|
|
149
|
+
return {
|
|
150
|
+
id: apiLogic.id,
|
|
151
|
+
inputValue: apiLogic.inputValue,
|
|
152
|
+
condition: apiLogic.condition,
|
|
153
|
+
formElements: apiLogic.formElements.map((element) => mapFormElementTypeToModel(element)),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function mapSubFormToModel(apiSubForm) {
|
|
157
|
+
return {
|
|
158
|
+
id: apiSubForm.id,
|
|
159
|
+
title: apiSubForm.title,
|
|
160
|
+
description: apiSubForm.description,
|
|
161
|
+
subFormStructure: apiSubForm.subFormStructure,
|
|
162
|
+
formElements: apiSubForm.formElements.map((element) => mapFormElementTypeToModel(element)),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function mapFormElementTypeToModel(apiFormElementType) {
|
|
166
|
+
return {
|
|
167
|
+
entityType: apiFormElementType.entityType,
|
|
168
|
+
formElementType: apiFormElementType.formElementType,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function mapAppearanceToModel(apiAppearance) {
|
|
172
|
+
return {
|
|
173
|
+
placeholder: apiAppearance.placeholder,
|
|
174
|
+
fontSize: apiAppearance.fontSize,
|
|
175
|
+
textAlign: apiAppearance.textAlign,
|
|
176
|
+
font: apiAppearance.font,
|
|
177
|
+
underline: apiAppearance.underline,
|
|
178
|
+
bold: apiAppearance.bold,
|
|
179
|
+
italics: apiAppearance.italics,
|
|
180
|
+
defaultValue: apiAppearance.defaultValue,
|
|
181
|
+
numberOfRows: apiAppearance.numberOfRows,
|
|
182
|
+
singleSelection: apiAppearance.singleSelection,
|
|
183
|
+
displayCountryCode: apiAppearance.displayCountryCode,
|
|
184
|
+
displayFlag: apiAppearance.displayFlag,
|
|
185
|
+
displayCode: apiAppearance.displayCode,
|
|
186
|
+
showCountryName: apiAppearance.showCountryName,
|
|
187
|
+
beautifyNumbers: apiAppearance.beautifyNumbers,
|
|
188
|
+
upAndDownButton: apiAppearance.upAndDownButton,
|
|
189
|
+
allowNegativeValues: apiAppearance.allowNegativeValues,
|
|
190
|
+
showPreviewButton: apiAppearance.showPreviewButton,
|
|
191
|
+
confirmPassword: apiAppearance.confirmPassword,
|
|
192
|
+
viewButton: apiAppearance.viewButton,
|
|
193
|
+
displayStrong: apiAppearance.displayStrong,
|
|
194
|
+
dateType: apiAppearance.dateType,
|
|
195
|
+
format: apiAppearance.format,
|
|
196
|
+
setCurrentPosition: apiAppearance.setCurrentPosition,
|
|
197
|
+
defaultZoomLevel: apiAppearance.defaultZoomLevel,
|
|
198
|
+
allowFullScreen: apiAppearance.allowFullScreen,
|
|
199
|
+
latitude: apiAppearance.latitude,
|
|
200
|
+
longitude: apiAppearance.longitude,
|
|
201
|
+
showAcceptButton: apiAppearance.showAcceptButton,
|
|
202
|
+
labelOnValue: apiAppearance.labelOnValue,
|
|
203
|
+
labelOffValue: apiAppearance.labelOffValue,
|
|
204
|
+
labelOnColor: apiAppearance.labelOnColor,
|
|
205
|
+
labelOffColor: apiAppearance.labelOffColor,
|
|
206
|
+
minValue: apiAppearance.minValue,
|
|
207
|
+
maxValue: apiAppearance.maxValue,
|
|
208
|
+
stepValue: apiAppearance.stepValue,
|
|
209
|
+
changeSliderColor: apiAppearance.changeSliderColor,
|
|
210
|
+
sliderColor: apiAppearance.sliderColor,
|
|
211
|
+
canvasOption: apiAppearance.canvasOption,
|
|
212
|
+
selectionType: apiAppearance.selectionType,
|
|
213
|
+
dragAndDrop: apiAppearance.dragAndDrop,
|
|
214
|
+
previewUploadedFiles: apiAppearance.previewUploadedFiles,
|
|
215
|
+
multiFileUploads: apiAppearance.multiFileUploads,
|
|
216
|
+
selectionColorRequired: apiAppearance.selectionColorRequired,
|
|
217
|
+
selectionColor: apiAppearance.selectionColor,
|
|
218
|
+
color: apiAppearance.color,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function mapValidationToModel(apiValidation) {
|
|
222
|
+
return {
|
|
223
|
+
regexValidation: apiValidation.regexValidation,
|
|
224
|
+
regex: apiValidation.regex,
|
|
225
|
+
validationMessage: apiValidation.validationMessage,
|
|
226
|
+
limitedCharacters: apiValidation.limitedCharacters,
|
|
227
|
+
count: apiValidation.count,
|
|
228
|
+
minimumSelection: apiValidation.minimumSelection,
|
|
229
|
+
maximumSelection: apiValidation.maximumSelection,
|
|
230
|
+
countryWiseValidation: apiValidation.countryWiseValidation,
|
|
231
|
+
restrictCountry: apiValidation.restrictCountry,
|
|
232
|
+
allowedCountry: apiValidation.allowedCountry,
|
|
233
|
+
blockedCountry: apiValidation.blockedCountry,
|
|
234
|
+
regularExpression: apiValidation.regularExpression,
|
|
235
|
+
expectedDomains: apiValidation.expectedDomains,
|
|
236
|
+
min: apiValidation.min,
|
|
237
|
+
max: apiValidation.max,
|
|
238
|
+
minLength: apiValidation.minLength,
|
|
239
|
+
maxLength: apiValidation.maxLength,
|
|
240
|
+
requireLowercaseLetters: apiValidation.requireLowercaseLetters,
|
|
241
|
+
requireUppercaseLetters: apiValidation.requireUppercaseLetters,
|
|
242
|
+
requireNumbers: apiValidation.requireNumbers,
|
|
243
|
+
requireSpecialCharacters: apiValidation.requireSpecialCharacters,
|
|
244
|
+
allowedSpecialCharacters: apiValidation.allowedSpecialCharacters,
|
|
245
|
+
minDateOption: apiValidation.minDateOption,
|
|
246
|
+
minDate: apiValidation.minDate,
|
|
247
|
+
maxDateOption: apiValidation.maxDateOption,
|
|
248
|
+
maxDate: apiValidation.maxDate,
|
|
249
|
+
regionBoundary: apiValidation.regionBoundary,
|
|
250
|
+
region: apiValidation.region,
|
|
251
|
+
preventFromProceedingWithoutAgree: apiValidation.preventFromProceedingWithoutAgree,
|
|
252
|
+
buttonColour: apiValidation.buttonColour,
|
|
253
|
+
maxFileSize: apiValidation.maxFileSize,
|
|
254
|
+
minFileSize: apiValidation.minFileSize,
|
|
255
|
+
minSelection: apiValidation.minSelection,
|
|
256
|
+
maxSelection: apiValidation.maxSelection,
|
|
257
|
+
fileTypes: apiValidation.fileTypes,
|
|
258
|
+
fileSize: apiValidation.fileSize,
|
|
259
|
+
fileSizeUnit: apiValidation.fileSizeUnit,
|
|
260
|
+
totalFileSize: apiValidation.totalFileSize,
|
|
261
|
+
minSelectionRequired: apiValidation.minSelectionRequired,
|
|
262
|
+
minSelectionValue: apiValidation.minSelectionValue,
|
|
263
|
+
validationType: apiValidation.validationType,
|
|
264
|
+
validation: apiValidation.validation,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function mapElementOptionDBToModel(apiElementOptionDB) {
|
|
268
|
+
return {
|
|
269
|
+
tableName: apiElementOptionDB.tableName,
|
|
270
|
+
valueField: apiElementOptionDB.valueField,
|
|
271
|
+
labelField: apiElementOptionDB.labelField,
|
|
272
|
+
criteria: apiElementOptionDB.criteria.map((apiCriteria) => mapElementOptionDBCriteriaToModel(apiCriteria)),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function mapElementOptionDBCriteriaToModel(apiElementOptionDBCriteria) {
|
|
276
|
+
return {
|
|
277
|
+
field: apiElementOptionDBCriteria.field,
|
|
278
|
+
condition: apiElementOptionDBCriteria.condition,
|
|
279
|
+
valueSource: apiElementOptionDBCriteria.valueSource,
|
|
280
|
+
inputValue: apiElementOptionDBCriteria.inputValue,
|
|
281
|
+
logicalOperator: apiElementOptionDBCriteria.logicalOperator,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function mapElementOptionAPIToModel(apiElementOptionAPI) {
|
|
285
|
+
return {
|
|
286
|
+
external: apiElementOptionAPI.external,
|
|
287
|
+
url: apiElementOptionAPI.url,
|
|
288
|
+
valueField: apiElementOptionAPI.valueField,
|
|
289
|
+
labelField: apiElementOptionAPI.labelField,
|
|
290
|
+
pathToValue: apiElementOptionAPI.pathToValue,
|
|
291
|
+
headers: apiElementOptionAPI.headers?.map(mapElementOptionAPIDataToModel),
|
|
292
|
+
params: apiElementOptionAPI.params?.map(mapElementOptionAPIDataToModel),
|
|
293
|
+
pathVariables: apiElementOptionAPI.pathVariables?.map(mapElementOptionAPIDataToModel),
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function mapElementOptionAPIDataToModel(apiElementOptionAPIData) {
|
|
297
|
+
return {
|
|
298
|
+
keyName: apiElementOptionAPIData.keyName,
|
|
299
|
+
valueSource: apiElementOptionAPIData.valueSource,
|
|
300
|
+
inputValue: apiElementOptionAPIData.inputValue,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function mapOptionToModel(apiOption) {
|
|
304
|
+
return {
|
|
305
|
+
optionType: apiOption?.optionType,
|
|
306
|
+
lookupTable: apiOption?.lookupTable,
|
|
307
|
+
customOptions: apiOption?.customOptions?.map((option) => ({
|
|
308
|
+
value: option.value,
|
|
309
|
+
})),
|
|
310
|
+
database: apiOption?.database
|
|
311
|
+
? mapElementOptionDBToModel(apiOption.database)
|
|
312
|
+
: undefined,
|
|
313
|
+
api: apiOption?.api ? mapElementOptionAPIToModel(apiOption.api) : undefined,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
class FormService {
|
|
318
|
+
constructor(http, dataService) {
|
|
319
|
+
this.http = http;
|
|
320
|
+
this.dataService = dataService;
|
|
321
|
+
this.apiUrl = '';
|
|
322
|
+
this.header = {};
|
|
323
|
+
this.dataService.apiUrl$.subscribe((data) => {
|
|
324
|
+
this.apiUrl = data;
|
|
325
|
+
});
|
|
326
|
+
this.dataService.header$.subscribe((data) => {
|
|
327
|
+
this.header = data;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
getQuestions(moduleName) {
|
|
331
|
+
return this.http.get(`${this.apiUrl}/api/public/forms/${moduleName}`);
|
|
332
|
+
}
|
|
333
|
+
fetchDataFromDatabase(database) {
|
|
334
|
+
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
|
|
335
|
+
return this.http.post(`${this.apiUrl}/api/load-from-db`, database, {
|
|
336
|
+
headers,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
fetchDataFromLookup(tableName) {
|
|
340
|
+
return this.http.get(`${this.apiUrl}/api/public/lookup/${tableName}`);
|
|
341
|
+
}
|
|
342
|
+
fetchDataFromExternalAPI(url) {
|
|
343
|
+
return this.http.get(url);
|
|
344
|
+
}
|
|
345
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormService, deps: [{ token: i1.HttpClient }, { token: DataService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
346
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormService, providedIn: 'root' }); }
|
|
347
|
+
}
|
|
348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormService, decorators: [{
|
|
349
|
+
type: Injectable,
|
|
350
|
+
args: [{
|
|
351
|
+
providedIn: 'root',
|
|
352
|
+
}]
|
|
353
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: DataService }]; } });
|
|
354
|
+
|
|
355
|
+
class HeaderComponent {
|
|
356
|
+
constructor() {
|
|
357
|
+
this.name = '';
|
|
358
|
+
}
|
|
359
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
360
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: HeaderComponent, selector: "lib-header", inputs: { name: "name" }, ngImport: i0, template: "<div class=\"head container\">\r\n <div class=\"registration-header\">\r\n <h2>{{ name }}</h2>\r\n </div>\r\n <div class=\"line\"></div>\r\n</div>\r\n", styles: [".head{background-color:#fff;padding:0!important}.registration-header{top:20px;left:50%}.line{margin-top:1%;margin-bottom:2%;width:100%;height:0px;border:1.5px solid #eaeaea;transform:rotate(180deg)}@media (max-width: 576px){.line{margin-bottom:5%}}\n"] }); }
|
|
361
|
+
}
|
|
362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderComponent, decorators: [{
|
|
363
|
+
type: Component,
|
|
364
|
+
args: [{ selector: 'lib-header', template: "<div class=\"head container\">\r\n <div class=\"registration-header\">\r\n <h2>{{ name }}</h2>\r\n </div>\r\n <div class=\"line\"></div>\r\n</div>\r\n", styles: [".head{background-color:#fff;padding:0!important}.registration-header{top:20px;left:50%}.line{margin-top:1%;margin-bottom:2%;width:100%;height:0px;border:1.5px solid #eaeaea;transform:rotate(180deg)}@media (max-width: 576px){.line{margin-bottom:5%}}\n"] }]
|
|
365
|
+
}], propDecorators: { name: [{
|
|
366
|
+
type: Input
|
|
367
|
+
}] } });
|
|
368
|
+
|
|
369
|
+
class SectionFieldsComponent {
|
|
370
|
+
constructor() {
|
|
371
|
+
this.section = {};
|
|
372
|
+
}
|
|
373
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SectionFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
374
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SectionFieldsComponent, selector: "lib-section-fields", inputs: { section: "section" }, ngImport: i0, template: "<div class=\"mb-4 px-3\">\r\n <p class=\"sectionTitle\">{{ section.title }}</p>\r\n <p class=\"description\">{{ section.description }}</p>\r\n</div>\r\n", styles: [".sectionTitle{font-size:15px;font-weight:500}\n"] }); }
|
|
375
|
+
}
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SectionFieldsComponent, decorators: [{
|
|
377
|
+
type: Component,
|
|
378
|
+
args: [{ selector: 'lib-section-fields', template: "<div class=\"mb-4 px-3\">\r\n <p class=\"sectionTitle\">{{ section.title }}</p>\r\n <p class=\"description\">{{ section.description }}</p>\r\n</div>\r\n", styles: [".sectionTitle{font-size:15px;font-weight:500}\n"] }]
|
|
379
|
+
}], propDecorators: { section: [{
|
|
380
|
+
type: Input
|
|
381
|
+
}] } });
|
|
382
|
+
|
|
383
|
+
class CheckBoxFieldsComponent {
|
|
384
|
+
constructor(formService) {
|
|
385
|
+
this.formService = formService;
|
|
386
|
+
this.question = {};
|
|
387
|
+
this.count = 0;
|
|
388
|
+
this.required = false;
|
|
389
|
+
this.hint = '';
|
|
390
|
+
this.selectionType = '';
|
|
391
|
+
this.optionType = '';
|
|
392
|
+
this.lookupTable = {};
|
|
393
|
+
this.customOptions = [];
|
|
394
|
+
this.database = {};
|
|
395
|
+
this.api = {};
|
|
396
|
+
this.apiOptions = []; // Assuming you have a property to store API options
|
|
397
|
+
this.selectedOptions = [];
|
|
398
|
+
this.validationFailed = false;
|
|
399
|
+
this.validationMessage = '';
|
|
400
|
+
this.validate = new EventEmitter();
|
|
401
|
+
}
|
|
402
|
+
ngOnInit() {
|
|
403
|
+
this.valueAssigned();
|
|
404
|
+
}
|
|
405
|
+
valueAssigned() {
|
|
406
|
+
this.count = this.question.count;
|
|
407
|
+
this.required = this.question.required;
|
|
408
|
+
this.hint = this.question.hint;
|
|
409
|
+
this.selectionType = this.question.formElement.appearance.selectionType;
|
|
410
|
+
this.minimumSelection =
|
|
411
|
+
this.question.formElement.validation.minimumSelection;
|
|
412
|
+
this.maximumSelection =
|
|
413
|
+
this.question.formElement.validation.maximumSelection;
|
|
414
|
+
this.optionType = this.question.formElement.option.optionType;
|
|
415
|
+
switch (this.optionType) {
|
|
416
|
+
case 'OPTION':
|
|
417
|
+
this.customOptions = this.question.formElement.option.customOptions;
|
|
418
|
+
break;
|
|
419
|
+
case 'LOOKUP':
|
|
420
|
+
this.lookupTable = this.question.formElement.option.lookupTable;
|
|
421
|
+
this.fetchDataFromLookup();
|
|
422
|
+
break;
|
|
423
|
+
case 'DATABASE':
|
|
424
|
+
this.database = this.question.formElement.option.database;
|
|
425
|
+
this.fetchDataFromDatabase();
|
|
426
|
+
break;
|
|
427
|
+
case 'API':
|
|
428
|
+
this.api = this.question.formElement.option.api;
|
|
429
|
+
this.fetchDataFromAPI();
|
|
430
|
+
break;
|
|
431
|
+
default:
|
|
432
|
+
console.warn('Unknown option type:', this.optionType);
|
|
433
|
+
}
|
|
434
|
+
// If selectionType is 'SINGLE', set minimumSelection and maximumSelection to 1
|
|
435
|
+
if (this.selectionType === 'SINGLE') {
|
|
436
|
+
this.minimumSelection = 1;
|
|
437
|
+
this.maximumSelection = 1;
|
|
438
|
+
}
|
|
439
|
+
// If selectionType is 'MULTIPLE' and minSelection and maxSelection are not specified, set them to undefined
|
|
440
|
+
if (this.selectionType === 'MULTIPLE' &&
|
|
441
|
+
!this.minimumSelection &&
|
|
442
|
+
!this.maximumSelection) {
|
|
443
|
+
this.minimumSelection = undefined;
|
|
444
|
+
this.maximumSelection = undefined;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
onCheckboxChange(option, event) {
|
|
448
|
+
if (this.selectionType === 'SINGLE') {
|
|
449
|
+
// Clear previously selected options for single selection type
|
|
450
|
+
this.selectedOptions = [];
|
|
451
|
+
}
|
|
452
|
+
if (event.target.checked) {
|
|
453
|
+
// Add the selected option if it's not already in the list
|
|
454
|
+
if (!this.selectedOptions.includes(option)) {
|
|
455
|
+
this.selectedOptions.push(option);
|
|
456
|
+
this.isMinimumSelectionValid();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
// Remove the selected option
|
|
461
|
+
this.selectedOptions = this.selectedOptions.filter((item) => item !== option);
|
|
462
|
+
this.isMinimumSelectionValid();
|
|
463
|
+
}
|
|
464
|
+
// Check if the number of selected options exceeds the maximum allowed
|
|
465
|
+
if (this.maximumSelection !== undefined &&
|
|
466
|
+
this.selectedOptions.length > this.maximumSelection) {
|
|
467
|
+
// If exceeded, uncheck the last selected option
|
|
468
|
+
event.target.checked = false;
|
|
469
|
+
// Remove the unchecked option from the selectedOptions array
|
|
470
|
+
this.selectedOptions = this.selectedOptions.filter((item) => item !== option);
|
|
471
|
+
// You can add a message to inform the user about the maximum selection limit if needed
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
fetchDataFromLookup() {
|
|
475
|
+
this.formService.fetchDataFromLookup(this.lookupTable).subscribe((response) => {
|
|
476
|
+
this.customOptions = response.result.values.map((item) => ({
|
|
477
|
+
value: item.value,
|
|
478
|
+
label: item.label,
|
|
479
|
+
}));
|
|
480
|
+
}, (error) => {
|
|
481
|
+
console.error('HTTP Error:', error);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
fetchDataFromDatabase() {
|
|
485
|
+
const transformedDatabase = this.transformDatabaseObject(this.database);
|
|
486
|
+
this.formService.fetchDataFromDatabase(transformedDatabase).subscribe((response) => {
|
|
487
|
+
if (response.success) {
|
|
488
|
+
this.customOptions = response.result.map((item) => ({
|
|
489
|
+
value: item.value,
|
|
490
|
+
label: item.label,
|
|
491
|
+
}));
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
console.error('Error fetching data from database:', response.message);
|
|
495
|
+
}
|
|
496
|
+
}, (error) => {
|
|
497
|
+
console.error('HTTP Error:', error);
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
transformDatabaseObject(database) {
|
|
501
|
+
return {
|
|
502
|
+
tableName: database.tableName,
|
|
503
|
+
valueField: database.valueField,
|
|
504
|
+
labelField: database.labelField,
|
|
505
|
+
criteria: database.criteria.map((criteria) => ({
|
|
506
|
+
field: criteria.field,
|
|
507
|
+
condition: criteria.condition,
|
|
508
|
+
value: criteria.inputValue,
|
|
509
|
+
logicalOperator: criteria.logicalOperator,
|
|
510
|
+
})),
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
fetchDataFromAPI() {
|
|
514
|
+
const apiConfig = this.api;
|
|
515
|
+
this.formService.fetchDataFromExternalAPI(apiConfig.url).subscribe((response) => {
|
|
516
|
+
const data = this.extractDataByPath(response, apiConfig.pathToValue);
|
|
517
|
+
this.customOptions = data.map((item) => ({
|
|
518
|
+
value: item[apiConfig.valueField],
|
|
519
|
+
label: item[apiConfig.labelField],
|
|
520
|
+
}));
|
|
521
|
+
}, (error) => {
|
|
522
|
+
console.error('HTTP Error:', error);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
extractDataByPath(data, path) {
|
|
526
|
+
return path.split('.').reduce((acc, part) => acc && acc[part], data);
|
|
527
|
+
}
|
|
528
|
+
isMinimumSelectionValid() {
|
|
529
|
+
this.validationFailed = false;
|
|
530
|
+
if (this.selectedOptions.length == 0 && this.required) {
|
|
531
|
+
this.validationFailed = true;
|
|
532
|
+
this.validationMessage = 'This is a required question';
|
|
533
|
+
this.validate.emit(this.validationFailed);
|
|
534
|
+
}
|
|
535
|
+
else if (this.minimumSelection !== undefined) {
|
|
536
|
+
if (this.selectedOptions.length < this.minimumSelection) {
|
|
537
|
+
this.validationFailed = true;
|
|
538
|
+
this.validationMessage = `Minimum ${this.minimumSelection} selection(s) required.`;
|
|
539
|
+
this.validate.emit(this.validationFailed);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
this.validate.emit(this.validationFailed);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
getOptions() {
|
|
547
|
+
if (this.optionType === 'OPTION') {
|
|
548
|
+
return this.customOptions;
|
|
549
|
+
}
|
|
550
|
+
else if (this.optionType === 'LOOKUP') {
|
|
551
|
+
return Object.values(this.lookupTable);
|
|
552
|
+
}
|
|
553
|
+
else if (this.optionType === 'API') {
|
|
554
|
+
return this.apiOptions.map((option) => option.valueField);
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
return [];
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
isOptionDisabled(option) {
|
|
561
|
+
return (this.maximumSelection !== undefined &&
|
|
562
|
+
this.selectedOptions.length >= this.maximumSelection &&
|
|
563
|
+
!this.selectedOptions.includes(option));
|
|
564
|
+
}
|
|
565
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CheckBoxFieldsComponent, deps: [{ token: FormService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
566
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CheckBoxFieldsComponent, selector: "lib-check-box-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-5 px-3\">\r\n <div class=\"input-wrapper mb-2\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <div class=\"form-check\" *ngFor=\"let option of customOptions\">\r\n <input\r\n class=\"form-check-input\"\r\n type=\"checkbox\"\r\n [id]=\"option.value + 'Checkbox'\"\r\n [name]=\"option.value + 'Checkbox'\"\r\n [value]=\"option.value\"\r\n (change)=\"onCheckboxChange(option, $event)\"\r\n [disabled]=\"isOptionDisabled(option)\"\r\n [checked]=\"selectedOptions.includes(option.value)\"\r\n />\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value + 'Checkbox'\"\r\n *ngIf=\"optionType == 'OPTION'\"\r\n >{{ option.value }}</label\r\n >\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value + 'Checkbox'\"\r\n *ngIf=\"optionType == 'LOOKUP' || 'DATABASE' || 'API'\"\r\n >{{ option.label }}</label\r\n >\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg\r\n class=\"validationSvg\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\"\r\n fill=\"#FF0000\"\r\n stroke=\"#FF0000\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M12 12.75L12 7.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\" />\r\n </svg>\r\n {{ validationMessage }}\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.form-check-input,.form-check-label{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
567
|
+
}
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CheckBoxFieldsComponent, decorators: [{
|
|
569
|
+
type: Component,
|
|
570
|
+
args: [{ selector: 'lib-check-box-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-5 px-3\">\r\n <div class=\"input-wrapper mb-2\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <div class=\"form-check\" *ngFor=\"let option of customOptions\">\r\n <input\r\n class=\"form-check-input\"\r\n type=\"checkbox\"\r\n [id]=\"option.value + 'Checkbox'\"\r\n [name]=\"option.value + 'Checkbox'\"\r\n [value]=\"option.value\"\r\n (change)=\"onCheckboxChange(option, $event)\"\r\n [disabled]=\"isOptionDisabled(option)\"\r\n [checked]=\"selectedOptions.includes(option.value)\"\r\n />\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value + 'Checkbox'\"\r\n *ngIf=\"optionType == 'OPTION'\"\r\n >{{ option.value }}</label\r\n >\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value + 'Checkbox'\"\r\n *ngIf=\"optionType == 'LOOKUP' || 'DATABASE' || 'API'\"\r\n >{{ option.label }}</label\r\n >\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg\r\n class=\"validationSvg\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\"\r\n fill=\"#FF0000\"\r\n stroke=\"#FF0000\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M12 12.75L12 7.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\" />\r\n </svg>\r\n {{ validationMessage }}\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.form-check-input,.form-check-label{cursor:pointer}\n"] }]
|
|
571
|
+
}], ctorParameters: function () { return [{ type: FormService }]; }, propDecorators: { question: [{
|
|
572
|
+
type: Input
|
|
573
|
+
}], validate: [{
|
|
574
|
+
type: Output
|
|
575
|
+
}] } });
|
|
576
|
+
|
|
577
|
+
class DateTimeFieldsComponent {
|
|
578
|
+
constructor() {
|
|
579
|
+
this.bsConfig = {
|
|
580
|
+
containerClass: 'theme-red', // Set the container class to apply the grey theme
|
|
581
|
+
};
|
|
582
|
+
this.question = {};
|
|
583
|
+
this.required = false;
|
|
584
|
+
this.hint = '';
|
|
585
|
+
this.count = 0;
|
|
586
|
+
this.dateType = '';
|
|
587
|
+
this.format = 'DD-MM-YYYY';
|
|
588
|
+
this.minDateOption = '';
|
|
589
|
+
this.maxDateOption = '';
|
|
590
|
+
this.todayDate = new Date(); // Current date
|
|
591
|
+
this.selectedDate = '';
|
|
592
|
+
this.selectedTime = '';
|
|
593
|
+
this.selectedDateRange = '';
|
|
594
|
+
this.selectedDateAndTime = '';
|
|
595
|
+
this.validationMessage = '';
|
|
596
|
+
this.validate = new EventEmitter();
|
|
597
|
+
}
|
|
598
|
+
ngOnInit() {
|
|
599
|
+
this.valueAssigned();
|
|
600
|
+
}
|
|
601
|
+
valueAssigned() {
|
|
602
|
+
this.count = this.question.count;
|
|
603
|
+
this.required = this.question.required;
|
|
604
|
+
this.hint = this.question.hint;
|
|
605
|
+
this.dateType = this.question.formElement.appearance.dateType;
|
|
606
|
+
this.format = this.question.formElement.appearance.format;
|
|
607
|
+
this.minDateOption = this.question.formElement.validation.minDateOption;
|
|
608
|
+
this.minDate = this.getMinDate();
|
|
609
|
+
this.maxDateOption = this.question.formElement.validation.maxDateOption;
|
|
610
|
+
this.maxDate = this.getMaxDate();
|
|
611
|
+
}
|
|
612
|
+
getMinDate() {
|
|
613
|
+
if (this.minDateOption === 'TODAY') {
|
|
614
|
+
return this.todayDate;
|
|
615
|
+
}
|
|
616
|
+
else if (this.minDateOption === 'CUSTOM') {
|
|
617
|
+
return new Date(this.question.formElement.validation.minDate);
|
|
618
|
+
}
|
|
619
|
+
return undefined; // Return undefined if no valid option
|
|
620
|
+
}
|
|
621
|
+
getMaxDate() {
|
|
622
|
+
if (this.maxDateOption === 'TODAY') {
|
|
623
|
+
return this.todayDate;
|
|
624
|
+
}
|
|
625
|
+
else if (this.maxDateOption === 'CUSTOM') {
|
|
626
|
+
return new Date(this.question.formElement.validation.maxDate);
|
|
627
|
+
}
|
|
628
|
+
return undefined; // Return undefined if no valid option
|
|
629
|
+
}
|
|
630
|
+
openDatePicker() {
|
|
631
|
+
this.datepicker.toggle();
|
|
632
|
+
}
|
|
633
|
+
openDateRangePicker() {
|
|
634
|
+
this.dateRangePicker.toggle();
|
|
635
|
+
}
|
|
636
|
+
openDateAndTimePicker() {
|
|
637
|
+
this.dateAndTimePicker.toggle();
|
|
638
|
+
}
|
|
639
|
+
validateField() {
|
|
640
|
+
if (this.dateType === 'DATE_ONLY') {
|
|
641
|
+
this.question.answer = String(this.selectedDate);
|
|
642
|
+
this.validateDateOnly();
|
|
643
|
+
}
|
|
644
|
+
else if (this.dateType === 'TIME_ONLY') {
|
|
645
|
+
this.question.answer = String(this.selectedTime);
|
|
646
|
+
this.validateTimeOnly();
|
|
647
|
+
}
|
|
648
|
+
else if (this.dateType === 'DATE_AND_TIME') {
|
|
649
|
+
this.question.answer = String(this.selectedDateAndTime);
|
|
650
|
+
this.validateDateAndTime();
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
this.question.answer = String(this.selectedDateRange);
|
|
654
|
+
this.validateDateRange();
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
validateDateOnly() {
|
|
658
|
+
this.validationFailed = false;
|
|
659
|
+
this.validationMessage = '';
|
|
660
|
+
if (this.required && !this.selectedDate) {
|
|
661
|
+
this.validationFailed = true;
|
|
662
|
+
this.validationMessage = 'This is a required question';
|
|
663
|
+
this.question.validation = false;
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
this.question.validation = true;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
validateTimeOnly() {
|
|
670
|
+
this.validationFailed = false;
|
|
671
|
+
this.validationMessage = '';
|
|
672
|
+
if (this.required && !this.selectedTime) {
|
|
673
|
+
this.validationFailed = true;
|
|
674
|
+
this.validationMessage = 'This is a required question';
|
|
675
|
+
;
|
|
676
|
+
this.question.validation = false;
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
this.question.validation = true;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
validateDateRange() {
|
|
683
|
+
this.validationFailed = false;
|
|
684
|
+
this.validationMessage = '';
|
|
685
|
+
if (this.required && !this.selectedDateRange) {
|
|
686
|
+
this.validationFailed = true;
|
|
687
|
+
this.validationMessage = 'This is a required question';
|
|
688
|
+
this.question.validation = false;
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
this.question.validation = true;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
validateDateAndTime() {
|
|
695
|
+
this.validationFailed = false;
|
|
696
|
+
this.validationMessage = '';
|
|
697
|
+
if (this.required && !this.selectedDateAndTime) {
|
|
698
|
+
this.validationFailed = true;
|
|
699
|
+
this.validationMessage = 'This is a required question';
|
|
700
|
+
this.question.validation = false;
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
this.question.validation = true;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateTimeFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
707
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DateTimeFieldsComponent, selector: "lib-date-time-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, viewQueries: [{ propertyName: "datepicker", first: true, predicate: ["datepickerYMD"], descendants: true }, { propertyName: "dateRangePicker", first: true, predicate: ["daterangepicker"], descendants: true }, { propertyName: "dateAndTimePicker", first: true, predicate: ["dateAndTimePicker"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-5 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <ng-container *ngIf=\"dateType === 'DATE_ONLY'\">\r\n <!-- Date only picker -->\r\n <div class=\"input-container\">\r\n <input\r\n class=\"form-control height\"\r\n #datepickerYMD=\"bsDatepicker\"\r\n bsDatepicker\r\n [minDate]=\"minDate ? minDate : todayDate\"\r\n [maxDate]=\"maxDate ? maxDate : todayDate\"\r\n [bsConfig]=\"{ dateInputFormat: format }\"\r\n [(ngModel)]=\"selectedDate\"\r\n (blur)=\"validateField()\"\r\n (ngModelChange)=\"validateField()\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <i class=\"fa-solid fa-calendar-days calendar-icon text-primary fs-5\" (click)=\"openDatePicker()\"></i>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dateType === 'TIME_ONLY'\">\r\n <!-- Time picker -->\r\n <input type=\"time\" class=\"form-control height\"\r\n (blur)=\"validateTimeOnly()\" \r\n [(ngModel)]=\"selectedTime\"\r\n (ngModelChange)=\"validateTimeOnly()\"\r\n [class.invalid]=\"validationFailed\"/>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dateType === 'DATE_AND_TIME'\">\r\n <!-- Date and time picker -->\r\n <div class=\"input-container\">\r\n <input\r\n #dateAndTimePicker=\"bsDatepicker\"\r\n type=\"text\"\r\n class=\"form-control height\"\r\n [minDate]=\"minDate ? minDate : todayDate\"\r\n [maxDate]=\"maxDate ? maxDate : todayDate\"\r\n [bsConfig]=\"{\r\n withTimepicker: true,\r\n keepDatepickerOpened: true,\r\n rangeInputFormat: format,\r\n dateInputFormat: format\r\n }\"\r\n bsDatepicker\r\n [class.invalid]=\"validationFailed\"\r\n [(ngModel)]=\"selectedDateAndTime\"\r\n (blur)=\"validateField()\"\r\n (ngModelChange)=\"validateField()\"\r\n />\r\n <i class=\"fa-solid fa-calendar-days calendar-icon text-primary fs-5\" (click)=\"openDateAndTimePicker()\"></i>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dateType === 'DATE_RANGE'\">\r\n <!-- Date range picker -->\r\n <div class=\"input-container\">\r\n <input\r\n type=\"text\"\r\n class=\"form-control height\"\r\n #daterangepicker=\"bsDaterangepicker\"\r\n bsDaterangepicker\r\n [minDate]=\"minDate ? minDate : todayDate\"\r\n [maxDate]=\"maxDate ? maxDate : todayDate\"\r\n [bsConfig]=\"{\r\n rangeInputFormat: format,\r\n dateInputFormat: format,\r\n showWeekNumbers: false\r\n }\"\r\n [(ngModel)]=\"selectedDateRange\"\r\n (blur)=\"validateField()\"\r\n (ngModelChange)=\"validateField()\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <i class=\"fa-solid fa-calendar-days calendar-icon text-primary fs-5\" (click)=\"openDateRangePicker()\"></i>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.input-container{position:relative}.input-container .form-control{padding-right:30px}.input-container .calendar-icon{position:absolute;top:50%;right:10px;transform:translateY(-50%);cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3.BsDatepickerDirective, selector: "[bsDatepicker]", inputs: ["placement", "triggers", "outsideClick", "container", "outsideEsc", "isDisabled", "minDate", "maxDate", "minMode", "daysDisabled", "datesDisabled", "datesEnabled", "dateCustomClasses", "dateTooltipTexts", "isOpen", "bsValue", "bsConfig"], outputs: ["onShown", "onHidden", "bsValueChange"], exportAs: ["bsDatepicker"] }, { kind: "directive", type: i3.BsDatepickerInputDirective, selector: "input[bsDatepicker]" }, { kind: "directive", type: i3.BsDaterangepickerDirective, selector: "[bsDaterangepicker]", inputs: ["placement", "triggers", "outsideClick", "container", "outsideEsc", "isOpen", "bsValue", "bsConfig", "isDisabled", "minDate", "maxDate", "dateCustomClasses", "daysDisabled", "datesDisabled", "datesEnabled"], outputs: ["onShown", "onHidden", "bsValueChange"], exportAs: ["bsDaterangepicker"] }, { kind: "directive", type: i3.BsDaterangepickerInputDirective, selector: "input[bsDaterangepicker]" }] }); }
|
|
708
|
+
}
|
|
709
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateTimeFieldsComponent, decorators: [{
|
|
710
|
+
type: Component,
|
|
711
|
+
args: [{ selector: 'lib-date-time-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-5 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <ng-container *ngIf=\"dateType === 'DATE_ONLY'\">\r\n <!-- Date only picker -->\r\n <div class=\"input-container\">\r\n <input\r\n class=\"form-control height\"\r\n #datepickerYMD=\"bsDatepicker\"\r\n bsDatepicker\r\n [minDate]=\"minDate ? minDate : todayDate\"\r\n [maxDate]=\"maxDate ? maxDate : todayDate\"\r\n [bsConfig]=\"{ dateInputFormat: format }\"\r\n [(ngModel)]=\"selectedDate\"\r\n (blur)=\"validateField()\"\r\n (ngModelChange)=\"validateField()\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <i class=\"fa-solid fa-calendar-days calendar-icon text-primary fs-5\" (click)=\"openDatePicker()\"></i>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dateType === 'TIME_ONLY'\">\r\n <!-- Time picker -->\r\n <input type=\"time\" class=\"form-control height\"\r\n (blur)=\"validateTimeOnly()\" \r\n [(ngModel)]=\"selectedTime\"\r\n (ngModelChange)=\"validateTimeOnly()\"\r\n [class.invalid]=\"validationFailed\"/>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dateType === 'DATE_AND_TIME'\">\r\n <!-- Date and time picker -->\r\n <div class=\"input-container\">\r\n <input\r\n #dateAndTimePicker=\"bsDatepicker\"\r\n type=\"text\"\r\n class=\"form-control height\"\r\n [minDate]=\"minDate ? minDate : todayDate\"\r\n [maxDate]=\"maxDate ? maxDate : todayDate\"\r\n [bsConfig]=\"{\r\n withTimepicker: true,\r\n keepDatepickerOpened: true,\r\n rangeInputFormat: format,\r\n dateInputFormat: format\r\n }\"\r\n bsDatepicker\r\n [class.invalid]=\"validationFailed\"\r\n [(ngModel)]=\"selectedDateAndTime\"\r\n (blur)=\"validateField()\"\r\n (ngModelChange)=\"validateField()\"\r\n />\r\n <i class=\"fa-solid fa-calendar-days calendar-icon text-primary fs-5\" (click)=\"openDateAndTimePicker()\"></i>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"dateType === 'DATE_RANGE'\">\r\n <!-- Date range picker -->\r\n <div class=\"input-container\">\r\n <input\r\n type=\"text\"\r\n class=\"form-control height\"\r\n #daterangepicker=\"bsDaterangepicker\"\r\n bsDaterangepicker\r\n [minDate]=\"minDate ? minDate : todayDate\"\r\n [maxDate]=\"maxDate ? maxDate : todayDate\"\r\n [bsConfig]=\"{\r\n rangeInputFormat: format,\r\n dateInputFormat: format,\r\n showWeekNumbers: false\r\n }\"\r\n [(ngModel)]=\"selectedDateRange\"\r\n (blur)=\"validateField()\"\r\n (ngModelChange)=\"validateField()\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <i class=\"fa-solid fa-calendar-days calendar-icon text-primary fs-5\" (click)=\"openDateRangePicker()\"></i>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mt-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n </ng-container>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.input-container{position:relative}.input-container .form-control{padding-right:30px}.input-container .calendar-icon{position:absolute;top:50%;right:10px;transform:translateY(-50%);cursor:pointer}\n"] }]
|
|
712
|
+
}], propDecorators: { question: [{
|
|
713
|
+
type: Input
|
|
714
|
+
}], datepicker: [{
|
|
715
|
+
type: ViewChild,
|
|
716
|
+
args: ['datepickerYMD']
|
|
717
|
+
}], dateRangePicker: [{
|
|
718
|
+
type: ViewChild,
|
|
719
|
+
args: ['daterangepicker']
|
|
720
|
+
}], dateAndTimePicker: [{
|
|
721
|
+
type: ViewChild,
|
|
722
|
+
args: ['dateAndTimePicker']
|
|
723
|
+
}], validate: [{
|
|
724
|
+
type: Output
|
|
725
|
+
}] } });
|
|
726
|
+
|
|
727
|
+
class DropDownFieldsComponent {
|
|
728
|
+
constructor(formService) {
|
|
729
|
+
this.formService = formService;
|
|
730
|
+
this.question = {};
|
|
731
|
+
this.count = 0;
|
|
732
|
+
this.required = false;
|
|
733
|
+
this.hint = '';
|
|
734
|
+
this.selectionType = '';
|
|
735
|
+
this.minimumSelection = 0;
|
|
736
|
+
this.maximumSelection = 0;
|
|
737
|
+
this.optionType = '';
|
|
738
|
+
this.lookupTable = '';
|
|
739
|
+
this.customOptions = [];
|
|
740
|
+
this.database = {};
|
|
741
|
+
this.api = {};
|
|
742
|
+
this.selectedValue = [];
|
|
743
|
+
this.validationMessage = '';
|
|
744
|
+
this.validate = new EventEmitter();
|
|
745
|
+
}
|
|
746
|
+
ngOnInit() {
|
|
747
|
+
this.valueAssigned();
|
|
748
|
+
}
|
|
749
|
+
onValueChange(newValue) {
|
|
750
|
+
this.selectedValue = newValue;
|
|
751
|
+
this.selectItems();
|
|
752
|
+
}
|
|
753
|
+
valueAssigned() {
|
|
754
|
+
console.log('Question', this.question);
|
|
755
|
+
this.count = this.question.count;
|
|
756
|
+
this.required = this.question.required;
|
|
757
|
+
this.hint = this.question.hint;
|
|
758
|
+
this.selectionType = this.question.formElement.appearance.selectionType;
|
|
759
|
+
this.minimumSelection =
|
|
760
|
+
this.question.formElement.validation.minimumSelection;
|
|
761
|
+
this.maximumSelection =
|
|
762
|
+
this.question.formElement.validation.maximumSelection;
|
|
763
|
+
this.optionType = this.question.formElement.option.optionType;
|
|
764
|
+
switch (this.optionType) {
|
|
765
|
+
case 'OPTION':
|
|
766
|
+
this.customOptions = this.question.formElement.option.customOptions.map((option) => ({
|
|
767
|
+
label: option.value,
|
|
768
|
+
value: '',
|
|
769
|
+
image: '',
|
|
770
|
+
}));
|
|
771
|
+
break;
|
|
772
|
+
case 'LOOKUP':
|
|
773
|
+
this.lookupTable = this.question.formElement.option.lookupTable;
|
|
774
|
+
this.fetchDataFromLookup();
|
|
775
|
+
break;
|
|
776
|
+
case 'DATABASE':
|
|
777
|
+
this.database = this.question.formElement.option.database;
|
|
778
|
+
this.fetchDataFromDatabase();
|
|
779
|
+
break;
|
|
780
|
+
case 'API':
|
|
781
|
+
this.api = this.question.formElement.option.api;
|
|
782
|
+
this.fetchDataFromAPI();
|
|
783
|
+
break;
|
|
784
|
+
default:
|
|
785
|
+
console.warn('Unknown option type:', this.optionType);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
transformDatabaseObject(database) {
|
|
789
|
+
return {
|
|
790
|
+
tableName: database.tableName,
|
|
791
|
+
valueField: database.valueField,
|
|
792
|
+
labelField: database.labelField,
|
|
793
|
+
criteria: database.criteria.map((criteria) => ({
|
|
794
|
+
field: criteria.field,
|
|
795
|
+
condition: criteria.condition,
|
|
796
|
+
value: criteria.inputValue,
|
|
797
|
+
logicalOperator: criteria.logicalOperator,
|
|
798
|
+
})),
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
fetchDataFromDatabase() {
|
|
802
|
+
const transformedDatabase = this.transformDatabaseObject(this.database);
|
|
803
|
+
this.formService.fetchDataFromDatabase(transformedDatabase).subscribe((response) => {
|
|
804
|
+
if (response.success) {
|
|
805
|
+
this.customOptions = response.result.map((item) => ({
|
|
806
|
+
value: item.value,
|
|
807
|
+
label: item.label,
|
|
808
|
+
}));
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
console.error('Error fetching data from database:', response.message);
|
|
812
|
+
}
|
|
813
|
+
}, (error) => {
|
|
814
|
+
console.error('HTTP Error:', error);
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
fetchDataFromLookup() {
|
|
818
|
+
this.formService.fetchDataFromLookup(this.lookupTable).subscribe((response) => {
|
|
819
|
+
this.customOptions = response.result.values.map((item) => ({
|
|
820
|
+
value: item.value,
|
|
821
|
+
label: item.label,
|
|
822
|
+
}));
|
|
823
|
+
}, (error) => {
|
|
824
|
+
console.error('HTTP Error:', error);
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
fetchDataFromAPI() {
|
|
828
|
+
const apiConfig = this.api;
|
|
829
|
+
this.formService.fetchDataFromExternalAPI(apiConfig.url).subscribe((response) => {
|
|
830
|
+
const data = this.extractDataByPath(response, apiConfig.pathToValue);
|
|
831
|
+
this.customOptions = data.map((item) => ({
|
|
832
|
+
value: item[apiConfig.valueField],
|
|
833
|
+
label: item[apiConfig.labelField],
|
|
834
|
+
}));
|
|
835
|
+
}, (error) => {
|
|
836
|
+
console.error('HTTP Error:', error);
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
extractDataByPath(data, path) {
|
|
840
|
+
return path.split('.').reduce((acc, part) => acc && acc[part], data);
|
|
841
|
+
}
|
|
842
|
+
selectItems() {
|
|
843
|
+
this.validationFailed = false;
|
|
844
|
+
this.validationMessage = '';
|
|
845
|
+
if (this.selectedValue.length == 0 && this.required) {
|
|
846
|
+
this.validationFailed = true;
|
|
847
|
+
this.validationMessage = `This is a required question`;
|
|
848
|
+
this.validate.emit(this.validationFailed);
|
|
849
|
+
}
|
|
850
|
+
else if (this.selectedValue.length < this.minimumSelection ||
|
|
851
|
+
this.selectedValue.length > this.maximumSelection) {
|
|
852
|
+
this.validationFailed = true;
|
|
853
|
+
this.validationMessage = `selected options must be between ${this.minimumSelection} & ${this.maximumSelection}`;
|
|
854
|
+
this.validate.emit(this.validationFailed);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropDownFieldsComponent, deps: [{ token: FormService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
858
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DropDownFieldsComponent, selector: "lib-drop-down-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-5 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <lib-dropdown\r\n [items]=\"customOptions\"\r\n [multiple]=\"selectionType === 'SINGLE' ? false : true\"\r\n ></lib-dropdown>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mb-2\">\r\n <svg\r\n class=\"validationSvg\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\"\r\n fill=\"#FF0000\"\r\n stroke=\"#FF0000\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M12 12.75L12 7.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\" />\r\n </svg>\r\n {{ validationMessage }}\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.DropdownComponent, selector: "lib-dropdown", inputs: ["multiple", "scrollable", "selectedItems", "placeholder", "items", "showCreateNew", "selectedValues", "customButtons", "showBorder"], outputs: ["buttonClick", "selectedItemsChange", "onScroll", "onCreateNew", "onSearch"] }] }); }
|
|
859
|
+
}
|
|
860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DropDownFieldsComponent, decorators: [{
|
|
861
|
+
type: Component,
|
|
862
|
+
args: [{ selector: 'lib-drop-down-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-5 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <lib-dropdown\r\n [items]=\"customOptions\"\r\n [multiple]=\"selectionType === 'SINGLE' ? false : true\"\r\n ></lib-dropdown>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mb-2\">\r\n <svg\r\n class=\"validationSvg\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\"\r\n fill=\"#FF0000\"\r\n stroke=\"#FF0000\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M12 12.75L12 7.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\" />\r\n </svg>\r\n {{ validationMessage }}\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
863
|
+
}], ctorParameters: function () { return [{ type: FormService }]; }, propDecorators: { question: [{
|
|
864
|
+
type: Input
|
|
865
|
+
}], validate: [{
|
|
866
|
+
type: Output
|
|
867
|
+
}] } });
|
|
868
|
+
|
|
869
|
+
class FilePickerFieldsComponent {
|
|
870
|
+
constructor() {
|
|
871
|
+
this.question = {};
|
|
872
|
+
this.count = 0;
|
|
873
|
+
this.required = false;
|
|
874
|
+
this.hint = '';
|
|
875
|
+
this.multiFileUploads = true;
|
|
876
|
+
this.fileTypes = [];
|
|
877
|
+
this.fileSize = 0;
|
|
878
|
+
this.fileSizeUnit = '';
|
|
879
|
+
this.totalFileSize = 0;
|
|
880
|
+
this.dragAndDrop = true;
|
|
881
|
+
this.previewUploadedFiles = true;
|
|
882
|
+
this.validationFailed = false;
|
|
883
|
+
this.validationMessage = '';
|
|
884
|
+
}
|
|
885
|
+
handleFileTypeNotAllowed(fileType) {
|
|
886
|
+
console.log(`File type not allowed in app: ${fileType}`);
|
|
887
|
+
this.validationFailed = true;
|
|
888
|
+
this.validationMessage = 'File type not allowed';
|
|
889
|
+
}
|
|
890
|
+
handleFileSize(fileType) {
|
|
891
|
+
console.log(`maximum limit app: ${fileType}`);
|
|
892
|
+
}
|
|
893
|
+
handleFinalArray(fileType) {
|
|
894
|
+
const extractedData = fileType.map((item) => ({
|
|
895
|
+
name: item._file.name,
|
|
896
|
+
size: item._file.size,
|
|
897
|
+
type: item._file.type,
|
|
898
|
+
}));
|
|
899
|
+
const jsonString = JSON.stringify(extractedData);
|
|
900
|
+
}
|
|
901
|
+
ngOnInit() {
|
|
902
|
+
this.valueAssigned();
|
|
903
|
+
}
|
|
904
|
+
valueAssigned() {
|
|
905
|
+
this.count = this.question.count;
|
|
906
|
+
this.required = this.question.required;
|
|
907
|
+
this.hint = this.question.hint;
|
|
908
|
+
this.multiFileUploads =
|
|
909
|
+
this.question.formElement.appearance.multiFileUploads;
|
|
910
|
+
this.dragAndDrop = this.question.formElement.appearance.dragAndDrop;
|
|
911
|
+
this.previewUploadedFiles =
|
|
912
|
+
this.question.formElement.appearance.previewUploadedFiles;
|
|
913
|
+
this.fileTypes = this.question.formElement.validation.fileTypes;
|
|
914
|
+
this.fileSizeUnit = this.question.formElement.validation.fileSizeUnit;
|
|
915
|
+
this.fileSize = this.convertToBytes(this.question.formElement.validation.fileSize, this.fileSizeUnit);
|
|
916
|
+
if (this.multiFileUploads) {
|
|
917
|
+
this.totalFileSize = this.convertToBytes(this.question.formElement.validation.totalFileSize, this.fileSizeUnit);
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
this.totalFileSize = this.fileSize;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
convertToBytes(size, unit) {
|
|
924
|
+
const units = {
|
|
925
|
+
B: 1,
|
|
926
|
+
KB: 1024,
|
|
927
|
+
MB: 1024 * 1024,
|
|
928
|
+
GB: 1024 * 1024 * 1024,
|
|
929
|
+
};
|
|
930
|
+
return size * (units[unit.toUpperCase()] || 1);
|
|
931
|
+
}
|
|
932
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilePickerFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
933
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FilePickerFieldsComponent, selector: "lib-file-picker-fields", inputs: { question: "question" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <lib-docUpload\r\n [totalSize]=\"totalFileSize\"\r\n [fileAllowed]=\"fileTypes\"\r\n [multiple]=\"multiFileUploads\"\r\n (fileTypeNotAllowed)=\"handleFileTypeNotAllowed($event)\"\r\n (fileSizeAllowed)=\"handleFileSize($event)\"\r\n (finalArray)=\"handleFinalArray($event)\"\r\n ></lib-docUpload>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.fileInput{position:relative;height:44px;width:111px;background:#d3d3d3;border-radius:6px;padding:0 16px;display:flex;align-items:center;justify-content:center;cursor:pointer}.fileInput input{opacity:0;position:absolute;left:0;top:0;width:100%;height:inherit}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.DocUploadComponent, selector: "lib-docUpload", inputs: ["totalSize", "fileAllowed", "multiple"], outputs: ["fileTypeNotAllowed", "fileSizeAllowed", "finalArray"] }] }); }
|
|
934
|
+
}
|
|
935
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilePickerFieldsComponent, decorators: [{
|
|
936
|
+
type: Component,
|
|
937
|
+
args: [{ selector: 'lib-file-picker-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <lib-docUpload\r\n [totalSize]=\"totalFileSize\"\r\n [fileAllowed]=\"fileTypes\"\r\n [multiple]=\"multiFileUploads\"\r\n (fileTypeNotAllowed)=\"handleFileTypeNotAllowed($event)\"\r\n (fileSizeAllowed)=\"handleFileSize($event)\"\r\n (finalArray)=\"handleFinalArray($event)\"\r\n ></lib-docUpload>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.fileInput{position:relative;height:44px;width:111px;background:#d3d3d3;border-radius:6px;padding:0 16px;display:flex;align-items:center;justify-content:center;cursor:pointer}.fileInput input{opacity:0;position:absolute;left:0;top:0;width:100%;height:inherit}\n"] }]
|
|
938
|
+
}], propDecorators: { question: [{
|
|
939
|
+
type: Input
|
|
940
|
+
}] } });
|
|
941
|
+
|
|
942
|
+
class LocationFieldsComponent {
|
|
943
|
+
constructor() {
|
|
944
|
+
this.question = {};
|
|
945
|
+
this.count = 0;
|
|
946
|
+
this.required = false;
|
|
947
|
+
this.hint = '';
|
|
948
|
+
this.defaultZoomLevel = 0;
|
|
949
|
+
this.setCurrentPosition = false;
|
|
950
|
+
this.allowFullScreen = false;
|
|
951
|
+
this.latitude = 0;
|
|
952
|
+
this.longitude = 0;
|
|
953
|
+
this.regionBoundary = false;
|
|
954
|
+
this.region = '';
|
|
955
|
+
this.mapConfigurations = {};
|
|
956
|
+
}
|
|
957
|
+
ngOnInit() {
|
|
958
|
+
this.count = this.question.count;
|
|
959
|
+
this.required = this.question.required;
|
|
960
|
+
this.hint = this.question.hint;
|
|
961
|
+
this.defaultZoomLevel =
|
|
962
|
+
this.question.formElement.appearance.defaultZoomLevel;
|
|
963
|
+
this.setCurrentPosition =
|
|
964
|
+
this.question.formElement.appearance.setCurrentPosition;
|
|
965
|
+
this.allowFullScreen = this.question.formElement.appearance.allowFullScreen;
|
|
966
|
+
this.latitude = this.question.formElement.appearance.latitude;
|
|
967
|
+
this.longitude = this.question.formElement.appearance.longitude;
|
|
968
|
+
this.regionBoundary = this.question.formElement.validation.regionBoundary;
|
|
969
|
+
this.region = this.question.formElement.validation.region;
|
|
970
|
+
this.mapConfigurations = {
|
|
971
|
+
disableDefaultUI: true,
|
|
972
|
+
fullscreenControl: this.allowFullScreen,
|
|
973
|
+
zoomControl: true,
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
ngAfterViewInit() {
|
|
977
|
+
const searchBox = new google.maps.places.SearchBox(this.searchField.nativeElement);
|
|
978
|
+
this.map.controls[google.maps.ControlPosition.TOP_CENTER].push(this.searchField.nativeElement);
|
|
979
|
+
searchBox.addListener('places_changed', () => {
|
|
980
|
+
const places = searchBox.getPlaces();
|
|
981
|
+
if (places?.length === 0) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
const bounds = new google.maps.LatLngBounds();
|
|
985
|
+
places?.forEach((place) => {
|
|
986
|
+
if (!place.geometry || !place.geometry.location) {
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
if (place.geometry.viewport) {
|
|
990
|
+
// Only geocodes have viewport.
|
|
991
|
+
bounds.union(place.geometry.viewport);
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
bounds.extend(place.geometry.location);
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
this.map.fitBounds(bounds);
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocationFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1001
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LocationFieldsComponent, selector: "lib-location-fields", inputs: { question: "question" }, viewQueries: [{ propertyName: "searchField", first: true, predicate: ["mapSearchField"], descendants: true }, { propertyName: "map", first: true, predicate: GoogleMap, descendants: true }], ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <div class=\"input-group\">\r\n <input\r\n type=\"text\"\r\n class=\"form-control location-input\"\r\n placeholder=\"Enter location\"\r\n #locationInput\r\n />\r\n </div>\r\n\r\n <input #mapSearchField class=\"my-map-search-field\" type=\"text\"/>\r\n <google-map\r\n width=\"100%\"\r\n [options]=\"mapConfigurations\"\r\n ></google-map>\r\n</div>", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.location-input{position:relative}.input-group-append{cursor:pointer;position:absolute;top:50%;right:10px;transform:translateY(-50%)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.GoogleMap, selector: "google-map", inputs: ["height", "width", "mapTypeId", "center", "zoom", "options"], outputs: ["mapInitialized", "authFailure", "boundsChanged", "centerChanged", "mapClick", "mapDblclick", "mapDrag", "mapDragend", "mapDragstart", "headingChanged", "idle", "maptypeidChanged", "mapMousemove", "mapMouseout", "mapMouseover", "projectionChanged", "mapRightclick", "tilesloaded", "tiltChanged", "zoomChanged"], exportAs: ["googleMap"] }] }); }
|
|
1002
|
+
}
|
|
1003
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocationFieldsComponent, decorators: [{
|
|
1004
|
+
type: Component,
|
|
1005
|
+
args: [{ selector: 'lib-location-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <div class=\"input-group\">\r\n <input\r\n type=\"text\"\r\n class=\"form-control location-input\"\r\n placeholder=\"Enter location\"\r\n #locationInput\r\n />\r\n </div>\r\n\r\n <input #mapSearchField class=\"my-map-search-field\" type=\"text\"/>\r\n <google-map\r\n width=\"100%\"\r\n [options]=\"mapConfigurations\"\r\n ></google-map>\r\n</div>", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.location-input{position:relative}.input-group-append{cursor:pointer;position:absolute;top:50%;right:10px;transform:translateY(-50%)}\n"] }]
|
|
1006
|
+
}], propDecorators: { question: [{
|
|
1007
|
+
type: Input
|
|
1008
|
+
}], searchField: [{
|
|
1009
|
+
type: ViewChild,
|
|
1010
|
+
args: ['mapSearchField']
|
|
1011
|
+
}], map: [{
|
|
1012
|
+
type: ViewChild,
|
|
1013
|
+
args: [GoogleMap]
|
|
1014
|
+
}] } });
|
|
1015
|
+
|
|
1016
|
+
class MailFieldsComponent {
|
|
1017
|
+
constructor() {
|
|
1018
|
+
this.question = {};
|
|
1019
|
+
this.count = 0;
|
|
1020
|
+
this.required = false;
|
|
1021
|
+
this.hint = '';
|
|
1022
|
+
this.placeholder = '';
|
|
1023
|
+
this.expectedDomains = [];
|
|
1024
|
+
this.regularExpression = '';
|
|
1025
|
+
this.email = '';
|
|
1026
|
+
this.validationFailed = false;
|
|
1027
|
+
this.validationMessage = '';
|
|
1028
|
+
this.validate = new EventEmitter();
|
|
1029
|
+
}
|
|
1030
|
+
ngOnInit() {
|
|
1031
|
+
this.valueAssigned();
|
|
1032
|
+
}
|
|
1033
|
+
valueAssigned() {
|
|
1034
|
+
this.count = this.question.count;
|
|
1035
|
+
this.required = this.question.required;
|
|
1036
|
+
this.hint = this.question.hint;
|
|
1037
|
+
this.placeholder = this.question.formElement.appearance.placeholder;
|
|
1038
|
+
this.expectedDomains =
|
|
1039
|
+
this.question?.formElement?.validation?.expectedDomains
|
|
1040
|
+
?.split(',')
|
|
1041
|
+
.map((domain) => domain.trim());
|
|
1042
|
+
this.regularExpression =
|
|
1043
|
+
this.question.formElement.validation.regularExpression;
|
|
1044
|
+
}
|
|
1045
|
+
validateEmail() {
|
|
1046
|
+
this.validationFailed = false;
|
|
1047
|
+
this.validationMessage = '';
|
|
1048
|
+
const enteredEmail = this.email.trim().toLowerCase();
|
|
1049
|
+
if (this.required && !this.email) {
|
|
1050
|
+
this.validationFailed = true;
|
|
1051
|
+
this.validationMessage = 'This is a required question';
|
|
1052
|
+
this.validate.emit(this.validationFailed);
|
|
1053
|
+
this.question.validation = false;
|
|
1054
|
+
}
|
|
1055
|
+
else if (this.expectedDomains) {
|
|
1056
|
+
const isValidEmail = this.expectedDomains?.some((domain) => enteredEmail.endsWith(domain));
|
|
1057
|
+
this.validationFailed = !isValidEmail;
|
|
1058
|
+
this.validationMessage = 'Please enter valid email address';
|
|
1059
|
+
if (this.validationFailed) {
|
|
1060
|
+
this.validate.emit(this.validationFailed);
|
|
1061
|
+
this.question.validation = false;
|
|
1062
|
+
}
|
|
1063
|
+
else {
|
|
1064
|
+
this.question.validation = true;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
else {
|
|
1068
|
+
this.question.validation = true;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
validateInput(event) {
|
|
1072
|
+
this.question.answer = event.target.value;
|
|
1073
|
+
this.validateEmail();
|
|
1074
|
+
}
|
|
1075
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MailFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1076
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MailFieldsComponent, selector: "lib-mail-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <input\r\n type=\"email\"\r\n class=\"form-control mb-2 height\"\r\n [placeholder]=\"placeholder\"\r\n [(ngModel)]=\"email\"\r\n (blur)=\"validateEmail()\"\r\n (input)=\"validateInput($event)\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1077
|
+
}
|
|
1078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MailFieldsComponent, decorators: [{
|
|
1079
|
+
type: Component,
|
|
1080
|
+
args: [{ selector: 'lib-mail-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <input\r\n type=\"email\"\r\n class=\"form-control mb-2 height\"\r\n [placeholder]=\"placeholder\"\r\n [(ngModel)]=\"email\"\r\n (blur)=\"validateEmail()\"\r\n (input)=\"validateInput($event)\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
1081
|
+
}], propDecorators: { question: [{
|
|
1082
|
+
type: Input
|
|
1083
|
+
}], validate: [{
|
|
1084
|
+
type: Output
|
|
1085
|
+
}] } });
|
|
1086
|
+
|
|
1087
|
+
class CountryService {
|
|
1088
|
+
constructor(http, dataService) {
|
|
1089
|
+
this.http = http;
|
|
1090
|
+
this.dataService = dataService;
|
|
1091
|
+
this.apiUrl = '';
|
|
1092
|
+
this.header = {};
|
|
1093
|
+
this.dataService.apiUrl$.subscribe((data) => {
|
|
1094
|
+
this.apiUrl = data;
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
loadCountryDetails() {
|
|
1098
|
+
return this.http.get(`${this.apiUrl}/api/public/json/country`);
|
|
1099
|
+
}
|
|
1100
|
+
processCountryDetails(data, displayFlag, displayCode, showCountryName) {
|
|
1101
|
+
const countryDetails = [];
|
|
1102
|
+
data.forEach((country) => {
|
|
1103
|
+
const name = showCountryName ? country.name || '' : '';
|
|
1104
|
+
let flag = '';
|
|
1105
|
+
if (displayFlag && country.flag) {
|
|
1106
|
+
flag = country.flag;
|
|
1107
|
+
}
|
|
1108
|
+
if (displayCode &&
|
|
1109
|
+
country.isd &&
|
|
1110
|
+
country.isd.root &&
|
|
1111
|
+
country.isd.suffixes?.length > 0) {
|
|
1112
|
+
country.isd.suffixes.forEach((suffix) => {
|
|
1113
|
+
const isdCode = `${country.isd.root}${suffix}`;
|
|
1114
|
+
countryDetails.push({
|
|
1115
|
+
value: isdCode,
|
|
1116
|
+
label: `${name} ${isdCode}`,
|
|
1117
|
+
image: flag,
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
else if (displayCode) {
|
|
1122
|
+
countryDetails.push({
|
|
1123
|
+
value: name,
|
|
1124
|
+
label: country.isd?.root || '',
|
|
1125
|
+
image: flag,
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
else if (!displayCode && !displayFlag) {
|
|
1129
|
+
countryDetails.push({
|
|
1130
|
+
value: name,
|
|
1131
|
+
label: '',
|
|
1132
|
+
image: '',
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
return countryDetails;
|
|
1137
|
+
}
|
|
1138
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CountryService, deps: [{ token: i1.HttpClient }, { token: DataService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1139
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CountryService, providedIn: 'root' }); }
|
|
1140
|
+
}
|
|
1141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CountryService, decorators: [{
|
|
1142
|
+
type: Injectable,
|
|
1143
|
+
args: [{
|
|
1144
|
+
providedIn: 'root',
|
|
1145
|
+
}]
|
|
1146
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: DataService }]; } });
|
|
1147
|
+
|
|
1148
|
+
class MobileFieldsComponent {
|
|
1149
|
+
constructor(countryService) {
|
|
1150
|
+
this.countryService = countryService;
|
|
1151
|
+
this.question = {};
|
|
1152
|
+
this.count = 0;
|
|
1153
|
+
this.required = false;
|
|
1154
|
+
this.hint = '';
|
|
1155
|
+
this.placeholder = '';
|
|
1156
|
+
this.displayCountryCode = true;
|
|
1157
|
+
this.displayFlag = true;
|
|
1158
|
+
this.displayCode = true;
|
|
1159
|
+
this.showCountryName = true;
|
|
1160
|
+
this.beautifyNumbers = true;
|
|
1161
|
+
this.countryWiseValidation = true;
|
|
1162
|
+
this.restrictCountry = true;
|
|
1163
|
+
this.allowedCountry = [];
|
|
1164
|
+
this.blockedCountry = [];
|
|
1165
|
+
this.countryDetails = [];
|
|
1166
|
+
this.selectedCountry = [];
|
|
1167
|
+
this.validationFailed = false;
|
|
1168
|
+
this.validationMessage = '';
|
|
1169
|
+
this.mobileNumber = '';
|
|
1170
|
+
this.filteredCountry = [];
|
|
1171
|
+
this.validate = new EventEmitter();
|
|
1172
|
+
}
|
|
1173
|
+
ngOnInit() {
|
|
1174
|
+
this.valueAssigned();
|
|
1175
|
+
}
|
|
1176
|
+
valueAssigned() {
|
|
1177
|
+
this.count = this.question.count;
|
|
1178
|
+
this.required = this.question.required;
|
|
1179
|
+
this.hint = this.question.hint;
|
|
1180
|
+
this.placeholder = this.question.formElement.appearance.placeholder;
|
|
1181
|
+
this.displayCountryCode =
|
|
1182
|
+
this.question.formElement.appearance.displayCountryCode;
|
|
1183
|
+
this.displayFlag = this.question.formElement.appearance.displayFlag;
|
|
1184
|
+
this.displayCode = this.question.formElement.appearance.displayCode;
|
|
1185
|
+
this.showCountryName = this.question.formElement.appearance.showCountryName;
|
|
1186
|
+
this.beautifyNumbers = this.question.formElement.appearance.beautifyNumbers;
|
|
1187
|
+
this.countryWiseValidation =
|
|
1188
|
+
this.question.formElement.validation.countryWiseValidation;
|
|
1189
|
+
this.restrictCountry = this.question.formElement.validation.restrictCountry;
|
|
1190
|
+
this.allowedCountry = this.question.formElement.validation.allowedCountry;
|
|
1191
|
+
this.blockedCountry = this.question.formElement.validation.blockedCountry;
|
|
1192
|
+
this.countryService.loadCountryDetails().subscribe((data) => {
|
|
1193
|
+
this.filteredCountry = data.result;
|
|
1194
|
+
if (this.restrictCountry && (this.allowedCountry || this.blockedCountry)) {
|
|
1195
|
+
this.filteredCountry = this.filteredCountry.filter(country => {
|
|
1196
|
+
return (this.allowedCountry.includes(country.name) || !this.blockedCountry.includes(country.name));
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
this.countryDetails = this.countryService.processCountryDetails(this.filteredCountry, this.displayFlag, this.displayCode, this.showCountryName);
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
validateMobile() {
|
|
1203
|
+
this.validationFailed = false;
|
|
1204
|
+
this.validationMessage = '';
|
|
1205
|
+
if (this.required && (!this.mobileNumber || this.selectedCountry.length === 0)) {
|
|
1206
|
+
this.validationFailed = true;
|
|
1207
|
+
this.validationMessage = 'This is a required question';
|
|
1208
|
+
this.validate.emit(this.validationFailed);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MobileFieldsComponent, deps: [{ token: CountryService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1212
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MobileFieldsComponent, selector: "lib-mobile-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <div class=\"input-group mb-2\">\r\n <div class=\"col-xs-5 col-5 col-md-3 px-0 pe-2\">\r\n <lib-dropdown\r\n [items]=\"countryDetails\"\r\n [multiple] = \"false\"\r\n [(selectedItems)]=\"selectedCountry\"></lib-dropdown>\r\n </div>\r\n <input\r\n type=\"number\"\r\n class=\"form-control col-xs-7 col-7 col-md-9 height mobileField\" \r\n [placeholder]=\"placeholder\"\r\n aria-label=\"Mobile Number\"\r\n [class.invalid]=\"validationFailed\"\r\n (blur)=\"validateMobile()\"\r\n [(ngModel)]=\"mobileNumber\"\r\n />\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.mobileField{border-radius:6px!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.DropdownComponent, selector: "lib-dropdown", inputs: ["multiple", "scrollable", "selectedItems", "placeholder", "items", "showCreateNew", "selectedValues", "customButtons", "showBorder"], outputs: ["buttonClick", "selectedItemsChange", "onScroll", "onCreateNew", "onSearch"] }] }); }
|
|
1213
|
+
}
|
|
1214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MobileFieldsComponent, decorators: [{
|
|
1215
|
+
type: Component,
|
|
1216
|
+
args: [{ selector: 'lib-mobile-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <div class=\"input-group mb-2\">\r\n <div class=\"col-xs-5 col-5 col-md-3 px-0 pe-2\">\r\n <lib-dropdown\r\n [items]=\"countryDetails\"\r\n [multiple] = \"false\"\r\n [(selectedItems)]=\"selectedCountry\"></lib-dropdown>\r\n </div>\r\n <input\r\n type=\"number\"\r\n class=\"form-control col-xs-7 col-7 col-md-9 height mobileField\" \r\n [placeholder]=\"placeholder\"\r\n aria-label=\"Mobile Number\"\r\n [class.invalid]=\"validationFailed\"\r\n (blur)=\"validateMobile()\"\r\n [(ngModel)]=\"mobileNumber\"\r\n />\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.mobileField{border-radius:6px!important}\n"] }]
|
|
1217
|
+
}], ctorParameters: function () { return [{ type: CountryService }]; }, propDecorators: { question: [{
|
|
1218
|
+
type: Input
|
|
1219
|
+
}], validate: [{
|
|
1220
|
+
type: Output
|
|
1221
|
+
}] } });
|
|
1222
|
+
|
|
1223
|
+
class NumberFieldsComponent {
|
|
1224
|
+
constructor() {
|
|
1225
|
+
this.question = {};
|
|
1226
|
+
this.count = 0;
|
|
1227
|
+
this.required = false;
|
|
1228
|
+
this.hint = '';
|
|
1229
|
+
this.validationFailed = false;
|
|
1230
|
+
this.validationMessage = '';
|
|
1231
|
+
this.validate = new EventEmitter();
|
|
1232
|
+
}
|
|
1233
|
+
ngOnInit() {
|
|
1234
|
+
this.valueAssigned();
|
|
1235
|
+
}
|
|
1236
|
+
valueAssigned() {
|
|
1237
|
+
this.count = this.question.count;
|
|
1238
|
+
this.required = this.question.required;
|
|
1239
|
+
this.hint = this.question.hint;
|
|
1240
|
+
this.upDown = this.question.formElement.appearance.upAndDownButton;
|
|
1241
|
+
this.allowNegativeValues =
|
|
1242
|
+
this.question.formElement.appearance.allowNegativeValues;
|
|
1243
|
+
this.placeholder = this.question.formElement.appearance.placeholder;
|
|
1244
|
+
this.min = this.question.formElement.validation.min;
|
|
1245
|
+
this.max = this.question.formElement.validation.max;
|
|
1246
|
+
}
|
|
1247
|
+
validateNumber() {
|
|
1248
|
+
this.validationFailed = false;
|
|
1249
|
+
this.validationMessage = '';
|
|
1250
|
+
if (this.required && !this.enteredNumber) {
|
|
1251
|
+
this.validationFailed = true;
|
|
1252
|
+
this.validationMessage = `Please enter a valid number`;
|
|
1253
|
+
this.validate.emit(this.validationFailed);
|
|
1254
|
+
}
|
|
1255
|
+
else if (!this.allowNegativeValues && this.enteredNumber < 0) {
|
|
1256
|
+
this.validationFailed = true;
|
|
1257
|
+
this.validationMessage = 'Please enter a positive number';
|
|
1258
|
+
this.validate.emit(this.validationFailed);
|
|
1259
|
+
}
|
|
1260
|
+
else if (this.enteredNumber < this.min || this.enteredNumber > this.max) {
|
|
1261
|
+
this.validationFailed = true;
|
|
1262
|
+
this.validationMessage = `Please enter a valid number between ${this.min} and ${this.max}`;
|
|
1263
|
+
this.validate.emit(this.validationFailed);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1267
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NumberFieldsComponent, selector: "lib-number-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <input\r\n type=\"number\"\r\n class=\"form-control mb-2 height\"\r\n [placeholder]=\"placeholder\"\r\n [class.hide-spin-buttons]=\"!upDown\"\r\n (blur)=\"validateNumber()\"\r\n [(ngModel)]=\"enteredNumber\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.hide-spin-buttons::-webkit-outer-spin-button,.hide-spin-buttons::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1268
|
+
}
|
|
1269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberFieldsComponent, decorators: [{
|
|
1270
|
+
type: Component,
|
|
1271
|
+
args: [{ selector: 'lib-number-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <input\r\n type=\"number\"\r\n class=\"form-control mb-2 height\"\r\n [placeholder]=\"placeholder\"\r\n [class.hide-spin-buttons]=\"!upDown\"\r\n (blur)=\"validateNumber()\"\r\n [(ngModel)]=\"enteredNumber\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.hide-spin-buttons::-webkit-outer-spin-button,.hide-spin-buttons::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}\n"] }]
|
|
1272
|
+
}], propDecorators: { question: [{
|
|
1273
|
+
type: Input
|
|
1274
|
+
}], validate: [{
|
|
1275
|
+
type: Output
|
|
1276
|
+
}] } });
|
|
1277
|
+
|
|
1278
|
+
class PasswordFieldsComponent {
|
|
1279
|
+
constructor() {
|
|
1280
|
+
this.question = {};
|
|
1281
|
+
this.count = 0;
|
|
1282
|
+
this.required = false;
|
|
1283
|
+
this.hint = '';
|
|
1284
|
+
this.allowedSpecialCharacters = [];
|
|
1285
|
+
this.validationMessage = '';
|
|
1286
|
+
this.cnfrmValidationMessage = '';
|
|
1287
|
+
this.validationFailed = false;
|
|
1288
|
+
this.validatedCnfrmPassword = false;
|
|
1289
|
+
this.enteredPassowrd = '';
|
|
1290
|
+
this.enteredCnfrmPassword = '';
|
|
1291
|
+
this.passwordStrength = 0;
|
|
1292
|
+
this.validate = new EventEmitter();
|
|
1293
|
+
}
|
|
1294
|
+
ngOnInit() {
|
|
1295
|
+
this.valueAssigned();
|
|
1296
|
+
}
|
|
1297
|
+
valueAssigned() {
|
|
1298
|
+
this.count = this.question.count;
|
|
1299
|
+
this.required = this.question.required;
|
|
1300
|
+
this.hint = this.question.hint;
|
|
1301
|
+
this.confirmPassword = this.question.formElement.appearance.confirmPassword;
|
|
1302
|
+
this.displayStrength = this.question.formElement.appearance.displayStrong;
|
|
1303
|
+
this.viewButton = this.question.formElement.appearance.viewButton;
|
|
1304
|
+
this.maxLength = this.question.formElement.validation.maxLength;
|
|
1305
|
+
this.minLength = this.question.formElement.validation.minLength;
|
|
1306
|
+
this.requireLowercaseLetters =
|
|
1307
|
+
this.question.formElement.validation.requireLowercaseLetters;
|
|
1308
|
+
this.requireUppercaseLetters =
|
|
1309
|
+
this.question.formElement.validation.requireUppercaseLetters;
|
|
1310
|
+
this.requireNumbers = this.question.formElement.validation.requireNumbers;
|
|
1311
|
+
this.requireSpecialCharacters =
|
|
1312
|
+
this.question.formElement.validation.requireSpecialCharacters;
|
|
1313
|
+
if (this.requireSpecialCharacters) {
|
|
1314
|
+
this.allowedSpecialCharacters =
|
|
1315
|
+
this.question.formElement.validation.allowedSpecialCharacters
|
|
1316
|
+
.split(',')
|
|
1317
|
+
.map((char) => char.trim());
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
togglePasswordVisibility() {
|
|
1321
|
+
let passwordField = document.getElementById('passwordField');
|
|
1322
|
+
let eyeIcon = document.getElementById('passwordEyeIcon');
|
|
1323
|
+
if (passwordField.type === 'password') {
|
|
1324
|
+
passwordField.type = 'text';
|
|
1325
|
+
eyeIcon.classList.remove('fa-eye');
|
|
1326
|
+
eyeIcon.classList.add('fa-eye-slash');
|
|
1327
|
+
}
|
|
1328
|
+
else {
|
|
1329
|
+
passwordField.type = 'password';
|
|
1330
|
+
eyeIcon.classList.remove('fa-eye-slash');
|
|
1331
|
+
eyeIcon.classList.add('fa-eye');
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
toggleCnfrmPasswordVisibility() {
|
|
1335
|
+
let passwordField = document.getElementById('cnfrmPasswordField');
|
|
1336
|
+
let eyeIcon = document.getElementById('CnfrmPasswordEyeIcon');
|
|
1337
|
+
if (passwordField.type === 'password') {
|
|
1338
|
+
passwordField.type = 'text';
|
|
1339
|
+
eyeIcon.classList.remove('fa-eye');
|
|
1340
|
+
eyeIcon.classList.add('fa-eye-slash');
|
|
1341
|
+
}
|
|
1342
|
+
else {
|
|
1343
|
+
passwordField.type = 'password';
|
|
1344
|
+
eyeIcon.classList.remove('fa-eye-slash');
|
|
1345
|
+
eyeIcon.classList.add('fa-eye');
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
checkPasswordMatch() {
|
|
1349
|
+
this.validatedCnfrmPassword = false;
|
|
1350
|
+
this.cnfrmValidationMessage = '';
|
|
1351
|
+
if (this.required && this.confirmPassword && !this.enteredCnfrmPassword) {
|
|
1352
|
+
this.validatedCnfrmPassword = true;
|
|
1353
|
+
this.cnfrmValidationMessage = `Please enter a valid password`;
|
|
1354
|
+
}
|
|
1355
|
+
if (this.enteredPassowrd != this.enteredCnfrmPassword && this.confirmPassword) {
|
|
1356
|
+
this.validatedCnfrmPassword = true;
|
|
1357
|
+
this.cnfrmValidationMessage = 'Passwords do not match';
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
validatePassword() {
|
|
1361
|
+
this.validationFailed = false;
|
|
1362
|
+
this.validationMessage = '';
|
|
1363
|
+
if (this.required && !this.enteredPassowrd) {
|
|
1364
|
+
this.validationFailed = true;
|
|
1365
|
+
this.validationMessage = `Please enter a valid password`;
|
|
1366
|
+
this.question.validation = false;
|
|
1367
|
+
this.validate.emit(this.validationFailed);
|
|
1368
|
+
}
|
|
1369
|
+
else if (this.requireLowercaseLetters ||
|
|
1370
|
+
this.requireUppercaseLetters ||
|
|
1371
|
+
this.requireNumbers ||
|
|
1372
|
+
this.requireSpecialCharacters) {
|
|
1373
|
+
const lowercaseRegex = /[a-z]/;
|
|
1374
|
+
const uppercaseRegex = /[A-Z]/;
|
|
1375
|
+
const numberRegex = /\d/;
|
|
1376
|
+
let lowerCaseValidate = lowercaseRegex.test(this.enteredPassowrd);
|
|
1377
|
+
let upperCaseValidate = uppercaseRegex.test(this.enteredPassowrd);
|
|
1378
|
+
let containsNumber = numberRegex.test(this.enteredPassowrd);
|
|
1379
|
+
let containsSpecialCharacter = this.allowedSpecialCharacters.some((char) => this.enteredPassowrd.includes(char));
|
|
1380
|
+
if (!lowerCaseValidate && this.requireLowercaseLetters) {
|
|
1381
|
+
this.validationFailed = true;
|
|
1382
|
+
this.validationMessage =
|
|
1383
|
+
'Password must contain at least one lowercase letter';
|
|
1384
|
+
this.validate.emit(this.validationFailed);
|
|
1385
|
+
this.question.validation = false;
|
|
1386
|
+
}
|
|
1387
|
+
else if (!upperCaseValidate && this.requireUppercaseLetters) {
|
|
1388
|
+
this.validationFailed = true;
|
|
1389
|
+
this.validationMessage =
|
|
1390
|
+
'Password must contain at least one uppercase letter';
|
|
1391
|
+
this.validate.emit(this.validationFailed);
|
|
1392
|
+
this.question.validation = false;
|
|
1393
|
+
}
|
|
1394
|
+
else if (!containsNumber && this.requireNumbers) {
|
|
1395
|
+
this.validationFailed = true;
|
|
1396
|
+
this.validationMessage = 'Password must contain at least one number';
|
|
1397
|
+
this.validate.emit(this.validationFailed);
|
|
1398
|
+
this.question.validation = false;
|
|
1399
|
+
}
|
|
1400
|
+
else if (!containsSpecialCharacter && this.requireSpecialCharacters) {
|
|
1401
|
+
this.validationFailed = true;
|
|
1402
|
+
this.validationMessage =
|
|
1403
|
+
'Password must contain at least one special character';
|
|
1404
|
+
this.question.validation = false;
|
|
1405
|
+
this.validate.emit(this.validationFailed);
|
|
1406
|
+
}
|
|
1407
|
+
else if (this.enteredPassowrd.length < this.minLength ||
|
|
1408
|
+
this.enteredPassowrd.length > this.maxLength) {
|
|
1409
|
+
this.validationFailed = true;
|
|
1410
|
+
this.validationMessage = `Password must be between ${this.minLength} and ${this.maxLength} characters long`;
|
|
1411
|
+
this.validate.emit(this.validationFailed);
|
|
1412
|
+
this.question.validation = false;
|
|
1413
|
+
}
|
|
1414
|
+
else {
|
|
1415
|
+
this.question.validation = true;
|
|
1416
|
+
}
|
|
1417
|
+
const lengthStrength = Math.min(100, Math.max(0, ((this.enteredPassowrd.length - this.minLength) /
|
|
1418
|
+
(this.maxLength - this.minLength)) *
|
|
1419
|
+
100));
|
|
1420
|
+
const uppercaseStrength = upperCaseValidate ? 20 : 0;
|
|
1421
|
+
const lowercaseStrength = lowerCaseValidate ? 20 : 0;
|
|
1422
|
+
const numberStrength = containsNumber ? 20 : 0;
|
|
1423
|
+
this.passwordStrength =
|
|
1424
|
+
lengthStrength + uppercaseStrength + lowercaseStrength + numberStrength;
|
|
1425
|
+
}
|
|
1426
|
+
else {
|
|
1427
|
+
this.question.validation = true;
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
validateInput(event) {
|
|
1431
|
+
this.question.answer = event.target.value;
|
|
1432
|
+
this.validatePassword();
|
|
1433
|
+
}
|
|
1434
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PasswordFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1435
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PasswordFieldsComponent, selector: "lib-password-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"password-input-wrapper\">\r\n <div class=\"input-wrapper\">\r\n <label for=\"passwordField\">{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n </div>\r\n <input\r\n type=\"password\"\r\n class=\"form-control mb-2 height\"\r\n id=\"passwordField\"\r\n (blur)=\"validatePassword()\"\r\n [(ngModel)]=\"enteredPassowrd\"\r\n [class.invalid]=\"validationFailed\"\r\n (input)=\"validateInput($event)\"\r\n />\r\n <button id=\"togglePasswordBtn\" class=\"toggle-password-btn\" (click)=\"togglePasswordVisibility()\">\r\n <i class=\"fa fa-eye\" id=\"passwordEyeIcon\"></i>\r\n </button>\r\n </div>\r\n <div class=\"password-strength-meter\" *ngIf=\"displayStrength\">\r\n <div class=\"progress\">\r\n <div\r\n class=\"progress-bar\"\r\n role=\"progressbar\"\r\n [style.width]=\"passwordStrength + '%'\"\r\n [class.bg-danger]=\"passwordStrength < 30\"\r\n [class.bg-warning]=\"passwordStrength >= 30 && passwordStrength < 70\"\r\n [class.bg-success]=\"passwordStrength >= 70\"\r\n ></div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mb-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n \r\n <div class=\"cnfrmPasswordWrapper\" *ngIf=\"confirmPassword\">\r\n <label for=\"cnfrmPasswordField\">Confirm password</label>\r\n <input type=\"password\" class=\"form-control mb-2 height\" id=\"cnfrmPasswordField\"\r\n (blur)=\"checkPasswordMatch()\"\r\n [(ngModel)]=\"enteredCnfrmPassword\"\r\n [class.invalid]=\"validatedCnfrmPassword\">\r\n <button id=\"toggleCnfrmPasswordBtn\" class=\"toggle-password-btn\" (click)=\"toggleCnfrmPasswordVisibility()\">\r\n <i class=\"fa fa-eye\" id=\"CnfrmPasswordEyeIcon\"></i>\r\n </button>\r\n </div>\r\n <div *ngIf=\"validatedCnfrmPassword\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{cnfrmValidationMessage}}</div>\r\n \r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.password-input-wrapper{position:relative}.password-input{padding-right:40px}.toggle-password-btn{position:absolute;top:70%;right:15px;transform:translateY(-50%);border:none;background-color:transparent;cursor:pointer}.toggle-password-btn:focus{outline:none}.cnfrmPasswordWrapper{position:relative}.password-strength-meter{width:40%;margin-top:10px;margin-left:auto}.progress{height:10px}.progress-bar{transition:width .3s ease-in-out}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1436
|
+
}
|
|
1437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PasswordFieldsComponent, decorators: [{
|
|
1438
|
+
type: Component,
|
|
1439
|
+
args: [{ selector: 'lib-password-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"password-input-wrapper\">\r\n <div class=\"input-wrapper\">\r\n <label for=\"passwordField\">{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n </div>\r\n <input\r\n type=\"password\"\r\n class=\"form-control mb-2 height\"\r\n id=\"passwordField\"\r\n (blur)=\"validatePassword()\"\r\n [(ngModel)]=\"enteredPassowrd\"\r\n [class.invalid]=\"validationFailed\"\r\n (input)=\"validateInput($event)\"\r\n />\r\n <button id=\"togglePasswordBtn\" class=\"toggle-password-btn\" (click)=\"togglePasswordVisibility()\">\r\n <i class=\"fa fa-eye\" id=\"passwordEyeIcon\"></i>\r\n </button>\r\n </div>\r\n <div class=\"password-strength-meter\" *ngIf=\"displayStrength\">\r\n <div class=\"progress\">\r\n <div\r\n class=\"progress-bar\"\r\n role=\"progressbar\"\r\n [style.width]=\"passwordStrength + '%'\"\r\n [class.bg-danger]=\"passwordStrength < 30\"\r\n [class.bg-warning]=\"passwordStrength >= 30 && passwordStrength < 70\"\r\n [class.bg-success]=\"passwordStrength >= 70\"\r\n ></div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger mb-2\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n \r\n <div class=\"cnfrmPasswordWrapper\" *ngIf=\"confirmPassword\">\r\n <label for=\"cnfrmPasswordField\">Confirm password</label>\r\n <input type=\"password\" class=\"form-control mb-2 height\" id=\"cnfrmPasswordField\"\r\n (blur)=\"checkPasswordMatch()\"\r\n [(ngModel)]=\"enteredCnfrmPassword\"\r\n [class.invalid]=\"validatedCnfrmPassword\">\r\n <button id=\"toggleCnfrmPasswordBtn\" class=\"toggle-password-btn\" (click)=\"toggleCnfrmPasswordVisibility()\">\r\n <i class=\"fa fa-eye\" id=\"CnfrmPasswordEyeIcon\"></i>\r\n </button>\r\n </div>\r\n <div *ngIf=\"validatedCnfrmPassword\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{cnfrmValidationMessage}}</div>\r\n \r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.password-input-wrapper{position:relative}.password-input{padding-right:40px}.toggle-password-btn{position:absolute;top:70%;right:15px;transform:translateY(-50%);border:none;background-color:transparent;cursor:pointer}.toggle-password-btn:focus{outline:none}.cnfrmPasswordWrapper{position:relative}.password-strength-meter{width:40%;margin-top:10px;margin-left:auto}.progress{height:10px}.progress-bar{transition:width .3s ease-in-out}\n"] }]
|
|
1440
|
+
}], propDecorators: { question: [{
|
|
1441
|
+
type: Input
|
|
1442
|
+
}], validate: [{
|
|
1443
|
+
type: Output
|
|
1444
|
+
}] } });
|
|
1445
|
+
|
|
1446
|
+
class RadioButtonFieldsComponent {
|
|
1447
|
+
constructor(formService) {
|
|
1448
|
+
this.formService = formService;
|
|
1449
|
+
this.question = {};
|
|
1450
|
+
this.count = 0;
|
|
1451
|
+
this.required = false;
|
|
1452
|
+
this.hint = '';
|
|
1453
|
+
this.color = '';
|
|
1454
|
+
this.minimumSelection = 0;
|
|
1455
|
+
this.maximumSelection = 0;
|
|
1456
|
+
this.optionType = '';
|
|
1457
|
+
this.lookupTable = '';
|
|
1458
|
+
this.customOptions = [];
|
|
1459
|
+
this.database = {};
|
|
1460
|
+
this.api = {};
|
|
1461
|
+
this.apiOptions = []; // Assuming you have a property to store API options
|
|
1462
|
+
this.selectedOption = '';
|
|
1463
|
+
this.validationMessage = '';
|
|
1464
|
+
this.validate = new EventEmitter();
|
|
1465
|
+
}
|
|
1466
|
+
ngOnInit() {
|
|
1467
|
+
this.valueAssigned();
|
|
1468
|
+
}
|
|
1469
|
+
valueAssigned() {
|
|
1470
|
+
this.count = this.question.count;
|
|
1471
|
+
this.required = this.question.required;
|
|
1472
|
+
this.hint = this.question.hint;
|
|
1473
|
+
this.color = this.question.formElement.appearance.color;
|
|
1474
|
+
this.optionType = this.question.formElement.option.optionType;
|
|
1475
|
+
switch (this.optionType) {
|
|
1476
|
+
case 'OPTION':
|
|
1477
|
+
this.customOptions = this.question.formElement.option.customOptions;
|
|
1478
|
+
break;
|
|
1479
|
+
case 'LOOKUP':
|
|
1480
|
+
this.lookupTable = this.question.formElement.option.lookupTable;
|
|
1481
|
+
this.fetchDataFromLookup();
|
|
1482
|
+
break;
|
|
1483
|
+
case 'DATABASE':
|
|
1484
|
+
this.database = this.question.formElement.option.database;
|
|
1485
|
+
this.fetchDataFromDatabase();
|
|
1486
|
+
break;
|
|
1487
|
+
case 'API':
|
|
1488
|
+
this.api = this.question.formElement.option.api;
|
|
1489
|
+
this.fetchDataFromAPI();
|
|
1490
|
+
break;
|
|
1491
|
+
default:
|
|
1492
|
+
console.warn('Unknown option type:', this.optionType);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
fetchDataFromLookup() {
|
|
1496
|
+
this.formService.fetchDataFromLookup(this.lookupTable).subscribe((response) => {
|
|
1497
|
+
this.customOptions = response.result.values.map((item) => ({
|
|
1498
|
+
value: item.value,
|
|
1499
|
+
label: item.label,
|
|
1500
|
+
}));
|
|
1501
|
+
}, (error) => {
|
|
1502
|
+
console.error('HTTP Error:', error);
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
fetchDataFromDatabase() {
|
|
1506
|
+
const transformedDatabase = this.transformDatabaseObject(this.database);
|
|
1507
|
+
this.formService.fetchDataFromDatabase(transformedDatabase).subscribe((response) => {
|
|
1508
|
+
if (response.success) {
|
|
1509
|
+
this.customOptions = response.result.map((item) => ({
|
|
1510
|
+
value: item.value,
|
|
1511
|
+
label: item.label,
|
|
1512
|
+
}));
|
|
1513
|
+
}
|
|
1514
|
+
else {
|
|
1515
|
+
console.error('Error fetching data from database:', response.message);
|
|
1516
|
+
}
|
|
1517
|
+
}, (error) => {
|
|
1518
|
+
console.error('HTTP Error:', error);
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
transformDatabaseObject(database) {
|
|
1522
|
+
return {
|
|
1523
|
+
tableName: database.tableName,
|
|
1524
|
+
valueField: database.valueField,
|
|
1525
|
+
labelField: database.labelField,
|
|
1526
|
+
criteria: database.criteria.map((criteria) => ({
|
|
1527
|
+
field: criteria.field,
|
|
1528
|
+
condition: criteria.condition,
|
|
1529
|
+
value: criteria.inputValue,
|
|
1530
|
+
logicalOperator: criteria.logicalOperator,
|
|
1531
|
+
})),
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
fetchDataFromAPI() {
|
|
1535
|
+
const apiConfig = this.api;
|
|
1536
|
+
this.formService.fetchDataFromExternalAPI(apiConfig.url).subscribe((response) => {
|
|
1537
|
+
const data = this.extractDataByPath(response, apiConfig.pathToValue);
|
|
1538
|
+
this.customOptions = data.map((item) => ({
|
|
1539
|
+
value: item[apiConfig.valueField],
|
|
1540
|
+
label: item[apiConfig.labelField],
|
|
1541
|
+
}));
|
|
1542
|
+
}, (error) => {
|
|
1543
|
+
console.error('HTTP Error:', error);
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
extractDataByPath(data, path) {
|
|
1547
|
+
return path.split('.').reduce((acc, part) => acc && acc[part], data);
|
|
1548
|
+
}
|
|
1549
|
+
validateInput() {
|
|
1550
|
+
this.validationFailed = false;
|
|
1551
|
+
this.validationMessage = '';
|
|
1552
|
+
if (this.required && this.selectedOption == '') {
|
|
1553
|
+
this.validationFailed = true;
|
|
1554
|
+
this.validationMessage = 'This is a required question';
|
|
1555
|
+
this.validate.emit(this.validationFailed);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RadioButtonFieldsComponent, deps: [{ token: FormService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1559
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RadioButtonFieldsComponent, selector: "lib-radio-button-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n\r\n <div class=\"checkboxField\" *ngFor=\"let option of customOptions\">\r\n <input\r\n class=\"formCheckbox mb-2\"\r\n type=\"radio\"\r\n [name]=\"question.id\"\r\n [id]=\"option.value\"\r\n [value]=\"option.value\"\r\n [style.accent-color]=\"color\"\r\n (blur)=\"validateInput()\"\r\n [(ngModel)]=\"selectedOption\"\r\n />\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value\"\r\n *ngIf=\"optionType == 'OPTION'\"\r\n >{{ option.value }}</label\r\n >\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value\"\r\n *ngIf=\"optionType == 'LOOKUP' || 'DATABASE' || 'API'\"\r\n >{{ option.label }}</label\r\n >\r\n </div>\r\n\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg\r\n class=\"validationSvg\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\"\r\n fill=\"#FF0000\"\r\n stroke=\"#FF0000\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M12 12.75L12 7.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\" />\r\n </svg>\r\n {{ validationMessage }}\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.formCheckbox,.formCheckLabel{cursor:pointer}.formCheckbox{width:15px;height:15px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1560
|
+
}
|
|
1561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RadioButtonFieldsComponent, decorators: [{
|
|
1562
|
+
type: Component,
|
|
1563
|
+
args: [{ selector: 'lib-radio-button-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n\r\n <div class=\"checkboxField\" *ngFor=\"let option of customOptions\">\r\n <input\r\n class=\"formCheckbox mb-2\"\r\n type=\"radio\"\r\n [name]=\"question.id\"\r\n [id]=\"option.value\"\r\n [value]=\"option.value\"\r\n [style.accent-color]=\"color\"\r\n (blur)=\"validateInput()\"\r\n [(ngModel)]=\"selectedOption\"\r\n />\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value\"\r\n *ngIf=\"optionType == 'OPTION'\"\r\n >{{ option.value }}</label\r\n >\r\n <label\r\n class=\"formCheckLabel ms-2 mb-2\"\r\n [for]=\"option.value\"\r\n *ngIf=\"optionType == 'LOOKUP' || 'DATABASE' || 'API'\"\r\n >{{ option.label }}</label\r\n >\r\n </div>\r\n\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg\r\n class=\"validationSvg\"\r\n viewBox=\"0 0 24 24\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\"\r\n fill=\"#FF0000\"\r\n stroke=\"#FF0000\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M12 12.75L12 7.75\"\r\n stroke=\"white\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\" />\r\n </svg>\r\n {{ validationMessage }}\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.formCheckbox,.formCheckLabel{cursor:pointer}.formCheckbox{width:15px;height:15px}\n"] }]
|
|
1564
|
+
}], ctorParameters: function () { return [{ type: FormService }]; }, propDecorators: { question: [{
|
|
1565
|
+
type: Input
|
|
1566
|
+
}], validate: [{
|
|
1567
|
+
type: Output
|
|
1568
|
+
}] } });
|
|
1569
|
+
|
|
1570
|
+
class RichTextEditorFieldsComponent {
|
|
1571
|
+
constructor() {
|
|
1572
|
+
this.question = {};
|
|
1573
|
+
this.count = 0;
|
|
1574
|
+
this.required = false;
|
|
1575
|
+
this.hint = '';
|
|
1576
|
+
this.limitedCharacters = false;
|
|
1577
|
+
this.counts = 0;
|
|
1578
|
+
this.htmlContent = '';
|
|
1579
|
+
this.validationFailed = false;
|
|
1580
|
+
this.validationMessage = '';
|
|
1581
|
+
this.validate = new EventEmitter();
|
|
1582
|
+
this.config = {
|
|
1583
|
+
editable: true,
|
|
1584
|
+
spellcheck: true,
|
|
1585
|
+
height: '15rem',
|
|
1586
|
+
minHeight: '5rem',
|
|
1587
|
+
placeholder: 'Enter text here...',
|
|
1588
|
+
translate: 'no',
|
|
1589
|
+
defaultParagraphSeparator: 'p',
|
|
1590
|
+
defaultFontName: 'Arial',
|
|
1591
|
+
toolbarHiddenButtons: [['bold']],
|
|
1592
|
+
customClasses: [
|
|
1593
|
+
{
|
|
1594
|
+
name: 'quote',
|
|
1595
|
+
class: 'quote',
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
name: 'redText',
|
|
1599
|
+
class: 'redText',
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
name: 'titleText',
|
|
1603
|
+
class: 'titleText',
|
|
1604
|
+
tag: 'h1',
|
|
1605
|
+
},
|
|
1606
|
+
],
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
ngOnInit() {
|
|
1610
|
+
this.valueAssigned();
|
|
1611
|
+
}
|
|
1612
|
+
valueAssigned() {
|
|
1613
|
+
this.count = this.question.count;
|
|
1614
|
+
this.required = this.question.required;
|
|
1615
|
+
this.hint = this.question.hint;
|
|
1616
|
+
this.numberOfRows = this.question.formElement.appearance.numberOfRows;
|
|
1617
|
+
this.limitedCharacters =
|
|
1618
|
+
this.question.formElement.validation.limitedCharacters;
|
|
1619
|
+
this.counts = this.question.formElement.validation.count;
|
|
1620
|
+
this.numberOfRows = this.question.formElement.appearance.numberOfRows;
|
|
1621
|
+
this.limitedCharacters =
|
|
1622
|
+
this.question.formElement.validation.limitedCharacters;
|
|
1623
|
+
if (this.limitedCharacters) {
|
|
1624
|
+
this.characterCount = this.question.formElement.validation.count;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
validateEditor() {
|
|
1628
|
+
this.validationFailed = false;
|
|
1629
|
+
this.validationMessage = '';
|
|
1630
|
+
if (!this.htmlContent && this.required) {
|
|
1631
|
+
this.validationFailed = true;
|
|
1632
|
+
this.validationMessage = 'This is a required question';
|
|
1633
|
+
this.validate.emit(this.validationFailed);
|
|
1634
|
+
;
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
validateInput(event) {
|
|
1638
|
+
if (this.htmlContent.length >= this.characterCount) {
|
|
1639
|
+
this.htmlContent = this.htmlContent.substring(0, this.characterCount);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RichTextEditorFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1643
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RichTextEditorFieldsComponent, selector: "lib-rich-text-editor-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <angular-editor\r\n [(ngModel)]=\"htmlContent\"\r\n [config]=\"config\"\r\n (input)=\"validateInput($event)\"\r\n (blur)=\"validateEditor()\"\r\n ></angular-editor>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$2.AngularEditorComponent, selector: "angular-editor", inputs: ["id", "config", "placeholder", "tabIndex"], outputs: ["html", "viewMode", "blur", "focus"] }] }); }
|
|
1644
|
+
}
|
|
1645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RichTextEditorFieldsComponent, decorators: [{
|
|
1646
|
+
type: Component,
|
|
1647
|
+
args: [{ selector: 'lib-rich-text-editor-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n <angular-editor\r\n [(ngModel)]=\"htmlContent\"\r\n [config]=\"config\"\r\n (input)=\"validateInput($event)\"\r\n (blur)=\"validateEditor()\"\r\n ></angular-editor>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
1648
|
+
}], propDecorators: { question: [{
|
|
1649
|
+
type: Input
|
|
1650
|
+
}], validate: [{
|
|
1651
|
+
type: Output
|
|
1652
|
+
}] } });
|
|
1653
|
+
|
|
1654
|
+
class SelectionMatrixFieldsComponent {
|
|
1655
|
+
constructor() {
|
|
1656
|
+
this.question = {};
|
|
1657
|
+
this.count = 0;
|
|
1658
|
+
this.required = false;
|
|
1659
|
+
this.hint = '';
|
|
1660
|
+
}
|
|
1661
|
+
ngOnInit() {
|
|
1662
|
+
this.count = this.question.count;
|
|
1663
|
+
this.required = this.question.required;
|
|
1664
|
+
this.hint = this.question.hint;
|
|
1665
|
+
this.question;
|
|
1666
|
+
this.count;
|
|
1667
|
+
}
|
|
1668
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectionMatrixFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1669
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SelectionMatrixFieldsComponent, selector: "lib-selection-matrix-fields", inputs: { question: "question" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{question.question}}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1670
|
+
}
|
|
1671
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectionMatrixFieldsComponent, decorators: [{
|
|
1672
|
+
type: Component,
|
|
1673
|
+
args: [{ selector: 'lib-selection-matrix-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{question.question}}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
1674
|
+
}], propDecorators: { question: [{
|
|
1675
|
+
type: Input
|
|
1676
|
+
}] } });
|
|
1677
|
+
|
|
1678
|
+
class SignatureFieldsComponent {
|
|
1679
|
+
constructor() {
|
|
1680
|
+
this.question = {};
|
|
1681
|
+
this.count = 0;
|
|
1682
|
+
this.required = false;
|
|
1683
|
+
this.hint = '';
|
|
1684
|
+
this.maxFileSize = 0;
|
|
1685
|
+
this.minFileSize = 0;
|
|
1686
|
+
}
|
|
1687
|
+
ngOnInit() {
|
|
1688
|
+
this.count = this.question.count;
|
|
1689
|
+
this.required = this.question.required;
|
|
1690
|
+
this.hint = this.question.hint;
|
|
1691
|
+
this.maxFileSize = this.question.formElement.validation.maxFileSize;
|
|
1692
|
+
this.minFileSize = this.question.formElement.validation.minFileSize;
|
|
1693
|
+
}
|
|
1694
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SignatureFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1695
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SignatureFieldsComponent, selector: "lib-signature-fields", inputs: { question: "question" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{question.question}}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1696
|
+
}
|
|
1697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SignatureFieldsComponent, decorators: [{
|
|
1698
|
+
type: Component,
|
|
1699
|
+
args: [{ selector: 'lib-signature-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{question.question}}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
1700
|
+
}], propDecorators: { question: [{
|
|
1701
|
+
type: Input
|
|
1702
|
+
}] } });
|
|
1703
|
+
|
|
1704
|
+
class SliderFieldsComponent {
|
|
1705
|
+
constructor(renderer, el) {
|
|
1706
|
+
this.renderer = renderer;
|
|
1707
|
+
this.el = el;
|
|
1708
|
+
this.question = {};
|
|
1709
|
+
this.count = 0;
|
|
1710
|
+
this.required = false;
|
|
1711
|
+
this.hint = '';
|
|
1712
|
+
this.minValue = 0;
|
|
1713
|
+
this.maxValue = 0;
|
|
1714
|
+
this.stepValue = 0;
|
|
1715
|
+
this.changeSliderColor = false;
|
|
1716
|
+
this.sliderColor = '';
|
|
1717
|
+
this.validationFailed = false;
|
|
1718
|
+
this.validationMessage = '';
|
|
1719
|
+
this.selectedValue = 0; // Initialize with default value
|
|
1720
|
+
this.validate = new EventEmitter();
|
|
1721
|
+
}
|
|
1722
|
+
ngOnInit() {
|
|
1723
|
+
this.valueAssigned();
|
|
1724
|
+
}
|
|
1725
|
+
valueAssigned() {
|
|
1726
|
+
this.count = this.question.count;
|
|
1727
|
+
this.required = this.question.required;
|
|
1728
|
+
this.hint = this.question.hint;
|
|
1729
|
+
this.minValue = this.question.formElement.appearance.minValue;
|
|
1730
|
+
this.maxValue = this.question.formElement.appearance.maxValue;
|
|
1731
|
+
this.stepValue = this.question.formElement.appearance.stepValue;
|
|
1732
|
+
this.changeSliderColor =
|
|
1733
|
+
this.question.formElement.appearance.changeSliderColor;
|
|
1734
|
+
if (this.changeSliderColor) {
|
|
1735
|
+
this.sliderColor = this.question.formElement.appearance.sliderColor;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
validateSlider() {
|
|
1739
|
+
this.validationFailed = false;
|
|
1740
|
+
this.validationMessage = '';
|
|
1741
|
+
if (this.required && this.selectedValue == 0) {
|
|
1742
|
+
this.validationFailed = true;
|
|
1743
|
+
this.validationMessage = 'This is a required question';
|
|
1744
|
+
this.validate.emit(this.validationFailed);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SliderFieldsComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1748
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SliderFieldsComponent, selector: "lib-slider-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n</div>\r\n</div>\r\n <div class=\"sliderRow\">\r\n <div class=\"sliderLeft\">\r\n <mat-slider\r\n [min]=\"minValue\"\r\n [max]=\"maxValue\"\r\n [step]=\"stepValue\"\r\n [ngStyle]=\"{\r\n '--mdc-slider-active-track-color': changeSliderColor\r\n ? sliderColor\r\n : ''\r\n }\"\r\n >\r\n <input matSliderThumb [(ngModel)]=\"selectedValue\" (blur)=\"validateSlider()\"/>\r\n </mat-slider>\r\n </div>\r\n <div class=\"sliderRight\">\r\n <label class=\"selected-count font-weight-bold\">{{ selectedValue }}</label>\r\n </div>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.selected-count{font-size:.8rem;color:#000}mat-slider{width:100%}.mat-mdc-slider.mat-primary{--mdc-slider-handle-color: #fcfcfc;--mdc-slider-handle-width: 15px;--mdc-slider-handle-height: 15px;--mat-mdc-slider-focus-ripple-color: none;--mat-mdc-slider-hover-ripple-color: none;--mdc-slider-focus-handle-color: #fcfcfc;--mdc-slider-inactive-track-color: #9e9d9d}.mat-mdc-slider .mdc-slider__thumb-knob{outline:1px solid #ff0000!important}.mat-slider-thumb{background-color:none!important;border:none!important;box-shadow:none;outline:none}.sliderRow{display:flex;align-items:center;gap:32px;width:100%}.sliderLeft{flex:1}.sliderRight label{margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$3.MatSlider, selector: "mat-slider", inputs: ["color", "disableRipple", "disabled", "discrete", "showTickMarks", "min", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i3$3.MatSliderThumb, selector: "input[matSliderThumb]", inputs: ["value"], outputs: ["valueChange", "dragStart", "dragEnd"], exportAs: ["matSliderThumb"] }] }); }
|
|
1749
|
+
}
|
|
1750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SliderFieldsComponent, decorators: [{
|
|
1751
|
+
type: Component,
|
|
1752
|
+
args: [{ selector: 'lib-slider-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n</div>\r\n</div>\r\n <div class=\"sliderRow\">\r\n <div class=\"sliderLeft\">\r\n <mat-slider\r\n [min]=\"minValue\"\r\n [max]=\"maxValue\"\r\n [step]=\"stepValue\"\r\n [ngStyle]=\"{\r\n '--mdc-slider-active-track-color': changeSliderColor\r\n ? sliderColor\r\n : ''\r\n }\"\r\n >\r\n <input matSliderThumb [(ngModel)]=\"selectedValue\" (blur)=\"validateSlider()\"/>\r\n </mat-slider>\r\n </div>\r\n <div class=\"sliderRight\">\r\n <label class=\"selected-count font-weight-bold\">{{ selectedValue }}</label>\r\n </div>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.selected-count{font-size:.8rem;color:#000}mat-slider{width:100%}.mat-mdc-slider.mat-primary{--mdc-slider-handle-color: #fcfcfc;--mdc-slider-handle-width: 15px;--mdc-slider-handle-height: 15px;--mat-mdc-slider-focus-ripple-color: none;--mat-mdc-slider-hover-ripple-color: none;--mdc-slider-focus-handle-color: #fcfcfc;--mdc-slider-inactive-track-color: #9e9d9d}.mat-mdc-slider .mdc-slider__thumb-knob{outline:1px solid #ff0000!important}.mat-slider-thumb{background-color:none!important;border:none!important;box-shadow:none;outline:none}.sliderRow{display:flex;align-items:center;gap:32px;width:100%}.sliderLeft{flex:1}.sliderRight label{margin-bottom:0}\n"] }]
|
|
1753
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { question: [{
|
|
1754
|
+
type: Input
|
|
1755
|
+
}], validate: [{
|
|
1756
|
+
type: Output
|
|
1757
|
+
}] } });
|
|
1758
|
+
|
|
1759
|
+
class TermsAndConditionFieldsComponent {
|
|
1760
|
+
constructor() {
|
|
1761
|
+
this.question = {};
|
|
1762
|
+
this.count = 0;
|
|
1763
|
+
this.required = false;
|
|
1764
|
+
this.hint = '';
|
|
1765
|
+
}
|
|
1766
|
+
ngOnInit() {
|
|
1767
|
+
this.count = this.question.count;
|
|
1768
|
+
this.required = this.question.required;
|
|
1769
|
+
this.hint = this.question.hint;
|
|
1770
|
+
this.question;
|
|
1771
|
+
this.count;
|
|
1772
|
+
}
|
|
1773
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TermsAndConditionFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1774
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TermsAndConditionFieldsComponent, selector: "lib-terms-and-condition-fields", inputs: { question: "question" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n </div>\r\n \r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1775
|
+
}
|
|
1776
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TermsAndConditionFieldsComponent, decorators: [{
|
|
1777
|
+
type: Component,
|
|
1778
|
+
args: [{ selector: 'lib-terms-and-condition-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n</div>\r\n </div>\r\n \r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
1779
|
+
}], propDecorators: { question: [{
|
|
1780
|
+
type: Input
|
|
1781
|
+
}] } });
|
|
1782
|
+
|
|
1783
|
+
class TextAreaFieldsComponent {
|
|
1784
|
+
constructor() {
|
|
1785
|
+
this.question = {};
|
|
1786
|
+
this.answer = '';
|
|
1787
|
+
this.count = 0;
|
|
1788
|
+
this.required = false;
|
|
1789
|
+
this.hint = '';
|
|
1790
|
+
this.validationFailed = false;
|
|
1791
|
+
this.validationMessage = '';
|
|
1792
|
+
this.enteredText = '';
|
|
1793
|
+
this.validate = new EventEmitter();
|
|
1794
|
+
}
|
|
1795
|
+
ngOnInit() {
|
|
1796
|
+
this.valueAssigned();
|
|
1797
|
+
}
|
|
1798
|
+
valueAssigned() {
|
|
1799
|
+
this.count = this.question.count;
|
|
1800
|
+
this.required = this.question.required;
|
|
1801
|
+
this.hint = this.question.hint;
|
|
1802
|
+
this.numberOfRows = this.question.formElement.appearance.numberOfRows;
|
|
1803
|
+
this.limitedCharacters =
|
|
1804
|
+
this.question.formElement.validation.limitedCharacters;
|
|
1805
|
+
if (this.limitedCharacters) {
|
|
1806
|
+
this.characterCount = this.question.formElement.validation.count;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
validateInput(event) {
|
|
1810
|
+
this.validationFailed = false;
|
|
1811
|
+
this.validationMessage = '';
|
|
1812
|
+
let value = event.target.value;
|
|
1813
|
+
if (this.required && !value) {
|
|
1814
|
+
this.validationFailed = true;
|
|
1815
|
+
this.validationMessage = 'Please enter a valid text';
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
validateTextarea() {
|
|
1819
|
+
this.validationFailed = false;
|
|
1820
|
+
this.validationMessage = '';
|
|
1821
|
+
if (!this.enteredText && this.required) {
|
|
1822
|
+
this.validationFailed = true;
|
|
1823
|
+
this.validationMessage = 'This is a required question';
|
|
1824
|
+
this.validate.emit(this.validationFailed);
|
|
1825
|
+
;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextAreaFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1829
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextAreaFieldsComponent, selector: "lib-text-area-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n</div>\r\n</div>\r\n <textarea class=\"form-control mb-2\" [rows]=\"numberOfRows\"\r\n (input)=\"validateInput($event)\"\r\n (blur)=\"validateTextarea()\"\r\n [(ngModel)]=\"enteredText\"\r\n [class.invalid]=\"validationFailed\"\r\n [maxlength]=\"characterCount\"\r\n ></textarea>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1830
|
+
}
|
|
1831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextAreaFieldsComponent, decorators: [{
|
|
1832
|
+
type: Component,
|
|
1833
|
+
args: [{ selector: 'lib-text-area-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n</div>\r\n</div>\r\n <textarea class=\"form-control mb-2\" [rows]=\"numberOfRows\"\r\n (input)=\"validateInput($event)\"\r\n (blur)=\"validateTextarea()\"\r\n [(ngModel)]=\"enteredText\"\r\n [class.invalid]=\"validationFailed\"\r\n [maxlength]=\"characterCount\"\r\n ></textarea>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}\n"] }]
|
|
1834
|
+
}], propDecorators: { question: [{
|
|
1835
|
+
type: Input
|
|
1836
|
+
}], validate: [{
|
|
1837
|
+
type: Output
|
|
1838
|
+
}] } });
|
|
1839
|
+
|
|
1840
|
+
class TextFieldsComponent {
|
|
1841
|
+
constructor() {
|
|
1842
|
+
this.question = {};
|
|
1843
|
+
this.answer = '';
|
|
1844
|
+
this.count = 0;
|
|
1845
|
+
this.required = false;
|
|
1846
|
+
this.hint = '';
|
|
1847
|
+
this.placeholder = '';
|
|
1848
|
+
this.defaultValue = '';
|
|
1849
|
+
this.textAlign = '';
|
|
1850
|
+
this.font = '';
|
|
1851
|
+
this.fontSize = '';
|
|
1852
|
+
this.validationType = '';
|
|
1853
|
+
this.validation = '';
|
|
1854
|
+
this.regex = '';
|
|
1855
|
+
this.enteredText = '';
|
|
1856
|
+
this.validationFailed = false;
|
|
1857
|
+
this.validationMessage = '';
|
|
1858
|
+
this.validate = new EventEmitter();
|
|
1859
|
+
}
|
|
1860
|
+
ngOnInit() {
|
|
1861
|
+
this.valueAssigned();
|
|
1862
|
+
}
|
|
1863
|
+
valueAssigned() {
|
|
1864
|
+
this.count = this.question.count;
|
|
1865
|
+
this.required = this.question.required;
|
|
1866
|
+
this.hint = this.question.hint;
|
|
1867
|
+
this.placeholder = this.question.formElement.appearance.placeholder;
|
|
1868
|
+
this.defaultValue = this.question.formElement.appearance.defaultValue;
|
|
1869
|
+
this.isBold = this.question.formElement.appearance.bold;
|
|
1870
|
+
this.isItalics = this.question.formElement.appearance.italics;
|
|
1871
|
+
this.isUnderline = this.question.formElement.appearance.underline;
|
|
1872
|
+
this.textAlign = this.question.formElement.appearance.textAlign;
|
|
1873
|
+
this.font = this.question.formElement.appearance.font;
|
|
1874
|
+
this.fontSize = this.question.formElement.appearance.fontSize;
|
|
1875
|
+
this.validationType = this.question.formElement.validation.validationType;
|
|
1876
|
+
if (this.validationType == 'CUSTOM_VALIDATION') {
|
|
1877
|
+
this.validation = this.question.formElement.validation.validation;
|
|
1878
|
+
}
|
|
1879
|
+
else if (this.validationType == 'REGULAR_EXPRESSION') {
|
|
1880
|
+
this.regex = this.question.formElement.validation.regex;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
validatetextField() {
|
|
1884
|
+
if (this.required && !this.enteredText) {
|
|
1885
|
+
this.validationFailed = true;
|
|
1886
|
+
this.validationMessage = 'This is a required question';
|
|
1887
|
+
this.validate.emit(this.validationFailed);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
validateInput(event) {
|
|
1891
|
+
this.validationFailed = false;
|
|
1892
|
+
this.validationMessage = '';
|
|
1893
|
+
let value = event.target.value;
|
|
1894
|
+
if (this.required && !this.enteredText) {
|
|
1895
|
+
this.validationFailed = true;
|
|
1896
|
+
this.validationMessage = 'Please enter a valid text';
|
|
1897
|
+
this.validate.emit(this.validationFailed);
|
|
1898
|
+
}
|
|
1899
|
+
if (this.validation == 'Numbers only') {
|
|
1900
|
+
event.target.value = value?.replace(/\D/g, '');
|
|
1901
|
+
}
|
|
1902
|
+
else if (this.validation == 'Alphanumeric') {
|
|
1903
|
+
event.target.value = value?.replace(/[^a-zA-Z0-9]/g, '');
|
|
1904
|
+
}
|
|
1905
|
+
else if (this.validationType == 'REGULAR_EXPRESSION' && this.regex) {
|
|
1906
|
+
// /[^aeiou]/gi
|
|
1907
|
+
event.target.value = value?.replace(this.regex, '');
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1911
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextFieldsComponent, selector: "lib-text-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n </div>\r\n \r\n <input\r\n type=\"text\"\r\n class=\"form-control mb-2 height\"\r\n [placeholder]=\"placeholder\"\r\n [value]=\"defaultValue\"\r\n [ngClass]=\"{\r\n 'bold': isBold,\r\n 'underline': isUnderline,\r\n 'italics': isItalics\r\n }\"\r\n [style.text-align]=\"textAlign\"\r\n [style.font-family]=\"font\"\r\n [style.font-size]=\"fontSize+'px'\"\r\n [(ngModel)]=\"enteredText\"\r\n (blur)=\"validatetextField()\"\r\n (input)=\"validateInput($event)\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.form-control:not(:placeholder-shown).bold{font-weight:700}.form-control:not(:placeholder-shown).underline{text-decoration:underline}.form-control:not(:placeholder-shown).italics{font-style:italic}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1912
|
+
}
|
|
1913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextFieldsComponent, decorators: [{
|
|
1914
|
+
type: Component,
|
|
1915
|
+
args: [{ selector: 'lib-text-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div>\r\n </div>\r\n \r\n <input\r\n type=\"text\"\r\n class=\"form-control mb-2 height\"\r\n [placeholder]=\"placeholder\"\r\n [value]=\"defaultValue\"\r\n [ngClass]=\"{\r\n 'bold': isBold,\r\n 'underline': isUnderline,\r\n 'italics': isItalics\r\n }\"\r\n [style.text-align]=\"textAlign\"\r\n [style.font-family]=\"font\"\r\n [style.font-size]=\"fontSize+'px'\"\r\n [(ngModel)]=\"enteredText\"\r\n (blur)=\"validatetextField()\"\r\n (input)=\"validateInput($event)\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.form-control:not(:placeholder-shown).bold{font-weight:700}.form-control:not(:placeholder-shown).underline{text-decoration:underline}.form-control:not(:placeholder-shown).italics{font-style:italic}\n"] }]
|
|
1916
|
+
}], propDecorators: { question: [{
|
|
1917
|
+
type: Input
|
|
1918
|
+
}], validate: [{
|
|
1919
|
+
type: Output
|
|
1920
|
+
}] } });
|
|
1921
|
+
|
|
1922
|
+
class ToggleSwitchFieldsComponent {
|
|
1923
|
+
constructor() {
|
|
1924
|
+
this.question = {};
|
|
1925
|
+
this.count = 0;
|
|
1926
|
+
this.required = false;
|
|
1927
|
+
this.hint = '';
|
|
1928
|
+
this.labelOnValue = '';
|
|
1929
|
+
this.labelOffValue = '';
|
|
1930
|
+
this.labelOnColor = '';
|
|
1931
|
+
this.labelOffColor = '';
|
|
1932
|
+
this.toggleBackgroundColor = '';
|
|
1933
|
+
}
|
|
1934
|
+
ngOnInit() {
|
|
1935
|
+
this.count = this.question.count;
|
|
1936
|
+
this.required = this.question.required;
|
|
1937
|
+
this.hint = this.question.hint;
|
|
1938
|
+
this.labelOnValue = this.question.formElement.appearance.labelOnValue;
|
|
1939
|
+
this.labelOffValue = this.question.formElement.appearance.labelOffValue;
|
|
1940
|
+
this.labelOnColor = this.question.formElement.appearance.labelOnColor;
|
|
1941
|
+
this.labelOffColor = this.question.formElement.appearance.labelOffColor;
|
|
1942
|
+
this.toggleBackgroundColor = this.labelOnColor;
|
|
1943
|
+
}
|
|
1944
|
+
toggleSliderColor(event) {
|
|
1945
|
+
let isChecked = event.target.checked;
|
|
1946
|
+
// Update slider background color based on toggle state
|
|
1947
|
+
this.toggleBackgroundColor = isChecked
|
|
1948
|
+
? this.question.formElement.appearance.labelOffColor
|
|
1949
|
+
: this.question.formElement.appearance.labelOnColor;
|
|
1950
|
+
}
|
|
1951
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToggleSwitchFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1952
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToggleSwitchFieldsComponent, selector: "lib-toggle-switch-fields", inputs: { question: "question" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-2 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div> \r\n</div>\r\n <div class=\"mt-2\">\r\n <label class=\"switch\">\r\n <input type=\"checkbox\" id=\"togBtn\" (change)=\"toggleSliderColor($event)\" />\r\n <div\r\n class=\"slider round\"\r\n [ngStyle]=\"{ 'background-color': toggleBackgroundColor }\"\r\n >\r\n <span class=\"on action-btn-text\">{{ labelOffValue }}</span>\r\n <span class=\"off action-btn-text\">{{ labelOnValue }}</span>\r\n </div>\r\n </label>\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.switch{position:relative;display:inline-block;width:auto;height:34px;min-width:120px}.switch input{display:none}.slider{position:absolute;cursor:pointer;inset:0;transition:.4s}.slider:before{position:absolute;content:\"\";height:26px;width:26px;left:4px;right:59px;bottom:4px;background-color:#fff;transition:.4s}input:checked+.slider{background-color:#00c48c}input:not(:checked)+.slider{background-color:#00c48c}input:focus+.slider{box-shadow:0 0 1px #2196f3}input:checked+.slider:before{transform:translate(86px)}.on{display:none}.on,.off{color:#fff;position:absolute;transform:translate(-50%,-50%);top:50%;left:50%;font-size:13px;font-weight:500}input:checked+.slider .on{display:block}input:checked+.slider .off{display:none}.slider.round{border-radius:28px}.slider.round:before{border-radius:50%}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
|
|
1953
|
+
}
|
|
1954
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToggleSwitchFieldsComponent, decorators: [{
|
|
1955
|
+
type: Component,
|
|
1956
|
+
args: [{ selector: 'lib-toggle-switch-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-2 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label> \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div class=\"svg-wrapper mb-2 hintIcon\" [attr.data-title]=\"hint\" *ngIf=\"hint\">\r\n <svg class=\"hintSvg\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\" stroke=\"#323232\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg>\r\n </div> \r\n</div>\r\n <div class=\"mt-2\">\r\n <label class=\"switch\">\r\n <input type=\"checkbox\" id=\"togBtn\" (change)=\"toggleSliderColor($event)\" />\r\n <div\r\n class=\"slider round\"\r\n [ngStyle]=\"{ 'background-color': toggleBackgroundColor }\"\r\n >\r\n <span class=\"on action-btn-text\">{{ labelOffValue }}</span>\r\n <span class=\"off action-btn-text\">{{ labelOnValue }}</span>\r\n </div>\r\n </label>\r\n </div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.switch{position:relative;display:inline-block;width:auto;height:34px;min-width:120px}.switch input{display:none}.slider{position:absolute;cursor:pointer;inset:0;transition:.4s}.slider:before{position:absolute;content:\"\";height:26px;width:26px;left:4px;right:59px;bottom:4px;background-color:#fff;transition:.4s}input:checked+.slider{background-color:#00c48c}input:not(:checked)+.slider{background-color:#00c48c}input:focus+.slider{box-shadow:0 0 1px #2196f3}input:checked+.slider:before{transform:translate(86px)}.on{display:none}.on,.off{color:#fff;position:absolute;transform:translate(-50%,-50%);top:50%;left:50%;font-size:13px;font-weight:500}input:checked+.slider .on{display:block}input:checked+.slider .off{display:none}.slider.round{border-radius:28px}.slider.round:before{border-radius:50%}\n"] }]
|
|
1957
|
+
}], propDecorators: { question: [{
|
|
1958
|
+
type: Input
|
|
1959
|
+
}] } });
|
|
1960
|
+
|
|
1961
|
+
class UrlFieldsComponent {
|
|
1962
|
+
constructor() {
|
|
1963
|
+
this.question = {};
|
|
1964
|
+
this.count = 0;
|
|
1965
|
+
this.required = false;
|
|
1966
|
+
this.hint = '';
|
|
1967
|
+
this.placeholder = '';
|
|
1968
|
+
this.enteredUrl = '';
|
|
1969
|
+
this.validationFailed = false;
|
|
1970
|
+
this.validationMessage = '';
|
|
1971
|
+
this.validate = new EventEmitter();
|
|
1972
|
+
}
|
|
1973
|
+
ngOnInit() {
|
|
1974
|
+
this.valueAssigned();
|
|
1975
|
+
}
|
|
1976
|
+
handleClick() {
|
|
1977
|
+
const textFieldValue = document.getElementById('textField').value;
|
|
1978
|
+
window.open(textFieldValue, '_blank');
|
|
1979
|
+
}
|
|
1980
|
+
valueAssigned() {
|
|
1981
|
+
this.count = this.question.count;
|
|
1982
|
+
this.required = this.question.required;
|
|
1983
|
+
this.hint = this.question.hint;
|
|
1984
|
+
this.placeholder = this.question.formElement.appearance.placeholder;
|
|
1985
|
+
this.showPreviewButton =
|
|
1986
|
+
this.question.formElement.appearance.showPreviewButton;
|
|
1987
|
+
}
|
|
1988
|
+
validateUrl() {
|
|
1989
|
+
this.validationFailed = false;
|
|
1990
|
+
this.validationMessage = '';
|
|
1991
|
+
if (this.required && !this.enteredUrl) {
|
|
1992
|
+
this.validationFailed = true;
|
|
1993
|
+
this.validationMessage = 'This is a required question';
|
|
1994
|
+
this.question.validation = false;
|
|
1995
|
+
}
|
|
1996
|
+
else {
|
|
1997
|
+
this.question.validation = true;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
validateInput(event) {
|
|
2001
|
+
this.validateUrl();
|
|
2002
|
+
this.question.answer = event.target.value;
|
|
2003
|
+
}
|
|
2004
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UrlFieldsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2005
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: UrlFieldsComponent, selector: "lib-url-fields", inputs: { question: "question" }, outputs: { validate: "validate" }, ngImport: i0, template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <div class=\"input-group\">\r\n <input\r\n id=\"textField\"\r\n type=\"text\"\r\n class=\"form-control col-11.5 rounded height\"\r\n [placeholder]=\"placeholder\"\r\n [(ngModel)]=\"enteredUrl\"\r\n (blur)=\"validateUrl()\"\r\n (input)=\"validateInput($event)\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div class=\"ps-2\">\r\n <button\r\n *ngIf=\"showPreviewButton\"\r\n type=\"button\"\r\n class=\"btn col-.5 custom-button rounded d-flex justify-content-center align-items-center height\"\r\n (click)=\"handleClick()\"\r\n >\r\n <svg\r\n width=\"30\"\r\n height=\"30\"\r\n viewBox=\"0 0 30 30\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M4.99561 16.2503C4.99561 21.7754 9.47462 26.2544 14.9998 26.2544C20.5249 26.2544 25.0039 21.7754 25.0039 16.2503C25.0039 10.7251 20.5249 6.24609 14.9998 6.24609H6.24613\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M9.99766 2.49219L6.24609 6.24375\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M9.99766 9.99766L6.24609 6.24609\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M17.7924 14.8125L14.3035 18.3015L12.2051 16.2106\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.custom-button{border:1px solid #ced4da;background-color:transparent;padding:.375rem .75rem;line-height:1.5;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
2006
|
+
}
|
|
2007
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UrlFieldsComponent, decorators: [{
|
|
2008
|
+
type: Component,
|
|
2009
|
+
args: [{ selector: 'lib-url-fields', template: "<div [ngClass]=\"'col-' + count\" class=\"mb-4 px-3\">\r\n <div class=\"input-wrapper\">\r\n <label>{{ question.question }}</label\r\n > \r\n <span class=\"text-danger\" *ngIf=\"required\">*</span>\r\n <div\r\n class=\"svg-wrapper mb-2 hintIcon\"\r\n [attr.data-title]=\"hint\"\r\n *ngIf=\"hint\"\r\n >\r\n <svg\r\n class=\"hintSvg\"\r\n viewBox=\"0 0 30 30\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n fill-rule=\"evenodd\"\r\n clip-rule=\"evenodd\"\r\n d=\"M15 26.25V26.25C8.78625 26.25 3.75 21.2138 3.75 15V15C3.75 8.78625 8.78625 3.75 15 3.75V3.75C21.2138 3.75 26.25 8.78625 26.25 15V15C26.25 21.2138 21.2138 26.25 15 26.25Z\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M15 16.5623V16.2498C15 15.2285 15.6312 14.6748 16.2637 14.2498C16.8812 13.8335 17.5 13.291 17.5 12.291C17.5 10.9098 16.3813 9.79102 15 9.79102C13.6187 9.79102 12.5 10.9098 12.5 12.291\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M14.9988 20C14.8263 20 14.6863 20.14 14.6875 20.3125C14.6875 20.485 14.8275 20.625 15 20.625C15.1725 20.625 15.3125 20.485 15.3125 20.3125C15.3125 20.14 15.1725 20 14.9988 20\"\r\n stroke=\"#323232\"\r\n stroke-width=\"1.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <div class=\"input-group\">\r\n <input\r\n id=\"textField\"\r\n type=\"text\"\r\n class=\"form-control col-11.5 rounded height\"\r\n [placeholder]=\"placeholder\"\r\n [(ngModel)]=\"enteredUrl\"\r\n (blur)=\"validateUrl()\"\r\n (input)=\"validateInput($event)\"\r\n [class.invalid]=\"validationFailed\"\r\n />\r\n <div class=\"ps-2\">\r\n <button\r\n *ngIf=\"showPreviewButton\"\r\n type=\"button\"\r\n class=\"btn col-.5 custom-button rounded d-flex justify-content-center align-items-center height\"\r\n (click)=\"handleClick()\"\r\n >\r\n <svg\r\n width=\"30\"\r\n height=\"30\"\r\n viewBox=\"0 0 30 30\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M4.99561 16.2503C4.99561 21.7754 9.47462 26.2544 14.9998 26.2544C20.5249 26.2544 25.0039 21.7754 25.0039 16.2503C25.0039 10.7251 20.5249 6.24609 14.9998 6.24609H6.24613\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M9.99766 2.49219L6.24609 6.24375\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M9.99766 9.99766L6.24609 6.24609\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M17.7924 14.8125L14.3035 18.3015L12.2051 16.2106\"\r\n stroke=\"#084FFF\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n <div *ngIf=\"validationFailed\" class=\"text-danger\">\r\n <svg class=\"validationSvg\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M12.001 16.75C12.139 16.75 12.251 16.638 12.25 16.5C12.25 16.362 12.138 16.25 12 16.25C11.862 16.25 11.75 16.362 11.75 16.5C11.75 16.638 11.862 16.75 12.001 16.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z\" fill=\"#FF0000\" stroke=\"#FF0000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <path d=\"M12 12.75L12 7.75\" stroke=\"white\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n <circle cx=\"12\" cy=\"16\" r=\"1\" fill=\"white\"/>\r\n </svg>\r\n {{validationMessage}}</div>\r\n</div>\r\n", styles: [".input-wrapper{display:flex;align-items:flex-start}.svg-wrapper{margin-left:auto;z-index:999}.hintIcon{position:relative;cursor:pointer}.hintIcon:hover:before{content:attr(data-title);position:absolute;top:calc(100% + 2px);left:50%;transform:translate(-50%);padding:4px 8px;border-radius:4px;background-color:#1d252d;color:#8e9aa0;font-size:14px;white-space:nowrap}.hintIcon:hover:after{content:\"\";position:absolute;top:calc(100% - 26px);left:50%;border:solid transparent;border-width:18px;border-bottom-color:#1d252d;transform:translate(-50%)}.height{height:42px}.invalid{border-color:red}.hintSvg{width:30px;height:30px;fill:none}.validationSvg{width:24px;height:24px;fill:none}.custom-button{border:1px solid #ced4da;background-color:transparent;padding:.375rem .75rem;line-height:1.5;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}\n"] }]
|
|
2010
|
+
}], ctorParameters: function () { return []; }, propDecorators: { question: [{
|
|
2011
|
+
type: Input
|
|
2012
|
+
}], validate: [{
|
|
2013
|
+
type: Output
|
|
2014
|
+
}] } });
|
|
2015
|
+
|
|
2016
|
+
class LogicComponent {
|
|
2017
|
+
constructor() {
|
|
2018
|
+
this.childLogics = [];
|
|
2019
|
+
}
|
|
2020
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogicComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2021
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LogicComponent, selector: "lib-logic", inputs: { childLogics: "childLogics" }, ngImport: i0, template: "<div *ngFor=\"let childLogic of childLogics\">\r\n <div *ngFor=\"let formElement of childLogic.formElements\">\r\n <!-- <lib-form-elements [grid]=\"formElement\"></lib-form-elements> -->\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
2022
|
+
}
|
|
2023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogicComponent, decorators: [{
|
|
2024
|
+
type: Component,
|
|
2025
|
+
args: [{ selector: 'lib-logic', template: "<div *ngFor=\"let childLogic of childLogics\">\r\n <div *ngFor=\"let formElement of childLogic.formElements\">\r\n <!-- <lib-form-elements [grid]=\"formElement\"></lib-form-elements> -->\r\n </div>\r\n</div>\r\n" }]
|
|
2026
|
+
}], propDecorators: { childLogics: [{
|
|
2027
|
+
type: Input
|
|
2028
|
+
}] } });
|
|
2029
|
+
|
|
2030
|
+
class QuestionComponent {
|
|
2031
|
+
ngOnInit() { }
|
|
2032
|
+
constructor(cdr) {
|
|
2033
|
+
this.cdr = cdr;
|
|
2034
|
+
this.question = {};
|
|
2035
|
+
this.validations = [];
|
|
2036
|
+
this.currentPageIndex = 0;
|
|
2037
|
+
this.emitValidations = new EventEmitter();
|
|
2038
|
+
}
|
|
2039
|
+
handleValidation(validation) {
|
|
2040
|
+
this.validations.push(validation);
|
|
2041
|
+
// Update validationStatus array
|
|
2042
|
+
this.emitValidations.emit(this.validations);
|
|
2043
|
+
this.cdr.detectChanges();
|
|
2044
|
+
}
|
|
2045
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QuestionComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2046
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: QuestionComponent, selector: "lib-question", inputs: { question: "question", currentPageIndex: "currentPageIndex" }, outputs: { emitValidations: "emitValidations" }, ngImport: i0, template: "<div>\r\n <lib-check-box-fields\r\n *ngIf=\"question.formElement.elementType === 'CHECK_BOX'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-check-box-fields>\r\n <lib-date-time-fields\r\n *ngIf=\"question.formElement.elementType === 'DATE_TIME'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-date-time-fields>\r\n <lib-drop-down-fields\r\n *ngIf=\"question.formElement.elementType === 'DROP_DOWN'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-drop-down-fields>\r\n <lib-file-picker-fields\r\n *ngIf=\"question.formElement.elementType === 'FILE_PICKER'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-file-picker-fields>\r\n <lib-location-fields\r\n *ngIf=\"question.formElement.elementType === 'LOCATION'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-location-fields>\r\n\r\n <lib-mail-fields\r\n *ngIf=\"question.formElement.elementType === 'EMAIL'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-mail-fields>\r\n <lib-mobile-fields\r\n *ngIf=\"question.formElement.elementType === 'MOBILE'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-mobile-fields>\r\n <lib-number-fields\r\n *ngIf=\"question.formElement.elementType === 'NUMBER'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-number-fields>\r\n <lib-password-fields\r\n *ngIf=\"question.formElement.elementType === 'PASSWORD'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-password-fields>\r\n <lib-radio-button-fields\r\n *ngIf=\"question.formElement.elementType === 'RADIO_BUTTON'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-radio-button-fields>\r\n <lib-rich-text-editor-fields\r\n *ngIf=\"question.formElement.elementType === 'RICH_TEXT_EDITOR'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-rich-text-editor-fields>\r\n <lib-selection-matrix-fields\r\n *ngIf=\"question.formElement.elementType === 'SELECTION_MATRIX'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-selection-matrix-fields>\r\n <lib-signature-fields\r\n *ngIf=\"question.formElement.elementType === 'SIGNATURE'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-signature-fields>\r\n <lib-slider-fields\r\n *ngIf=\"question.formElement.elementType === 'SLIDER'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-slider-fields>\r\n <lib-terms-and-condition-fields\r\n *ngIf=\"question.formElement.elementType === 'TERMS_AND_CONDITION'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-terms-and-condition-fields>\r\n <lib-text-area-fields\r\n *ngIf=\"question.formElement.elementType === 'TEXT_AREA'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-text-area-fields>\r\n <lib-text-fields\r\n *ngIf=\"question.formElement.elementType === 'TEXT_BOX'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-text-fields>\r\n <lib-toggle-switch-fields\r\n *ngIf=\"question.formElement.elementType === 'TOGGLE_SWITCH'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-toggle-switch-fields>\r\n <lib-url-fields\r\n *ngIf=\"question.formElement.elementType === 'URL'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-url-fields>\r\n <lib-logic *ngIf=\"question.childLogics\"\r\n [childLogics]=\"question.childLogics\"></lib-logic>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CheckBoxFieldsComponent, selector: "lib-check-box-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: DateTimeFieldsComponent, selector: "lib-date-time-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: DropDownFieldsComponent, selector: "lib-drop-down-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: FilePickerFieldsComponent, selector: "lib-file-picker-fields", inputs: ["question"] }, { kind: "component", type: LocationFieldsComponent, selector: "lib-location-fields", inputs: ["question"] }, { kind: "component", type: MailFieldsComponent, selector: "lib-mail-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: MobileFieldsComponent, selector: "lib-mobile-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: NumberFieldsComponent, selector: "lib-number-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: PasswordFieldsComponent, selector: "lib-password-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: RadioButtonFieldsComponent, selector: "lib-radio-button-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: RichTextEditorFieldsComponent, selector: "lib-rich-text-editor-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: SelectionMatrixFieldsComponent, selector: "lib-selection-matrix-fields", inputs: ["question"] }, { kind: "component", type: SignatureFieldsComponent, selector: "lib-signature-fields", inputs: ["question"] }, { kind: "component", type: SliderFieldsComponent, selector: "lib-slider-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: TermsAndConditionFieldsComponent, selector: "lib-terms-and-condition-fields", inputs: ["question"] }, { kind: "component", type: TextAreaFieldsComponent, selector: "lib-text-area-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: TextFieldsComponent, selector: "lib-text-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: ToggleSwitchFieldsComponent, selector: "lib-toggle-switch-fields", inputs: ["question"] }, { kind: "component", type: UrlFieldsComponent, selector: "lib-url-fields", inputs: ["question"], outputs: ["validate"] }, { kind: "component", type: LogicComponent, selector: "lib-logic", inputs: ["childLogics"] }] }); }
|
|
2047
|
+
}
|
|
2048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: QuestionComponent, decorators: [{
|
|
2049
|
+
type: Component,
|
|
2050
|
+
args: [{ selector: 'lib-question', template: "<div>\r\n <lib-check-box-fields\r\n *ngIf=\"question.formElement.elementType === 'CHECK_BOX'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-check-box-fields>\r\n <lib-date-time-fields\r\n *ngIf=\"question.formElement.elementType === 'DATE_TIME'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-date-time-fields>\r\n <lib-drop-down-fields\r\n *ngIf=\"question.formElement.elementType === 'DROP_DOWN'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-drop-down-fields>\r\n <lib-file-picker-fields\r\n *ngIf=\"question.formElement.elementType === 'FILE_PICKER'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-file-picker-fields>\r\n <lib-location-fields\r\n *ngIf=\"question.formElement.elementType === 'LOCATION'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-location-fields>\r\n\r\n <lib-mail-fields\r\n *ngIf=\"question.formElement.elementType === 'EMAIL'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-mail-fields>\r\n <lib-mobile-fields\r\n *ngIf=\"question.formElement.elementType === 'MOBILE'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-mobile-fields>\r\n <lib-number-fields\r\n *ngIf=\"question.formElement.elementType === 'NUMBER'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-number-fields>\r\n <lib-password-fields\r\n *ngIf=\"question.formElement.elementType === 'PASSWORD'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\">\r\n </lib-password-fields>\r\n <lib-radio-button-fields\r\n *ngIf=\"question.formElement.elementType === 'RADIO_BUTTON'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-radio-button-fields>\r\n <lib-rich-text-editor-fields\r\n *ngIf=\"question.formElement.elementType === 'RICH_TEXT_EDITOR'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-rich-text-editor-fields>\r\n <lib-selection-matrix-fields\r\n *ngIf=\"question.formElement.elementType === 'SELECTION_MATRIX'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-selection-matrix-fields>\r\n <lib-signature-fields\r\n *ngIf=\"question.formElement.elementType === 'SIGNATURE'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-signature-fields>\r\n <lib-slider-fields\r\n *ngIf=\"question.formElement.elementType === 'SLIDER'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-slider-fields>\r\n <lib-terms-and-condition-fields\r\n *ngIf=\"question.formElement.elementType === 'TERMS_AND_CONDITION'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-terms-and-condition-fields>\r\n <lib-text-area-fields\r\n *ngIf=\"question.formElement.elementType === 'TEXT_AREA'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-text-area-fields>\r\n <lib-text-fields\r\n *ngIf=\"question.formElement.elementType === 'TEXT_BOX'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-text-fields>\r\n <lib-toggle-switch-fields\r\n *ngIf=\"question.formElement.elementType === 'TOGGLE_SWITCH'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-toggle-switch-fields>\r\n <lib-url-fields\r\n *ngIf=\"question.formElement.elementType === 'URL'\"\r\n [question]=\"question\"\r\n (validate)=\"handleValidation($event)\"></lib-url-fields>\r\n <lib-logic *ngIf=\"question.childLogics\"\r\n [childLogics]=\"question.childLogics\"></lib-logic>\r\n</div>\r\n" }]
|
|
2051
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { question: [{
|
|
2052
|
+
type: Input
|
|
2053
|
+
}], currentPageIndex: [{
|
|
2054
|
+
type: Input
|
|
2055
|
+
}], emitValidations: [{
|
|
2056
|
+
type: Output
|
|
2057
|
+
}] } });
|
|
2058
|
+
|
|
2059
|
+
class SubFormComponent {
|
|
2060
|
+
constructor() {
|
|
2061
|
+
this.subForm = {};
|
|
2062
|
+
}
|
|
2063
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2064
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SubFormComponent, selector: "lib-sub-form", inputs: { subForm: "subForm" }, ngImport: i0, template: "<div class=\"outer-container mb-4 px-3\">\r\n <div class=\"body container pt-3 pb-3 px-3\">\r\n <div class=\"tab-content pt-4 pb-3 px-3\">\r\n <p class=\"sectionTitle\">{{subForm.title}}</p>\r\n <p class=\"description mb-5\">{{subForm.description}}</p>\r\n <div *ngFor=\"let formElement of subForm.formElements\">\r\n <!-- <lib-form-elements [grid]=\"formElement\"></lib-form-elements> -->\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".outer-container{background-color:#fff;padding:20px;position:relative;margin-top:25px}@media (max-width: 576px){.outer-container{padding:8px}}.body{position:relative;z-index:1;background:#efefef;border-radius:6px}.tab-content{background-color:#fff}.sectionTitle{font-size:15px;font-weight:500}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
|
|
2065
|
+
}
|
|
2066
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubFormComponent, decorators: [{
|
|
2067
|
+
type: Component,
|
|
2068
|
+
args: [{ selector: 'lib-sub-form', template: "<div class=\"outer-container mb-4 px-3\">\r\n <div class=\"body container pt-3 pb-3 px-3\">\r\n <div class=\"tab-content pt-4 pb-3 px-3\">\r\n <p class=\"sectionTitle\">{{subForm.title}}</p>\r\n <p class=\"description mb-5\">{{subForm.description}}</p>\r\n <div *ngFor=\"let formElement of subForm.formElements\">\r\n <!-- <lib-form-elements [grid]=\"formElement\"></lib-form-elements> -->\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".outer-container{background-color:#fff;padding:20px;position:relative;margin-top:25px}@media (max-width: 576px){.outer-container{padding:8px}}.body{position:relative;z-index:1;background:#efefef;border-radius:6px}.tab-content{background-color:#fff}.sectionTitle{font-size:15px;font-weight:500}\n"] }]
|
|
2069
|
+
}], propDecorators: { subForm: [{
|
|
2070
|
+
type: Input
|
|
2071
|
+
}] } });
|
|
2072
|
+
|
|
2073
|
+
class FormElementsComponent {
|
|
2074
|
+
constructor() {
|
|
2075
|
+
this.grid = {};
|
|
2076
|
+
this.currentPageIndex = 0;
|
|
2077
|
+
}
|
|
2078
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormElementsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2079
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FormElementsComponent, selector: "lib-form-elements", inputs: { grid: "grid", currentPageIndex: "currentPageIndex" }, ngImport: i0, template: "<div *ngIf=\"grid.entityType === 'QUESTION'\">\r\n <lib-question [question]=\"grid?.formElementType\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n ></lib-question>\r\n</div>\r\n<div *ngIf=\"grid.entityType === 'SECTION'\">\r\n <lib-section-fields [section]=\"grid.formElementType\"></lib-section-fields>\r\n</div>\r\n<div *ngIf=\"grid.entityType === 'SUBFORM'\">\r\n <lib-sub-form [subForm]=\"grid.formElementType\"></lib-sub-form>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SectionFieldsComponent, selector: "lib-section-fields", inputs: ["section"] }, { kind: "component", type: QuestionComponent, selector: "lib-question", inputs: ["question", "currentPageIndex"], outputs: ["emitValidations"] }, { kind: "component", type: SubFormComponent, selector: "lib-sub-form", inputs: ["subForm"] }] }); }
|
|
2080
|
+
}
|
|
2081
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormElementsComponent, decorators: [{
|
|
2082
|
+
type: Component,
|
|
2083
|
+
args: [{ selector: 'lib-form-elements', template: "<div *ngIf=\"grid.entityType === 'QUESTION'\">\r\n <lib-question [question]=\"grid?.formElementType\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n ></lib-question>\r\n</div>\r\n<div *ngIf=\"grid.entityType === 'SECTION'\">\r\n <lib-section-fields [section]=\"grid.formElementType\"></lib-section-fields>\r\n</div>\r\n<div *ngIf=\"grid.entityType === 'SUBFORM'\">\r\n <lib-sub-form [subForm]=\"grid.formElementType\"></lib-sub-form>\r\n</div>\r\n" }]
|
|
2084
|
+
}], propDecorators: { grid: [{
|
|
2085
|
+
type: Input
|
|
2086
|
+
}], currentPageIndex: [{
|
|
2087
|
+
type: Input
|
|
2088
|
+
}] } });
|
|
2089
|
+
|
|
2090
|
+
class NavigationTabsComponent {
|
|
2091
|
+
constructor() {
|
|
2092
|
+
this.pages = [];
|
|
2093
|
+
this.currentPageIndex = 0;
|
|
2094
|
+
this.pageChanged = new EventEmitter();
|
|
2095
|
+
}
|
|
2096
|
+
setCurrentPage(index) {
|
|
2097
|
+
this.pageChanged.emit(index);
|
|
2098
|
+
}
|
|
2099
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2100
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NavigationTabsComponent, selector: "lib-navigation-tabs", inputs: { pages: "pages", currentPageIndex: "currentPageIndex" }, outputs: { pageChanged: "pageChanged" }, ngImport: i0, template: "<div class=\"tab-inner-container\">\r\n <ul class=\"nav nav-tabs navTabs\" id=\"myTab\" role=\"tablist\">\r\n <li\r\n class=\"nav-item mr-1\"\r\n role=\"presentation\"\r\n *ngFor=\"let page of pages; let i = index\">\r\n <button\r\n class=\"nav-link\"\r\n [class.active]=\"i === currentPageIndex\"\r\n id=\"tab-{{ i }}\"\r\n [attr.data-bs-toggle]=\"'tab'\"\r\n [attr.data-bs-target]=\"'#content-' + i\"\r\n type=\"button\"\r\n role=\"tab\"\r\n [attr.aria-controls]=\"'content-' + i\"\r\n [attr.aria-selected]=\"i === 0\"\r\n (click)=\"setCurrentPage(i)\">\r\n {{ page.title }}\r\n </button>\r\n </li>\r\n </ul>\r\n\r\n <div class=\"tab-content pt-5 pb-3 px-1\">\r\n <div\r\n *ngFor=\"let page of pages; let i = index\"\r\n class=\"tab-pane fade\"\r\n [class.show]=\"i === 0\"\r\n [class.active]=\"i === 0\"\r\n id=\"content-{{ i }}\"\r\n role=\"tabpanel\"\r\n [attr.aria-labelledby]=\"'tab-' + i\">\r\n <div *ngFor=\"let row of page.rows\">\r\n <div class=\"margin\">\r\n <div *ngFor=\"let grid of row.grid\">\r\n <lib-form-elements\r\n [grid]=\"grid\"></lib-form-elements>\r\n </div>\r\n </div>\r\n </div>\r\n <div\r\n *ngIf=\"currentPageIndex == pages.length - 1\"\r\n class=\"footerButton d-flex justify-content-end\">\r\n <button class=\"btn btn-primary me-md-2 rounded-pill\" type=\"button\">\r\n Submit\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".tab-inner-container{width:100%;position:relative;padding:3rem}@media (max-width: 1024px){.tab-inner-container{padding-left:1rem;padding-right:1rem}}@media (max-width: 576px){.tab-inner-container{padding:2rem .5rem}}.navTabs{overflow-x:auto;overflow-y:hidden;flex-wrap:unset;margin:0 0 -1px!important}.nav-item{background-color:#fff;border-radius:5px}.nav-link{position:relative;margin-bottom:-2px}.nav-link:after{content:\"\";position:absolute;left:0;bottom:0;width:101%;height:6px;background:#efefef}.nav-link.active:after{display:none}.tab-content{background-color:#fff}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormElementsComponent, selector: "lib-form-elements", inputs: ["grid", "currentPageIndex"] }] }); }
|
|
2101
|
+
}
|
|
2102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationTabsComponent, decorators: [{
|
|
2103
|
+
type: Component,
|
|
2104
|
+
args: [{ selector: 'lib-navigation-tabs', template: "<div class=\"tab-inner-container\">\r\n <ul class=\"nav nav-tabs navTabs\" id=\"myTab\" role=\"tablist\">\r\n <li\r\n class=\"nav-item mr-1\"\r\n role=\"presentation\"\r\n *ngFor=\"let page of pages; let i = index\">\r\n <button\r\n class=\"nav-link\"\r\n [class.active]=\"i === currentPageIndex\"\r\n id=\"tab-{{ i }}\"\r\n [attr.data-bs-toggle]=\"'tab'\"\r\n [attr.data-bs-target]=\"'#content-' + i\"\r\n type=\"button\"\r\n role=\"tab\"\r\n [attr.aria-controls]=\"'content-' + i\"\r\n [attr.aria-selected]=\"i === 0\"\r\n (click)=\"setCurrentPage(i)\">\r\n {{ page.title }}\r\n </button>\r\n </li>\r\n </ul>\r\n\r\n <div class=\"tab-content pt-5 pb-3 px-1\">\r\n <div\r\n *ngFor=\"let page of pages; let i = index\"\r\n class=\"tab-pane fade\"\r\n [class.show]=\"i === 0\"\r\n [class.active]=\"i === 0\"\r\n id=\"content-{{ i }}\"\r\n role=\"tabpanel\"\r\n [attr.aria-labelledby]=\"'tab-' + i\">\r\n <div *ngFor=\"let row of page.rows\">\r\n <div class=\"margin\">\r\n <div *ngFor=\"let grid of row.grid\">\r\n <lib-form-elements\r\n [grid]=\"grid\"></lib-form-elements>\r\n </div>\r\n </div>\r\n </div>\r\n <div\r\n *ngIf=\"currentPageIndex == pages.length - 1\"\r\n class=\"footerButton d-flex justify-content-end\">\r\n <button class=\"btn btn-primary me-md-2 rounded-pill\" type=\"button\">\r\n Submit\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".tab-inner-container{width:100%;position:relative;padding:3rem}@media (max-width: 1024px){.tab-inner-container{padding-left:1rem;padding-right:1rem}}@media (max-width: 576px){.tab-inner-container{padding:2rem .5rem}}.navTabs{overflow-x:auto;overflow-y:hidden;flex-wrap:unset;margin:0 0 -1px!important}.nav-item{background-color:#fff;border-radius:5px}.nav-link{position:relative;margin-bottom:-2px}.nav-link:after{content:\"\";position:absolute;left:0;bottom:0;width:101%;height:6px;background:#efefef}.nav-link.active:after{display:none}.tab-content{background-color:#fff}\n"] }]
|
|
2105
|
+
}], propDecorators: { pages: [{
|
|
2106
|
+
type: Input
|
|
2107
|
+
}], currentPageIndex: [{
|
|
2108
|
+
type: Input
|
|
2109
|
+
}], pageChanged: [{
|
|
2110
|
+
type: Output
|
|
2111
|
+
}] } });
|
|
2112
|
+
|
|
2113
|
+
class NextPrevNavigationComponent {
|
|
2114
|
+
constructor() {
|
|
2115
|
+
this.currentPageIndex = 0;
|
|
2116
|
+
this.pages = [];
|
|
2117
|
+
this.previousPage = {};
|
|
2118
|
+
this.nextPage = {};
|
|
2119
|
+
this.currentPage = {};
|
|
2120
|
+
this.navigateNext = new EventEmitter();
|
|
2121
|
+
this.navigatePrevious = new EventEmitter();
|
|
2122
|
+
}
|
|
2123
|
+
onNavigateNext() {
|
|
2124
|
+
this.navigateNext.emit();
|
|
2125
|
+
}
|
|
2126
|
+
onNavigatePrevious() {
|
|
2127
|
+
this.navigatePrevious.emit();
|
|
2128
|
+
}
|
|
2129
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NextPrevNavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2130
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NextPrevNavigationComponent, selector: "lib-next-prev-navigation", inputs: { currentPageIndex: "currentPageIndex", pages: "pages", previousPage: "previousPage", nextPage: "nextPage", currentPage: "currentPage" }, outputs: { navigateNext: "navigateNext", navigatePrevious: "navigatePrevious" }, ngImport: i0, template: "<div class=\"pageTitleDiv\">\r\n <p class=\"pageTitle\">{{ currentPage.title }}</p>\r\n</div>\r\n<div class=\"button-inner-container rounded\">\r\n <div class=\"tab-content pt-5 pb-3 row\">\r\n <div *ngFor=\"let row of pages[currentPageIndex].rows\" class=\"marginSize\">\r\n <div *ngFor=\"let grid of row.grid\">\r\n <lib-form-elements\r\n [grid]=\"grid\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n ></lib-form-elements>\r\n </div>\r\n </div>\r\n <div class=\"footerButton\">\r\n <div class=\"prevButtonDiv\">\r\n <button\r\n class=\"me-md-2 rounded-pill navButton\"\r\n type=\"button\"\r\n (click)=\"onNavigatePrevious()\"\r\n *ngIf=\"0 < currentPageIndex\"\r\n >\r\n <svg\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M4.51025 11.9883L19.5003 11.9883\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M10.514 17.9766L4.49805 11.9996L10.514 6.02256\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n Previous | {{ previousPage.title }}\r\n </button>\r\n </div>\r\n <div class=\"nextButtonDiv\">\r\n <button\r\n class=\"md-2 rounded-pill navButton\"\r\n type=\"button\"\r\n (click)=\"onNavigateNext()\"\r\n *ngIf=\"currentPageIndex < pages.length - 1\"\r\n >\r\n Next | {{ nextPage.title }}\r\n <svg\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M19.4897 12.0117L4.49975 12.0117\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M13.486 6.02344L19.502 12.0004L13.486 17.9774\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </button>\r\n <button\r\n class=\"submitBtn me-md-2 rounded-pill\"\r\n type=\"button\"\r\n *ngIf=\"currentPageIndex == pages.length - 1\"\r\n >\r\n Submit\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".pageTitle{font-size:15px;font-weight:500}.pageTitleDiv{padding-left:3rem;padding-top:3rem}@media (max-width: 1024px){.pageTitleDiv{padding-left:1rem;padding-top:2rem}}@media (max-width: 576px){.pageTitleDiv{padding-left:.4rem;padding-top:1.5rem}}.button-inner-container{width:100%;position:relative;padding:0rem 3rem 3rem}@media (max-width: 1024px){.button-inner-container{padding-left:1rem;padding-right:1rem}}@media (max-width: 576px){.button-inner-container{padding:.1rem .5rem 2rem}}@media (max-width: 576px){.marginSize{padding:0!important}}.footerButton{padding:10px 32px 16px 30px;display:flex;flex-wrap:wrap}@media (max-width: 576px){.footerButton{padding-left:20px;padding-right:17px}}.navButton{background:#084fff;color:#fff;border:none;padding:10px 8px;width:auto}.submitBtn{background:#084fff;color:#fff;border:none;padding:10px 27px;width:auto}.prevButtonDiv{display:flex;justify-content:center;margin-bottom:5px}.nextButtonDiv{display:flex;justify-content:end;margin-left:auto;margin-bottom:5px}.tab-content,.row{background-color:#fff}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormElementsComponent, selector: "lib-form-elements", inputs: ["grid", "currentPageIndex"] }] }); }
|
|
2131
|
+
}
|
|
2132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NextPrevNavigationComponent, decorators: [{
|
|
2133
|
+
type: Component,
|
|
2134
|
+
args: [{ selector: 'lib-next-prev-navigation', template: "<div class=\"pageTitleDiv\">\r\n <p class=\"pageTitle\">{{ currentPage.title }}</p>\r\n</div>\r\n<div class=\"button-inner-container rounded\">\r\n <div class=\"tab-content pt-5 pb-3 row\">\r\n <div *ngFor=\"let row of pages[currentPageIndex].rows\" class=\"marginSize\">\r\n <div *ngFor=\"let grid of row.grid\">\r\n <lib-form-elements\r\n [grid]=\"grid\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n ></lib-form-elements>\r\n </div>\r\n </div>\r\n <div class=\"footerButton\">\r\n <div class=\"prevButtonDiv\">\r\n <button\r\n class=\"me-md-2 rounded-pill navButton\"\r\n type=\"button\"\r\n (click)=\"onNavigatePrevious()\"\r\n *ngIf=\"0 < currentPageIndex\"\r\n >\r\n <svg\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M4.51025 11.9883L19.5003 11.9883\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M10.514 17.9766L4.49805 11.9996L10.514 6.02256\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n Previous | {{ previousPage.title }}\r\n </button>\r\n </div>\r\n <div class=\"nextButtonDiv\">\r\n <button\r\n class=\"md-2 rounded-pill navButton\"\r\n type=\"button\"\r\n (click)=\"onNavigateNext()\"\r\n *ngIf=\"currentPageIndex < pages.length - 1\"\r\n >\r\n Next | {{ nextPage.title }}\r\n <svg\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <path\r\n d=\"M19.4897 12.0117L4.49975 12.0117\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n <path\r\n d=\"M13.486 6.02344L19.502 12.0004L13.486 17.9774\"\r\n stroke=\"white\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n </button>\r\n <button\r\n class=\"submitBtn me-md-2 rounded-pill\"\r\n type=\"button\"\r\n *ngIf=\"currentPageIndex == pages.length - 1\"\r\n >\r\n Submit\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".pageTitle{font-size:15px;font-weight:500}.pageTitleDiv{padding-left:3rem;padding-top:3rem}@media (max-width: 1024px){.pageTitleDiv{padding-left:1rem;padding-top:2rem}}@media (max-width: 576px){.pageTitleDiv{padding-left:.4rem;padding-top:1.5rem}}.button-inner-container{width:100%;position:relative;padding:0rem 3rem 3rem}@media (max-width: 1024px){.button-inner-container{padding-left:1rem;padding-right:1rem}}@media (max-width: 576px){.button-inner-container{padding:.1rem .5rem 2rem}}@media (max-width: 576px){.marginSize{padding:0!important}}.footerButton{padding:10px 32px 16px 30px;display:flex;flex-wrap:wrap}@media (max-width: 576px){.footerButton{padding-left:20px;padding-right:17px}}.navButton{background:#084fff;color:#fff;border:none;padding:10px 8px;width:auto}.submitBtn{background:#084fff;color:#fff;border:none;padding:10px 27px;width:auto}.prevButtonDiv{display:flex;justify-content:center;margin-bottom:5px}.nextButtonDiv{display:flex;justify-content:end;margin-left:auto;margin-bottom:5px}.tab-content,.row{background-color:#fff}\n"] }]
|
|
2135
|
+
}], propDecorators: { currentPageIndex: [{
|
|
2136
|
+
type: Input
|
|
2137
|
+
}], pages: [{
|
|
2138
|
+
type: Input
|
|
2139
|
+
}], previousPage: [{
|
|
2140
|
+
type: Input
|
|
2141
|
+
}], nextPage: [{
|
|
2142
|
+
type: Input
|
|
2143
|
+
}], currentPage: [{
|
|
2144
|
+
type: Input
|
|
2145
|
+
}], navigateNext: [{
|
|
2146
|
+
type: Output
|
|
2147
|
+
}], navigatePrevious: [{
|
|
2148
|
+
type: Output
|
|
2149
|
+
}] } });
|
|
2150
|
+
|
|
2151
|
+
class SubmitFormComponent {
|
|
2152
|
+
constructor(formService) {
|
|
2153
|
+
this.formService = formService;
|
|
2154
|
+
this.question = null;
|
|
2155
|
+
this.moduleName = '';
|
|
2156
|
+
this.name = '';
|
|
2157
|
+
this.saveAutomatically = false;
|
|
2158
|
+
this.saveInterval = 0;
|
|
2159
|
+
this.customizeFont = false;
|
|
2160
|
+
this.fontFamily = '';
|
|
2161
|
+
this.fontSize = 0;
|
|
2162
|
+
this.enableDataExport = false;
|
|
2163
|
+
this.fileFormats = [];
|
|
2164
|
+
this.enableQuestionNumbering = false;
|
|
2165
|
+
this.questionNumbering = '';
|
|
2166
|
+
this.enableGoogleRecaptcha = false;
|
|
2167
|
+
this.googleRecaptchaKey = '';
|
|
2168
|
+
this.googleRecaptchaSecret = '';
|
|
2169
|
+
this.navigation = '';
|
|
2170
|
+
this.markAllQuestionsAsRequired = false;
|
|
2171
|
+
this.pages = [];
|
|
2172
|
+
this.currentPageIndex = 0;
|
|
2173
|
+
this.previousPage = {};
|
|
2174
|
+
this.currentPage = {};
|
|
2175
|
+
this.nextPage = {};
|
|
2176
|
+
this.lastTab = false;
|
|
2177
|
+
this.validations = [];
|
|
2178
|
+
this.questionAnswers = [];
|
|
2179
|
+
}
|
|
2180
|
+
ngOnInit() {
|
|
2181
|
+
this.formService.getQuestions(this.moduleName).subscribe((response) => {
|
|
2182
|
+
this.question = mapPublicFormToModel(response);
|
|
2183
|
+
this.name = this.question.name;
|
|
2184
|
+
this.pages = this.question.pages;
|
|
2185
|
+
this.currentPage = this.pages[0];
|
|
2186
|
+
this.nextPage = this.pages[1];
|
|
2187
|
+
this.saveAutomatically =
|
|
2188
|
+
this.question.formConfiguration.saveAutomatically;
|
|
2189
|
+
this.saveInterval = this.question.formConfiguration.saveInterval;
|
|
2190
|
+
this.customizeFont = this.question.formConfiguration.customizeFont;
|
|
2191
|
+
this.fontFamily = this.question.formConfiguration.fontFamily;
|
|
2192
|
+
this.fontSize = this.question.formConfiguration.fontSize;
|
|
2193
|
+
this.enableDataExport = this.question.formConfiguration.enableDataExport;
|
|
2194
|
+
this.fileFormats = this.question.formConfiguration.fileFormats;
|
|
2195
|
+
this.enableQuestionNumbering =
|
|
2196
|
+
this.question.formConfiguration.enableQuestionNumbering;
|
|
2197
|
+
this.questionNumbering =
|
|
2198
|
+
this.question.formConfiguration.questionNumbering;
|
|
2199
|
+
this.enableGoogleRecaptcha =
|
|
2200
|
+
this.question.formConfiguration.enableGoogleRecaptcha;
|
|
2201
|
+
this.googleRecaptchaKey =
|
|
2202
|
+
this.question.formConfiguration.googleRecaptchaKey;
|
|
2203
|
+
this.googleRecaptchaSecret =
|
|
2204
|
+
this.question.formConfiguration.googleRecaptchaSecret;
|
|
2205
|
+
this.navigation = this.question.formConfiguration.navigation;
|
|
2206
|
+
this.markAllQuestionsAsRequired =
|
|
2207
|
+
this.question.formConfiguration.markAllQuestionsAsRequired;
|
|
2208
|
+
this.generateQuestionAnswers();
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
navigateToNextPage() {
|
|
2212
|
+
if (this.currentPageIndex < this.pages.length - 1) {
|
|
2213
|
+
if (this.markAllQuestionsAsRequired) {
|
|
2214
|
+
if (this.validations?.length === 0) {
|
|
2215
|
+
this.previousPage = this.currentPage;
|
|
2216
|
+
this.currentPageIndex++;
|
|
2217
|
+
this.currentPage = this.pages[this.currentPageIndex];
|
|
2218
|
+
this.nextPage = this.pages[this.currentPageIndex + 1];
|
|
2219
|
+
}
|
|
2220
|
+
else {
|
|
2221
|
+
alert('please fill required questions');
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
else {
|
|
2225
|
+
this.previousPage = this.currentPage;
|
|
2226
|
+
this.currentPageIndex++;
|
|
2227
|
+
this.currentPage = this.pages[this.currentPageIndex];
|
|
2228
|
+
this.nextPage = this.pages[this.currentPageIndex + 1];
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
navigateToPreviousPage() {
|
|
2233
|
+
if (this.currentPageIndex > 0) {
|
|
2234
|
+
if (this.markAllQuestionsAsRequired) {
|
|
2235
|
+
if (this.validations?.length === 0) {
|
|
2236
|
+
this.nextPage = this.currentPage;
|
|
2237
|
+
this.currentPageIndex--;
|
|
2238
|
+
this.currentPage = this.pages[this.currentPageIndex];
|
|
2239
|
+
this.previousPage = this.pages[this.currentPageIndex - 1];
|
|
2240
|
+
}
|
|
2241
|
+
else {
|
|
2242
|
+
alert('please fill required questions');
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
else {
|
|
2246
|
+
this.nextPage = this.currentPage;
|
|
2247
|
+
this.currentPageIndex--;
|
|
2248
|
+
this.currentPage = this.pages[this.currentPageIndex];
|
|
2249
|
+
this.previousPage = this.pages[this.currentPageIndex - 1];
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
setCurrentPage(index) {
|
|
2254
|
+
this.currentPageIndex = index;
|
|
2255
|
+
}
|
|
2256
|
+
generateQuestionAnswers() {
|
|
2257
|
+
const extractQuestions = (formElements) => {
|
|
2258
|
+
const questions = [];
|
|
2259
|
+
formElements.forEach((element) => {
|
|
2260
|
+
if (element.entityType === 'QUESTION') {
|
|
2261
|
+
questions.push({
|
|
2262
|
+
questionId: element.formElementType.id,
|
|
2263
|
+
answer: '',
|
|
2264
|
+
});
|
|
2265
|
+
if (element.formElementType.childLogics) {
|
|
2266
|
+
element.formElementType.childLogics.forEach((logic) => {
|
|
2267
|
+
questions.push(...extractQuestions(logic.formElements));
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
else if (element.entityType === 'SUBFORM') {
|
|
2272
|
+
if (element.formElementType.formElements) {
|
|
2273
|
+
questions.push(...extractQuestions(element.formElementType.formElements));
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
});
|
|
2277
|
+
return questions;
|
|
2278
|
+
};
|
|
2279
|
+
const processPages = (pages) => {
|
|
2280
|
+
const questions = [];
|
|
2281
|
+
pages.forEach((page) => {
|
|
2282
|
+
page.rows.forEach((row) => {
|
|
2283
|
+
questions.push(...extractQuestions(row.grid));
|
|
2284
|
+
});
|
|
2285
|
+
});
|
|
2286
|
+
return questions;
|
|
2287
|
+
};
|
|
2288
|
+
this.questionAnswers = processPages(this.pages);
|
|
2289
|
+
}
|
|
2290
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubmitFormComponent, deps: [{ token: FormService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2291
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SubmitFormComponent, selector: "lib-submit-form", inputs: { moduleName: "moduleName" }, ngImport: i0, template: "<div class=\"outer-container\">\r\n <div class=\"head container\">\r\n <lib-header [name]=\"name\"></lib-header>\r\n </div>\r\n <div class=\"body container\">\r\n <lib-navigation-tabs\r\n *ngIf=\"navigation == 'TAB'\"\r\n [pages]=\"pages\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n (pageChanged)=\"setCurrentPage($event)\"\r\n ></lib-navigation-tabs>\r\n <lib-next-prev-navigation\r\n *ngIf=\"navigation == 'NEXT_AND_PREVIOUS_BUTTON'\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n [pages]=\"pages\"\r\n [previousPage]=\"previousPage\"\r\n [currentPage]=\"currentPage\"\r\n [nextPage]=\"nextPage\"\r\n (navigateNext)=\"navigateToNextPage()\"\r\n (navigatePrevious)=\"navigateToPreviousPage()\"\r\n ></lib-next-prev-navigation>\r\n </div>\r\n</div>\r\n", styles: [".outer-container{background-color:#fff;padding:20px;position:relative;margin-top:25px}@media (max-width: 576px){.outer-container{padding:8px}}.head{background-color:#fff;padding:0!important}.body{position:relative;z-index:1;background:#efefef;border-radius:6px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: HeaderComponent, selector: "lib-header", inputs: ["name"] }, { kind: "component", type: NavigationTabsComponent, selector: "lib-navigation-tabs", inputs: ["pages", "currentPageIndex"], outputs: ["pageChanged"] }, { kind: "component", type: NextPrevNavigationComponent, selector: "lib-next-prev-navigation", inputs: ["currentPageIndex", "pages", "previousPage", "nextPage", "currentPage"], outputs: ["navigateNext", "navigatePrevious"] }] }); }
|
|
2292
|
+
}
|
|
2293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubmitFormComponent, decorators: [{
|
|
2294
|
+
type: Component,
|
|
2295
|
+
args: [{ selector: 'lib-submit-form', template: "<div class=\"outer-container\">\r\n <div class=\"head container\">\r\n <lib-header [name]=\"name\"></lib-header>\r\n </div>\r\n <div class=\"body container\">\r\n <lib-navigation-tabs\r\n *ngIf=\"navigation == 'TAB'\"\r\n [pages]=\"pages\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n (pageChanged)=\"setCurrentPage($event)\"\r\n ></lib-navigation-tabs>\r\n <lib-next-prev-navigation\r\n *ngIf=\"navigation == 'NEXT_AND_PREVIOUS_BUTTON'\"\r\n [currentPageIndex]=\"currentPageIndex\"\r\n [pages]=\"pages\"\r\n [previousPage]=\"previousPage\"\r\n [currentPage]=\"currentPage\"\r\n [nextPage]=\"nextPage\"\r\n (navigateNext)=\"navigateToNextPage()\"\r\n (navigatePrevious)=\"navigateToPreviousPage()\"\r\n ></lib-next-prev-navigation>\r\n </div>\r\n</div>\r\n", styles: [".outer-container{background-color:#fff;padding:20px;position:relative;margin-top:25px}@media (max-width: 576px){.outer-container{padding:8px}}.head{background-color:#fff;padding:0!important}.body{position:relative;z-index:1;background:#efefef;border-radius:6px}\n"] }]
|
|
2296
|
+
}], ctorParameters: function () { return [{ type: FormService }]; }, propDecorators: { moduleName: [{
|
|
2297
|
+
type: Input
|
|
2298
|
+
}] } });
|
|
2299
|
+
|
|
2300
|
+
class FormSubmissionComponent {
|
|
2301
|
+
constructor(dataService) {
|
|
2302
|
+
this.dataService = dataService;
|
|
2303
|
+
this.formData = {};
|
|
2304
|
+
}
|
|
2305
|
+
ngOnInit() {
|
|
2306
|
+
this.dataService.setApiUrl(this.formData.apiurl);
|
|
2307
|
+
this.dataService.setHeader(this.formData.headers);
|
|
2308
|
+
}
|
|
2309
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionComponent, deps: [{ token: DataService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2310
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FormSubmissionComponent, selector: "lib-formSubmission", inputs: { formData: "formData" }, ngImport: i0, template: "<lib-submit-form [moduleName]=\"formData.moduleName\"></lib-submit-form>", styles: [""], dependencies: [{ kind: "component", type: SubmitFormComponent, selector: "lib-submit-form", inputs: ["moduleName"] }] }); }
|
|
2311
|
+
}
|
|
2312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionComponent, decorators: [{
|
|
2313
|
+
type: Component,
|
|
2314
|
+
args: [{ selector: 'lib-formSubmission', template: "<lib-submit-form [moduleName]=\"formData.moduleName\"></lib-submit-form>" }]
|
|
2315
|
+
}], ctorParameters: function () { return [{ type: DataService }]; }, propDecorators: { formData: [{
|
|
2316
|
+
type: Input
|
|
2317
|
+
}] } });
|
|
2318
|
+
|
|
2319
|
+
class FormFieldsModule {
|
|
2320
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormFieldsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2321
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FormFieldsModule, declarations: [CheckBoxFieldsComponent,
|
|
2322
|
+
DateTimeFieldsComponent,
|
|
2323
|
+
DropDownFieldsComponent,
|
|
2324
|
+
FilePickerFieldsComponent,
|
|
2325
|
+
LocationFieldsComponent,
|
|
2326
|
+
RadioButtonFieldsComponent,
|
|
2327
|
+
RichTextEditorFieldsComponent,
|
|
2328
|
+
SelectionMatrixFieldsComponent,
|
|
2329
|
+
SignatureFieldsComponent,
|
|
2330
|
+
SliderFieldsComponent,
|
|
2331
|
+
TermsAndConditionFieldsComponent,
|
|
2332
|
+
TextAreaFieldsComponent,
|
|
2333
|
+
TextFieldsComponent,
|
|
2334
|
+
ToggleSwitchFieldsComponent,
|
|
2335
|
+
UrlFieldsComponent,
|
|
2336
|
+
MailFieldsComponent,
|
|
2337
|
+
MobileFieldsComponent,
|
|
2338
|
+
NumberFieldsComponent,
|
|
2339
|
+
PasswordFieldsComponent,
|
|
2340
|
+
SectionFieldsComponent], imports: [CommonModule,
|
|
2341
|
+
FormsModule,
|
|
2342
|
+
MatSliderModule, i3.BsDatepickerModule, DropdownModule,
|
|
2343
|
+
AngularEditorModule,
|
|
2344
|
+
DocUploadModule,
|
|
2345
|
+
BrowserModule,
|
|
2346
|
+
GoogleMapsModule,
|
|
2347
|
+
FilePreviewModule], exports: [CheckBoxFieldsComponent,
|
|
2348
|
+
DateTimeFieldsComponent,
|
|
2349
|
+
DropDownFieldsComponent,
|
|
2350
|
+
FilePickerFieldsComponent,
|
|
2351
|
+
LocationFieldsComponent,
|
|
2352
|
+
MailFieldsComponent,
|
|
2353
|
+
MobileFieldsComponent,
|
|
2354
|
+
NumberFieldsComponent,
|
|
2355
|
+
PasswordFieldsComponent,
|
|
2356
|
+
RadioButtonFieldsComponent,
|
|
2357
|
+
RichTextEditorFieldsComponent,
|
|
2358
|
+
SelectionMatrixFieldsComponent,
|
|
2359
|
+
SignatureFieldsComponent,
|
|
2360
|
+
SliderFieldsComponent,
|
|
2361
|
+
TermsAndConditionFieldsComponent,
|
|
2362
|
+
TextAreaFieldsComponent,
|
|
2363
|
+
TextFieldsComponent,
|
|
2364
|
+
ToggleSwitchFieldsComponent,
|
|
2365
|
+
UrlFieldsComponent,
|
|
2366
|
+
SectionFieldsComponent] }); }
|
|
2367
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormFieldsModule, imports: [CommonModule,
|
|
2368
|
+
FormsModule,
|
|
2369
|
+
MatSliderModule,
|
|
2370
|
+
BsDatepickerModule.forRoot(),
|
|
2371
|
+
DropdownModule,
|
|
2372
|
+
AngularEditorModule,
|
|
2373
|
+
DocUploadModule,
|
|
2374
|
+
BrowserModule,
|
|
2375
|
+
GoogleMapsModule,
|
|
2376
|
+
FilePreviewModule] }); }
|
|
2377
|
+
}
|
|
2378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormFieldsModule, decorators: [{
|
|
2379
|
+
type: NgModule,
|
|
2380
|
+
args: [{
|
|
2381
|
+
declarations: [
|
|
2382
|
+
CheckBoxFieldsComponent,
|
|
2383
|
+
DateTimeFieldsComponent,
|
|
2384
|
+
DropDownFieldsComponent,
|
|
2385
|
+
FilePickerFieldsComponent,
|
|
2386
|
+
LocationFieldsComponent,
|
|
2387
|
+
RadioButtonFieldsComponent,
|
|
2388
|
+
RichTextEditorFieldsComponent,
|
|
2389
|
+
SelectionMatrixFieldsComponent,
|
|
2390
|
+
SignatureFieldsComponent,
|
|
2391
|
+
SliderFieldsComponent,
|
|
2392
|
+
TermsAndConditionFieldsComponent,
|
|
2393
|
+
TextAreaFieldsComponent,
|
|
2394
|
+
TextFieldsComponent,
|
|
2395
|
+
ToggleSwitchFieldsComponent,
|
|
2396
|
+
UrlFieldsComponent,
|
|
2397
|
+
MailFieldsComponent,
|
|
2398
|
+
MobileFieldsComponent,
|
|
2399
|
+
NumberFieldsComponent,
|
|
2400
|
+
PasswordFieldsComponent,
|
|
2401
|
+
SectionFieldsComponent
|
|
2402
|
+
],
|
|
2403
|
+
imports: [
|
|
2404
|
+
CommonModule,
|
|
2405
|
+
FormsModule,
|
|
2406
|
+
MatSliderModule,
|
|
2407
|
+
BsDatepickerModule.forRoot(),
|
|
2408
|
+
DropdownModule,
|
|
2409
|
+
AngularEditorModule,
|
|
2410
|
+
DocUploadModule,
|
|
2411
|
+
BrowserModule,
|
|
2412
|
+
GoogleMapsModule,
|
|
2413
|
+
FilePreviewModule
|
|
2414
|
+
],
|
|
2415
|
+
exports: [
|
|
2416
|
+
CheckBoxFieldsComponent,
|
|
2417
|
+
DateTimeFieldsComponent,
|
|
2418
|
+
DropDownFieldsComponent,
|
|
2419
|
+
FilePickerFieldsComponent,
|
|
2420
|
+
LocationFieldsComponent,
|
|
2421
|
+
MailFieldsComponent,
|
|
2422
|
+
MobileFieldsComponent,
|
|
2423
|
+
NumberFieldsComponent,
|
|
2424
|
+
PasswordFieldsComponent,
|
|
2425
|
+
RadioButtonFieldsComponent,
|
|
2426
|
+
RichTextEditorFieldsComponent,
|
|
2427
|
+
SelectionMatrixFieldsComponent,
|
|
2428
|
+
SignatureFieldsComponent,
|
|
2429
|
+
SliderFieldsComponent,
|
|
2430
|
+
TermsAndConditionFieldsComponent,
|
|
2431
|
+
TextAreaFieldsComponent,
|
|
2432
|
+
TextFieldsComponent,
|
|
2433
|
+
ToggleSwitchFieldsComponent,
|
|
2434
|
+
UrlFieldsComponent,
|
|
2435
|
+
SectionFieldsComponent
|
|
2436
|
+
]
|
|
2437
|
+
}]
|
|
2438
|
+
}] });
|
|
2439
|
+
|
|
2440
|
+
class LogicModule {
|
|
2441
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogicModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2442
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LogicModule, declarations: [LogicComponent], imports: [CommonModule], exports: [LogicComponent] }); }
|
|
2443
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogicModule, imports: [CommonModule] }); }
|
|
2444
|
+
}
|
|
2445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LogicModule, decorators: [{
|
|
2446
|
+
type: NgModule,
|
|
2447
|
+
args: [{
|
|
2448
|
+
declarations: [LogicComponent],
|
|
2449
|
+
imports: [
|
|
2450
|
+
CommonModule
|
|
2451
|
+
],
|
|
2452
|
+
exports: [LogicComponent]
|
|
2453
|
+
}]
|
|
2454
|
+
}] });
|
|
2455
|
+
|
|
2456
|
+
class ElementTypeModule {
|
|
2457
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ElementTypeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2458
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ElementTypeModule, declarations: [FormElementsComponent, QuestionComponent, SubFormComponent], imports: [CommonModule,
|
|
2459
|
+
FormFieldsModule,
|
|
2460
|
+
LogicModule], exports: [FormElementsComponent,
|
|
2461
|
+
QuestionComponent,
|
|
2462
|
+
SubFormComponent] }); }
|
|
2463
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ElementTypeModule, imports: [CommonModule,
|
|
2464
|
+
FormFieldsModule,
|
|
2465
|
+
LogicModule] }); }
|
|
2466
|
+
}
|
|
2467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ElementTypeModule, decorators: [{
|
|
2468
|
+
type: NgModule,
|
|
2469
|
+
args: [{
|
|
2470
|
+
declarations: [FormElementsComponent, QuestionComponent, SubFormComponent],
|
|
2471
|
+
imports: [
|
|
2472
|
+
CommonModule,
|
|
2473
|
+
FormFieldsModule,
|
|
2474
|
+
LogicModule
|
|
2475
|
+
],
|
|
2476
|
+
exports: [
|
|
2477
|
+
FormElementsComponent,
|
|
2478
|
+
QuestionComponent,
|
|
2479
|
+
SubFormComponent
|
|
2480
|
+
]
|
|
2481
|
+
}]
|
|
2482
|
+
}] });
|
|
2483
|
+
|
|
2484
|
+
class FormSubmitModule {
|
|
2485
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2486
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FormSubmitModule, declarations: [SubmitFormComponent,
|
|
2487
|
+
HeaderComponent,
|
|
2488
|
+
NavigationTabsComponent,
|
|
2489
|
+
NextPrevNavigationComponent], imports: [CommonModule,
|
|
2490
|
+
FormFieldsModule, i3.BsDatepickerModule, ElementTypeModule], exports: [SubmitFormComponent, NextPrevNavigationComponent] }); }
|
|
2491
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmitModule, imports: [CommonModule,
|
|
2492
|
+
FormFieldsModule,
|
|
2493
|
+
BsDatepickerModule.forRoot(),
|
|
2494
|
+
ElementTypeModule] }); }
|
|
2495
|
+
}
|
|
2496
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmitModule, decorators: [{
|
|
2497
|
+
type: NgModule,
|
|
2498
|
+
args: [{
|
|
2499
|
+
declarations: [
|
|
2500
|
+
SubmitFormComponent,
|
|
2501
|
+
HeaderComponent,
|
|
2502
|
+
NavigationTabsComponent,
|
|
2503
|
+
NextPrevNavigationComponent
|
|
2504
|
+
],
|
|
2505
|
+
imports: [
|
|
2506
|
+
CommonModule,
|
|
2507
|
+
FormFieldsModule,
|
|
2508
|
+
BsDatepickerModule.forRoot(),
|
|
2509
|
+
ElementTypeModule
|
|
2510
|
+
],
|
|
2511
|
+
exports: [SubmitFormComponent, NextPrevNavigationComponent]
|
|
2512
|
+
}]
|
|
2513
|
+
}] });
|
|
2514
|
+
|
|
2515
|
+
class FormSubmissionModule {
|
|
2516
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2517
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionModule, declarations: [FormSubmissionComponent], imports: [DropdownModule,
|
|
2518
|
+
FilePreviewModule,
|
|
2519
|
+
DocUploadModule,
|
|
2520
|
+
FormsModule,
|
|
2521
|
+
MatTabsModule,
|
|
2522
|
+
FormFieldsModule,
|
|
2523
|
+
FormSubmitModule], exports: [FormSubmissionComponent] }); }
|
|
2524
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionModule, imports: [DropdownModule,
|
|
2525
|
+
FilePreviewModule,
|
|
2526
|
+
DocUploadModule,
|
|
2527
|
+
FormsModule,
|
|
2528
|
+
MatTabsModule,
|
|
2529
|
+
FormFieldsModule,
|
|
2530
|
+
FormSubmitModule] }); }
|
|
2531
|
+
}
|
|
2532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSubmissionModule, decorators: [{
|
|
2533
|
+
type: NgModule,
|
|
2534
|
+
args: [{
|
|
2535
|
+
declarations: [FormSubmissionComponent],
|
|
2536
|
+
imports: [
|
|
2537
|
+
DropdownModule,
|
|
2538
|
+
FilePreviewModule,
|
|
2539
|
+
DocUploadModule,
|
|
2540
|
+
FormsModule,
|
|
2541
|
+
MatTabsModule,
|
|
2542
|
+
FormFieldsModule,
|
|
2543
|
+
FormSubmitModule,
|
|
2544
|
+
],
|
|
2545
|
+
exports: [FormSubmissionComponent],
|
|
2546
|
+
}]
|
|
2547
|
+
}] });
|
|
2548
|
+
|
|
2549
|
+
/*
|
|
2550
|
+
* Public API Surface of form-submission
|
|
2551
|
+
*/
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* Generated bundle index. Do not edit.
|
|
2555
|
+
*/
|
|
2556
|
+
|
|
2557
|
+
export { FormSubmissionComponent, FormSubmissionModule, FormSubmissionService };
|
|
2558
|
+
//# sourceMappingURL=piserve-tech-form-submission.mjs.map
|