@piserve-tech/form-submission 1.3.314 → 1.3.316
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/ng-package.json +30 -0
- package/package.json +33 -46
- package/{assets → src/assets}/icons/close-sidebar-mark-icon.svg +3 -3
- package/{assets → src/assets}/icons/copy-icon.svg +5 -5
- package/{assets → src/assets}/icons/delete-icon.svg +7 -7
- package/{assets → src/assets}/icons/delete-no-outline-icon.svg +7 -7
- package/src/environment/environment.ts +6 -0
- package/src/form-fields/aggregate-function/aggregate-function.component.html +63 -0
- package/src/form-fields/aggregate-function/aggregate-function.component.scss +1 -0
- package/src/form-fields/aggregate-function/aggregate-function.component.spec.ts +21 -0
- package/src/form-fields/aggregate-function/aggregate-function.component.ts +148 -0
- package/src/form-fields/check-box-fields/check-box-fields.component.html +81 -0
- package/src/form-fields/check-box-fields/check-box-fields.component.scss +28 -0
- package/src/form-fields/check-box-fields/check-box-fields.component.spec.ts +21 -0
- package/src/form-fields/check-box-fields/check-box-fields.component.ts +538 -0
- package/src/form-fields/currency-fields/currency-fields.component.html +85 -0
- package/src/form-fields/currency-fields/currency-fields.component.scss +48 -0
- package/src/form-fields/currency-fields/currency-fields.component.spec.ts +21 -0
- package/src/form-fields/currency-fields/currency-fields.component.ts +589 -0
- package/src/form-fields/date-time-fields/date-time-fields.component.html +268 -0
- package/src/form-fields/date-time-fields/date-time-fields.component.scss +88 -0
- package/src/form-fields/date-time-fields/date-time-fields.component.spec.ts +21 -0
- package/src/form-fields/date-time-fields/date-time-fields.component.ts +693 -0
- package/src/form-fields/drop-down-fields/drop-down-fields.component.html +77 -0
- package/src/form-fields/drop-down-fields/drop-down-fields.component.scss +12 -0
- package/src/form-fields/drop-down-fields/drop-down-fields.component.spec.ts +21 -0
- package/src/form-fields/drop-down-fields/drop-down-fields.component.ts +698 -0
- package/src/form-fields/file-picker-fields/file-picker-fields.component.html +72 -0
- package/src/form-fields/file-picker-fields/file-picker-fields.component.scss +33 -0
- package/src/form-fields/file-picker-fields/file-picker-fields.component.spec.ts +21 -0
- package/src/form-fields/file-picker-fields/file-picker-fields.component.ts +256 -0
- package/src/form-fields/form-fields.module.ts +110 -0
- package/src/form-fields/hidden-field/hidden-field.component.scss +0 -0
- package/src/form-fields/hidden-field/hidden-field.component.spec.ts +21 -0
- package/src/form-fields/hidden-field/hidden-field.component.ts +156 -0
- package/src/form-fields/iframe-fields/iframe-fields.component.html +31 -0
- package/src/form-fields/iframe-fields/iframe-fields.component.scss +0 -0
- package/src/form-fields/iframe-fields/iframe-fields.component.spec.ts +21 -0
- package/src/form-fields/iframe-fields/iframe-fields.component.ts +225 -0
- package/src/form-fields/location-fields/location-fields.component.html +54 -0
- package/src/form-fields/location-fields/location-fields.component.scss +22 -0
- package/src/form-fields/location-fields/location-fields.component.spec.ts +21 -0
- package/src/form-fields/location-fields/location-fields.component.ts +83 -0
- package/src/form-fields/mail-fields/mail-fields.component.html +66 -0
- package/src/form-fields/mail-fields/mail-fields.component.scss +10 -0
- package/src/form-fields/mail-fields/mail-fields.component.spec.ts +21 -0
- package/src/form-fields/mail-fields/mail-fields.component.ts +127 -0
- package/src/form-fields/mobile-fields/mobile-fields.component.html +97 -0
- package/src/form-fields/mobile-fields/mobile-fields.component.scss +52 -0
- package/src/form-fields/mobile-fields/mobile-fields.component.spec.ts +21 -0
- package/src/form-fields/mobile-fields/mobile-fields.component.ts +310 -0
- package/src/form-fields/number-fields/number-fields.component.html +70 -0
- package/src/form-fields/number-fields/number-fields.component.scss +17 -0
- package/src/form-fields/number-fields/number-fields.component.spec.ts +21 -0
- package/src/form-fields/number-fields/number-fields.component.ts +256 -0
- package/src/form-fields/password-fields/password-fields.component.html +113 -0
- package/src/form-fields/password-fields/password-fields.component.scss +61 -0
- package/src/form-fields/password-fields/password-fields.component.spec.ts +21 -0
- package/src/form-fields/password-fields/password-fields.component.ts +273 -0
- package/src/form-fields/radio-button-fields/radio-button-fields.component.html +82 -0
- package/src/form-fields/radio-button-fields/radio-button-fields.component.scss +28 -0
- package/src/form-fields/radio-button-fields/radio-button-fields.component.spec.ts +21 -0
- package/src/form-fields/radio-button-fields/radio-button-fields.component.ts +391 -0
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.html +67 -0
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.scss +23 -0
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.spec.ts +21 -0
- package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.ts +145 -0
- package/src/form-fields/section-fields/section-fields.component.html +4 -0
- package/src/form-fields/section-fields/section-fields.component.scss +37 -0
- package/src/form-fields/section-fields/section-fields.component.spec.ts +21 -0
- package/src/form-fields/section-fields/section-fields.component.ts +25 -0
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.html +93 -0
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.scss +52 -0
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.spec.ts +21 -0
- package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.ts +155 -0
- package/src/form-fields/signature-fields/signature-fields.component.html +43 -0
- package/src/form-fields/signature-fields/signature-fields.component.scss +10 -0
- package/src/form-fields/signature-fields/signature-fields.component.spec.ts +21 -0
- package/src/form-fields/signature-fields/signature-fields.component.ts +25 -0
- package/src/form-fields/slider-fields/slider-fields.component.html +67 -0
- package/src/form-fields/slider-fields/slider-fields.component.scss +55 -0
- package/src/form-fields/slider-fields/slider-fields.component.spec.ts +21 -0
- package/src/form-fields/slider-fields/slider-fields.component.ts +63 -0
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.html +52 -0
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.scss +85 -0
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.spec.ts +21 -0
- package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.ts +62 -0
- package/src/form-fields/text-area-fields/text-area-fields.component.html +68 -0
- package/src/form-fields/text-area-fields/text-area-fields.component.scss +19 -0
- package/src/form-fields/text-area-fields/text-area-fields.component.spec.ts +21 -0
- package/src/form-fields/text-area-fields/text-area-fields.component.ts +166 -0
- package/src/form-fields/text-fields/text-fields.component.html +67 -0
- package/src/form-fields/text-fields/text-fields.component.scss +26 -0
- package/src/form-fields/text-fields/text-fields.component.spec.ts +21 -0
- package/src/form-fields/text-fields/text-fields.component.ts +248 -0
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.html +70 -0
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.scss +112 -0
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.spec.ts +21 -0
- package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.ts +74 -0
- package/src/form-fields/url-fields/url-fields.component.html +109 -0
- package/src/form-fields/url-fields/url-fields.component.scss +22 -0
- package/src/form-fields/url-fields/url-fields.component.spec.ts +21 -0
- package/src/form-fields/url-fields/url-fields.component.ts +123 -0
- package/src/form-submission/form-submission.module.ts +40 -0
- package/src/form-submission/header/header.component.html +6 -0
- package/src/form-submission/header/header.component.scss +26 -0
- package/src/form-submission/header/header.component.spec.ts +21 -0
- package/src/form-submission/header/header.component.ts +12 -0
- package/src/form-submission/navigation-tabs/navigation-tabs.component.html +134 -0
- package/src/form-submission/navigation-tabs/navigation-tabs.component.scss +200 -0
- package/src/form-submission/navigation-tabs/navigation-tabs.component.spec.ts +21 -0
- package/src/form-submission/navigation-tabs/navigation-tabs.component.ts +134 -0
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.html +207 -0
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.scss +208 -0
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.spec.ts +21 -0
- package/src/form-submission/next-prev-navigation/next-prev-navigation.component.ts +74 -0
- package/src/form-submission/save-as-draft/saveDraftModalComponent .ts +60 -0
- package/src/form-submission/save-as-draft/saveDraftModalComponent.html +33 -0
- package/src/form-submission/save-as-draft/saveDraftModalComponent.scss +195 -0
- package/src/form-submission/submission-container/submission-container.component.html +30 -0
- package/src/form-submission/submission-container/submission-container.component.scss +67 -0
- package/src/form-submission/submission-container/submission-container.component.spec.ts +21 -0
- package/src/form-submission/submission-container/submission-container.component.ts +14 -0
- package/src/form-submission/submit-form/submit-form.component.html +76 -0
- package/src/form-submission/submit-form/submit-form.component.scss +88 -0
- package/src/form-submission/submit-form/submit-form.component.spec.ts +21 -0
- package/src/form-submission/submit-form/submit-form.component.ts +1953 -0
- package/src/lib/form-submission.component.html +15 -0
- package/src/lib/form-submission.component.scss +1 -0
- package/src/lib/form-submission.component.ts +120 -0
- package/src/lib/form-submission.module.ts +31 -0
- package/src/lib/form-submission.service.spec.ts +16 -0
- package/src/lib/form-submission.service.ts +9 -0
- package/src/models/aggregate.model.ts +4 -0
- package/{models/answer.model.d.ts → src/models/answer.model.ts} +25 -23
- package/src/models/appearance.model.ts +64 -0
- package/{models/attachment.model.d.ts → src/models/attachment.model.ts} +6 -6
- package/{models/defaultAnswerEntry.model.d.ts → src/models/defaultAnswerEntry.model.ts} +7 -5
- package/{models/defaultAnswersModel.model.d.ts → src/models/defaultAnswersModel.model.ts} +5 -4
- package/{models/defaultQuestionAnswer.model.d.ts → src/models/defaultQuestionAnswer.model.ts} +6 -6
- package/src/models/elementOptionAPI.model.ts +13 -0
- package/src/models/elementOptionAPIData.model.ts +5 -0
- package/src/models/elementOptionDB.model.ts +9 -0
- package/src/models/elementOptionDBCriteria.model.ts +7 -0
- package/{models/emitters.model.d.ts → src/models/emitters.model.ts} +8 -8
- package/{models/enum/condition.enum.d.ts → src/models/enum/condition.enum.ts} +2 -2
- package/src/models/enum/elementType .enum.ts +22 -0
- package/src/models/enum/entityType.enum.ts +10 -0
- package/{models/formConfiguration.model.d.ts → src/models/formConfiguration.model.ts} +2 -2
- package/{models/formElement.model.d.ts → src/models/formElement.model.ts} +22 -22
- package/{models/formElementType.model.d.ts → src/models/formElementType.model.ts} +3 -2
- package/{models/grid.model.d.ts → src/models/grid.model.ts} +14 -13
- package/{models/hiddenField.model.d.ts → src/models/hiddenField.model.ts} +5 -5
- package/{models/iFrameProperties.model.d.ts → src/models/iFrameProperties.model.ts} +13 -13
- package/src/models/logic.model.ts +11 -0
- package/src/models/multifields.model.ts +12 -0
- package/{models/option.model.d.ts → src/models/option.model.ts} +5 -5
- package/src/models/page.model.ts +7 -0
- package/src/models/publicForm.model.ts +19 -0
- package/src/models/question.model.ts +27 -0
- package/src/models/questionAnswer.model.ts +8 -0
- package/src/models/questionGroup.model.ts +12 -0
- package/src/models/response.model.ts +9 -0
- package/src/models/result.model.ts +5 -0
- package/{models/row.model.d.ts → src/models/row.model.ts} +2 -1
- package/src/models/scoring.model.ts +10 -0
- package/src/models/section.model.ts +6 -0
- package/src/models/subForm.model.ts +25 -0
- package/src/models/subformConfiguration.model.ts +4 -0
- package/src/models/subformPropery.model.ts +8 -0
- package/{models/submission.model.d.ts → src/models/submission.model.ts} +16 -14
- package/{models/submissionCopyConfig.mopdel.d.ts → src/models/submissionCopyConfig.mopdel.ts} +4 -4
- package/{models/terms&condition.model.d.ts → src/models/terms&condition.model.ts} +1 -1
- package/src/models/validation.model.ts +48 -0
- package/src/models/whenClause.model.ts +7 -0
- package/{models/whenClauseCondition.model.d.ts → src/models/whenClauseCondition.model.ts} +6 -6
- package/{models/whenClauseElements.model.d.ts → src/models/whenClauseElements.model.ts} +6 -5
- package/{public-api.d.ts → src/public-api.ts} +4 -0
- package/src/question/card-subform/card-subform.component.html +282 -0
- package/src/question/card-subform/card-subform.component.scss +49 -0
- package/src/question/card-subform/card-subform.component.spec.ts +21 -0
- package/src/question/card-subform/card-subform.component.ts +407 -0
- package/src/question/confirm-dialog/confirm-dialog.component.html +32 -0
- package/src/question/confirm-dialog/confirm-dialog.component.scss +109 -0
- package/src/question/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
- package/src/question/confirm-dialog/confirm-dialog.component.ts +24 -0
- package/src/question/form-elements/form-elements.component.html +28 -0
- package/src/question/form-elements/form-elements.component.scss +0 -0
- package/src/question/form-elements/form-elements.component.spec.ts +21 -0
- package/src/question/form-elements/form-elements.component.ts +41 -0
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.html +321 -0
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.scss +78 -0
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.spec.ts +21 -0
- package/src/question/inline-multiple-subform/inline-multiple-subform.component.ts +425 -0
- package/src/question/multifields/multifields.component.html +78 -0
- package/src/question/multifields/multifields.component.scss +6 -0
- package/src/question/multifields/multifields.component.spec.ts +21 -0
- package/src/question/multifields/multifields.component.ts +27 -0
- package/src/question/multiple-subform/multiple-subform.component.html +185 -0
- package/src/question/multiple-subform/multiple-subform.component.scss +52 -0
- package/src/question/multiple-subform/multiple-subform.component.spec.ts +21 -0
- package/src/question/multiple-subform/multiple-subform.component.ts +481 -0
- package/src/question/question/question.component.html +51 -0
- package/src/question/question/question.component.scss +0 -0
- package/src/question/question/question.component.spec.ts +21 -0
- package/src/question/question/question.component.ts +129 -0
- package/src/question/question-group/question-group.component.html +147 -0
- package/src/question/question-group/question-group.component.scss +36 -0
- package/src/question/question-group/question-group.component.spec.ts +21 -0
- package/src/question/question-group/question-group.component.ts +94 -0
- package/src/question/question.module.ts +22 -0
- package/src/question/recursive-logic/recursive-logic.component.html +33 -0
- package/src/question/recursive-logic/recursive-logic.component.scss +0 -0
- package/src/question/recursive-logic/recursive-logic.component.spec.ts +21 -0
- package/src/question/recursive-logic/recursive-logic.component.ts +29 -0
- package/src/question/sub-form/sub-form.component.html +254 -0
- package/src/question/sub-form/sub-form.component.scss +83 -0
- package/src/question/sub-form/sub-form.component.spec.ts +21 -0
- package/src/question/sub-form/sub-form.component.ts +421 -0
- package/src/services/aggregate.service.ts +148 -0
- package/src/services/countryService.ts +92 -0
- package/src/services/data.service.ts +36 -0
- package/src/services/element-tracker.service.spec.ts +16 -0
- package/src/services/element-tracker.service.ts +24 -0
- package/src/services/form-validation.service.ts +151 -0
- package/src/services/form.service.spec.ts +16 -0
- package/src/services/form.service.ts +407 -0
- package/src/services/mapper.service.ts +625 -0
- package/src/services/recaptcha.service.spec.ts +16 -0
- package/src/services/recaptcha.service.ts +179 -0
- package/src/services/score.service.ts +352 -0
- package/src/services/subform-copy.service.ts +148 -0
- package/src/services/validation.service.spec.ts +16 -0
- package/src/services/validation.service.ts +33 -0
- package/src/services/whenClause.service.ts +502 -0
- package/src/shared/shared.module.ts +58 -0
- package/src/styles/shared-style.scss +86 -0
- package/src/sub-form/sub-form.module.ts +24 -0
- package/src/sub-form/submission-modal/submission-modal.component.html +160 -0
- package/src/sub-form/submission-modal/submission-modal.component.scss +54 -0
- package/src/sub-form/submission-modal/submission-modal.component.spec.ts +21 -0
- package/src/sub-form/submission-modal/submission-modal.component.ts +127 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/environment/environment.d.ts +0 -5
- package/esm2022/environment/environment.mjs +0 -6
- package/esm2022/form-fields/aggregate-function/aggregate-function.component.mjs +0 -146
- package/esm2022/form-fields/check-box-fields/check-box-fields.component.mjs +0 -473
- package/esm2022/form-fields/currency-fields/currency-fields.component.mjs +0 -502
- package/esm2022/form-fields/date-time-fields/date-time-fields.component.mjs +0 -608
- package/esm2022/form-fields/drop-down-fields/drop-down-fields.component.mjs +0 -585
- package/esm2022/form-fields/file-picker-fields/file-picker-fields.component.mjs +0 -224
- package/esm2022/form-fields/form-fields.module.mjs +0 -174
- package/esm2022/form-fields/hidden-field/hidden-field.component.mjs +0 -137
- package/esm2022/form-fields/iframe-fields/iframe-fields.component.mjs +0 -198
- package/esm2022/form-fields/location-fields/location-fields.component.mjs +0 -85
- package/esm2022/form-fields/mail-fields/mail-fields.component.mjs +0 -131
- package/esm2022/form-fields/mobile-fields/mobile-fields.component.mjs +0 -270
- package/esm2022/form-fields/number-fields/number-fields.component.mjs +0 -242
- package/esm2022/form-fields/password-fields/password-fields.component.mjs +0 -257
- package/esm2022/form-fields/radio-button-fields/radio-button-fields.component.mjs +0 -346
- package/esm2022/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.mjs +0 -148
- package/esm2022/form-fields/section-fields/section-fields.component.mjs +0 -29
- package/esm2022/form-fields/selection-matrix-fields/selection-matrix-fields.component.mjs +0 -158
- package/esm2022/form-fields/signature-fields/signature-fields.component.mjs +0 -32
- package/esm2022/form-fields/slider-fields/slider-fields.component.mjs +0 -73
- package/esm2022/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.mjs +0 -66
- package/esm2022/form-fields/text-area-fields/text-area-fields.component.mjs +0 -159
- package/esm2022/form-fields/text-fields/text-fields.component.mjs +0 -245
- package/esm2022/form-fields/toggle-switch-fields/toggle-switch-fields.component.mjs +0 -85
- package/esm2022/form-fields/url-fields/url-fields.component.mjs +0 -124
- package/esm2022/form-submission/form-submission.module.mjs +0 -64
- package/esm2022/form-submission/header/header.component.mjs +0 -20
- package/esm2022/form-submission/navigation-tabs/navigation-tabs.component.mjs +0 -171
- package/esm2022/form-submission/next-prev-navigation/next-prev-navigation.component.mjs +0 -124
- package/esm2022/form-submission/save-as-draft/saveDraftModalComponent .mjs +0 -50
- package/esm2022/form-submission/submission-container/submission-container.component.mjs +0 -17
- package/esm2022/form-submission/submit-form/submit-form.component.mjs +0 -1610
- package/esm2022/lib/form-submission.component.mjs +0 -113
- package/esm2022/lib/form-submission.module.mjs +0 -56
- package/esm2022/lib/form-submission.service.mjs +0 -14
- package/esm2022/models/aggregate.model.mjs +0 -2
- package/esm2022/models/answer.model.mjs +0 -2
- package/esm2022/models/appearance.model.mjs +0 -2
- package/esm2022/models/attachment.model.mjs +0 -2
- package/esm2022/models/defaultAnswerEntry.model.mjs +0 -2
- package/esm2022/models/defaultAnswersModel.model.mjs +0 -2
- package/esm2022/models/defaultQuestionAnswer.model.mjs +0 -2
- package/esm2022/models/elementOptionAPI.model.mjs +0 -2
- package/esm2022/models/elementOptionAPIData.model.mjs +0 -2
- package/esm2022/models/elementOptionDB.model.mjs +0 -2
- package/esm2022/models/elementOptionDBCriteria.model.mjs +0 -2
- package/esm2022/models/emitters.model.mjs +0 -2
- package/esm2022/models/enum/condition.enum.mjs +0 -18
- package/esm2022/models/enum/elementType .enum.mjs +0 -24
- package/esm2022/models/enum/entityType.enum.mjs +0 -12
- package/esm2022/models/formConfiguration.model.mjs +0 -2
- package/esm2022/models/formElement.model.mjs +0 -2
- package/esm2022/models/formElementType.model.mjs +0 -2
- package/esm2022/models/grid.model.mjs +0 -2
- package/esm2022/models/hiddenField.model.mjs +0 -2
- package/esm2022/models/iFrameProperties.model.mjs +0 -2
- package/esm2022/models/logic.model.mjs +0 -2
- package/esm2022/models/multifields.model.mjs +0 -2
- package/esm2022/models/option.model.mjs +0 -2
- package/esm2022/models/page.model.mjs +0 -2
- package/esm2022/models/publicForm.model.mjs +0 -2
- package/esm2022/models/question.model.mjs +0 -2
- package/esm2022/models/questionAnswer.model.mjs +0 -2
- package/esm2022/models/questionGroup.model.mjs +0 -2
- package/esm2022/models/row.model.mjs +0 -2
- package/esm2022/models/scoring.model.mjs +0 -2
- package/esm2022/models/section.model.mjs +0 -2
- package/esm2022/models/subForm.model.mjs +0 -2
- package/esm2022/models/subformConfiguration.model.mjs +0 -2
- package/esm2022/models/subformPropery.model.mjs +0 -2
- package/esm2022/models/submission.model.mjs +0 -2
- package/esm2022/models/submissionCopyConfig.mopdel.mjs +0 -2
- package/esm2022/models/terms&condition.model.mjs +0 -2
- package/esm2022/models/validation.model.mjs +0 -2
- package/esm2022/models/whenClause.model.mjs +0 -2
- package/esm2022/models/whenClauseCondition.model.mjs +0 -2
- package/esm2022/models/whenClauseElements.model.mjs +0 -2
- package/esm2022/piserve-tech-form-submission.mjs +0 -5
- package/esm2022/public-api.mjs +0 -7
- package/esm2022/question/card-subform/card-subform.component.mjs +0 -354
- package/esm2022/question/confirm-dialog/confirm-dialog.component.mjs +0 -27
- package/esm2022/question/form-elements/form-elements.component.mjs +0 -62
- package/esm2022/question/inline-multiple-subform/inline-multiple-subform.component.mjs +0 -384
- package/esm2022/question/multifields/multifields.component.mjs +0 -54
- package/esm2022/question/multiple-subform/multiple-subform.component.mjs +0 -413
- package/esm2022/question/question/question.component.mjs +0 -145
- package/esm2022/question/question-group/question-group.component.mjs +0 -102
- package/esm2022/question/recursive-logic/recursive-logic.component.mjs +0 -49
- package/esm2022/question/sub-form/sub-form.component.mjs +0 -351
- package/esm2022/services/aggregate.service.mjs +0 -139
- package/esm2022/services/countryService.mjs +0 -89
- package/esm2022/services/data.service.mjs +0 -36
- package/esm2022/services/element-tracker.service.mjs +0 -27
- package/esm2022/services/form-validation.service.mjs +0 -128
- package/esm2022/services/form.service.mjs +0 -333
- package/esm2022/services/mapper.service.mjs +0 -519
- package/esm2022/services/recaptcha.service.mjs +0 -136
- package/esm2022/services/score.service.mjs +0 -268
- package/esm2022/services/subform-copy.service.mjs +0 -122
- package/esm2022/services/validation.service.mjs +0 -35
- package/esm2022/services/whenClause.service.mjs +0 -423
- package/esm2022/shared/shared.module.mjs +0 -97
- package/esm2022/sub-form/submission-modal/submission-modal.component.mjs +0 -133
- package/fesm2022/piserve-tech-form-submission.mjs +0 -11658
- package/fesm2022/piserve-tech-form-submission.mjs.map +0 -1
- package/form-fields/aggregate-function/aggregate-function.component.d.ts +0 -43
- package/form-fields/check-box-fields/check-box-fields.component.d.ts +0 -73
- package/form-fields/currency-fields/currency-fields.component.d.ts +0 -62
- package/form-fields/date-time-fields/date-time-fields.component.d.ts +0 -96
- package/form-fields/drop-down-fields/drop-down-fields.component.d.ts +0 -88
- package/form-fields/file-picker-fields/file-picker-fields.component.d.ts +0 -72
- package/form-fields/form-fields.module.d.ts +0 -40
- package/form-fields/hidden-field/hidden-field.component.d.ts +0 -38
- package/form-fields/iframe-fields/iframe-fields.component.d.ts +0 -35
- package/form-fields/location-fields/location-fields.component.d.ts +0 -29
- package/form-fields/mail-fields/mail-fields.component.d.ts +0 -41
- package/form-fields/mobile-fields/mobile-fields.component.d.ts +0 -71
- package/form-fields/number-fields/number-fields.component.d.ts +0 -53
- package/form-fields/password-fields/password-fields.component.d.ts +0 -57
- package/form-fields/radio-button-fields/radio-button-fields.component.d.ts +0 -70
- package/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.d.ts +0 -46
- package/form-fields/section-fields/section-fields.component.d.ts +0 -10
- package/form-fields/selection-matrix-fields/selection-matrix-fields.component.d.ts +0 -45
- package/form-fields/signature-fields/signature-fields.component.d.ts +0 -13
- package/form-fields/slider-fields/slider-fields.component.d.ts +0 -32
- package/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.d.ts +0 -26
- package/form-fields/text-area-fields/text-area-fields.component.d.ts +0 -49
- package/form-fields/text-fields/text-fields.component.d.ts +0 -49
- package/form-fields/toggle-switch-fields/toggle-switch-fields.component.d.ts +0 -29
- package/form-fields/url-fields/url-fields.component.d.ts +0 -41
- package/form-submission/form-submission.module.d.ts +0 -20
- package/form-submission/header/header.component.d.ts +0 -7
- package/form-submission/navigation-tabs/navigation-tabs.component.d.ts +0 -57
- package/form-submission/next-prev-navigation/next-prev-navigation.component.d.ts +0 -46
- package/form-submission/save-as-draft/saveDraftModalComponent .d.ts +0 -17
- package/form-submission/submission-container/submission-container.component.d.ts +0 -7
- package/form-submission/submit-form/submit-form.component.d.ts +0 -237
- package/index.d.ts +0 -5
- package/lib/form-submission.component.d.ts +0 -30
- package/lib/form-submission.module.d.ts +0 -16
- package/lib/form-submission.service.d.ts +0 -6
- package/models/aggregate.model.d.ts +0 -4
- package/models/appearance.model.d.ts +0 -64
- package/models/elementOptionAPI.model.d.ts +0 -12
- package/models/elementOptionAPIData.model.d.ts +0 -5
- package/models/elementOptionDB.model.d.ts +0 -8
- package/models/elementOptionDBCriteria.model.d.ts +0 -7
- package/models/enum/elementType .enum.d.ts +0 -22
- package/models/enum/entityType.enum.d.ts +0 -10
- package/models/logic.model.d.ts +0 -9
- package/models/multifields.model.d.ts +0 -11
- package/models/page.model.d.ts +0 -6
- package/models/publicForm.model.d.ts +0 -18
- package/models/question.model.d.ts +0 -26
- package/models/questionAnswer.model.d.ts +0 -7
- package/models/questionGroup.model.d.ts +0 -11
- package/models/scoring.model.d.ts +0 -10
- package/models/section.model.d.ts +0 -6
- package/models/subForm.model.d.ts +0 -24
- package/models/subformConfiguration.model.d.ts +0 -4
- package/models/subformPropery.model.d.ts +0 -7
- package/models/validation.model.d.ts +0 -48
- package/models/whenClause.model.d.ts +0 -6
- package/question/card-subform/card-subform.component.d.ts +0 -44
- package/question/confirm-dialog/confirm-dialog.component.d.ts +0 -12
- package/question/form-elements/form-elements.component.d.ts +0 -20
- package/question/inline-multiple-subform/inline-multiple-subform.component.d.ts +0 -47
- package/question/multifields/multifields.component.d.ts +0 -11
- package/question/multiple-subform/multiple-subform.component.d.ts +0 -39
- package/question/question/question.component.d.ts +0 -30
- package/question/question-group/question-group.component.d.ts +0 -29
- package/question/recursive-logic/recursive-logic.component.d.ts +0 -19
- package/question/sub-form/sub-form.component.d.ts +0 -70
- package/services/aggregate.service.d.ts +0 -29
- package/services/countryService.d.ts +0 -21
- package/services/data.service.d.ts +0 -19
- package/services/element-tracker.service.d.ts +0 -10
- package/services/form-validation.service.d.ts +0 -16
- package/services/form.service.d.ts +0 -27
- package/services/mapper.service.d.ts +0 -31
- package/services/recaptcha.service.d.ts +0 -46
- package/services/score.service.d.ts +0 -27
- package/services/subform-copy.service.d.ts +0 -10
- package/services/validation.service.d.ts +0 -14
- package/services/whenClause.service.d.ts +0 -45
- package/shared/shared.module.d.ts +0 -25
- package/sub-form/submission-modal/submission-modal.component.d.ts +0 -31
- /package/{assets → src/assets}/fonts/Garamond.woff2 +0 -0
- /package/{assets → src/assets}/fonts/Georgia.woff2 +0 -0
- /package/{assets → src/assets}/fonts/Poppins.woff2 +0 -0
- /package/{assets → src/assets}/fonts/Tahoma.woff2 +0 -0
- /package/{assets → src/assets}/fonts/Tajawal.woff2 +0 -0
- /package/{assets → src/assets}/fonts/Verdana.woff2 +0 -0
- /package/{assets → src/assets}/icons/left_arrow.svg +0 -0
- /package/{assets → src/assets}/icons/right_arrow.svg +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root'
|
|
6
|
+
})
|
|
7
|
+
export class ValidationService {
|
|
8
|
+
private invalidQuestions: {[key: string]: {message: string, pageIndex: number}} = {};
|
|
9
|
+
|
|
10
|
+
setInvalid(questionId: string, message: string, pageIndex: number) {
|
|
11
|
+
this.invalidQuestions[questionId] = {message, pageIndex};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
clearInvalid(questionId: string) {
|
|
15
|
+
delete this.invalidQuestions[questionId];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getFirstInvalid(): {id: string, pageIndex: number} | null {
|
|
19
|
+
const keys = Object.keys(this.invalidQuestions);
|
|
20
|
+
return keys.length > 0 ? {
|
|
21
|
+
id: keys[0],
|
|
22
|
+
pageIndex: this.invalidQuestions[keys[0]].pageIndex
|
|
23
|
+
} : null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getErrorMessage(questionId: string): string | null {
|
|
27
|
+
return this.invalidQuestions[questionId]?.message || null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
clearAll() {
|
|
31
|
+
this.invalidQuestions = {};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Submission } from '../models/submission.model';
|
|
3
|
+
import { Subject } from 'rxjs/internal/Subject';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root',
|
|
7
|
+
})
|
|
8
|
+
export class WhenClauseService {
|
|
9
|
+
private activeWhenClauseGrids: any[] = [];
|
|
10
|
+
private questionAnswerMap: { [questionId: string]: any } = {};
|
|
11
|
+
private questionChange$ = new Subject<{ questionId: string }>();
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
isInitialLoad: boolean = true;
|
|
16
|
+
constructor() {}
|
|
17
|
+
|
|
18
|
+
markLoadCompleted() {
|
|
19
|
+
this.isInitialLoad = false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
onQuestionChange() {
|
|
23
|
+
return this.questionChange$.asObservable();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if a grid has an active when clause
|
|
29
|
+
*/
|
|
30
|
+
isActiveWhenClause(grid: any): boolean {
|
|
31
|
+
const when = grid?.whenClause;
|
|
32
|
+
return !!(
|
|
33
|
+
when &&
|
|
34
|
+
when.activate &&
|
|
35
|
+
Array.isArray(when.whenClauseCondition) &&
|
|
36
|
+
when.whenClauseCondition.length > 0
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Add a grid to tracking list if it has an active when clause
|
|
42
|
+
*/
|
|
43
|
+
addGrid(grid: any): void {
|
|
44
|
+
if (!grid) return;
|
|
45
|
+
|
|
46
|
+
if (this.isActiveWhenClause(grid)) {
|
|
47
|
+
const exists = this.activeWhenClauseGrids.some(
|
|
48
|
+
(g) => g.element?.id === grid.element?.id
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if (!exists) {
|
|
52
|
+
this.activeWhenClauseGrids.push(grid);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setQuestionAnswer(questionId: string, answer: any,initial:boolean = false): void {
|
|
58
|
+
if (!questionId) return;
|
|
59
|
+
this.questionAnswerMap[questionId] = answer;
|
|
60
|
+
this.evaluateAllWhenClauses(initial);
|
|
61
|
+
this.questionChange$.next({ questionId });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getAnswer(questionId: string): any {
|
|
65
|
+
return this.questionAnswerMap[questionId];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private evaluateAllWhenClauses(initial:boolean): void {
|
|
69
|
+
const visibleGrids: any[] = [];
|
|
70
|
+
|
|
71
|
+
for (const grid of this.activeWhenClauseGrids) {
|
|
72
|
+
const when = grid.whenClause;
|
|
73
|
+
const conditions = when.whenClauseCondition;
|
|
74
|
+
|
|
75
|
+
if (!conditions || !conditions.length) continue;
|
|
76
|
+
|
|
77
|
+
let overallResult = true;
|
|
78
|
+
|
|
79
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
80
|
+
const clause = conditions[i];
|
|
81
|
+
const logic = (clause.logic || (i === 0 ? 'AND' : 'AND')).toUpperCase(); // Default to AND for first
|
|
82
|
+
const answer = this.getAnswer(clause.questionid);
|
|
83
|
+
const result = this.evaluateCondition(
|
|
84
|
+
answer,
|
|
85
|
+
clause.condition,
|
|
86
|
+
clause.value
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// Combine results based on logic (AND / OR)
|
|
90
|
+
if (i === 0) {
|
|
91
|
+
overallResult = result; // initialize with first condition
|
|
92
|
+
} else {
|
|
93
|
+
if (logic === 'AND') {
|
|
94
|
+
overallResult = overallResult && result;
|
|
95
|
+
} else if (logic === 'OR') {
|
|
96
|
+
overallResult = overallResult || result;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// safe read actions (could be undefined)
|
|
101
|
+
const actions: string[] = Array.isArray(when?.whenClauseActions)
|
|
102
|
+
? when.whenClauseActions.map(String)
|
|
103
|
+
: [];
|
|
104
|
+
|
|
105
|
+
// choose the decisive action (use last if multiple)
|
|
106
|
+
const action = actions.length > 0 ? actions[actions.length - 1] : undefined;
|
|
107
|
+
|
|
108
|
+
if (overallResult) {
|
|
109
|
+
// Condition(s) satisfied -> perform the action
|
|
110
|
+
switch (action) {
|
|
111
|
+
case 'SHOW':
|
|
112
|
+
grid.show = true;
|
|
113
|
+
break;
|
|
114
|
+
case 'HIDE':
|
|
115
|
+
grid.show = false;
|
|
116
|
+
break;
|
|
117
|
+
case 'MARK_AS_REQUIRED':
|
|
118
|
+
if (grid.element) grid.element.required = true;
|
|
119
|
+
break;
|
|
120
|
+
case 'MARK_AS_OPTIONAL':
|
|
121
|
+
if (grid.element) grid.element.required = false;
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
// no show/hide action — keep current behavior (you can choose default here)
|
|
125
|
+
// For safety, if no explicit action, we'll leave grid.show unchanged.
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// if visible, collect
|
|
130
|
+
if (grid.show) visibleGrids.push(grid);
|
|
131
|
+
} else {
|
|
132
|
+
// Condition(s) not satisfied -> revert the action's effect
|
|
133
|
+
switch (action) {
|
|
134
|
+
case 'SHOW':
|
|
135
|
+
// condition no longer true => hide (revert)
|
|
136
|
+
grid.show = false;
|
|
137
|
+
break;
|
|
138
|
+
case 'HIDE':
|
|
139
|
+
// condition no longer true => show (revert)
|
|
140
|
+
grid.show = true;
|
|
141
|
+
break;
|
|
142
|
+
case 'MARK_AS_REQUIRED':
|
|
143
|
+
if (grid.element) grid.element.required = false;
|
|
144
|
+
break;
|
|
145
|
+
case 'MARK_AS_OPTIONAL':
|
|
146
|
+
if (grid.element) grid.element.required = true;
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
// nothing to revert
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
// if we hid it because overallResult false and it's not initial, clear answer
|
|
153
|
+
if (!overallResult && !initial && !grid.show) {
|
|
154
|
+
grid.element.answer = null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (overallResult) visibleGrids.push(grid);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
evaluateCondition(answer: any, operator: string, value: any): boolean {
|
|
162
|
+
|
|
163
|
+
// treat null/undefined/empty-string/empty-array as "no answer"
|
|
164
|
+
if (answer === null || answer === undefined) return false;
|
|
165
|
+
// if (typeof answer === 'string' && answer === '') return false;
|
|
166
|
+
if (Array.isArray(answer) && answer.length === 0) return false;
|
|
167
|
+
|
|
168
|
+
// helpers to normalize values to arrays of lower-case strings (for string ops)
|
|
169
|
+
const toStr = (v: any) =>
|
|
170
|
+
v === null || v === undefined ? '' : String(v).toLowerCase();
|
|
171
|
+
|
|
172
|
+
const ensureArray = (v: any): string[] => {
|
|
173
|
+
if (Array.isArray(v)) return v.map((x) => toStr(x));
|
|
174
|
+
// if comma-separated string => split, else single element array
|
|
175
|
+
if (typeof v === 'string' && v.indexOf(',') !== -1) {
|
|
176
|
+
return v
|
|
177
|
+
.split(',')
|
|
178
|
+
.map((x) => x.trim())
|
|
179
|
+
.map((x) => toStr(x));
|
|
180
|
+
}
|
|
181
|
+
return [toStr(v)];
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const ansArr = ensureArray(answer);
|
|
185
|
+
const valArr = ensureArray(value);
|
|
186
|
+
|
|
187
|
+
// numeric comparisons: only when both sides are scalars (non-array) and numeric
|
|
188
|
+
const isNumericScalar = (x: any) =>
|
|
189
|
+
!Array.isArray(x) && x !== null && x !== undefined && !Number.isNaN(Number(x));
|
|
190
|
+
|
|
191
|
+
switch (operator) {
|
|
192
|
+
case '<':
|
|
193
|
+
if (isNumericScalar(answer) && isNumericScalar(value))
|
|
194
|
+
return Number(answer) < Number(value);
|
|
195
|
+
return false;
|
|
196
|
+
case '>':
|
|
197
|
+
if (isNumericScalar(answer) && isNumericScalar(value))
|
|
198
|
+
return Number(answer) > Number(value);
|
|
199
|
+
return false;
|
|
200
|
+
case '<=':
|
|
201
|
+
if (isNumericScalar(answer) && isNumericScalar(value))
|
|
202
|
+
return Number(answer) <= Number(value);
|
|
203
|
+
return false;
|
|
204
|
+
case '>=':
|
|
205
|
+
if (isNumericScalar(answer) && isNumericScalar(value))
|
|
206
|
+
return Number(answer) >= Number(value);
|
|
207
|
+
return false;
|
|
208
|
+
|
|
209
|
+
// equality: true if any answer element equals any value element
|
|
210
|
+
case '=':
|
|
211
|
+
return ansArr.some((a) => valArr.some((v) => a === v));
|
|
212
|
+
|
|
213
|
+
case '!=':
|
|
214
|
+
return !ansArr.some((a) => valArr.some((v) => a === v));
|
|
215
|
+
|
|
216
|
+
// LIKE / NOT LIKE: check substring match anywhere in any answer element
|
|
217
|
+
case 'LIKE':
|
|
218
|
+
return ansArr.some((a) => valArr.some((v) => a.includes(v)));
|
|
219
|
+
case 'NOT LIKE':
|
|
220
|
+
return !ansArr.some((a) => valArr.some((v) => a.includes(v)));
|
|
221
|
+
|
|
222
|
+
case 'BEGIN WITH':
|
|
223
|
+
return ansArr.some((a) => valArr.some((v) => a.startsWith(v)));
|
|
224
|
+
case 'END WITH':
|
|
225
|
+
return ansArr.some((a) => valArr.some((v) => a.endsWith(v)));
|
|
226
|
+
|
|
227
|
+
// IN / NOT IN: true if any answer element exists in value list
|
|
228
|
+
case 'IN':
|
|
229
|
+
return ansArr.some((a) => valArr.includes(a));
|
|
230
|
+
case 'NOT IN':
|
|
231
|
+
return !ansArr.some((a) => valArr.includes(a));
|
|
232
|
+
|
|
233
|
+
default:
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
addGridsFromSubform(subform: any): void {
|
|
239
|
+
if (!subform || !Array.isArray(subform.rows)) return;
|
|
240
|
+
|
|
241
|
+
for (const row of subform.rows) {
|
|
242
|
+
if (!row.grid || !Array.isArray(row.grid)) continue;
|
|
243
|
+
|
|
244
|
+
for (const grid of row.grid) {
|
|
245
|
+
// 1️⃣ Add this grid itself if it has an active whenClause
|
|
246
|
+
this.addGrid(grid);
|
|
247
|
+
|
|
248
|
+
// 2️⃣ Then, recursively process nested childLogics inside its element
|
|
249
|
+
if (grid.element?.childLogics?.length) {
|
|
250
|
+
this.processChildLogics(grid.element.childLogics);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Recursively process childLogics structure
|
|
258
|
+
*/
|
|
259
|
+
private processChildLogics(childLogics: any[]): void {
|
|
260
|
+
if (!Array.isArray(childLogics)) return;
|
|
261
|
+
|
|
262
|
+
for (const logic of childLogics) {
|
|
263
|
+
// 1️⃣ Each logic may have its own rows (similar to subform rows)
|
|
264
|
+
if (Array.isArray(logic.rows)) {
|
|
265
|
+
for (const row of logic.rows) {
|
|
266
|
+
if (Array.isArray(row.grid)) {
|
|
267
|
+
for (const grid of row.grid) {
|
|
268
|
+
// Check whenClause for this nested grid
|
|
269
|
+
this.addGrid(grid);
|
|
270
|
+
|
|
271
|
+
// 2️⃣ Recurse again if this nested question also has its own childLogics
|
|
272
|
+
if (grid.element?.childLogics?.length) {
|
|
273
|
+
this.processChildLogics(grid.element.childLogics);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// 3️⃣ A logic itself might directly contain nested logics
|
|
281
|
+
if (Array.isArray(logic.childLogics)) {
|
|
282
|
+
this.processChildLogics(logic.childLogics);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Return ALL elements with an active whenClause inside a subform,
|
|
289
|
+
* including nested childLogics (recursive)
|
|
290
|
+
*/
|
|
291
|
+
getWhenClauseElements(subform: any): any[] {
|
|
292
|
+
const result: any[] = [];
|
|
293
|
+
|
|
294
|
+
if (!subform || !Array.isArray(subform.rows)) {
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
for (const row of subform.rows) {
|
|
299
|
+
if (!Array.isArray(row.grid)) continue;
|
|
300
|
+
|
|
301
|
+
for (const grid of row.grid) {
|
|
302
|
+
// 1️⃣ Add this grid if it has an active whenClause
|
|
303
|
+
if (this.isActiveWhenClause(grid)) {
|
|
304
|
+
result.push(grid);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 2️⃣ Process nested childLogics inside this element
|
|
308
|
+
if (Array.isArray(grid.element?.childLogics)) {
|
|
309
|
+
result.push(
|
|
310
|
+
...this.getElementsFromChildLogics(grid.element.childLogics)
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Recursively gather grids with active whenClause inside childLogics
|
|
321
|
+
*/
|
|
322
|
+
private getElementsFromChildLogics(childLogics: any[]): any[] {
|
|
323
|
+
const found: any[] = [];
|
|
324
|
+
|
|
325
|
+
if (!Array.isArray(childLogics)) return found;
|
|
326
|
+
|
|
327
|
+
for (const logic of childLogics) {
|
|
328
|
+
// Each logic can have rows
|
|
329
|
+
if (Array.isArray(logic.rows)) {
|
|
330
|
+
for (const row of logic.rows) {
|
|
331
|
+
if (!Array.isArray(row.grid)) continue;
|
|
332
|
+
|
|
333
|
+
for (const grid of row.grid) {
|
|
334
|
+
if (this.isActiveWhenClause(grid)) {
|
|
335
|
+
found.push(grid);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Recurse deeper if this grid has nested childLogics
|
|
339
|
+
if (Array.isArray(grid.element?.childLogics)) {
|
|
340
|
+
found.push(
|
|
341
|
+
...this.getElementsFromChildLogics(grid.element.childLogics)
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Logic itself may have nested childLogics
|
|
349
|
+
if (Array.isArray(logic.childLogics)) {
|
|
350
|
+
found.push(...this.getElementsFromChildLogics(logic.childLogics));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return found;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
checkElementVisibility(id: string, submission: Submission): boolean {
|
|
358
|
+
if (!id || !submission || !Array.isArray(submission.answers)) {
|
|
359
|
+
return true; // default visible if invalid input
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const matchedAnswer = submission.answers.find(
|
|
363
|
+
(ans) => ans.questionId === id
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
// Return the 'show' flag if found, else default to true
|
|
367
|
+
return matchedAnswer ? matchedAnswer.show ?? true : true;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
evaluateSubformWhenClauses(
|
|
371
|
+
changedAnswer: any,
|
|
372
|
+
submission: Submission,
|
|
373
|
+
changedQuestionId: string,
|
|
374
|
+
elementsWithWhenClause: any
|
|
375
|
+
) {
|
|
376
|
+
if (!elementsWithWhenClause.length) return;
|
|
377
|
+
|
|
378
|
+
for (const grid of elementsWithWhenClause) {
|
|
379
|
+
const elementId = grid.element.id;
|
|
380
|
+
const when = grid.whenClause;
|
|
381
|
+
const conditions = when.whenClauseCondition;
|
|
382
|
+
|
|
383
|
+
if (!conditions?.length) continue;
|
|
384
|
+
|
|
385
|
+
let overallResult = true;
|
|
386
|
+
|
|
387
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
388
|
+
const clause = conditions[i];
|
|
389
|
+
|
|
390
|
+
const logic = (clause.logic || (i === 0 ? 'AND' : 'AND')).toUpperCase();
|
|
391
|
+
|
|
392
|
+
// Determine which answer to use for this condition
|
|
393
|
+
let answerToCheck: any;
|
|
394
|
+
|
|
395
|
+
if (clause.questionid === changedQuestionId) {
|
|
396
|
+
// Use updated answer for the changed question
|
|
397
|
+
answerToCheck = changedAnswer;
|
|
398
|
+
} else {
|
|
399
|
+
// Fetch existing value from submission for other questions
|
|
400
|
+
const existing = submission.answers.find(
|
|
401
|
+
(a) => a.questionId === clause.questionid
|
|
402
|
+
);
|
|
403
|
+
answerToCheck = existing?.answer;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const result = this.evaluateCondition(
|
|
407
|
+
answerToCheck,
|
|
408
|
+
clause.condition,
|
|
409
|
+
clause.value
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
// Apply AND/OR logic
|
|
413
|
+
if (i === 0) {
|
|
414
|
+
overallResult = result;
|
|
415
|
+
} else {
|
|
416
|
+
overallResult =
|
|
417
|
+
logic === 'AND' ? overallResult && result : overallResult || result;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Update show flag for the element controlled by this whenClause
|
|
422
|
+
const matchedAnswer = submission.answers.find(
|
|
423
|
+
(ans) => ans.questionId === elementId
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
const actions: string[] = Array.isArray(when?.whenClauseActions)
|
|
427
|
+
? when.whenClauseActions.map(String)
|
|
428
|
+
: [];
|
|
429
|
+
|
|
430
|
+
// choose the decisive action (use last if multiple)
|
|
431
|
+
const action = actions.length > 0 ? actions[actions.length - 1] : undefined;
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
if (matchedAnswer) {
|
|
435
|
+
if (overallResult) {
|
|
436
|
+
// Condition(s) satisfied -> perform the action
|
|
437
|
+
switch (action) {
|
|
438
|
+
case 'SHOW':
|
|
439
|
+
matchedAnswer.show = true;
|
|
440
|
+
break;
|
|
441
|
+
case 'HIDE':
|
|
442
|
+
matchedAnswer.show = false;
|
|
443
|
+
break;
|
|
444
|
+
case 'MARK_AS_REQUIRED':
|
|
445
|
+
matchedAnswer.required = true;
|
|
446
|
+
break;
|
|
447
|
+
case 'MARK_AS_OPTIONAL':
|
|
448
|
+
matchedAnswer.required = false;
|
|
449
|
+
break;
|
|
450
|
+
default:
|
|
451
|
+
// no show/hide action — keep current behavior (you can choose default here)
|
|
452
|
+
// For safety, if no explicit action, we'll leave grid.show unchanged.
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
} else {
|
|
457
|
+
// Condition(s) not satisfied -> revert the action's effect
|
|
458
|
+
switch (action) {
|
|
459
|
+
case 'SHOW':
|
|
460
|
+
// condition no longer true => hide (revert)
|
|
461
|
+
matchedAnswer.show = false;
|
|
462
|
+
break;
|
|
463
|
+
case 'HIDE':
|
|
464
|
+
// condition no longer true => show (revert)
|
|
465
|
+
matchedAnswer.show = true;
|
|
466
|
+
break;
|
|
467
|
+
case 'MARK_AS_REQUIRED':
|
|
468
|
+
matchedAnswer.required = false;
|
|
469
|
+
break;
|
|
470
|
+
case 'MARK_AS_OPTIONAL':
|
|
471
|
+
matchedAnswer.required = true;
|
|
472
|
+
break;
|
|
473
|
+
default:
|
|
474
|
+
// nothing to revert
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
// if (matchedAnswer) {
|
|
484
|
+
// matchedAnswer.show = overallResult;
|
|
485
|
+
// }
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
resetService(): void {
|
|
490
|
+
// Clear tracked grids
|
|
491
|
+
this.activeWhenClauseGrids = [];
|
|
492
|
+
|
|
493
|
+
// Clear stored question → answer map
|
|
494
|
+
this.questionAnswerMap = {};
|
|
495
|
+
|
|
496
|
+
// Reset visibility logic to initial state
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
getActiveWhenClauseGrids(): any[] {
|
|
500
|
+
return this.activeWhenClauseGrids;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { RecursiveLogicComponent } from '../question/recursive-logic/recursive-logic.component';
|
|
4
|
+
import { QuestionComponent } from '../question/question/question.component';
|
|
5
|
+
import { SubFormComponent } from '../question/sub-form/sub-form.component';
|
|
6
|
+
import { FormElementsComponent } from '../question/form-elements/form-elements.component';
|
|
7
|
+
|
|
8
|
+
import { FormFieldsModule } from '../form-fields/form-fields.module';
|
|
9
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
10
|
+
import { MatTableModule } from '@angular/material/table';
|
|
11
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
12
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
+
import { MultipleSubformComponent } from '../question/multiple-subform/multiple-subform.component';
|
|
14
|
+
import { SubmissionModalComponent } from '../sub-form/submission-modal/submission-modal.component';
|
|
15
|
+
import { QuestionGroupComponent } from '../question/question-group/question-group.component';
|
|
16
|
+
import { InlineMultipleSubformComponent } from '../question/inline-multiple-subform/inline-multiple-subform.component';
|
|
17
|
+
import { MultifieldsComponent } from '../question/multifields/multifields.component';
|
|
18
|
+
import { CardSubformComponent } from '../question/card-subform/card-subform.component';
|
|
19
|
+
import { QuillModule } from 'ngx-quill';
|
|
20
|
+
import { FormsModule } from '@angular/forms';
|
|
21
|
+
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
|
22
|
+
|
|
23
|
+
@NgModule({
|
|
24
|
+
declarations: [
|
|
25
|
+
RecursiveLogicComponent,
|
|
26
|
+
QuestionComponent,
|
|
27
|
+
SubFormComponent,
|
|
28
|
+
FormElementsComponent,
|
|
29
|
+
MultipleSubformComponent,
|
|
30
|
+
SubmissionModalComponent,
|
|
31
|
+
QuestionGroupComponent,
|
|
32
|
+
InlineMultipleSubformComponent,
|
|
33
|
+
MultifieldsComponent,
|
|
34
|
+
CardSubformComponent
|
|
35
|
+
],
|
|
36
|
+
imports: [
|
|
37
|
+
CommonModule,
|
|
38
|
+
FormFieldsModule,
|
|
39
|
+
MatDialogModule,
|
|
40
|
+
MatTableModule,
|
|
41
|
+
MatMenuModule,
|
|
42
|
+
MatIconModule,
|
|
43
|
+
QuillModule,
|
|
44
|
+
FormsModule,
|
|
45
|
+
NgbModule
|
|
46
|
+
],
|
|
47
|
+
exports: [
|
|
48
|
+
RecursiveLogicComponent,
|
|
49
|
+
QuestionComponent,
|
|
50
|
+
SubFormComponent,
|
|
51
|
+
FormElementsComponent,
|
|
52
|
+
QuestionGroupComponent,
|
|
53
|
+
InlineMultipleSubformComponent,
|
|
54
|
+
MultifieldsComponent,
|
|
55
|
+
CardSubformComponent
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
export class SharedModule { }
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.input-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.svg-wrapper {
|
|
7
|
+
margin-inline-start: auto;
|
|
8
|
+
z-index: 999;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.hintIcon {
|
|
12
|
+
position: relative;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.hintIcon:hover::before {
|
|
17
|
+
content: attr(data-title);
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: calc(100% + 2px);
|
|
20
|
+
right: 0;
|
|
21
|
+
// transform: translateX(-50%);
|
|
22
|
+
padding: 4px 8px;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
background-color: #1D252D;
|
|
25
|
+
color: #8E9AA0;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
min-width: 300px;
|
|
28
|
+
word-wrap: break-word;
|
|
29
|
+
word-break: break-word;
|
|
30
|
+
text-align: center;
|
|
31
|
+
white-space: normal;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.hintIcon:hover::after {
|
|
35
|
+
content: "";
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: calc(100% - 26px);
|
|
38
|
+
left: 50%;
|
|
39
|
+
border: solid transparent;
|
|
40
|
+
border-width: 18px;
|
|
41
|
+
border-bottom-color: #1D252D;
|
|
42
|
+
transform: translateX(-50%);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.height {
|
|
46
|
+
height: 42px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.invalid {
|
|
50
|
+
border-color: #FF0000;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.hintSvg{
|
|
54
|
+
width:30px;
|
|
55
|
+
height:30px;
|
|
56
|
+
fill: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
::ng-deep html lib-formSubmission {
|
|
60
|
+
font-family: var(--library-font-family) !important;
|
|
61
|
+
font-size: var(--library-font-size) !important;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
::ng-deep .timepicker-overlay {
|
|
65
|
+
z-index: 1000 !important;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
::ng-deep .timepicker-backdrop-overlay {
|
|
69
|
+
z-index: 1000 !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.space{
|
|
73
|
+
width: 5px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.error-message {
|
|
77
|
+
color: #f44336;
|
|
78
|
+
font-size: 0.8em;
|
|
79
|
+
margin-top: 4px;
|
|
80
|
+
padding: 0 8px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@keyframes fadeIn {
|
|
84
|
+
from { opacity: 0; transform: translateY(-5px); }
|
|
85
|
+
to { opacity: 1; transform: translateY(0); }
|
|
86
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { SubFormComponent } from '../question/sub-form/sub-form.component';
|
|
4
|
+
import { FormFieldsModule } from '../form-fields/form-fields.module';
|
|
5
|
+
import { MultipleSubformComponent } from '../question/multiple-subform/multiple-subform.component';
|
|
6
|
+
import { SubmissionModalComponent } from './submission-modal/submission-modal.component';
|
|
7
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
8
|
+
import { MatTableModule } from '@angular/material/table';
|
|
9
|
+
import {MatMenuModule} from '@angular/material/menu';
|
|
10
|
+
import {MatIconModule} from '@angular/material/icon';
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
declarations: [SubFormComponent, MultipleSubformComponent, SubmissionModalComponent],
|
|
14
|
+
imports: [
|
|
15
|
+
CommonModule,
|
|
16
|
+
FormFieldsModule,
|
|
17
|
+
MatDialogModule,
|
|
18
|
+
MatTableModule,
|
|
19
|
+
MatMenuModule,
|
|
20
|
+
MatIconModule
|
|
21
|
+
],
|
|
22
|
+
exports:[SubFormComponent]
|
|
23
|
+
})
|
|
24
|
+
export class SubFormModule { }
|