@piserve-tech/form-submission 1.3.317 โ 1.3.319
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/environment/environment.d.ts +5 -0
- package/esm2022/environment/environment.mjs +6 -0
- package/esm2022/form-fields/aggregate-function/aggregate-function.component.mjs +146 -0
- package/esm2022/form-fields/check-box-fields/check-box-fields.component.mjs +473 -0
- package/esm2022/form-fields/currency-fields/currency-fields.component.mjs +502 -0
- package/esm2022/form-fields/date-time-fields/date-time-fields.component.mjs +608 -0
- package/esm2022/form-fields/drop-down-fields/drop-down-fields.component.mjs +585 -0
- package/esm2022/form-fields/file-picker-fields/file-picker-fields.component.mjs +224 -0
- package/esm2022/form-fields/form-fields.module.mjs +174 -0
- package/esm2022/form-fields/hidden-field/hidden-field.component.mjs +137 -0
- package/esm2022/form-fields/iframe-fields/iframe-fields.component.mjs +198 -0
- package/esm2022/form-fields/location-fields/location-fields.component.mjs +85 -0
- package/esm2022/form-fields/mail-fields/mail-fields.component.mjs +131 -0
- package/esm2022/form-fields/mobile-fields/mobile-fields.component.mjs +270 -0
- package/esm2022/form-fields/number-fields/number-fields.component.mjs +242 -0
- package/esm2022/form-fields/password-fields/password-fields.component.mjs +257 -0
- package/esm2022/form-fields/radio-button-fields/radio-button-fields.component.mjs +346 -0
- package/esm2022/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.mjs +148 -0
- package/esm2022/form-fields/section-fields/section-fields.component.mjs +29 -0
- package/esm2022/form-fields/selection-matrix-fields/selection-matrix-fields.component.mjs +158 -0
- package/esm2022/form-fields/signature-fields/signature-fields.component.mjs +32 -0
- package/esm2022/form-fields/slider-fields/slider-fields.component.mjs +73 -0
- package/esm2022/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.mjs +66 -0
- package/esm2022/form-fields/text-area-fields/text-area-fields.component.mjs +159 -0
- package/esm2022/form-fields/text-fields/text-fields.component.mjs +245 -0
- package/esm2022/form-fields/toggle-switch-fields/toggle-switch-fields.component.mjs +85 -0
- package/esm2022/form-fields/url-fields/url-fields.component.mjs +124 -0
- package/esm2022/form-submission/form-submission.module.mjs +64 -0
- package/esm2022/form-submission/header/header.component.mjs +20 -0
- package/esm2022/form-submission/navigation-tabs/navigation-tabs.component.mjs +171 -0
- package/esm2022/form-submission/next-prev-navigation/next-prev-navigation.component.mjs +124 -0
- package/esm2022/form-submission/save-as-draft/saveDraftModalComponent .mjs +50 -0
- package/esm2022/form-submission/submission-container/submission-container.component.mjs +17 -0
- package/esm2022/form-submission/submit-form/submit-form.component.mjs +1610 -0
- package/esm2022/lib/form-submission.component.mjs +113 -0
- package/esm2022/lib/form-submission.module.mjs +56 -0
- package/esm2022/lib/form-submission.service.mjs +14 -0
- package/esm2022/models/aggregate.model.mjs +2 -0
- package/esm2022/models/answer.model.mjs +2 -0
- package/esm2022/models/appearance.model.mjs +2 -0
- package/esm2022/models/attachment.model.mjs +2 -0
- package/esm2022/models/defaultAnswerEntry.model.mjs +2 -0
- package/esm2022/models/defaultAnswersModel.model.mjs +2 -0
- package/esm2022/models/defaultQuestionAnswer.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/emitters.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/hiddenField.model.mjs +2 -0
- package/esm2022/models/iFrameProperties.model.mjs +2 -0
- package/esm2022/models/logic.model.mjs +2 -0
- package/esm2022/models/multifields.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/questionAnswer.model.mjs +2 -0
- package/esm2022/models/questionGroup.model.mjs +2 -0
- package/esm2022/models/row.model.mjs +2 -0
- package/esm2022/models/scoring.model.mjs +2 -0
- package/esm2022/models/section.model.mjs +2 -0
- package/esm2022/models/subForm.model.mjs +2 -0
- package/esm2022/models/subformConfiguration.model.mjs +2 -0
- package/esm2022/models/subformPropery.model.mjs +2 -0
- package/esm2022/models/submission.model.mjs +2 -0
- package/esm2022/models/submissionCopyConfig.mopdel.mjs +2 -0
- package/esm2022/models/terms&condition.model.mjs +2 -0
- package/esm2022/models/validation.model.mjs +2 -0
- package/esm2022/models/whenClause.model.mjs +2 -0
- package/esm2022/models/whenClauseCondition.model.mjs +2 -0
- package/esm2022/models/whenClauseElements.model.mjs +2 -0
- package/esm2022/piserve-tech-form-submission.mjs +5 -0
- package/esm2022/public-api.mjs +7 -0
- package/esm2022/question/card-subform/card-subform.component.mjs +354 -0
- package/esm2022/question/confirm-dialog/confirm-dialog.component.mjs +27 -0
- package/esm2022/question/form-elements/form-elements.component.mjs +62 -0
- package/esm2022/question/inline-multiple-subform/inline-multiple-subform.component.mjs +384 -0
- package/esm2022/question/multifields/multifields.component.mjs +54 -0
- package/esm2022/question/multiple-subform/multiple-subform.component.mjs +413 -0
- package/esm2022/question/question/question.component.mjs +145 -0
- package/esm2022/question/question-group/question-group.component.mjs +102 -0
- package/esm2022/question/recursive-logic/recursive-logic.component.mjs +49 -0
- package/esm2022/question/sub-form/sub-form.component.mjs +355 -0
- package/esm2022/services/aggregate.service.mjs +139 -0
- package/esm2022/services/countryService.mjs +89 -0
- package/esm2022/services/data.service.mjs +36 -0
- package/esm2022/services/element-tracker.service.mjs +27 -0
- package/esm2022/services/form-validation.service.mjs +128 -0
- package/esm2022/services/form.service.mjs +332 -0
- package/esm2022/services/mapper.service.mjs +519 -0
- package/esm2022/services/recaptcha.service.mjs +136 -0
- package/esm2022/services/score.service.mjs +268 -0
- package/esm2022/services/subform-copy.service.mjs +122 -0
- package/esm2022/services/validation.service.mjs +35 -0
- package/esm2022/services/whenClause.service.mjs +423 -0
- package/esm2022/shared/shared.module.mjs +97 -0
- package/esm2022/sub-form/submission-modal/submission-modal.component.mjs +133 -0
- package/fesm2022/piserve-tech-form-submission.mjs +11661 -0
- package/fesm2022/piserve-tech-form-submission.mjs.map +1 -0
- package/form-fields/aggregate-function/aggregate-function.component.d.ts +43 -0
- package/form-fields/check-box-fields/check-box-fields.component.d.ts +73 -0
- package/form-fields/currency-fields/currency-fields.component.d.ts +62 -0
- package/form-fields/date-time-fields/date-time-fields.component.d.ts +96 -0
- package/form-fields/drop-down-fields/drop-down-fields.component.d.ts +88 -0
- package/form-fields/file-picker-fields/file-picker-fields.component.d.ts +72 -0
- package/form-fields/form-fields.module.d.ts +40 -0
- package/form-fields/hidden-field/hidden-field.component.d.ts +38 -0
- package/form-fields/iframe-fields/iframe-fields.component.d.ts +35 -0
- package/form-fields/location-fields/location-fields.component.d.ts +29 -0
- package/form-fields/mail-fields/mail-fields.component.d.ts +41 -0
- package/form-fields/mobile-fields/mobile-fields.component.d.ts +71 -0
- package/form-fields/number-fields/number-fields.component.d.ts +53 -0
- package/form-fields/password-fields/password-fields.component.d.ts +57 -0
- package/form-fields/radio-button-fields/radio-button-fields.component.d.ts +70 -0
- package/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.d.ts +46 -0
- package/form-fields/section-fields/section-fields.component.d.ts +10 -0
- package/form-fields/selection-matrix-fields/selection-matrix-fields.component.d.ts +45 -0
- package/form-fields/signature-fields/signature-fields.component.d.ts +13 -0
- package/form-fields/slider-fields/slider-fields.component.d.ts +32 -0
- package/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.d.ts +26 -0
- package/form-fields/text-area-fields/text-area-fields.component.d.ts +49 -0
- package/form-fields/text-fields/text-fields.component.d.ts +49 -0
- package/form-fields/toggle-switch-fields/toggle-switch-fields.component.d.ts +29 -0
- package/form-fields/url-fields/url-fields.component.d.ts +41 -0
- package/form-submission/form-submission.module.d.ts +20 -0
- package/form-submission/header/header.component.d.ts +7 -0
- package/form-submission/navigation-tabs/navigation-tabs.component.d.ts +57 -0
- package/form-submission/next-prev-navigation/next-prev-navigation.component.d.ts +46 -0
- package/form-submission/save-as-draft/saveDraftModalComponent .d.ts +17 -0
- package/form-submission/submission-container/submission-container.component.d.ts +7 -0
- package/form-submission/submit-form/submit-form.component.d.ts +237 -0
- package/index.d.ts +5 -0
- package/lib/form-submission.component.d.ts +30 -0
- package/lib/form-submission.module.d.ts +16 -0
- package/lib/form-submission.service.d.ts +6 -0
- package/models/aggregate.model.d.ts +4 -0
- package/{src/models/answer.model.ts โ models/answer.model.d.ts} +23 -25
- package/models/appearance.model.d.ts +64 -0
- package/{src/models/attachment.model.ts โ models/attachment.model.d.ts} +6 -6
- package/{src/models/defaultAnswerEntry.model.ts โ models/defaultAnswerEntry.model.d.ts} +5 -7
- package/{src/models/defaultAnswersModel.model.ts โ models/defaultAnswersModel.model.d.ts} +4 -5
- package/{src/models/defaultQuestionAnswer.model.ts โ models/defaultQuestionAnswer.model.d.ts} +6 -6
- package/models/elementOptionAPI.model.d.ts +12 -0
- package/models/elementOptionAPIData.model.d.ts +5 -0
- package/models/elementOptionDB.model.d.ts +8 -0
- package/models/elementOptionDBCriteria.model.d.ts +7 -0
- package/{src/models/emitters.model.ts โ models/emitters.model.d.ts} +8 -8
- package/{src/models/enum/condition.enum.ts โ models/enum/condition.enum.d.ts} +2 -2
- package/models/enum/elementType .enum.d.ts +22 -0
- package/models/enum/entityType.enum.d.ts +10 -0
- package/{src/models/formConfiguration.model.ts โ models/formConfiguration.model.d.ts} +2 -2
- package/{src/models/formElement.model.ts โ models/formElement.model.d.ts} +22 -22
- package/{src/models/formElementType.model.ts โ models/formElementType.model.d.ts} +2 -3
- package/{src/models/grid.model.ts โ models/grid.model.d.ts} +13 -14
- package/{src/models/hiddenField.model.ts โ models/hiddenField.model.d.ts} +5 -5
- package/{src/models/iFrameProperties.model.ts โ models/iFrameProperties.model.d.ts} +13 -13
- package/models/logic.model.d.ts +9 -0
- package/models/multifields.model.d.ts +11 -0
- package/{src/models/option.model.ts โ models/option.model.d.ts} +5 -5
- package/models/page.model.d.ts +6 -0
- package/models/publicForm.model.d.ts +18 -0
- package/models/question.model.d.ts +26 -0
- package/models/questionAnswer.model.d.ts +7 -0
- package/models/questionGroup.model.d.ts +11 -0
- package/{src/models/row.model.ts โ models/row.model.d.ts} +1 -2
- package/models/scoring.model.d.ts +10 -0
- package/models/section.model.d.ts +6 -0
- package/models/subForm.model.d.ts +24 -0
- package/models/subformConfiguration.model.d.ts +4 -0
- package/models/subformPropery.model.d.ts +7 -0
- package/{src/models/submission.model.ts โ models/submission.model.d.ts} +14 -16
- package/{src/models/submissionCopyConfig.mopdel.ts โ models/submissionCopyConfig.mopdel.d.ts} +4 -4
- package/{src/models/terms&condition.model.ts โ models/terms&condition.model.d.ts} +1 -1
- package/models/validation.model.d.ts +48 -0
- package/models/whenClause.model.d.ts +6 -0
- package/{src/models/whenClauseCondition.model.ts โ models/whenClauseCondition.model.d.ts} +6 -6
- package/{src/models/whenClauseElements.model.ts โ models/whenClauseElements.model.d.ts} +5 -6
- package/package.json +46 -33
- package/{src/public-api.ts โ public-api.d.ts} +0 -4
- package/question/card-subform/card-subform.component.d.ts +44 -0
- package/question/confirm-dialog/confirm-dialog.component.d.ts +12 -0
- package/question/form-elements/form-elements.component.d.ts +20 -0
- package/question/inline-multiple-subform/inline-multiple-subform.component.d.ts +47 -0
- package/question/multifields/multifields.component.d.ts +11 -0
- package/question/multiple-subform/multiple-subform.component.d.ts +39 -0
- package/question/question/question.component.d.ts +30 -0
- package/question/question-group/question-group.component.d.ts +29 -0
- package/question/recursive-logic/recursive-logic.component.d.ts +19 -0
- package/question/sub-form/sub-form.component.d.ts +70 -0
- package/services/aggregate.service.d.ts +29 -0
- package/services/countryService.d.ts +21 -0
- package/services/data.service.d.ts +19 -0
- package/services/element-tracker.service.d.ts +10 -0
- package/services/form-validation.service.d.ts +16 -0
- package/services/form.service.d.ts +27 -0
- package/services/mapper.service.d.ts +31 -0
- package/services/recaptcha.service.d.ts +46 -0
- package/services/score.service.d.ts +27 -0
- package/services/subform-copy.service.d.ts +10 -0
- package/services/validation.service.d.ts +14 -0
- package/services/whenClause.service.d.ts +45 -0
- package/shared/shared.module.d.ts +25 -0
- package/sub-form/submission-modal/submission-modal.component.d.ts +31 -0
- package/ng-package.json +0 -30
- package/src/environment/environment.ts +0 -6
- package/src/form-fields/aggregate-function/aggregate-function.component.html +0 -63
- package/src/form-fields/aggregate-function/aggregate-function.component.scss +0 -1
- package/src/form-fields/aggregate-function/aggregate-function.component.spec.ts +0 -21
- package/src/form-fields/aggregate-function/aggregate-function.component.ts +0 -148
- package/src/form-fields/check-box-fields/check-box-fields.component.html +0 -81
- package/src/form-fields/check-box-fields/check-box-fields.component.scss +0 -28
- package/src/form-fields/check-box-fields/check-box-fields.component.spec.ts +0 -21
- package/src/form-fields/check-box-fields/check-box-fields.component.ts +0 -538
- package/src/form-fields/currency-fields/currency-fields.component.html +0 -85
- package/src/form-fields/currency-fields/currency-fields.component.scss +0 -48
- package/src/form-fields/currency-fields/currency-fields.component.spec.ts +0 -21
- package/src/form-fields/currency-fields/currency-fields.component.ts +0 -589
- package/src/form-fields/date-time-fields/date-time-fields.component.html +0 -268
- package/src/form-fields/date-time-fields/date-time-fields.component.scss +0 -88
- package/src/form-fields/date-time-fields/date-time-fields.component.spec.ts +0 -21
- package/src/form-fields/date-time-fields/date-time-fields.component.ts +0 -693
- package/src/form-fields/drop-down-fields/drop-down-fields.component.html +0 -77
- package/src/form-fields/drop-down-fields/drop-down-fields.component.scss +0 -12
- package/src/form-fields/drop-down-fields/drop-down-fields.component.spec.ts +0 -21
- package/src/form-fields/drop-down-fields/drop-down-fields.component.ts +0 -698
- package/src/form-fields/file-picker-fields/file-picker-fields.component.html +0 -72
- package/src/form-fields/file-picker-fields/file-picker-fields.component.scss +0 -33
- package/src/form-fields/file-picker-fields/file-picker-fields.component.spec.ts +0 -21
- package/src/form-fields/file-picker-fields/file-picker-fields.component.ts +0 -256
- package/src/form-fields/form-fields.module.ts +0 -110
- package/src/form-fields/hidden-field/hidden-field.component.scss +0 -0
- package/src/form-fields/hidden-field/hidden-field.component.spec.ts +0 -21
- package/src/form-fields/hidden-field/hidden-field.component.ts +0 -156
- package/src/form-fields/iframe-fields/iframe-fields.component.html +0 -31
- package/src/form-fields/iframe-fields/iframe-fields.component.scss +0 -0
- package/src/form-fields/iframe-fields/iframe-fields.component.spec.ts +0 -21
- package/src/form-fields/iframe-fields/iframe-fields.component.ts +0 -225
- package/src/form-fields/location-fields/location-fields.component.html +0 -54
- package/src/form-fields/location-fields/location-fields.component.scss +0 -22
- package/src/form-fields/location-fields/location-fields.component.spec.ts +0 -21
- package/src/form-fields/location-fields/location-fields.component.ts +0 -83
- package/src/form-fields/mail-fields/mail-fields.component.html +0 -66
- package/src/form-fields/mail-fields/mail-fields.component.scss +0 -10
- package/src/form-fields/mail-fields/mail-fields.component.spec.ts +0 -21
- package/src/form-fields/mail-fields/mail-fields.component.ts +0 -127
- package/src/form-fields/mobile-fields/mobile-fields.component.html +0 -97
- package/src/form-fields/mobile-fields/mobile-fields.component.scss +0 -52
- package/src/form-fields/mobile-fields/mobile-fields.component.spec.ts +0 -21
- package/src/form-fields/mobile-fields/mobile-fields.component.ts +0 -310
- package/src/form-fields/number-fields/number-fields.component.html +0 -70
- package/src/form-fields/number-fields/number-fields.component.scss +0 -17
- package/src/form-fields/number-fields/number-fields.component.spec.ts +0 -21
- package/src/form-fields/number-fields/number-fields.component.ts +0 -256
- package/src/form-fields/password-fields/password-fields.component.html +0 -113
- package/src/form-fields/password-fields/password-fields.component.scss +0 -61
- package/src/form-fields/password-fields/password-fields.component.spec.ts +0 -21
- package/src/form-fields/password-fields/password-fields.component.ts +0 -273
- package/src/form-fields/radio-button-fields/radio-button-fields.component.html +0 -82
- package/src/form-fields/radio-button-fields/radio-button-fields.component.scss +0 -28
- package/src/form-fields/radio-button-fields/radio-button-fields.component.spec.ts +0 -21
- package/src/form-fields/radio-button-fields/radio-button-fields.component.ts +0 -391
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.html +0 -67
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.scss +0 -23
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.spec.ts +0 -21
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.ts +0 -145
- package/src/form-fields/section-fields/section-fields.component.html +0 -4
- package/src/form-fields/section-fields/section-fields.component.scss +0 -37
- package/src/form-fields/section-fields/section-fields.component.spec.ts +0 -21
- package/src/form-fields/section-fields/section-fields.component.ts +0 -25
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.html +0 -93
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.scss +0 -52
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.spec.ts +0 -21
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.ts +0 -155
- package/src/form-fields/signature-fields/signature-fields.component.html +0 -43
- package/src/form-fields/signature-fields/signature-fields.component.scss +0 -10
- package/src/form-fields/signature-fields/signature-fields.component.spec.ts +0 -21
- package/src/form-fields/signature-fields/signature-fields.component.ts +0 -25
- package/src/form-fields/slider-fields/slider-fields.component.html +0 -67
- package/src/form-fields/slider-fields/slider-fields.component.scss +0 -55
- package/src/form-fields/slider-fields/slider-fields.component.spec.ts +0 -21
- package/src/form-fields/slider-fields/slider-fields.component.ts +0 -63
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.html +0 -52
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.scss +0 -85
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.spec.ts +0 -21
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.ts +0 -62
- package/src/form-fields/text-area-fields/text-area-fields.component.html +0 -68
- package/src/form-fields/text-area-fields/text-area-fields.component.scss +0 -19
- package/src/form-fields/text-area-fields/text-area-fields.component.spec.ts +0 -21
- package/src/form-fields/text-area-fields/text-area-fields.component.ts +0 -166
- package/src/form-fields/text-fields/text-fields.component.html +0 -67
- package/src/form-fields/text-fields/text-fields.component.scss +0 -26
- package/src/form-fields/text-fields/text-fields.component.spec.ts +0 -21
- package/src/form-fields/text-fields/text-fields.component.ts +0 -248
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.html +0 -70
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.scss +0 -112
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.spec.ts +0 -21
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.ts +0 -74
- package/src/form-fields/url-fields/url-fields.component.html +0 -109
- package/src/form-fields/url-fields/url-fields.component.scss +0 -22
- package/src/form-fields/url-fields/url-fields.component.spec.ts +0 -21
- package/src/form-fields/url-fields/url-fields.component.ts +0 -123
- package/src/form-submission/form-submission.module.ts +0 -40
- package/src/form-submission/header/header.component.html +0 -6
- package/src/form-submission/header/header.component.scss +0 -26
- package/src/form-submission/header/header.component.spec.ts +0 -21
- package/src/form-submission/header/header.component.ts +0 -12
- package/src/form-submission/navigation-tabs/navigation-tabs.component.html +0 -134
- package/src/form-submission/navigation-tabs/navigation-tabs.component.scss +0 -200
- package/src/form-submission/navigation-tabs/navigation-tabs.component.spec.ts +0 -21
- package/src/form-submission/navigation-tabs/navigation-tabs.component.ts +0 -134
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.html +0 -207
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.scss +0 -208
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.spec.ts +0 -21
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.ts +0 -74
- package/src/form-submission/save-as-draft/saveDraftModalComponent .ts +0 -60
- package/src/form-submission/save-as-draft/saveDraftModalComponent.html +0 -33
- package/src/form-submission/save-as-draft/saveDraftModalComponent.scss +0 -195
- package/src/form-submission/submission-container/submission-container.component.html +0 -30
- package/src/form-submission/submission-container/submission-container.component.scss +0 -67
- package/src/form-submission/submission-container/submission-container.component.spec.ts +0 -21
- package/src/form-submission/submission-container/submission-container.component.ts +0 -14
- package/src/form-submission/submit-form/submit-form.component.html +0 -76
- package/src/form-submission/submit-form/submit-form.component.scss +0 -88
- package/src/form-submission/submit-form/submit-form.component.spec.ts +0 -21
- package/src/form-submission/submit-form/submit-form.component.ts +0 -1953
- package/src/lib/form-submission.component.html +0 -15
- package/src/lib/form-submission.component.scss +0 -1
- package/src/lib/form-submission.component.ts +0 -120
- package/src/lib/form-submission.module.ts +0 -31
- package/src/lib/form-submission.service.spec.ts +0 -16
- package/src/lib/form-submission.service.ts +0 -9
- package/src/models/aggregate.model.ts +0 -4
- package/src/models/appearance.model.ts +0 -64
- package/src/models/elementOptionAPI.model.ts +0 -13
- package/src/models/elementOptionAPIData.model.ts +0 -5
- package/src/models/elementOptionDB.model.ts +0 -9
- package/src/models/elementOptionDBCriteria.model.ts +0 -7
- package/src/models/enum/elementType .enum.ts +0 -22
- package/src/models/enum/entityType.enum.ts +0 -10
- package/src/models/logic.model.ts +0 -11
- package/src/models/multifields.model.ts +0 -12
- package/src/models/page.model.ts +0 -7
- package/src/models/publicForm.model.ts +0 -19
- package/src/models/question.model.ts +0 -27
- package/src/models/questionAnswer.model.ts +0 -8
- package/src/models/questionGroup.model.ts +0 -12
- package/src/models/response.model.ts +0 -9
- package/src/models/result.model.ts +0 -5
- package/src/models/scoring.model.ts +0 -10
- package/src/models/section.model.ts +0 -6
- package/src/models/subForm.model.ts +0 -25
- package/src/models/subformConfiguration.model.ts +0 -4
- package/src/models/subformPropery.model.ts +0 -8
- package/src/models/validation.model.ts +0 -48
- package/src/models/whenClause.model.ts +0 -7
- package/src/question/card-subform/card-subform.component.html +0 -282
- package/src/question/card-subform/card-subform.component.scss +0 -49
- package/src/question/card-subform/card-subform.component.spec.ts +0 -21
- package/src/question/card-subform/card-subform.component.ts +0 -407
- package/src/question/confirm-dialog/confirm-dialog.component.html +0 -32
- package/src/question/confirm-dialog/confirm-dialog.component.scss +0 -109
- package/src/question/confirm-dialog/confirm-dialog.component.spec.ts +0 -21
- package/src/question/confirm-dialog/confirm-dialog.component.ts +0 -24
- package/src/question/form-elements/form-elements.component.html +0 -28
- package/src/question/form-elements/form-elements.component.scss +0 -0
- package/src/question/form-elements/form-elements.component.spec.ts +0 -21
- package/src/question/form-elements/form-elements.component.ts +0 -41
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.html +0 -321
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.scss +0 -78
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.spec.ts +0 -21
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.ts +0 -425
- package/src/question/multifields/multifields.component.html +0 -78
- package/src/question/multifields/multifields.component.scss +0 -6
- package/src/question/multifields/multifields.component.spec.ts +0 -21
- package/src/question/multifields/multifields.component.ts +0 -27
- package/src/question/multiple-subform/multiple-subform.component.html +0 -185
- package/src/question/multiple-subform/multiple-subform.component.scss +0 -52
- package/src/question/multiple-subform/multiple-subform.component.spec.ts +0 -21
- package/src/question/multiple-subform/multiple-subform.component.ts +0 -481
- package/src/question/question/question.component.html +0 -51
- package/src/question/question/question.component.scss +0 -0
- package/src/question/question/question.component.spec.ts +0 -21
- package/src/question/question/question.component.ts +0 -129
- package/src/question/question-group/question-group.component.html +0 -147
- package/src/question/question-group/question-group.component.scss +0 -36
- package/src/question/question-group/question-group.component.spec.ts +0 -21
- package/src/question/question-group/question-group.component.ts +0 -94
- package/src/question/question.module.ts +0 -22
- package/src/question/recursive-logic/recursive-logic.component.html +0 -33
- package/src/question/recursive-logic/recursive-logic.component.scss +0 -0
- package/src/question/recursive-logic/recursive-logic.component.spec.ts +0 -21
- package/src/question/recursive-logic/recursive-logic.component.ts +0 -29
- package/src/question/sub-form/sub-form.component.html +0 -254
- package/src/question/sub-form/sub-form.component.scss +0 -83
- package/src/question/sub-form/sub-form.component.spec.ts +0 -21
- package/src/question/sub-form/sub-form.component.ts +0 -421
- package/src/services/aggregate.service.ts +0 -148
- package/src/services/countryService.ts +0 -92
- package/src/services/data.service.ts +0 -36
- package/src/services/element-tracker.service.spec.ts +0 -16
- package/src/services/element-tracker.service.ts +0 -24
- package/src/services/form-validation.service.ts +0 -151
- package/src/services/form.service.spec.ts +0 -16
- package/src/services/form.service.ts +0 -407
- package/src/services/mapper.service.ts +0 -625
- package/src/services/recaptcha.service.spec.ts +0 -16
- package/src/services/recaptcha.service.ts +0 -179
- package/src/services/score.service.ts +0 -352
- package/src/services/subform-copy.service.ts +0 -148
- package/src/services/validation.service.spec.ts +0 -16
- package/src/services/validation.service.ts +0 -33
- package/src/services/whenClause.service.ts +0 -502
- package/src/shared/shared.module.ts +0 -58
- package/src/styles/shared-style.scss +0 -86
- package/src/sub-form/sub-form.module.ts +0 -24
- package/src/sub-form/submission-modal/submission-modal.component.html +0 -160
- package/src/sub-form/submission-modal/submission-modal.component.scss +0 -54
- package/src/sub-form/submission-modal/submission-modal.component.spec.ts +0 -21
- package/src/sub-form/submission-modal/submission-modal.component.ts +0 -127
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/assets โ assets}/fonts/Garamond.woff2 +0 -0
- /package/{src/assets โ assets}/fonts/Georgia.woff2 +0 -0
- /package/{src/assets โ assets}/fonts/Poppins.woff2 +0 -0
- /package/{src/assets โ assets}/fonts/Tahoma.woff2 +0 -0
- /package/{src/assets โ assets}/fonts/Tajawal.woff2 +0 -0
- /package/{src/assets โ assets}/fonts/Verdana.woff2 +0 -0
- /package/{src/assets โ assets}/icons/close-sidebar-mark-icon.svg +0 -0
- /package/{src/assets โ assets}/icons/copy-icon.svg +0 -0
- /package/{src/assets โ assets}/icons/delete-icon.svg +0 -0
- /package/{src/assets โ assets}/icons/delete-no-outline-icon.svg +0 -0
- /package/{src/assets โ assets}/icons/left_arrow.svg +0 -0
- /package/{src/assets โ assets}/icons/right_arrow.svg +0 -0
|
@@ -1,698 +0,0 @@
|
|
|
1
|
-
import { Logic } from './../../models/logic.model';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectorRef,
|
|
4
|
-
Component,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
Input,
|
|
7
|
-
Output,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { FormService } from '../../services/form.service';
|
|
10
|
-
import { ElementTrackerService } from '../../services/element-tracker.service';
|
|
11
|
-
import { ValidationService } from '../../services/validation.service';
|
|
12
|
-
import { ScoreCalculationService } from '../../services/score.service';
|
|
13
|
-
import { WhenClauseService } from '../../services/whenClause.service';
|
|
14
|
-
|
|
15
|
-
interface DropDownData {
|
|
16
|
-
value: string;
|
|
17
|
-
label: string;
|
|
18
|
-
image: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'lib-drop-down-fields',
|
|
23
|
-
templateUrl: './drop-down-fields.component.html',
|
|
24
|
-
styleUrls: ['./drop-down-fields.component.scss'],
|
|
25
|
-
})
|
|
26
|
-
export class DropDownFieldsComponent {
|
|
27
|
-
@Input() question: any = {};
|
|
28
|
-
@Input() inLine: boolean = false;
|
|
29
|
-
@Input() inCard: boolean = false;
|
|
30
|
-
@Input() submissionIndex!: number;
|
|
31
|
-
@Output() answerChange = new EventEmitter<{
|
|
32
|
-
answer: any;
|
|
33
|
-
maxPossibleScore?: number;
|
|
34
|
-
}>();
|
|
35
|
-
|
|
36
|
-
count: number = 0;
|
|
37
|
-
required: boolean = false;
|
|
38
|
-
hint: string = '';
|
|
39
|
-
selectionType: string = '';
|
|
40
|
-
minimumSelection: number = 0;
|
|
41
|
-
maximumSelection: number = 0;
|
|
42
|
-
optionType: string = '';
|
|
43
|
-
lookupTable: string = '';
|
|
44
|
-
customOptions: DropDownData[] = [];
|
|
45
|
-
originalOptions: DropDownData[] = [];
|
|
46
|
-
database: any = {};
|
|
47
|
-
api: any = {};
|
|
48
|
-
originalApi: any = {};
|
|
49
|
-
selectedValue: any[] = [];
|
|
50
|
-
validationFailed!: boolean;
|
|
51
|
-
validationMessage: string = '';
|
|
52
|
-
private elementId: string = '';
|
|
53
|
-
hasMoreData: boolean = true;
|
|
54
|
-
maxPossibleScore?: number;
|
|
55
|
-
selectedValues: any[] = [];
|
|
56
|
-
dbPageIndex: number = 0;
|
|
57
|
-
dbPageSize: number = 10;
|
|
58
|
-
dbTotalPages: number = 0;
|
|
59
|
-
@Input() disableEdit: boolean = false;
|
|
60
|
-
|
|
61
|
-
constructor(
|
|
62
|
-
private formService: FormService,
|
|
63
|
-
private cdr: ChangeDetectorRef,
|
|
64
|
-
private validationService: ValidationService,
|
|
65
|
-
private tracker: ElementTrackerService,
|
|
66
|
-
private scoreCalcService: ScoreCalculationService,
|
|
67
|
-
private whenClauseService:WhenClauseService
|
|
68
|
-
) {}
|
|
69
|
-
|
|
70
|
-
ngOnInit() {
|
|
71
|
-
this.valueAssigned();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
onValueChange(newValue: any) {
|
|
75
|
-
this.selectedValue = newValue;
|
|
76
|
-
this.selectItems();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
valueAssigned() {
|
|
80
|
-
this.count = this.question.count;
|
|
81
|
-
this.required = this.question.required;
|
|
82
|
-
this.hint = this.question.hint;
|
|
83
|
-
this.selectionType = this.question.formElement.appearance.selectionType;
|
|
84
|
-
this.minimumSelection =
|
|
85
|
-
this.question.formElement.validation.minimumSelection;
|
|
86
|
-
this.maximumSelection =
|
|
87
|
-
this.question.formElement.validation.maximumSelection;
|
|
88
|
-
this.optionType = this.question.formElement.option.optionType;
|
|
89
|
-
|
|
90
|
-
// --- Check if answer is present ---
|
|
91
|
-
if (this.question.answer && Array.isArray(this.question.answer)) {
|
|
92
|
-
if (this.optionType === 'API') {
|
|
93
|
-
this.api = this.question.formElement.option.api;
|
|
94
|
-
this.originalApi = JSON.parse(JSON.stringify(this.api));
|
|
95
|
-
// โ
Check if pagination is enabled (pageIndex + pageSize exist in params with valueSource)
|
|
96
|
-
const hasPagination =
|
|
97
|
-
this.api?.params?.some((p: any) => p.valueSource === 'PAGE_INDEX') &&
|
|
98
|
-
this.api?.params?.some((p: any) => p.valueSource === 'PAGE_SIZE');
|
|
99
|
-
|
|
100
|
-
if (hasPagination) {
|
|
101
|
-
// โ
Populate selected values from answer
|
|
102
|
-
this.selectedValues = this.question.answer.map((ans: string) => {
|
|
103
|
-
const parts = ans.split('|');
|
|
104
|
-
return parts.length > 1 ? parts[1] : parts[0];
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
else if (this.optionType === 'DATABASE') {
|
|
110
|
-
this.selectedValues = this.question.answer.map((ans: string) => {
|
|
111
|
-
const parts = ans.split('|');
|
|
112
|
-
return parts.length > 1 ? parts[1] : parts[0];
|
|
113
|
-
})};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// --- Handle different option types ---
|
|
118
|
-
switch (this.optionType) {
|
|
119
|
-
case 'OPTION':
|
|
120
|
-
this.customOptions = this.question.formElement.option.customOptions.map(
|
|
121
|
-
(option: { value: string }) => ({
|
|
122
|
-
label: option.value,
|
|
123
|
-
value: option.value,
|
|
124
|
-
image: '',
|
|
125
|
-
})
|
|
126
|
-
);
|
|
127
|
-
this.originalOptions = [...this.customOptions];
|
|
128
|
-
if (this.question.answer) {
|
|
129
|
-
this.initializeCustomOption();
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
|
|
133
|
-
case 'LOOKUP':
|
|
134
|
-
this.lookupTable = this.question.formElement.option.lookupTable;
|
|
135
|
-
this.fetchDataFromLookup();
|
|
136
|
-
break;
|
|
137
|
-
|
|
138
|
-
case 'DATABASE':
|
|
139
|
-
this.database = this.question.formElement.option.database;
|
|
140
|
-
this.fetchDataFromDatabase();
|
|
141
|
-
break;
|
|
142
|
-
|
|
143
|
-
case 'API':
|
|
144
|
-
if (!this.api || Object.keys(this.api).length === 0) {
|
|
145
|
-
this.api = this.question.formElement.option.api;
|
|
146
|
-
this.originalApi = JSON.parse(JSON.stringify(this.api));
|
|
147
|
-
}
|
|
148
|
-
this.fetchDataFromAPI();
|
|
149
|
-
break;
|
|
150
|
-
|
|
151
|
-
default:
|
|
152
|
-
console.warn('Unknown option type:', this.optionType);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// --- Scoring ---
|
|
156
|
-
if (
|
|
157
|
-
this.question.formElement.scoring &&
|
|
158
|
-
this.question.formElement.scoring.enableScoring
|
|
159
|
-
) {
|
|
160
|
-
this.maxPossibleScore =
|
|
161
|
-
this.scoreCalcService.getMaxPossibleScoreForQuestion(this.question);
|
|
162
|
-
this.question.maxPossibleScore = this.maxPossibleScore;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
initializeCustomOption() {
|
|
167
|
-
|
|
168
|
-
this.customOptions.forEach((option: any) => {
|
|
169
|
-
const isMatch = this.question?.answer?.some((a: any) => {
|
|
170
|
-
const parts = a.trim().split('|');
|
|
171
|
-
if (parts.length === 2) {
|
|
172
|
-
const label = parts[0];
|
|
173
|
-
const value = parts[1];
|
|
174
|
-
return value == option.value && label == option.label;
|
|
175
|
-
} else {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
if (isMatch) {
|
|
180
|
-
const alreadyExists = this.selectedValue.some(
|
|
181
|
-
(item: any) => item.value === option.value
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
if (!alreadyExists) {
|
|
185
|
-
this.selectedValue = [...this.selectedValue, option];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
setTimeout(() => {
|
|
189
|
-
const answers = Array.isArray(this.question.answer) ? this.question.answer : [];
|
|
190
|
-
const parsedAnswers = answers.map((ans:any) => ans.split('|')[1]);
|
|
191
|
-
this.whenClauseService.setQuestionAnswer(this.question.id,parsedAnswers,true);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (this.question.childLogics && this.question.answer) {
|
|
195
|
-
this.updateChildLogics(this.question);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
this.cdr.detectChanges();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
transformDatabaseObject(database: any,selectedValues:string[]=[]) {
|
|
203
|
-
return {
|
|
204
|
-
tableName: database.tableName,
|
|
205
|
-
valueField: database.valueField,
|
|
206
|
-
labelField: database.labelField,
|
|
207
|
-
labelPattern: database?.labelPattern,
|
|
208
|
-
selectedValues: selectedValues,
|
|
209
|
-
criteria: database.criteria.map((criteria: any) => ({
|
|
210
|
-
field: criteria.field,
|
|
211
|
-
valueSource: criteria?.valueSource,
|
|
212
|
-
condition: criteria.condition,
|
|
213
|
-
value: criteria.inputValue,
|
|
214
|
-
logicalOperator: criteria.logicalOperator,
|
|
215
|
-
})),
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
fetchDataFromDatabase(searchString:string='') {
|
|
220
|
-
const value= this.question?.answer?.map((a: string) => {
|
|
221
|
-
const [label, value] = a.split('|');
|
|
222
|
-
return {
|
|
223
|
-
label,
|
|
224
|
-
value
|
|
225
|
-
};
|
|
226
|
-
})
|
|
227
|
-
const transformedDatabase = this.transformDatabaseObject(this.database,value);
|
|
228
|
-
this.formService.fetchDataFromDatabase(transformedDatabase,this.dbPageIndex,this.dbPageSize,searchString,true).subscribe(
|
|
229
|
-
(response) => {
|
|
230
|
-
if (response.success) {
|
|
231
|
-
this.dbTotalPages = response.result.totalPages;
|
|
232
|
-
const newOptions =
|
|
233
|
-
response.result?.content?.map(
|
|
234
|
-
(item: { value: string; label: string }) => ({
|
|
235
|
-
value: item.value,
|
|
236
|
-
label: item.label,
|
|
237
|
-
})
|
|
238
|
-
) || [];
|
|
239
|
-
if (this.dbPageIndex === 0) {
|
|
240
|
-
this.customOptions = [...newOptions];
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
this.customOptions = [
|
|
244
|
-
...this.customOptions,
|
|
245
|
-
...newOptions,
|
|
246
|
-
];
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
this.originalOptions = [...this.customOptions];
|
|
251
|
-
|
|
252
|
-
if (this.question.answer) {
|
|
253
|
-
this.initializeCustomOption();
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
console.error('Error fetching data from database:', response.message);
|
|
257
|
-
}
|
|
258
|
-
this.cdr.detectChanges();
|
|
259
|
-
},
|
|
260
|
-
(error) => {
|
|
261
|
-
console.error('HTTP Error:', error);
|
|
262
|
-
this.cdr.detectChanges();
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
fetchDataFromLookup() {
|
|
268
|
-
this.formService.fetchDataFromLookup(this.lookupTable).subscribe(
|
|
269
|
-
(response) => {
|
|
270
|
-
this.customOptions = response.result.values.map(
|
|
271
|
-
(item: { value: string; label: string }) => ({
|
|
272
|
-
value: item.value,
|
|
273
|
-
label: item.label,
|
|
274
|
-
})
|
|
275
|
-
);
|
|
276
|
-
this.originalOptions = [...this.customOptions];
|
|
277
|
-
if (this.question.answer) {
|
|
278
|
-
this.initializeCustomOption();
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
(error) => {
|
|
282
|
-
console.error('HTTP Error:', error);
|
|
283
|
-
}
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
fetchDataFromAPI(append: boolean = false, search: boolean = false) {
|
|
288
|
-
const apiConfig = JSON.parse(JSON.stringify(this.api));
|
|
289
|
-
if (!this.hasMoreData && append) {
|
|
290
|
-
// If no more data from last call and this is an append call, skip API
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
const allowedChars = ['.', ',', '-', '_', '(', ')', ''];
|
|
294
|
-
|
|
295
|
-
if (search) {
|
|
296
|
-
if (apiConfig.params) {
|
|
297
|
-
apiConfig.params = apiConfig.params.filter(
|
|
298
|
-
(p: any) => p.valueSource !== 'SELECTED_VALUES'
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
if (apiConfig.headers) {
|
|
302
|
-
apiConfig.headers = apiConfig.headers.filter(
|
|
303
|
-
(h: any) => h.valueSource !== 'SELECTED_VALUES'
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
this.formService
|
|
309
|
-
.fetchDataFromExternalAPI(apiConfig, this.selectedValues)
|
|
310
|
-
.subscribe(
|
|
311
|
-
(response) => {
|
|
312
|
-
let data;
|
|
313
|
-
if (apiConfig.pathToValue) {
|
|
314
|
-
data = this.extractDataByPath(response, apiConfig.pathToValue);
|
|
315
|
-
} else {
|
|
316
|
-
data = response;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const newOptions = data.map((item: any) => {
|
|
320
|
-
if (
|
|
321
|
-
apiConfig.labelPattern &&
|
|
322
|
-
Array.isArray(apiConfig.labelPattern) &&
|
|
323
|
-
apiConfig.labelPattern.length > 0
|
|
324
|
-
) {
|
|
325
|
-
let label = '';
|
|
326
|
-
apiConfig.labelPattern.forEach((pattern: string) => {
|
|
327
|
-
pattern = pattern.trim();
|
|
328
|
-
if (allowedChars.includes(pattern)) {
|
|
329
|
-
label += pattern;
|
|
330
|
-
} else {
|
|
331
|
-
if (item[pattern] !== undefined && item[pattern] !== null) {
|
|
332
|
-
label += item[pattern]+' ';
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
return {
|
|
337
|
-
value: item[apiConfig.valueField.trim()],
|
|
338
|
-
label: label,
|
|
339
|
-
};
|
|
340
|
-
} else {
|
|
341
|
-
return {
|
|
342
|
-
value: item[apiConfig.valueField.trim()],
|
|
343
|
-
label: item[apiConfig.labelField.trim()],
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
if (append) {
|
|
349
|
-
this.customOptions = [...this.customOptions, ...newOptions];
|
|
350
|
-
} else {
|
|
351
|
-
this.customOptions = newOptions;
|
|
352
|
-
}
|
|
353
|
-
this.originalOptions = [...this.customOptions];
|
|
354
|
-
|
|
355
|
-
// If no new data returned, mark as last page
|
|
356
|
-
if (!newOptions.length) {
|
|
357
|
-
this.hasMoreData = false;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
if (this.question.answer && !append && !search) {
|
|
361
|
-
this.initializeCustomOption();
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
(error) => {
|
|
365
|
-
console.error('HTTP Error:', error);
|
|
366
|
-
}
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
extractDataByPath(data: any, path: string) {
|
|
371
|
-
return path.split('.').reduce((acc, part) => acc && acc[part], data);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
selectItems(event?: any) {
|
|
375
|
-
this.selectedValue = event;
|
|
376
|
-
|
|
377
|
-
const valuesArray = this.selectedValue.map(
|
|
378
|
-
(item) => `${item.label}|${item.value}`
|
|
379
|
-
);
|
|
380
|
-
this.question.answer = valuesArray;
|
|
381
|
-
const scoreResult = this.scoreCalcService.calculateScoreFromAnswer(
|
|
382
|
-
this.question.answer,
|
|
383
|
-
this.question
|
|
384
|
-
);
|
|
385
|
-
this.question.score = scoreResult?.scores;
|
|
386
|
-
|
|
387
|
-
this.validationFailed = false;
|
|
388
|
-
this.validationMessage = '';
|
|
389
|
-
if (this.selectedValue.length == 0 && this.required) {
|
|
390
|
-
this.validationFailed = true;
|
|
391
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
392
|
-
this.validationMessage = `This is a required question`;
|
|
393
|
-
this.question.validation = false;
|
|
394
|
-
this.question.validationMessage = `This is a required question`;
|
|
395
|
-
} else if (
|
|
396
|
-
this.selectedValue.length < this.minimumSelection ||
|
|
397
|
-
this.selectedValue.length > this.maximumSelection
|
|
398
|
-
) {
|
|
399
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
400
|
-
this.validationFailed = true;
|
|
401
|
-
this.validationMessage = `selected options must be between ${this.minimumSelection} & ${this.maximumSelection}`;
|
|
402
|
-
this.question.validation = false;
|
|
403
|
-
this.question.validationMessage = `selected options must be between ${this.minimumSelection} & ${this.maximumSelection}`;
|
|
404
|
-
} else {
|
|
405
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
406
|
-
this.question.validation = true;
|
|
407
|
-
}
|
|
408
|
-
if (this.question.childLogics) {
|
|
409
|
-
this.updateChildLogics(this.question);
|
|
410
|
-
}
|
|
411
|
-
this.answerChange.emit({
|
|
412
|
-
answer: this.question.answer,
|
|
413
|
-
maxPossibleScore: this.maxPossibleScore,
|
|
414
|
-
});
|
|
415
|
-
const answers = Array.isArray(this.question.answer) ? this.question.answer : [];
|
|
416
|
-
const parsedAnswers = answers.map((ans:any) => ans.split('|')[1]);
|
|
417
|
-
this.whenClauseService.setQuestionAnswer(this.question.id,parsedAnswers);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
updateChildLogics(question: any) {
|
|
421
|
-
if (question.childLogics && Array.isArray(question.childLogics)) {
|
|
422
|
-
question.childLogics.forEach((childLogic: any) => {
|
|
423
|
-
if (this.selectionType == 'SINGLE') {
|
|
424
|
-
if (this.selectedValue.length == 0) {
|
|
425
|
-
childLogic.show = false;
|
|
426
|
-
this.clearAnswersRecursively(childLogic);
|
|
427
|
-
} else {
|
|
428
|
-
const selectedValue = this.selectedValue[0]?.label;
|
|
429
|
-
if (
|
|
430
|
-
this.evaluateCondition(
|
|
431
|
-
selectedValue,
|
|
432
|
-
childLogic.condition,
|
|
433
|
-
childLogic.inputValue
|
|
434
|
-
)
|
|
435
|
-
) {
|
|
436
|
-
childLogic.showLogic = true;
|
|
437
|
-
} else {
|
|
438
|
-
childLogic.showLogic = false;
|
|
439
|
-
this.clearAnswersRecursively(childLogic);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
} else if (this.selectionType === 'MULTIPLE') {
|
|
443
|
-
if (this.selectedValue.length == 0) {
|
|
444
|
-
childLogic.show = false;
|
|
445
|
-
this.clearAnswersRecursively(childLogic);
|
|
446
|
-
} else {
|
|
447
|
-
const selectedValues = this.selectedValue.map(
|
|
448
|
-
(item: any) => item.label
|
|
449
|
-
);
|
|
450
|
-
if (
|
|
451
|
-
this.evaluateMultipleCondition(
|
|
452
|
-
selectedValues,
|
|
453
|
-
childLogic.condition,
|
|
454
|
-
childLogic.inputValue
|
|
455
|
-
)
|
|
456
|
-
) {
|
|
457
|
-
childLogic.showLogic = true;
|
|
458
|
-
} else {
|
|
459
|
-
childLogic.showLogic = false;
|
|
460
|
-
this.clearAnswersRecursively(childLogic);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
clearAnswersRecursively(logic: any) {
|
|
469
|
-
if (!logic || !logic.rows) return;
|
|
470
|
-
|
|
471
|
-
logic.rows.forEach((row: any) => {
|
|
472
|
-
row.grid.forEach((item: any) => {
|
|
473
|
-
const element = item.element;
|
|
474
|
-
|
|
475
|
-
if (item.entityType === 'QUESTION' && element) {
|
|
476
|
-
// Clear answer if present
|
|
477
|
-
if ('answer' in element) {
|
|
478
|
-
element.answer = '';
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// Recursively clear childLogics if any
|
|
482
|
-
if (element.childLogics && element.childLogics.length > 0) {
|
|
483
|
-
element.childLogics.forEach((childLogic: any) => {
|
|
484
|
-
this.clearAnswersRecursively(childLogic);
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
if (item.entityType === 'SUBFORM' && element && element.rows) {
|
|
490
|
-
// SUBFORM contains its own rows structure like a form
|
|
491
|
-
this.clearAnswersRecursively({ rows: element.rows });
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
evaluateCondition(answer: any, condition: string, inputValue: any): boolean {
|
|
498
|
-
const stringInputValue = Array.isArray(inputValue)
|
|
499
|
-
? inputValue.map((val) => val.toString().toLowerCase())
|
|
500
|
-
: inputValue.toLowerCase();
|
|
501
|
-
answer = Array.isArray(answer)
|
|
502
|
-
? answer?.map((ans) => ans.toLowerCase())
|
|
503
|
-
: answer.toLowerCase();
|
|
504
|
-
switch (condition) {
|
|
505
|
-
case '!=':
|
|
506
|
-
return answer != inputValue;
|
|
507
|
-
case '=':
|
|
508
|
-
return answer == inputValue;
|
|
509
|
-
case 'IN':
|
|
510
|
-
return stringInputValue.includes(answer);
|
|
511
|
-
case 'NOT IN':
|
|
512
|
-
return !stringInputValue.includes(answer);
|
|
513
|
-
default:
|
|
514
|
-
return false;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
evaluateMultipleCondition(
|
|
519
|
-
answers: any,
|
|
520
|
-
condition: string,
|
|
521
|
-
inputValue: any
|
|
522
|
-
): boolean {
|
|
523
|
-
const stringInputValue = Array.isArray(inputValue)
|
|
524
|
-
? inputValue.map((val) => val.toString())
|
|
525
|
-
: inputValue.toString();
|
|
526
|
-
answers = Array.isArray(answers)
|
|
527
|
-
? answers?.map((answer) => answer.toLowerCase())
|
|
528
|
-
: answers.toLowerCase();
|
|
529
|
-
switch (condition) {
|
|
530
|
-
case '!=':
|
|
531
|
-
return answers.every((answer: any) => answer != stringInputValue);
|
|
532
|
-
case '=':
|
|
533
|
-
return answers.some((answer: any) => answer == stringInputValue);
|
|
534
|
-
case 'IN':
|
|
535
|
-
return answers.some((answer: any) => stringInputValue.includes(answer));
|
|
536
|
-
case 'NOT IN':
|
|
537
|
-
return answers.every(
|
|
538
|
-
(answer: any) => !stringInputValue.includes(answer)
|
|
539
|
-
);
|
|
540
|
-
default:
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
handleValidation(
|
|
546
|
-
isValid: boolean,
|
|
547
|
-
message: string = 'This field is required'
|
|
548
|
-
) {
|
|
549
|
-
if (isValid) {
|
|
550
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
551
|
-
} else {
|
|
552
|
-
// this.validationService.setInvalid(this.question.id, message);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
private buildElementId(): string {
|
|
557
|
-
return this.inLine || this.inCard
|
|
558
|
-
? `${this.submissionIndex}-${this.question.id}`
|
|
559
|
-
: `${this.question.id}`;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
get isInvalid(): boolean {
|
|
563
|
-
return !!this.validationService.getErrorMessage(this.buildElementId());
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
get errorMessage(): string | null {
|
|
567
|
-
return this.validationService.getErrorMessage(this.buildElementId());
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
private hasPagination(apiConfig: any): boolean {
|
|
571
|
-
const checkValueSource = (arr: any[]) =>
|
|
572
|
-
Array.isArray(arr) &&
|
|
573
|
-
arr.some(
|
|
574
|
-
(item) =>
|
|
575
|
-
item?.valueSource === 'PAGE_INDEX' ||
|
|
576
|
-
item?.valueSource === 'PAGE_SIZE'
|
|
577
|
-
);
|
|
578
|
-
|
|
579
|
-
return (
|
|
580
|
-
checkValueSource(apiConfig.headers) ||
|
|
581
|
-
checkValueSource(apiConfig.params) ||
|
|
582
|
-
checkValueSource(apiConfig.pathVariables)
|
|
583
|
-
);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
getNextSetOfItems(event: any) {
|
|
587
|
-
const element = event.target;
|
|
588
|
-
if (
|
|
589
|
-
Math.floor(element.scrollHeight - element.scrollTop) <=
|
|
590
|
-
element.clientHeight &&
|
|
591
|
-
this.hasPagination(this.api) // Only if pagination is configured
|
|
592
|
-
) {
|
|
593
|
-
this.loadNextPage();
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
else if( this.optionType === 'DATABASE' && this.dbPageIndex < this.dbTotalPages){
|
|
599
|
-
this.dbPageIndex +=1;
|
|
600
|
-
this.fetchDataFromDatabase();
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
private loadNextPage() {
|
|
605
|
-
if (!this.hasMoreData) return;
|
|
606
|
-
// Find the PAGE_INDEX param/header/pathVar and increment it
|
|
607
|
-
const updateValueSource = (arr: any[]) => {
|
|
608
|
-
if (!Array.isArray(arr)) return;
|
|
609
|
-
arr.forEach((item) => {
|
|
610
|
-
if (item.valueSource === 'PAGE_INDEX') {
|
|
611
|
-
let currentPage = parseInt(item.inputValue || '0', 10);
|
|
612
|
-
item.inputValue = (currentPage + 1).toString();
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
updateValueSource(this.api.headers);
|
|
618
|
-
updateValueSource(this.api.params);
|
|
619
|
-
updateValueSource(this.api.pathVariables);
|
|
620
|
-
|
|
621
|
-
// Call your fetch function again
|
|
622
|
-
this.fetchDataFromAPI(true);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
search(searchTerm: string) {
|
|
626
|
-
if( this.optionType ==='DATABASE'){
|
|
627
|
-
this.dbPageIndex =0;
|
|
628
|
-
this.fetchDataFromDatabase(searchTerm.trim());
|
|
629
|
-
}
|
|
630
|
-
else if (this.optionType !== 'API') {
|
|
631
|
-
// ๐น Local search
|
|
632
|
-
if (searchTerm && searchTerm.trim() !== '') {
|
|
633
|
-
const lowerSearch = searchTerm.toLowerCase();
|
|
634
|
-
this.customOptions = this.originalOptions.filter((option) =>
|
|
635
|
-
option.label?.toLowerCase().includes(lowerSearch)
|
|
636
|
-
);
|
|
637
|
-
} else {
|
|
638
|
-
// Reset to full list when search is cleared
|
|
639
|
-
this.customOptions = [...this.originalOptions];
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
else {
|
|
643
|
-
// ๐น API search
|
|
644
|
-
if (searchTerm && searchTerm.trim() !== '') {
|
|
645
|
-
// Inject search term into API config (headers or params)
|
|
646
|
-
this.injectSearchString(searchTerm.trim());
|
|
647
|
-
} else {
|
|
648
|
-
// ๐น Clear the search string from API config when input is empty
|
|
649
|
-
this.injectSearchString('');
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
// Reset pagination
|
|
653
|
-
this.hasMoreData = true;
|
|
654
|
-
// Fetch fresh results
|
|
655
|
-
this.fetchDataFromAPI(false, true);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
injectSearchString(searchTerm: string) {
|
|
660
|
-
// Always work on a fresh copy, donโt mutate this.api directly
|
|
661
|
-
this.api = JSON.parse(JSON.stringify(this.originalApi));
|
|
662
|
-
|
|
663
|
-
if (this.api?.params) {
|
|
664
|
-
this.api.params.forEach((p: any) => {
|
|
665
|
-
if (p.valueSource === 'SEARCH_STRING') {
|
|
666
|
-
p.inputValue = searchTerm;
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
if (this.api?.headers) {
|
|
672
|
-
this.api.headers.forEach((h: any) => {
|
|
673
|
-
if (h.valueSource === 'SEARCH_STRING') {
|
|
674
|
-
h.inputValue = searchTerm;
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
ngAfterViewInit() {
|
|
681
|
-
if (this.inLine || this.inCard) {
|
|
682
|
-
this.elementId = `question-${this.submissionIndex}-${this.question.id}`;
|
|
683
|
-
} else {
|
|
684
|
-
this.elementId = `question-${this.question.id}`;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
this.tracker.registerElement(this.elementId);
|
|
688
|
-
setTimeout(() => {
|
|
689
|
-
this.whenClauseService.markLoadCompleted();
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
ngOnDestroy() {
|
|
694
|
-
if (this.elementId) {
|
|
695
|
-
this.tracker.unregisterElement(this.elementId);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|