@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,589 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
-
import { ValidationService } from '../../services/validation.service';
|
|
3
|
-
import { ElementTrackerService } from '../../services/element-tracker.service';
|
|
4
|
-
import { AggregationFunctionService } from '../../services/aggregate.service';
|
|
5
|
-
type CurrencyMeta = {
|
|
6
|
-
codes: string[];
|
|
7
|
-
symbols?: string[];
|
|
8
|
-
mainUnit: string;
|
|
9
|
-
subUnit: string;
|
|
10
|
-
decimals: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
@Component({
|
|
14
|
-
selector: 'lib-currency-fields',
|
|
15
|
-
templateUrl: './currency-fields.component.html',
|
|
16
|
-
styleUrls: ['./currency-fields.component.scss'],
|
|
17
|
-
})
|
|
18
|
-
export class CurrencyFieldsComponent {
|
|
19
|
-
@Input() question: any = {};
|
|
20
|
-
@Input() inLine: boolean = false;
|
|
21
|
-
@Input() inCard: boolean = false;
|
|
22
|
-
@Input() submissionIndex!: number;
|
|
23
|
-
@Input() disableEdit: boolean = false;
|
|
24
|
-
@Output() answerChange = new EventEmitter<{
|
|
25
|
-
answer: any;
|
|
26
|
-
maxPossibleScore?: number;
|
|
27
|
-
amountInWords: string;
|
|
28
|
-
currency: string;
|
|
29
|
-
}>();
|
|
30
|
-
@Input() rowId: any;
|
|
31
|
-
|
|
32
|
-
count: number = 0;
|
|
33
|
-
required: boolean = false;
|
|
34
|
-
hint: string = '';
|
|
35
|
-
placeholder: string = '';
|
|
36
|
-
min!: number;
|
|
37
|
-
max!: number;
|
|
38
|
-
currencySymbol: string = '';
|
|
39
|
-
decimalPrecision!: number;
|
|
40
|
-
symbolPosition: string = 'Before the value';
|
|
41
|
-
thousandSeparator!: boolean;
|
|
42
|
-
showAmountInWords: boolean = false;
|
|
43
|
-
enteredAmount!: string;
|
|
44
|
-
validationFailed: boolean = false;
|
|
45
|
-
validationMessage: string = '';
|
|
46
|
-
private elementId: string = '';
|
|
47
|
-
amountInWordsText: string = '';
|
|
48
|
-
defaultCurrency:string='';
|
|
49
|
-
constructor(
|
|
50
|
-
private validationService: ValidationService,
|
|
51
|
-
private tracker: ElementTrackerService,
|
|
52
|
-
private aggregateService: AggregationFunctionService
|
|
53
|
-
) {}
|
|
54
|
-
|
|
55
|
-
ngOnInit() {
|
|
56
|
-
this.valueAssigned();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
valueAssigned() {
|
|
60
|
-
this.count = this.question.count;
|
|
61
|
-
this.required = this.question.required;
|
|
62
|
-
this.hint = this.question.hint;
|
|
63
|
-
this.defaultCurrency=this.question.formElement?.appearance?.defaultCurrency || '';
|
|
64
|
-
this.placeholder = this.question.formElement?.appearance?.placeholder || '';
|
|
65
|
-
this.currencySymbol = this.question.formElement?.appearance?.currencySymbol;
|
|
66
|
-
this.decimalPrecision =
|
|
67
|
-
this.question.formElement?.appearance?.decimalPrecision || 2;
|
|
68
|
-
this.symbolPosition =
|
|
69
|
-
this.question.formElement?.appearance?.symbolPosition ||
|
|
70
|
-
'Before the value';
|
|
71
|
-
this.thousandSeparator =
|
|
72
|
-
this.question.formElement?.appearance?.thousandSeparator;
|
|
73
|
-
this.min = this.question.formElement.validation.min;
|
|
74
|
-
this.max = this.question.formElement.validation.max;
|
|
75
|
-
this.showAmountInWords =
|
|
76
|
-
this.question.formElement?.appearance?.showAmountInWords;
|
|
77
|
-
if (this.question.formElement?.appearance?.currency) {
|
|
78
|
-
let userLocaleCureency = this.question.formElement?.appearance?.currency;
|
|
79
|
-
if (this.question.formElement.appearance.currencyOption) {
|
|
80
|
-
let currencyOption =
|
|
81
|
-
this.question.formElement.appearance.currencyOption;
|
|
82
|
-
if (currencyOption == 'auto') {
|
|
83
|
-
if (
|
|
84
|
-
this.question.formElement.appearance.limitCurrencySymbol &&
|
|
85
|
-
this.question.formElement.appearance.limitCurrencySymbol.length > 0
|
|
86
|
-
) {
|
|
87
|
-
this.currencySymbol =
|
|
88
|
-
this.question.formElement.appearance.limitCurrencySymbol.includes(
|
|
89
|
-
userLocaleCureency
|
|
90
|
-
)
|
|
91
|
-
? userLocaleCureency
|
|
92
|
-
: this.question.formElement?.appearance?.currencySymbol;
|
|
93
|
-
} else {
|
|
94
|
-
this.currencySymbol = userLocaleCureency;
|
|
95
|
-
}
|
|
96
|
-
} else if (currencyOption == 'specific') {
|
|
97
|
-
this.currencySymbol =
|
|
98
|
-
this.question.formElement?.appearance?.specificCurrencySymbol;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (
|
|
103
|
-
!this.currencySymbol &&
|
|
104
|
-
this.question.formElement?.appearance?.currencySymbol
|
|
105
|
-
) {
|
|
106
|
-
this.currencySymbol =
|
|
107
|
-
this.question.formElement?.appearance?.currencySymbol;
|
|
108
|
-
}
|
|
109
|
-
if(this.question.formElement?.appearance?.defaultCurrency){
|
|
110
|
-
this.currencySymbol = this.question.formElement?.appearance?.defaultCurrency;
|
|
111
|
-
}
|
|
112
|
-
if(this.question.answerCurrency){
|
|
113
|
-
this.currencySymbol=this.question.answerCurrency;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (this.question.answer) {
|
|
118
|
-
this.initializeAnswer();
|
|
119
|
-
}
|
|
120
|
-
if (this.showAmountInWords) {
|
|
121
|
-
this.amountInWordsText = this.question.amountInWords;
|
|
122
|
-
}
|
|
123
|
-
if (this.question.childLogics && this.question.answer) {
|
|
124
|
-
this.updateChildLogics(this.question);
|
|
125
|
-
}
|
|
126
|
-
this.aggregateService.setNumberField(
|
|
127
|
-
this.rowId,
|
|
128
|
-
this.question.id,
|
|
129
|
-
this.question.answer
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
initializeAnswer() {
|
|
134
|
-
let value = this.question?.answer;
|
|
135
|
-
if (!value) return;
|
|
136
|
-
// check if numeric
|
|
137
|
-
if (!isNaN(Number(value))) {
|
|
138
|
-
if (this.thousandSeparator) {
|
|
139
|
-
const parts = value.split('.');
|
|
140
|
-
parts[0] = Number(parts[0]).toLocaleString('en-US'); // adds proper thousand separator
|
|
141
|
-
value = parts.join('.');
|
|
142
|
-
} else {
|
|
143
|
-
value = value;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
this.enteredAmount = value;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
preventNumberScroll(event: WheelEvent) {
|
|
151
|
-
if (document.activeElement === event.target) {
|
|
152
|
-
event.preventDefault();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
validateNumber() {
|
|
157
|
-
this.validationFailed = false;
|
|
158
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
159
|
-
this.validationMessage = '';
|
|
160
|
-
let enteredAmount = this.parseCurrencyToNumber(this.enteredAmount);
|
|
161
|
-
if (this.required && !enteredAmount) {
|
|
162
|
-
this.validationFailed = true;
|
|
163
|
-
this.validationMessage = `Please enter a valid amount`;
|
|
164
|
-
this.question.validationMessage = `Please enter a valid amount`;
|
|
165
|
-
this.question.validation = false;
|
|
166
|
-
} else if (
|
|
167
|
-
(this.min !== undefined && enteredAmount < this.min) ||
|
|
168
|
-
(this.max !== undefined && enteredAmount > this.max)
|
|
169
|
-
) {
|
|
170
|
-
this.validationFailed = true;
|
|
171
|
-
|
|
172
|
-
// Construct appropriate validation message based on whether min, max, or both are provided
|
|
173
|
-
if (this.min !== undefined && this.max !== undefined) {
|
|
174
|
-
this.validationMessage = `Please enter a valid amount between ${this.min} and ${this.max}`;
|
|
175
|
-
this.question.validationMessage = `Please enter a valid amount between ${this.min} and ${this.max}`;
|
|
176
|
-
} else if (this.min !== undefined) {
|
|
177
|
-
this.validationMessage = `Please enter a amount greater than or equal to ${this.min}`;
|
|
178
|
-
this.question.validationMessage = `Please enter a amount greater than or equal to ${this.min}`;
|
|
179
|
-
} else if (this.max !== undefined) {
|
|
180
|
-
this.validationMessage = `Please enter a amount less than or equal to ${this.max}`;
|
|
181
|
-
this.question.validationMessage = `Please enter a amount less than or equal to ${this.max}`;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
this.question.validation = false;
|
|
185
|
-
} else {
|
|
186
|
-
this.question.validation = true;
|
|
187
|
-
}
|
|
188
|
-
if (this.question.childLogics) {
|
|
189
|
-
this.updateChildLogics(this.question);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
validateInput(event: any) {
|
|
194
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
195
|
-
|
|
196
|
-
// remove existing commas & currency symbol
|
|
197
|
-
let rawValue: string = (event.target.value || '')
|
|
198
|
-
.replace(/,/g, '')
|
|
199
|
-
.replace(this.currencySymbol || '', '');
|
|
200
|
-
|
|
201
|
-
// remove any characters except digits and dot
|
|
202
|
-
rawValue = rawValue.replace(/[^\d.]/g, '');
|
|
203
|
-
|
|
204
|
-
// keep only the first dot (remove any additional dots)
|
|
205
|
-
const firstDot = rawValue.indexOf('.');
|
|
206
|
-
if (firstDot !== -1) {
|
|
207
|
-
// split into before-first-dot and rest, remove additional dots from rest
|
|
208
|
-
const before = rawValue.slice(0, firstDot);
|
|
209
|
-
const after = rawValue.slice(firstDot + 1).replace(/\./g, '');
|
|
210
|
-
rawValue = `${before}.${after}`;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// determine decimal precision to enforce (default to 2)
|
|
214
|
-
const dp =
|
|
215
|
-
typeof this.decimalPrecision === 'number' && this.decimalPrecision >= 0
|
|
216
|
-
? this.decimalPrecision
|
|
217
|
-
: 2;
|
|
218
|
-
|
|
219
|
-
// if there's a decimal part, trim it to allowed length
|
|
220
|
-
if (rawValue.includes('.')) {
|
|
221
|
-
const [intPart, decimalPart = ''] = rawValue.split('.');
|
|
222
|
-
const trimmedDecimal = decimalPart.slice(0, dp);
|
|
223
|
-
rawValue = trimmedDecimal
|
|
224
|
-
? `${intPart}.${trimmedDecimal}`
|
|
225
|
-
: intPart + '.';
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// format with thousand separator for display
|
|
229
|
-
let formattedValue = rawValue;
|
|
230
|
-
if (this.thousandSeparator && rawValue) {
|
|
231
|
-
const parts = rawValue.split('.');
|
|
232
|
-
// handle case where user types ".12" -> parts[0] === ''
|
|
233
|
-
const intPartForFormat = parts[0] === '' ? '0' : parts[0];
|
|
234
|
-
parts[0] = Number(intPartForFormat).toLocaleString('en-US');
|
|
235
|
-
formattedValue = parts.join('.');
|
|
236
|
-
// if original had leading '.' (user typed ".12"), restore it visually as ".12"
|
|
237
|
-
if (rawValue.startsWith('.') && !formattedValue.startsWith('.')) {
|
|
238
|
-
formattedValue = formattedValue.replace(/^0/, '');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// keep numeric version for backend/calculations
|
|
243
|
-
this.question.answer = rawValue;
|
|
244
|
-
this.question.currencySymbol = this.currencySymbol;
|
|
245
|
-
|
|
246
|
-
// update field display
|
|
247
|
-
event.target.value = formattedValue;
|
|
248
|
-
|
|
249
|
-
this.aggregateService.setNumberField(
|
|
250
|
-
this.rowId,
|
|
251
|
-
this.question.id,
|
|
252
|
-
rawValue ? parseFloat(rawValue) : 0
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
if (this.question.childLogics) {
|
|
256
|
-
this.updateChildLogics(this.question);
|
|
257
|
-
}
|
|
258
|
-
if (this.showAmountInWords) {
|
|
259
|
-
this.amountInWordsText = this.convertAmountToWords(rawValue);
|
|
260
|
-
this.question.amountInWords = this.amountInWordsText;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
this.answerChange.emit({
|
|
264
|
-
answer: this.question.answer,
|
|
265
|
-
maxPossibleScore: 0,
|
|
266
|
-
amountInWords: this.question.amountInWords,
|
|
267
|
-
currency: this.currencySymbol
|
|
268
|
-
});
|
|
269
|
-
this.validateNumber();
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// 2) typed currency map
|
|
273
|
-
private currencyMap: Record<string, CurrencyMeta> = {
|
|
274
|
-
USD: {
|
|
275
|
-
codes: ['USD'],
|
|
276
|
-
symbols: ['$', 'US$'],
|
|
277
|
-
mainUnit: 'Dollars',
|
|
278
|
-
subUnit: 'Cents',
|
|
279
|
-
decimals: 2,
|
|
280
|
-
},
|
|
281
|
-
INR: {
|
|
282
|
-
codes: ['INR'],
|
|
283
|
-
symbols: ['₹', 'Rs', '₨'],
|
|
284
|
-
mainUnit: 'Rupees',
|
|
285
|
-
subUnit: 'Paisa',
|
|
286
|
-
decimals: 2,
|
|
287
|
-
},
|
|
288
|
-
EUR: {
|
|
289
|
-
codes: ['EUR'],
|
|
290
|
-
symbols: ['€'],
|
|
291
|
-
mainUnit: 'Euros',
|
|
292
|
-
subUnit: 'Cents',
|
|
293
|
-
decimals: 2,
|
|
294
|
-
},
|
|
295
|
-
AED: {
|
|
296
|
-
codes: ['AED'],
|
|
297
|
-
symbols: ['AED', 'د.إ'],
|
|
298
|
-
mainUnit: 'Dirhams',
|
|
299
|
-
subUnit: 'Fils',
|
|
300
|
-
decimals: 2,
|
|
301
|
-
},
|
|
302
|
-
GBP: {
|
|
303
|
-
codes: ['GBP'],
|
|
304
|
-
symbols: ['£'],
|
|
305
|
-
mainUnit: 'Pounds',
|
|
306
|
-
subUnit: 'Pence',
|
|
307
|
-
decimals: 2,
|
|
308
|
-
},
|
|
309
|
-
JPY: {
|
|
310
|
-
codes: ['JPY'],
|
|
311
|
-
symbols: ['¥'],
|
|
312
|
-
mainUnit: 'Yen',
|
|
313
|
-
subUnit: '',
|
|
314
|
-
decimals: 0,
|
|
315
|
-
},
|
|
316
|
-
// add more entries as needed
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
// 3) convertAmountToWords using CurrencyMeta typing
|
|
320
|
-
convertAmountToWords(value: string): string {
|
|
321
|
-
if (!value) return '';
|
|
322
|
-
|
|
323
|
-
// prefer currencyCode (ISO) if available; fall back to symbol
|
|
324
|
-
const currencyCode = this.question?.currencyCode || null;
|
|
325
|
-
const currencySymbol =
|
|
326
|
-
this.question?.currencySymbol || this.currencySymbol || null;
|
|
327
|
-
|
|
328
|
-
// find currency metadata from map:
|
|
329
|
-
let meta: CurrencyMeta | undefined;
|
|
330
|
-
|
|
331
|
-
if (currencyCode) {
|
|
332
|
-
meta = this.currencyMap[currencyCode];
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (!meta && currencySymbol) {
|
|
336
|
-
meta = Object.values(this.currencyMap).find(
|
|
337
|
-
(m) => Array.isArray(m.symbols) && m.symbols.includes(currencySymbol)
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// use fallback if not found — typed as CurrencyMeta
|
|
342
|
-
if (!meta) {
|
|
343
|
-
const fallbackName = (
|
|
344
|
-
currencyCode ||
|
|
345
|
-
currencySymbol ||
|
|
346
|
-
'Currency'
|
|
347
|
-
).toString();
|
|
348
|
-
meta = {
|
|
349
|
-
codes: [currencyCode || fallbackName],
|
|
350
|
-
symbols: currencySymbol ? [currencySymbol] : [],
|
|
351
|
-
mainUnit: fallbackName,
|
|
352
|
-
subUnit: '',
|
|
353
|
-
decimals: 2,
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// normalize numeric parts
|
|
358
|
-
const normalized = (value || '').toString().replace(/,/g, '');
|
|
359
|
-
const [intPartStr = '0', decimalPartStr = ''] = normalized.split('.');
|
|
360
|
-
|
|
361
|
-
const intPartNum = Number(intPartStr) || 0;
|
|
362
|
-
|
|
363
|
-
// calculate subunit number robustly:
|
|
364
|
-
const dp =
|
|
365
|
-
typeof meta.decimals === 'number' && meta.decimals >= 0
|
|
366
|
-
? meta.decimals
|
|
367
|
-
: 2;
|
|
368
|
-
let subUnitNumber = 0;
|
|
369
|
-
|
|
370
|
-
if (dp > 0 && decimalPartStr) {
|
|
371
|
-
const scale = Math.pow(10, dp);
|
|
372
|
-
const decDigits = decimalPartStr.replace(/\D/g, '');
|
|
373
|
-
// if shorter than dp, multiply; if longer, trim to dp
|
|
374
|
-
const trimmed = decDigits.slice(0, dp);
|
|
375
|
-
subUnitNumber = Number(trimmed) * Math.pow(10, dp - trimmed.length);
|
|
376
|
-
// guard for rounding overflow (e.g., .999 -> 1.00)
|
|
377
|
-
if (subUnitNumber >= scale) {
|
|
378
|
-
// increment integer part
|
|
379
|
-
return this.buildFinalPhrase(intPartNum + 1, 0, meta);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return this.buildFinalPhrase(intPartNum, subUnitNumber, meta);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// 4) buildFinalPhrase accepts CurrencyMeta (or same shape) — typed accordingly
|
|
387
|
-
private buildFinalPhrase(
|
|
388
|
-
intNum: number,
|
|
389
|
-
subNum: number,
|
|
390
|
-
meta: { mainUnit: string; subUnit: string; decimals: number }
|
|
391
|
-
): string {
|
|
392
|
-
const mainWords = this.numberToWords(intNum) || 'Zero';
|
|
393
|
-
|
|
394
|
-
if (meta.decimals === 0 || !meta.subUnit) {
|
|
395
|
-
return `${mainWords} ${meta.mainUnit} Only`;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if (!subNum) {
|
|
399
|
-
return `${mainWords} ${meta.mainUnit} Only`;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const subWords = this.numberToWords(subNum);
|
|
403
|
-
return `${mainWords} ${meta.mainUnit} and ${subWords} ${meta.subUnit} Only`;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// -------------------------
|
|
407
|
-
// NUMBER → WORDS (Up to Crores)
|
|
408
|
-
// -------------------------
|
|
409
|
-
numberToWords(num: number): string {
|
|
410
|
-
if (num === 0) return 'Zero';
|
|
411
|
-
|
|
412
|
-
const a = [
|
|
413
|
-
'',
|
|
414
|
-
'One',
|
|
415
|
-
'Two',
|
|
416
|
-
'Three',
|
|
417
|
-
'Four',
|
|
418
|
-
'Five',
|
|
419
|
-
'Six',
|
|
420
|
-
'Seven',
|
|
421
|
-
'Eight',
|
|
422
|
-
'Nine',
|
|
423
|
-
'Ten',
|
|
424
|
-
'Eleven',
|
|
425
|
-
'Twelve',
|
|
426
|
-
'Thirteen',
|
|
427
|
-
'Fourteen',
|
|
428
|
-
'Fifteen',
|
|
429
|
-
'Sixteen',
|
|
430
|
-
'Seventeen',
|
|
431
|
-
'Eighteen',
|
|
432
|
-
'Nineteen',
|
|
433
|
-
];
|
|
434
|
-
const b = [
|
|
435
|
-
'',
|
|
436
|
-
'',
|
|
437
|
-
'Twenty',
|
|
438
|
-
'Thirty',
|
|
439
|
-
'Forty',
|
|
440
|
-
'Fifty',
|
|
441
|
-
'Sixty',
|
|
442
|
-
'Seventy',
|
|
443
|
-
'Eighty',
|
|
444
|
-
'Ninety',
|
|
445
|
-
];
|
|
446
|
-
|
|
447
|
-
const toWords = (n: number): string => {
|
|
448
|
-
if (n < 20) return a[n];
|
|
449
|
-
if (n < 100) return `${b[Math.floor(n / 10)]} ${a[n % 10]}`.trim();
|
|
450
|
-
if (n < 1000)
|
|
451
|
-
return `${a[Math.floor(n / 100)]} Hundred ${toWords(n % 100)}`.trim();
|
|
452
|
-
if (n < 100000)
|
|
453
|
-
return `${toWords(Math.floor(n / 1000))} Thousand ${toWords(
|
|
454
|
-
n % 1000
|
|
455
|
-
)}`.trim();
|
|
456
|
-
if (n < 10000000)
|
|
457
|
-
return `${toWords(Math.floor(n / 100000))} Lakh ${toWords(
|
|
458
|
-
n % 100000
|
|
459
|
-
)}`.trim();
|
|
460
|
-
return `${toWords(Math.floor(n / 10000000))} Crore ${toWords(
|
|
461
|
-
n % 10000000
|
|
462
|
-
)}`.trim();
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
return toWords(num);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
updateChildLogics(question: any) {
|
|
469
|
-
if (question.childLogics && Array.isArray(question.childLogics)) {
|
|
470
|
-
question.childLogics.forEach((childLogic: any) => {
|
|
471
|
-
if (
|
|
472
|
-
this.evaluateCondition(
|
|
473
|
-
question.answer,
|
|
474
|
-
childLogic.condition,
|
|
475
|
-
childLogic.inputValue
|
|
476
|
-
)
|
|
477
|
-
) {
|
|
478
|
-
childLogic.showLogic = true;
|
|
479
|
-
} else {
|
|
480
|
-
childLogic.showLogic = false;
|
|
481
|
-
this.clearAnswersRecursively(childLogic);
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
parseCurrencyToNumber(value: string): number {
|
|
488
|
-
if (!value) return 0;
|
|
489
|
-
|
|
490
|
-
// Remove currency symbol, commas, spaces
|
|
491
|
-
const numericString = value
|
|
492
|
-
.replace(new RegExp(`\\${this.currencySymbol}`, 'g'), '') // remove symbol
|
|
493
|
-
.replace(/,/g, '') // remove thousand separators
|
|
494
|
-
.trim();
|
|
495
|
-
|
|
496
|
-
// Convert to number
|
|
497
|
-
const num = parseFloat(numericString);
|
|
498
|
-
return isNaN(num) ? 0 : num;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
clearAnswersRecursively(logic: any) {
|
|
502
|
-
if (!logic || !logic.rows) return;
|
|
503
|
-
|
|
504
|
-
logic.rows.forEach((row: any) => {
|
|
505
|
-
row.grid.forEach((item: any) => {
|
|
506
|
-
const element = item.element;
|
|
507
|
-
|
|
508
|
-
if (item.entityType === 'QUESTION' && element) {
|
|
509
|
-
// Clear answer if present
|
|
510
|
-
if ('answer' in element) {
|
|
511
|
-
element.answer = '';
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
// Recursively clear childLogics if any
|
|
515
|
-
if (element.childLogics && element.childLogics.length > 0) {
|
|
516
|
-
element.childLogics.forEach((childLogic: any) => {
|
|
517
|
-
this.clearAnswersRecursively(childLogic);
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
if (item.entityType === 'SUBFORM' && element && element.rows) {
|
|
523
|
-
// SUBFORM contains its own rows structure like a form
|
|
524
|
-
this.clearAnswersRecursively({ rows: element.rows });
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
evaluateCondition(answer: any, condition: any, inputValue: any) {
|
|
531
|
-
switch (condition) {
|
|
532
|
-
case '>':
|
|
533
|
-
return answer > Number(inputValue);
|
|
534
|
-
case '<':
|
|
535
|
-
return answer < Number(inputValue);
|
|
536
|
-
case '>=':
|
|
537
|
-
return answer >= Number(inputValue);
|
|
538
|
-
case '<=':
|
|
539
|
-
return answer <= Number(inputValue);
|
|
540
|
-
case '=':
|
|
541
|
-
return answer == inputValue;
|
|
542
|
-
case '!=':
|
|
543
|
-
return answer != inputValue;
|
|
544
|
-
default:
|
|
545
|
-
return false;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
handleValidation(
|
|
550
|
-
isValid: boolean,
|
|
551
|
-
message: string = 'This field is required'
|
|
552
|
-
) {
|
|
553
|
-
if (isValid) {
|
|
554
|
-
this.validationService.clearInvalid(this.buildElementId());
|
|
555
|
-
} else {
|
|
556
|
-
// this.validationService.setInvalid(this.question.id, message);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
private buildElementId(): string {
|
|
561
|
-
return this.inLine || this.inCard
|
|
562
|
-
? `${this.submissionIndex}-${this.question.id}`
|
|
563
|
-
: `${this.question.id}`;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
get isInvalid(): boolean {
|
|
567
|
-
return !!this.validationService.getErrorMessage(this.buildElementId());
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
get errorMessage(): string | null {
|
|
571
|
-
return this.validationService.getErrorMessage(this.buildElementId());
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
ngAfterViewInit() {
|
|
575
|
-
if (this.inLine || this.inCard) {
|
|
576
|
-
this.elementId = `question-${this.submissionIndex}-${this.question.id}`;
|
|
577
|
-
} else {
|
|
578
|
-
this.elementId = `question-${this.question.id}`;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
this.tracker.registerElement(this.elementId);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
ngOnDestroy() {
|
|
585
|
-
if (this.elementId) {
|
|
586
|
-
this.tracker.unregisterElement(this.elementId);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|