@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.
Files changed (443) hide show
  1. package/README.md +24 -24
  2. package/ng-package.json +30 -0
  3. package/package.json +33 -46
  4. package/{assets → src/assets}/icons/close-sidebar-mark-icon.svg +3 -3
  5. package/{assets → src/assets}/icons/copy-icon.svg +5 -5
  6. package/{assets → src/assets}/icons/delete-icon.svg +7 -7
  7. package/{assets → src/assets}/icons/delete-no-outline-icon.svg +7 -7
  8. package/src/environment/environment.ts +6 -0
  9. package/src/form-fields/aggregate-function/aggregate-function.component.html +63 -0
  10. package/src/form-fields/aggregate-function/aggregate-function.component.scss +1 -0
  11. package/src/form-fields/aggregate-function/aggregate-function.component.spec.ts +21 -0
  12. package/src/form-fields/aggregate-function/aggregate-function.component.ts +148 -0
  13. package/src/form-fields/check-box-fields/check-box-fields.component.html +81 -0
  14. package/src/form-fields/check-box-fields/check-box-fields.component.scss +28 -0
  15. package/src/form-fields/check-box-fields/check-box-fields.component.spec.ts +21 -0
  16. package/src/form-fields/check-box-fields/check-box-fields.component.ts +538 -0
  17. package/src/form-fields/currency-fields/currency-fields.component.html +85 -0
  18. package/src/form-fields/currency-fields/currency-fields.component.scss +48 -0
  19. package/src/form-fields/currency-fields/currency-fields.component.spec.ts +21 -0
  20. package/src/form-fields/currency-fields/currency-fields.component.ts +589 -0
  21. package/src/form-fields/date-time-fields/date-time-fields.component.html +268 -0
  22. package/src/form-fields/date-time-fields/date-time-fields.component.scss +88 -0
  23. package/src/form-fields/date-time-fields/date-time-fields.component.spec.ts +21 -0
  24. package/src/form-fields/date-time-fields/date-time-fields.component.ts +693 -0
  25. package/src/form-fields/drop-down-fields/drop-down-fields.component.html +77 -0
  26. package/src/form-fields/drop-down-fields/drop-down-fields.component.scss +12 -0
  27. package/src/form-fields/drop-down-fields/drop-down-fields.component.spec.ts +21 -0
  28. package/src/form-fields/drop-down-fields/drop-down-fields.component.ts +698 -0
  29. package/src/form-fields/file-picker-fields/file-picker-fields.component.html +72 -0
  30. package/src/form-fields/file-picker-fields/file-picker-fields.component.scss +33 -0
  31. package/src/form-fields/file-picker-fields/file-picker-fields.component.spec.ts +21 -0
  32. package/src/form-fields/file-picker-fields/file-picker-fields.component.ts +256 -0
  33. package/src/form-fields/form-fields.module.ts +110 -0
  34. package/src/form-fields/hidden-field/hidden-field.component.scss +0 -0
  35. package/src/form-fields/hidden-field/hidden-field.component.spec.ts +21 -0
  36. package/src/form-fields/hidden-field/hidden-field.component.ts +156 -0
  37. package/src/form-fields/iframe-fields/iframe-fields.component.html +31 -0
  38. package/src/form-fields/iframe-fields/iframe-fields.component.scss +0 -0
  39. package/src/form-fields/iframe-fields/iframe-fields.component.spec.ts +21 -0
  40. package/src/form-fields/iframe-fields/iframe-fields.component.ts +225 -0
  41. package/src/form-fields/location-fields/location-fields.component.html +54 -0
  42. package/src/form-fields/location-fields/location-fields.component.scss +22 -0
  43. package/src/form-fields/location-fields/location-fields.component.spec.ts +21 -0
  44. package/src/form-fields/location-fields/location-fields.component.ts +83 -0
  45. package/src/form-fields/mail-fields/mail-fields.component.html +66 -0
  46. package/src/form-fields/mail-fields/mail-fields.component.scss +10 -0
  47. package/src/form-fields/mail-fields/mail-fields.component.spec.ts +21 -0
  48. package/src/form-fields/mail-fields/mail-fields.component.ts +127 -0
  49. package/src/form-fields/mobile-fields/mobile-fields.component.html +97 -0
  50. package/src/form-fields/mobile-fields/mobile-fields.component.scss +52 -0
  51. package/src/form-fields/mobile-fields/mobile-fields.component.spec.ts +21 -0
  52. package/src/form-fields/mobile-fields/mobile-fields.component.ts +310 -0
  53. package/src/form-fields/number-fields/number-fields.component.html +70 -0
  54. package/src/form-fields/number-fields/number-fields.component.scss +17 -0
  55. package/src/form-fields/number-fields/number-fields.component.spec.ts +21 -0
  56. package/src/form-fields/number-fields/number-fields.component.ts +256 -0
  57. package/src/form-fields/password-fields/password-fields.component.html +113 -0
  58. package/src/form-fields/password-fields/password-fields.component.scss +61 -0
  59. package/src/form-fields/password-fields/password-fields.component.spec.ts +21 -0
  60. package/src/form-fields/password-fields/password-fields.component.ts +273 -0
  61. package/src/form-fields/radio-button-fields/radio-button-fields.component.html +82 -0
  62. package/src/form-fields/radio-button-fields/radio-button-fields.component.scss +28 -0
  63. package/src/form-fields/radio-button-fields/radio-button-fields.component.spec.ts +21 -0
  64. package/src/form-fields/radio-button-fields/radio-button-fields.component.ts +391 -0
  65. package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.html +67 -0
  66. package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.scss +23 -0
  67. package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.spec.ts +21 -0
  68. package/src/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.ts +145 -0
  69. package/src/form-fields/section-fields/section-fields.component.html +4 -0
  70. package/src/form-fields/section-fields/section-fields.component.scss +37 -0
  71. package/src/form-fields/section-fields/section-fields.component.spec.ts +21 -0
  72. package/src/form-fields/section-fields/section-fields.component.ts +25 -0
  73. package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.html +93 -0
  74. package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.scss +52 -0
  75. package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.spec.ts +21 -0
  76. package/src/form-fields/selection-matrix-fields/selection-matrix-fields.component.ts +155 -0
  77. package/src/form-fields/signature-fields/signature-fields.component.html +43 -0
  78. package/src/form-fields/signature-fields/signature-fields.component.scss +10 -0
  79. package/src/form-fields/signature-fields/signature-fields.component.spec.ts +21 -0
  80. package/src/form-fields/signature-fields/signature-fields.component.ts +25 -0
  81. package/src/form-fields/slider-fields/slider-fields.component.html +67 -0
  82. package/src/form-fields/slider-fields/slider-fields.component.scss +55 -0
  83. package/src/form-fields/slider-fields/slider-fields.component.spec.ts +21 -0
  84. package/src/form-fields/slider-fields/slider-fields.component.ts +63 -0
  85. package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.html +52 -0
  86. package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.scss +85 -0
  87. package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.spec.ts +21 -0
  88. package/src/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.ts +62 -0
  89. package/src/form-fields/text-area-fields/text-area-fields.component.html +68 -0
  90. package/src/form-fields/text-area-fields/text-area-fields.component.scss +19 -0
  91. package/src/form-fields/text-area-fields/text-area-fields.component.spec.ts +21 -0
  92. package/src/form-fields/text-area-fields/text-area-fields.component.ts +166 -0
  93. package/src/form-fields/text-fields/text-fields.component.html +67 -0
  94. package/src/form-fields/text-fields/text-fields.component.scss +26 -0
  95. package/src/form-fields/text-fields/text-fields.component.spec.ts +21 -0
  96. package/src/form-fields/text-fields/text-fields.component.ts +248 -0
  97. package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.html +70 -0
  98. package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.scss +112 -0
  99. package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.spec.ts +21 -0
  100. package/src/form-fields/toggle-switch-fields/toggle-switch-fields.component.ts +74 -0
  101. package/src/form-fields/url-fields/url-fields.component.html +109 -0
  102. package/src/form-fields/url-fields/url-fields.component.scss +22 -0
  103. package/src/form-fields/url-fields/url-fields.component.spec.ts +21 -0
  104. package/src/form-fields/url-fields/url-fields.component.ts +123 -0
  105. package/src/form-submission/form-submission.module.ts +40 -0
  106. package/src/form-submission/header/header.component.html +6 -0
  107. package/src/form-submission/header/header.component.scss +26 -0
  108. package/src/form-submission/header/header.component.spec.ts +21 -0
  109. package/src/form-submission/header/header.component.ts +12 -0
  110. package/src/form-submission/navigation-tabs/navigation-tabs.component.html +134 -0
  111. package/src/form-submission/navigation-tabs/navigation-tabs.component.scss +200 -0
  112. package/src/form-submission/navigation-tabs/navigation-tabs.component.spec.ts +21 -0
  113. package/src/form-submission/navigation-tabs/navigation-tabs.component.ts +134 -0
  114. package/src/form-submission/next-prev-navigation/next-prev-navigation.component.html +207 -0
  115. package/src/form-submission/next-prev-navigation/next-prev-navigation.component.scss +208 -0
  116. package/src/form-submission/next-prev-navigation/next-prev-navigation.component.spec.ts +21 -0
  117. package/src/form-submission/next-prev-navigation/next-prev-navigation.component.ts +74 -0
  118. package/src/form-submission/save-as-draft/saveDraftModalComponent .ts +60 -0
  119. package/src/form-submission/save-as-draft/saveDraftModalComponent.html +33 -0
  120. package/src/form-submission/save-as-draft/saveDraftModalComponent.scss +195 -0
  121. package/src/form-submission/submission-container/submission-container.component.html +30 -0
  122. package/src/form-submission/submission-container/submission-container.component.scss +67 -0
  123. package/src/form-submission/submission-container/submission-container.component.spec.ts +21 -0
  124. package/src/form-submission/submission-container/submission-container.component.ts +14 -0
  125. package/src/form-submission/submit-form/submit-form.component.html +76 -0
  126. package/src/form-submission/submit-form/submit-form.component.scss +88 -0
  127. package/src/form-submission/submit-form/submit-form.component.spec.ts +21 -0
  128. package/src/form-submission/submit-form/submit-form.component.ts +1953 -0
  129. package/src/lib/form-submission.component.html +15 -0
  130. package/src/lib/form-submission.component.scss +1 -0
  131. package/src/lib/form-submission.component.ts +120 -0
  132. package/src/lib/form-submission.module.ts +31 -0
  133. package/src/lib/form-submission.service.spec.ts +16 -0
  134. package/src/lib/form-submission.service.ts +9 -0
  135. package/src/models/aggregate.model.ts +4 -0
  136. package/{models/answer.model.d.ts → src/models/answer.model.ts} +25 -23
  137. package/src/models/appearance.model.ts +64 -0
  138. package/{models/attachment.model.d.ts → src/models/attachment.model.ts} +6 -6
  139. package/{models/defaultAnswerEntry.model.d.ts → src/models/defaultAnswerEntry.model.ts} +7 -5
  140. package/{models/defaultAnswersModel.model.d.ts → src/models/defaultAnswersModel.model.ts} +5 -4
  141. package/{models/defaultQuestionAnswer.model.d.ts → src/models/defaultQuestionAnswer.model.ts} +6 -6
  142. package/src/models/elementOptionAPI.model.ts +13 -0
  143. package/src/models/elementOptionAPIData.model.ts +5 -0
  144. package/src/models/elementOptionDB.model.ts +9 -0
  145. package/src/models/elementOptionDBCriteria.model.ts +7 -0
  146. package/{models/emitters.model.d.ts → src/models/emitters.model.ts} +8 -8
  147. package/{models/enum/condition.enum.d.ts → src/models/enum/condition.enum.ts} +2 -2
  148. package/src/models/enum/elementType .enum.ts +22 -0
  149. package/src/models/enum/entityType.enum.ts +10 -0
  150. package/{models/formConfiguration.model.d.ts → src/models/formConfiguration.model.ts} +2 -2
  151. package/{models/formElement.model.d.ts → src/models/formElement.model.ts} +22 -22
  152. package/{models/formElementType.model.d.ts → src/models/formElementType.model.ts} +3 -2
  153. package/{models/grid.model.d.ts → src/models/grid.model.ts} +14 -13
  154. package/{models/hiddenField.model.d.ts → src/models/hiddenField.model.ts} +5 -5
  155. package/{models/iFrameProperties.model.d.ts → src/models/iFrameProperties.model.ts} +13 -13
  156. package/src/models/logic.model.ts +11 -0
  157. package/src/models/multifields.model.ts +12 -0
  158. package/{models/option.model.d.ts → src/models/option.model.ts} +5 -5
  159. package/src/models/page.model.ts +7 -0
  160. package/src/models/publicForm.model.ts +19 -0
  161. package/src/models/question.model.ts +27 -0
  162. package/src/models/questionAnswer.model.ts +8 -0
  163. package/src/models/questionGroup.model.ts +12 -0
  164. package/src/models/response.model.ts +9 -0
  165. package/src/models/result.model.ts +5 -0
  166. package/{models/row.model.d.ts → src/models/row.model.ts} +2 -1
  167. package/src/models/scoring.model.ts +10 -0
  168. package/src/models/section.model.ts +6 -0
  169. package/src/models/subForm.model.ts +25 -0
  170. package/src/models/subformConfiguration.model.ts +4 -0
  171. package/src/models/subformPropery.model.ts +8 -0
  172. package/{models/submission.model.d.ts → src/models/submission.model.ts} +16 -14
  173. package/{models/submissionCopyConfig.mopdel.d.ts → src/models/submissionCopyConfig.mopdel.ts} +4 -4
  174. package/{models/terms&condition.model.d.ts → src/models/terms&condition.model.ts} +1 -1
  175. package/src/models/validation.model.ts +48 -0
  176. package/src/models/whenClause.model.ts +7 -0
  177. package/{models/whenClauseCondition.model.d.ts → src/models/whenClauseCondition.model.ts} +6 -6
  178. package/{models/whenClauseElements.model.d.ts → src/models/whenClauseElements.model.ts} +6 -5
  179. package/{public-api.d.ts → src/public-api.ts} +4 -0
  180. package/src/question/card-subform/card-subform.component.html +282 -0
  181. package/src/question/card-subform/card-subform.component.scss +49 -0
  182. package/src/question/card-subform/card-subform.component.spec.ts +21 -0
  183. package/src/question/card-subform/card-subform.component.ts +407 -0
  184. package/src/question/confirm-dialog/confirm-dialog.component.html +32 -0
  185. package/src/question/confirm-dialog/confirm-dialog.component.scss +109 -0
  186. package/src/question/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
  187. package/src/question/confirm-dialog/confirm-dialog.component.ts +24 -0
  188. package/src/question/form-elements/form-elements.component.html +28 -0
  189. package/src/question/form-elements/form-elements.component.scss +0 -0
  190. package/src/question/form-elements/form-elements.component.spec.ts +21 -0
  191. package/src/question/form-elements/form-elements.component.ts +41 -0
  192. package/src/question/inline-multiple-subform/inline-multiple-subform.component.html +321 -0
  193. package/src/question/inline-multiple-subform/inline-multiple-subform.component.scss +78 -0
  194. package/src/question/inline-multiple-subform/inline-multiple-subform.component.spec.ts +21 -0
  195. package/src/question/inline-multiple-subform/inline-multiple-subform.component.ts +425 -0
  196. package/src/question/multifields/multifields.component.html +78 -0
  197. package/src/question/multifields/multifields.component.scss +6 -0
  198. package/src/question/multifields/multifields.component.spec.ts +21 -0
  199. package/src/question/multifields/multifields.component.ts +27 -0
  200. package/src/question/multiple-subform/multiple-subform.component.html +185 -0
  201. package/src/question/multiple-subform/multiple-subform.component.scss +52 -0
  202. package/src/question/multiple-subform/multiple-subform.component.spec.ts +21 -0
  203. package/src/question/multiple-subform/multiple-subform.component.ts +481 -0
  204. package/src/question/question/question.component.html +51 -0
  205. package/src/question/question/question.component.scss +0 -0
  206. package/src/question/question/question.component.spec.ts +21 -0
  207. package/src/question/question/question.component.ts +129 -0
  208. package/src/question/question-group/question-group.component.html +147 -0
  209. package/src/question/question-group/question-group.component.scss +36 -0
  210. package/src/question/question-group/question-group.component.spec.ts +21 -0
  211. package/src/question/question-group/question-group.component.ts +94 -0
  212. package/src/question/question.module.ts +22 -0
  213. package/src/question/recursive-logic/recursive-logic.component.html +33 -0
  214. package/src/question/recursive-logic/recursive-logic.component.scss +0 -0
  215. package/src/question/recursive-logic/recursive-logic.component.spec.ts +21 -0
  216. package/src/question/recursive-logic/recursive-logic.component.ts +29 -0
  217. package/src/question/sub-form/sub-form.component.html +254 -0
  218. package/src/question/sub-form/sub-form.component.scss +83 -0
  219. package/src/question/sub-form/sub-form.component.spec.ts +21 -0
  220. package/src/question/sub-form/sub-form.component.ts +421 -0
  221. package/src/services/aggregate.service.ts +148 -0
  222. package/src/services/countryService.ts +92 -0
  223. package/src/services/data.service.ts +36 -0
  224. package/src/services/element-tracker.service.spec.ts +16 -0
  225. package/src/services/element-tracker.service.ts +24 -0
  226. package/src/services/form-validation.service.ts +151 -0
  227. package/src/services/form.service.spec.ts +16 -0
  228. package/src/services/form.service.ts +407 -0
  229. package/src/services/mapper.service.ts +625 -0
  230. package/src/services/recaptcha.service.spec.ts +16 -0
  231. package/src/services/recaptcha.service.ts +179 -0
  232. package/src/services/score.service.ts +352 -0
  233. package/src/services/subform-copy.service.ts +148 -0
  234. package/src/services/validation.service.spec.ts +16 -0
  235. package/src/services/validation.service.ts +33 -0
  236. package/src/services/whenClause.service.ts +502 -0
  237. package/src/shared/shared.module.ts +58 -0
  238. package/src/styles/shared-style.scss +86 -0
  239. package/src/sub-form/sub-form.module.ts +24 -0
  240. package/src/sub-form/submission-modal/submission-modal.component.html +160 -0
  241. package/src/sub-form/submission-modal/submission-modal.component.scss +54 -0
  242. package/src/sub-form/submission-modal/submission-modal.component.spec.ts +21 -0
  243. package/src/sub-form/submission-modal/submission-modal.component.ts +127 -0
  244. package/tsconfig.lib.json +14 -0
  245. package/tsconfig.lib.prod.json +10 -0
  246. package/tsconfig.spec.json +14 -0
  247. package/environment/environment.d.ts +0 -5
  248. package/esm2022/environment/environment.mjs +0 -6
  249. package/esm2022/form-fields/aggregate-function/aggregate-function.component.mjs +0 -146
  250. package/esm2022/form-fields/check-box-fields/check-box-fields.component.mjs +0 -473
  251. package/esm2022/form-fields/currency-fields/currency-fields.component.mjs +0 -502
  252. package/esm2022/form-fields/date-time-fields/date-time-fields.component.mjs +0 -608
  253. package/esm2022/form-fields/drop-down-fields/drop-down-fields.component.mjs +0 -585
  254. package/esm2022/form-fields/file-picker-fields/file-picker-fields.component.mjs +0 -224
  255. package/esm2022/form-fields/form-fields.module.mjs +0 -174
  256. package/esm2022/form-fields/hidden-field/hidden-field.component.mjs +0 -137
  257. package/esm2022/form-fields/iframe-fields/iframe-fields.component.mjs +0 -198
  258. package/esm2022/form-fields/location-fields/location-fields.component.mjs +0 -85
  259. package/esm2022/form-fields/mail-fields/mail-fields.component.mjs +0 -131
  260. package/esm2022/form-fields/mobile-fields/mobile-fields.component.mjs +0 -270
  261. package/esm2022/form-fields/number-fields/number-fields.component.mjs +0 -242
  262. package/esm2022/form-fields/password-fields/password-fields.component.mjs +0 -257
  263. package/esm2022/form-fields/radio-button-fields/radio-button-fields.component.mjs +0 -346
  264. package/esm2022/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.mjs +0 -148
  265. package/esm2022/form-fields/section-fields/section-fields.component.mjs +0 -29
  266. package/esm2022/form-fields/selection-matrix-fields/selection-matrix-fields.component.mjs +0 -158
  267. package/esm2022/form-fields/signature-fields/signature-fields.component.mjs +0 -32
  268. package/esm2022/form-fields/slider-fields/slider-fields.component.mjs +0 -73
  269. package/esm2022/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.mjs +0 -66
  270. package/esm2022/form-fields/text-area-fields/text-area-fields.component.mjs +0 -159
  271. package/esm2022/form-fields/text-fields/text-fields.component.mjs +0 -245
  272. package/esm2022/form-fields/toggle-switch-fields/toggle-switch-fields.component.mjs +0 -85
  273. package/esm2022/form-fields/url-fields/url-fields.component.mjs +0 -124
  274. package/esm2022/form-submission/form-submission.module.mjs +0 -64
  275. package/esm2022/form-submission/header/header.component.mjs +0 -20
  276. package/esm2022/form-submission/navigation-tabs/navigation-tabs.component.mjs +0 -171
  277. package/esm2022/form-submission/next-prev-navigation/next-prev-navigation.component.mjs +0 -124
  278. package/esm2022/form-submission/save-as-draft/saveDraftModalComponent .mjs +0 -50
  279. package/esm2022/form-submission/submission-container/submission-container.component.mjs +0 -17
  280. package/esm2022/form-submission/submit-form/submit-form.component.mjs +0 -1610
  281. package/esm2022/lib/form-submission.component.mjs +0 -113
  282. package/esm2022/lib/form-submission.module.mjs +0 -56
  283. package/esm2022/lib/form-submission.service.mjs +0 -14
  284. package/esm2022/models/aggregate.model.mjs +0 -2
  285. package/esm2022/models/answer.model.mjs +0 -2
  286. package/esm2022/models/appearance.model.mjs +0 -2
  287. package/esm2022/models/attachment.model.mjs +0 -2
  288. package/esm2022/models/defaultAnswerEntry.model.mjs +0 -2
  289. package/esm2022/models/defaultAnswersModel.model.mjs +0 -2
  290. package/esm2022/models/defaultQuestionAnswer.model.mjs +0 -2
  291. package/esm2022/models/elementOptionAPI.model.mjs +0 -2
  292. package/esm2022/models/elementOptionAPIData.model.mjs +0 -2
  293. package/esm2022/models/elementOptionDB.model.mjs +0 -2
  294. package/esm2022/models/elementOptionDBCriteria.model.mjs +0 -2
  295. package/esm2022/models/emitters.model.mjs +0 -2
  296. package/esm2022/models/enum/condition.enum.mjs +0 -18
  297. package/esm2022/models/enum/elementType .enum.mjs +0 -24
  298. package/esm2022/models/enum/entityType.enum.mjs +0 -12
  299. package/esm2022/models/formConfiguration.model.mjs +0 -2
  300. package/esm2022/models/formElement.model.mjs +0 -2
  301. package/esm2022/models/formElementType.model.mjs +0 -2
  302. package/esm2022/models/grid.model.mjs +0 -2
  303. package/esm2022/models/hiddenField.model.mjs +0 -2
  304. package/esm2022/models/iFrameProperties.model.mjs +0 -2
  305. package/esm2022/models/logic.model.mjs +0 -2
  306. package/esm2022/models/multifields.model.mjs +0 -2
  307. package/esm2022/models/option.model.mjs +0 -2
  308. package/esm2022/models/page.model.mjs +0 -2
  309. package/esm2022/models/publicForm.model.mjs +0 -2
  310. package/esm2022/models/question.model.mjs +0 -2
  311. package/esm2022/models/questionAnswer.model.mjs +0 -2
  312. package/esm2022/models/questionGroup.model.mjs +0 -2
  313. package/esm2022/models/row.model.mjs +0 -2
  314. package/esm2022/models/scoring.model.mjs +0 -2
  315. package/esm2022/models/section.model.mjs +0 -2
  316. package/esm2022/models/subForm.model.mjs +0 -2
  317. package/esm2022/models/subformConfiguration.model.mjs +0 -2
  318. package/esm2022/models/subformPropery.model.mjs +0 -2
  319. package/esm2022/models/submission.model.mjs +0 -2
  320. package/esm2022/models/submissionCopyConfig.mopdel.mjs +0 -2
  321. package/esm2022/models/terms&condition.model.mjs +0 -2
  322. package/esm2022/models/validation.model.mjs +0 -2
  323. package/esm2022/models/whenClause.model.mjs +0 -2
  324. package/esm2022/models/whenClauseCondition.model.mjs +0 -2
  325. package/esm2022/models/whenClauseElements.model.mjs +0 -2
  326. package/esm2022/piserve-tech-form-submission.mjs +0 -5
  327. package/esm2022/public-api.mjs +0 -7
  328. package/esm2022/question/card-subform/card-subform.component.mjs +0 -354
  329. package/esm2022/question/confirm-dialog/confirm-dialog.component.mjs +0 -27
  330. package/esm2022/question/form-elements/form-elements.component.mjs +0 -62
  331. package/esm2022/question/inline-multiple-subform/inline-multiple-subform.component.mjs +0 -384
  332. package/esm2022/question/multifields/multifields.component.mjs +0 -54
  333. package/esm2022/question/multiple-subform/multiple-subform.component.mjs +0 -413
  334. package/esm2022/question/question/question.component.mjs +0 -145
  335. package/esm2022/question/question-group/question-group.component.mjs +0 -102
  336. package/esm2022/question/recursive-logic/recursive-logic.component.mjs +0 -49
  337. package/esm2022/question/sub-form/sub-form.component.mjs +0 -351
  338. package/esm2022/services/aggregate.service.mjs +0 -139
  339. package/esm2022/services/countryService.mjs +0 -89
  340. package/esm2022/services/data.service.mjs +0 -36
  341. package/esm2022/services/element-tracker.service.mjs +0 -27
  342. package/esm2022/services/form-validation.service.mjs +0 -128
  343. package/esm2022/services/form.service.mjs +0 -333
  344. package/esm2022/services/mapper.service.mjs +0 -519
  345. package/esm2022/services/recaptcha.service.mjs +0 -136
  346. package/esm2022/services/score.service.mjs +0 -268
  347. package/esm2022/services/subform-copy.service.mjs +0 -122
  348. package/esm2022/services/validation.service.mjs +0 -35
  349. package/esm2022/services/whenClause.service.mjs +0 -423
  350. package/esm2022/shared/shared.module.mjs +0 -97
  351. package/esm2022/sub-form/submission-modal/submission-modal.component.mjs +0 -133
  352. package/fesm2022/piserve-tech-form-submission.mjs +0 -11658
  353. package/fesm2022/piserve-tech-form-submission.mjs.map +0 -1
  354. package/form-fields/aggregate-function/aggregate-function.component.d.ts +0 -43
  355. package/form-fields/check-box-fields/check-box-fields.component.d.ts +0 -73
  356. package/form-fields/currency-fields/currency-fields.component.d.ts +0 -62
  357. package/form-fields/date-time-fields/date-time-fields.component.d.ts +0 -96
  358. package/form-fields/drop-down-fields/drop-down-fields.component.d.ts +0 -88
  359. package/form-fields/file-picker-fields/file-picker-fields.component.d.ts +0 -72
  360. package/form-fields/form-fields.module.d.ts +0 -40
  361. package/form-fields/hidden-field/hidden-field.component.d.ts +0 -38
  362. package/form-fields/iframe-fields/iframe-fields.component.d.ts +0 -35
  363. package/form-fields/location-fields/location-fields.component.d.ts +0 -29
  364. package/form-fields/mail-fields/mail-fields.component.d.ts +0 -41
  365. package/form-fields/mobile-fields/mobile-fields.component.d.ts +0 -71
  366. package/form-fields/number-fields/number-fields.component.d.ts +0 -53
  367. package/form-fields/password-fields/password-fields.component.d.ts +0 -57
  368. package/form-fields/radio-button-fields/radio-button-fields.component.d.ts +0 -70
  369. package/form-fields/rich-text-editor-fields/rich-text-editor-fields.component.d.ts +0 -46
  370. package/form-fields/section-fields/section-fields.component.d.ts +0 -10
  371. package/form-fields/selection-matrix-fields/selection-matrix-fields.component.d.ts +0 -45
  372. package/form-fields/signature-fields/signature-fields.component.d.ts +0 -13
  373. package/form-fields/slider-fields/slider-fields.component.d.ts +0 -32
  374. package/form-fields/terms-and-condition-fields/terms-and-condition-fields.component.d.ts +0 -26
  375. package/form-fields/text-area-fields/text-area-fields.component.d.ts +0 -49
  376. package/form-fields/text-fields/text-fields.component.d.ts +0 -49
  377. package/form-fields/toggle-switch-fields/toggle-switch-fields.component.d.ts +0 -29
  378. package/form-fields/url-fields/url-fields.component.d.ts +0 -41
  379. package/form-submission/form-submission.module.d.ts +0 -20
  380. package/form-submission/header/header.component.d.ts +0 -7
  381. package/form-submission/navigation-tabs/navigation-tabs.component.d.ts +0 -57
  382. package/form-submission/next-prev-navigation/next-prev-navigation.component.d.ts +0 -46
  383. package/form-submission/save-as-draft/saveDraftModalComponent .d.ts +0 -17
  384. package/form-submission/submission-container/submission-container.component.d.ts +0 -7
  385. package/form-submission/submit-form/submit-form.component.d.ts +0 -237
  386. package/index.d.ts +0 -5
  387. package/lib/form-submission.component.d.ts +0 -30
  388. package/lib/form-submission.module.d.ts +0 -16
  389. package/lib/form-submission.service.d.ts +0 -6
  390. package/models/aggregate.model.d.ts +0 -4
  391. package/models/appearance.model.d.ts +0 -64
  392. package/models/elementOptionAPI.model.d.ts +0 -12
  393. package/models/elementOptionAPIData.model.d.ts +0 -5
  394. package/models/elementOptionDB.model.d.ts +0 -8
  395. package/models/elementOptionDBCriteria.model.d.ts +0 -7
  396. package/models/enum/elementType .enum.d.ts +0 -22
  397. package/models/enum/entityType.enum.d.ts +0 -10
  398. package/models/logic.model.d.ts +0 -9
  399. package/models/multifields.model.d.ts +0 -11
  400. package/models/page.model.d.ts +0 -6
  401. package/models/publicForm.model.d.ts +0 -18
  402. package/models/question.model.d.ts +0 -26
  403. package/models/questionAnswer.model.d.ts +0 -7
  404. package/models/questionGroup.model.d.ts +0 -11
  405. package/models/scoring.model.d.ts +0 -10
  406. package/models/section.model.d.ts +0 -6
  407. package/models/subForm.model.d.ts +0 -24
  408. package/models/subformConfiguration.model.d.ts +0 -4
  409. package/models/subformPropery.model.d.ts +0 -7
  410. package/models/validation.model.d.ts +0 -48
  411. package/models/whenClause.model.d.ts +0 -6
  412. package/question/card-subform/card-subform.component.d.ts +0 -44
  413. package/question/confirm-dialog/confirm-dialog.component.d.ts +0 -12
  414. package/question/form-elements/form-elements.component.d.ts +0 -20
  415. package/question/inline-multiple-subform/inline-multiple-subform.component.d.ts +0 -47
  416. package/question/multifields/multifields.component.d.ts +0 -11
  417. package/question/multiple-subform/multiple-subform.component.d.ts +0 -39
  418. package/question/question/question.component.d.ts +0 -30
  419. package/question/question-group/question-group.component.d.ts +0 -29
  420. package/question/recursive-logic/recursive-logic.component.d.ts +0 -19
  421. package/question/sub-form/sub-form.component.d.ts +0 -70
  422. package/services/aggregate.service.d.ts +0 -29
  423. package/services/countryService.d.ts +0 -21
  424. package/services/data.service.d.ts +0 -19
  425. package/services/element-tracker.service.d.ts +0 -10
  426. package/services/form-validation.service.d.ts +0 -16
  427. package/services/form.service.d.ts +0 -27
  428. package/services/mapper.service.d.ts +0 -31
  429. package/services/recaptcha.service.d.ts +0 -46
  430. package/services/score.service.d.ts +0 -27
  431. package/services/subform-copy.service.d.ts +0 -10
  432. package/services/validation.service.d.ts +0 -14
  433. package/services/whenClause.service.d.ts +0 -45
  434. package/shared/shared.module.d.ts +0 -25
  435. package/sub-form/submission-modal/submission-modal.component.d.ts +0 -31
  436. /package/{assets → src/assets}/fonts/Garamond.woff2 +0 -0
  437. /package/{assets → src/assets}/fonts/Georgia.woff2 +0 -0
  438. /package/{assets → src/assets}/fonts/Poppins.woff2 +0 -0
  439. /package/{assets → src/assets}/fonts/Tahoma.woff2 +0 -0
  440. /package/{assets → src/assets}/fonts/Tajawal.woff2 +0 -0
  441. /package/{assets → src/assets}/fonts/Verdana.woff2 +0 -0
  442. /package/{assets → src/assets}/icons/left_arrow.svg +0 -0
  443. /package/{assets → src/assets}/icons/right_arrow.svg +0 -0
@@ -0,0 +1,693 @@
1
+ import { DatePipe } from '@angular/common';
2
+ import { Component, EventEmitter, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
3
+ import { NavigationEnd, Router } from '@angular/router';
4
+ import {
5
+ BsDatepickerConfig,
6
+ BsDatepickerDirective,
7
+ } from 'ngx-bootstrap/datepicker';
8
+ import { NgxMaterialTimepickerComponent } from 'ngx-material-timepicker';
9
+ import { Subscription } from 'rxjs';
10
+ import { ElementTrackerService } from '../../services/element-tracker.service';
11
+ import { ValidationService } from '../../services/validation.service';
12
+
13
+ @Component({
14
+ selector: 'lib-date-time-fields',
15
+ templateUrl: './date-time-fields.component.html',
16
+ styleUrls: ['./date-time-fields.component.scss'],
17
+ providers: [DatePipe],
18
+ encapsulation: ViewEncapsulation.None,
19
+ })
20
+ export class DateTimeFieldsComponent {
21
+ bsConfig: Partial<BsDatepickerConfig> = {
22
+ containerClass: 'theme-custom',
23
+ isAnimated: true,
24
+ adaptivePosition: true,
25
+ showWeekNumbers: false,
26
+ };
27
+
28
+ rangeBsConfig: Partial<BsDatepickerConfig> = {};
29
+
30
+ @Input() question: any = {};
31
+ @Input() inLine: boolean = false;
32
+ @Input() inCard: boolean = false;
33
+ @Input() submissionIndex!: number;
34
+ @Output() answerChange = new EventEmitter<{ answer: any; maxPossibleScore?: number }>();
35
+
36
+ required: boolean = false;
37
+ hint: string = '';
38
+ count: number = 0;
39
+ minTime: string = '';
40
+ maxTime: string = '';
41
+ dateType: string = '';
42
+ format: string = '';
43
+ Dateformat: string = '';
44
+ timeFormat: string = '';
45
+ minDateOption: string = '';
46
+ minDate: Date | undefined;
47
+ maxDateOption: string = '';
48
+ maxDate: Date | undefined;
49
+ todayDate: Date = new Date();
50
+ selectedDate: Date | null = null;
51
+ selectedTime: string = '';
52
+ selectedDateRange: string = '';
53
+ selectedDateAndTime: Date | null = null;
54
+ validationFailed!: boolean;
55
+ timeValidationFailed!: boolean;
56
+ validationMessage: string = '';
57
+ maxTimeOption: string = '';
58
+ minTimeOption: string = '';
59
+ @Input() disableEdit: boolean = false;
60
+ private elementId: string='';
61
+ private timePickerOpened = false;
62
+ private subscriptions: Subscription[] = [];
63
+ private timePickersOpened: { [key: string]: boolean } = {};
64
+
65
+ @ViewChild('datepickerYMD') datepicker!: BsDatepickerDirective;
66
+ @ViewChild('daterangepicker') dateRangePicker!: BsDatepickerDirective;
67
+ @ViewChild('dateAndTimePicker') dateAndTimePicker!: BsDatepickerDirective;
68
+ @ViewChild('fullTime3') fullTime3!: NgxMaterialTimepickerComponent;
69
+ @ViewChild('fullTime4') fullTime4!: NgxMaterialTimepickerComponent;
70
+
71
+
72
+ constructor(
73
+ private datePipe: DatePipe,
74
+ private router: Router,
75
+ private validationService: ValidationService,
76
+ private tracker: ElementTrackerService
77
+ ) { }
78
+
79
+ ngOnInit() {
80
+ this.valueAssigned();
81
+ this.setRangeConfig();
82
+ }
83
+
84
+ private setRangeConfig() {
85
+ this.rangeBsConfig = {
86
+ containerClass: 'theme-custom',
87
+ isAnimated: true,
88
+ adaptivePosition: true,
89
+ showWeekNumbers: false,
90
+ dateInputFormat: this.format,
91
+ rangeInputFormat: this.format,
92
+ displayOneMonthRange: true, // ← only one month if start/end in same month
93
+ };
94
+ }
95
+
96
+ valueAssigned() {
97
+ this.count = this.question.count;
98
+ this.required = this.question.required;
99
+ this.hint = this.question.hint;
100
+ this.dateType = this.question.formElement.appearance.dateType;
101
+ this.minDateOption = this.question.formElement.validation.minDateOption;
102
+ this.Dateformat = this.question.formElement.appearance.format.replace(
103
+ /DD/g,
104
+ 'dd'
105
+ ).replace(/YYYY/g, 'yyyy');
106
+
107
+ this.minDate = this.getMinDate();
108
+
109
+
110
+ this.maxDateOption = this.question.formElement.validation.maxDateOption;
111
+ this.maxDate = this.getMaxDate();
112
+ this.setDateTimeFormat();
113
+ if (this.question?.answer && (this.question?.answer).length > 0)
114
+ this.selectedDate = this.question?.answer;
115
+ this.selectedTime = this.question.answer;
116
+ if (this.question?.answer && (this.question?.answer).length > 0)
117
+ this.selectedDateAndTime = new Date(this.question.answer);
118
+ this.selectedDateRange = this.question.answer;
119
+ this.minTimeOption = this.question.formElement.validation.minTimeOption;
120
+ this.maxTimeOption = this.question.formElement.validation.maxTimeOption;
121
+ if (this.dateType !== 'DATE_AND_TIME') {
122
+ this.minTime = this.getMinTime().toString();
123
+ this.maxTime = this.getMaxTime().toString();
124
+ }
125
+ if (this.dateType === 'DATE_AND_TIME' && this.question?.answer) {
126
+ const dateTimeArray = this.question.answer
127
+ ? this.question.answer.split(',')
128
+ : []; // Fallback to an empty array if `this.question.answer` is undefined
129
+
130
+ if (dateTimeArray.length === 2) {
131
+ const fetchedDate = dateTimeArray[0].trim();
132
+ const fetchedTime = dateTimeArray[1].trim();
133
+ this.selectedDate = fetchedDate;
134
+ this.selectedTime = fetchedTime;
135
+ }
136
+
137
+ const formattedDate = this.datePipe.transform(
138
+ this.selectedDateAndTime,
139
+ this.Dateformat
140
+ );
141
+ const formatteminDate = this.datePipe.transform(
142
+ this.minDate,
143
+ this.Dateformat
144
+ );
145
+ const formattemaxDate = this.datePipe.transform(
146
+ this.maxDate,
147
+ this.Dateformat
148
+ );
149
+
150
+ if (formattedDate === formatteminDate) {
151
+ this.minTime = this.getMinTime().toString();
152
+ if (this.timeFormat === '12') {
153
+ this.maxTime = '12:00 pm';
154
+ } else {
155
+ this.maxTime = '23:59';
156
+ }
157
+ }
158
+ if (formattedDate === formattemaxDate) {
159
+ this.maxTime = this.getMaxTime().toString();
160
+ if (this.timeFormat === '12') {
161
+ this.minTime = '12:00 am';
162
+ } else {
163
+ this.minTime = '00:00';
164
+ }
165
+ }
166
+ if (
167
+ formattedDate !== formatteminDate &&
168
+ formattedDate !== formattemaxDate
169
+ ) {
170
+ if (this.timeFormat === '12') {
171
+ this.minTime = '12:00 am';
172
+ this.maxTime = '12:00 pm';
173
+ } else {
174
+ this.minTime = '00:00';
175
+ this.maxTime = '23:59';
176
+ }
177
+ }
178
+ }
179
+
180
+ if (!this.minTime || this.minTime.length === 0) {
181
+ if (this.timeFormat === '12') {
182
+ this.minTime = '12:00 am';
183
+ } else {
184
+ this.minTime = '00:00';
185
+ }
186
+ }
187
+
188
+ if (!this.maxTime || this.maxTime.length === 0) {
189
+ if (this.timeFormat === '12') {
190
+ this.maxTime = '11:59 pm';
191
+ } else {
192
+ this.maxTime = '23:59';
193
+ }
194
+ }
195
+ }
196
+
197
+ setDateTimeFormat() {
198
+ switch (this.dateType) {
199
+ case 'DATE_ONLY':
200
+ this.format = this.question.formElement.appearance.format;
201
+ break;
202
+ case 'TIME_ONLY':
203
+ this.timeFormat = this.question.formElement.appearance.timeFormat;
204
+ break;
205
+ case 'DATE_AND_TIME':
206
+ this.format = this.question.formElement.appearance.format;
207
+ this.timeFormat = this.question.formElement.appearance.timeFormat;
208
+ break;
209
+ case 'DATE_RANGE':
210
+ this.format = this.question.formElement.appearance.format;
211
+ break;
212
+ case 'MONTH_YEAR':
213
+ this.format = this.question.formElement.appearance.format;
214
+ break
215
+ default:
216
+ this.format = 'DD/MM/YYYY';
217
+ }
218
+ }
219
+
220
+ getMinDate(): Date | undefined {
221
+ if (this.minDateOption === 'CURRENT_DATE') {
222
+ return this.todayDate;
223
+ } else if (this.minDateOption === 'CUSTOM') {
224
+ return new Date(this.question.formElement.validation.minDate);
225
+ }
226
+ else if(this.dateType==='MONTH_YEAR')
227
+ {
228
+ const minDateStr = this.question.formElement.validation.minDate;
229
+ const year = new Date(minDateStr).getFullYear();
230
+ return new Date(year, 0, 1);
231
+
232
+ }
233
+ return undefined; // Return undefined if no valid option
234
+ }
235
+
236
+ getMaxDate(): Date | undefined {
237
+ if (this.maxDateOption === 'CURRENT_DATE') {
238
+ return this.todayDate;
239
+ } else if (this.maxDateOption === 'CUSTOM') {
240
+ return new Date(this.question.formElement.validation.maxDate);
241
+ }
242
+ else if(this.dateType==='MONTH_YEAR')
243
+ {
244
+ const minDateStr = this.question.formElement.validation.maxDate;
245
+ const year = new Date(minDateStr).getFullYear(); // Extracts the year
246
+ return new Date(year, 11, 31);
247
+
248
+ }
249
+ return undefined;
250
+ }
251
+
252
+ getMinTime() {
253
+ if (this.minTimeOption) {
254
+ const format = this.timeFormat === '24' ? 'HH:mm' : 'hh:mm a';
255
+
256
+ if (this.minTimeOption === 'CURRENT_TIME') {
257
+ const now = new Date();
258
+ return this.datePipe.transform(now, format) || '';
259
+ } else if (this.minTimeOption === 'CUSTOM') {
260
+ const customTime = this.question.formElement.validation.minTime;
261
+ const [hours, minutes] = customTime.split(':'); // Split by colon to get hours and minutes
262
+
263
+ // Create a Date object with a fixed date and custom time
264
+ const customDate = new Date();
265
+ customDate.setHours(parseInt(hours, 10), parseInt(minutes, 10), 0, 0); // Set hours and minutes
266
+
267
+ return this.datePipe.transform(customDate, format) || '';
268
+ }
269
+ }
270
+
271
+ // Ensure a default return if no condition is met
272
+ return '';
273
+ }
274
+
275
+ getMaxTime() {
276
+ if (this.maxTimeOption) {
277
+ const format = this.timeFormat === '24' ? 'HH:mm' : 'hh:mm a';
278
+ if (this.maxTimeOption === 'CURRENT_TIME') {
279
+ const now = new Date();
280
+ return this.datePipe.transform(now, format) || '';
281
+ } else if (this.maxTimeOption === 'CUSTOM') {
282
+ const customTime = this.question.formElement.validation.maxTime;
283
+ const [hours, minutes] = customTime.split(':'); // Split by colon to get hours and minutes
284
+
285
+ // Create a Date object with a fixed date and custom time
286
+ const customDate = new Date();
287
+ customDate.setHours(parseInt(hours, 10), parseInt(minutes, 10), 0, 0); // Set hours and minutes
288
+
289
+ return this.datePipe.transform(customDate, format) || '';
290
+ }
291
+ }
292
+
293
+ return '';
294
+ }
295
+
296
+ openDatePicker() {
297
+ this.datepicker.toggle();
298
+ }
299
+
300
+ openDateRangePicker() {
301
+ this.dateRangePicker.toggle();
302
+ }
303
+
304
+ openDateAndTimePicker() {
305
+ this.dateAndTimePicker.toggle();
306
+ }
307
+
308
+ closeDatepicker() {
309
+ if (this.dateAndTimePicker) {
310
+ this.dateAndTimePicker.hide(); // Close the datepicker
311
+ }
312
+ }
313
+
314
+ validateField() {
315
+ if (this.dateType === 'DATE_ONLY' || this.dateType === 'MONTH_YEAR') {
316
+ if (this.selectedDate) {
317
+ this.question.answer = this.formatDate(this.selectedDate.toString());
318
+ } else {
319
+ this.question.answer = '';
320
+ }
321
+
322
+ this.validateDateOnly();
323
+ } else if (this.dateType === 'TIME_ONLY') {
324
+ this.question.answer = String(this.selectedTime);
325
+ this.validateTimeOnly();
326
+ } else if (this.dateType === 'DATE_AND_TIME') {
327
+ if (this.selectedDateAndTime) {
328
+ this.question.answer = this.formatDate(
329
+ this.selectedDateAndTime.toString()
330
+ );
331
+ } else {
332
+ this.question.answer = '';
333
+ }
334
+
335
+ this.validateDateAndTime();
336
+ } else {
337
+ this.question.answer = this.formatDate(this.selectedDateRange);
338
+ this.validateDateRange();
339
+ }
340
+ this.answerChange.emit({answer:this.question.answer,maxPossibleScore:0});
341
+ }
342
+
343
+ formatDate(date: string | Date, type: string = 'dateTime'): string {
344
+ switch (this.dateType) {
345
+ case 'DATE_ONLY':
346
+ return this.datePipe.transform(this.selectedDate, this.Dateformat) || '';
347
+
348
+ case 'MONTH_YEAR':
349
+ const extracted = this.extractMonthYear(this.selectedDate?.toString());
350
+
351
+ if (!extracted) {
352
+ console.error("Invalid date format");
353
+ return '';
354
+ }
355
+
356
+ // Create a Date object with the extracted month and year
357
+ this.selectedDate = new Date(extracted.year, extracted.month - 1, 1); // Month is 0-based in JS
358
+
359
+ // Return formatted date
360
+ return this.datePipe.transform(this.selectedDate, this.Dateformat) || '';
361
+
362
+
363
+ // return this.datePipe.transform(this.selectedDate, this.Dateformat) || '';
364
+ case 'DATE_AND_TIME':
365
+ const formattedDate = this.datePipe.transform(
366
+ this.selectedDateAndTime,
367
+ this.Dateformat
368
+ );
369
+ const formatteminDate = this.datePipe.transform(
370
+ this.minDate,
371
+ this.Dateformat
372
+ );
373
+ const formattemaxDate = this.datePipe.transform(
374
+ this.maxDate,
375
+ this.Dateformat
376
+ );
377
+
378
+ if (formattedDate === formatteminDate) {
379
+ this.minTime = this.getMinTime().toString();
380
+ this.maxTime = this.timeFormat === '12' ? '11:59 pm' : '23:59';
381
+ }
382
+
383
+ if (formattedDate === formattemaxDate) {
384
+ this.maxTime = this.getMaxTime().toString();
385
+ this.minTime = this.timeFormat === '12' ? '12:00 am' : '00:00';
386
+ }
387
+
388
+ if (
389
+ formattedDate !== formatteminDate &&
390
+ formattedDate !== formattemaxDate
391
+ ) {
392
+ this.minTime = this.timeFormat === '12' ? '12:00 am' : '00:00';
393
+ this.maxTime = this.timeFormat === '12' ? '11:59 pm' : '23:59';
394
+ }
395
+
396
+ const formattedTime = this.selectedTime || ''; // Ensure selectedTime is handled properly
397
+ if (formattedDate && formattedTime) {
398
+ return `${formattedDate}, ${formattedTime}`;
399
+ }
400
+ return '';
401
+ case 'DATE_RANGE':
402
+ const dates = date as unknown as Date[];
403
+
404
+ // Ensure dates is defined and is an array
405
+ if (Array.isArray(dates) && dates.length === 2) {
406
+ const start = this.datePipe.transform(dates[0], this.Dateformat);
407
+ const end = this.datePipe.transform(dates[1], this.Dateformat);
408
+ return `${start} - ${end}`;
409
+ }
410
+
411
+ return '';
412
+ default:
413
+ return this.datePipe.transform(date, this.Dateformat) || '';
414
+ }
415
+ }
416
+
417
+ extractMonthYear(dateInput: string | Date | null | undefined): { month: number, year: number } | null {
418
+ if (!dateInput) {
419
+ return null;
420
+ }
421
+
422
+ // Handle string case where date is passed as a stringified Date object
423
+ if (typeof dateInput === "string") {
424
+ const parsedDate = new Date(dateInput);
425
+ if (!isNaN(parsedDate.getTime())) {
426
+ return { month: parsedDate.getMonth() + 1, year: parsedDate.getFullYear() };
427
+ }
428
+
429
+ // Handle string formats like "MM/YYYY" or "YYYY/MM"
430
+ const parts = dateInput.split(/[-/]/); // Split by '-' or '/'
431
+ if (parts.length !== 2) {
432
+ return null; // Invalid format
433
+ }
434
+
435
+ let year = 0, month = 0;
436
+
437
+
438
+ if (parts[0].length === 4) {
439
+ // Format: YYYY/MM or YYYY-MM
440
+ year = parseInt(parts[0], 10);
441
+ month = parseInt(parts[1], 10);
442
+ } else {
443
+ // Format: MM/YYYY or MM-YYYY
444
+ month = parseInt(parts[0], 10);
445
+ year = parseInt(parts[1], 10);
446
+ }
447
+
448
+ return { month, year };
449
+ }
450
+
451
+ // Handle actual Date object case
452
+ if (dateInput instanceof Date && !isNaN(dateInput.getTime())) {
453
+ return { month: dateInput.getMonth() + 1, year: dateInput.getFullYear() };
454
+ }
455
+
456
+ return null; // Invalid input
457
+ }
458
+
459
+
460
+
461
+ validateDateOnly() {
462
+ this.validationFailed = false;
463
+ this.validationMessage = '';
464
+ if (this.required && !this.selectedDate) {
465
+ this.validationFailed = true;
466
+ this.validationService.clearInvalid(this.buildElementId());
467
+ this.validationMessage = 'This is a required question';
468
+ this.question.validation = false;
469
+ this.question.validationMessage = 'This is a required question';
470
+ } else {
471
+ this.validationService.clearInvalid(this.buildElementId());
472
+ this.question.validation = true;
473
+ }
474
+ }
475
+ validateTimeOnly() {
476
+ this.validationFailed = false;
477
+ this.validationMessage = '';
478
+ if (this.required && !this.selectedTime) {
479
+ this.validationService.clearInvalid(this.buildElementId());
480
+ this.validationFailed = true;
481
+ this.validationMessage = 'This is a required question';
482
+ this.question.validation = false;
483
+ this.question.validationMessage = 'This is a required question';
484
+ } else {
485
+ this.validationService.clearInvalid(this.buildElementId());
486
+ this.question.validation = true;
487
+ }
488
+ }
489
+ validateDateRange() {
490
+ this.validationService.clearInvalid(this.buildElementId());
491
+ this.validationFailed = false;
492
+ this.validationMessage = '';
493
+ if (this.required && !this.selectedDateRange) {
494
+ this.validationFailed = true;
495
+ this.validationMessage = 'This is a required question';
496
+ this.question.validation = false;
497
+ this.question.validationMessage = 'This is a required question';
498
+ } else {
499
+ this.question.validation = true;
500
+ }
501
+ }
502
+ validateDateAndTime() {
503
+ this.validationService.clearInvalid(this.buildElementId());
504
+ this.validationFailed = false;
505
+ this.timeValidationFailed = false;
506
+ this.validationMessage = '';
507
+ if (this.required && !this.selectedDateAndTime) {
508
+ this.validationFailed = true;
509
+ this.validationMessage = 'This is a required question';
510
+ this.question.validation = false;
511
+ this.question.validationMessage = 'This is a required question';
512
+ } else if (this.required && !this.selectedTime) {
513
+ this.timeValidationFailed = true;
514
+ this.validationMessage = 'This is a required question';
515
+ this.question.validation = false;
516
+ this.question.validationMessage = 'This is a required question';
517
+ } else {
518
+ this.question.validation = true;
519
+ }
520
+ }
521
+
522
+ convertToISODate(
523
+ dateInput: [number, number, number] | string | null | undefined
524
+ ): Date | null {
525
+ if (!dateInput) {
526
+ return null; // Return null if dateInput is null, undefined, or any falsy value
527
+ }
528
+
529
+ let year, month, day;
530
+
531
+ if (Array.isArray(dateInput)) {
532
+ // Extract year, month, and day from array input
533
+ [year, month, day] = dateInput;
534
+
535
+ // Validate the array format
536
+ if (
537
+ typeof year !== 'number' ||
538
+ typeof month !== 'number' ||
539
+ typeof day !== 'number' ||
540
+ isNaN(year) ||
541
+ isNaN(month) ||
542
+ isNaN(day) ||
543
+ !Number.isInteger(year) ||
544
+ !Number.isInteger(month) ||
545
+ !Number.isInteger(day) ||
546
+ month < 1 ||
547
+ month > 12 ||
548
+ day < 1 ||
549
+ day > 31
550
+ ) {
551
+ return null;
552
+ }
553
+ } else if (typeof dateInput === 'string') {
554
+ // Check if the string matches the YYYY-MM-DD format
555
+ const dateParts = dateInput.split('-');
556
+ if (dateParts.length !== 3) return null;
557
+
558
+ [year, month, day] = dateParts.map(Number);
559
+
560
+ // Validate the parsed parts
561
+ if (
562
+ isNaN(year) ||
563
+ isNaN(month) ||
564
+ isNaN(day) ||
565
+ !Number.isInteger(year) ||
566
+ !Number.isInteger(month) ||
567
+ !Number.isInteger(day) ||
568
+ month < 1 ||
569
+ month > 12 ||
570
+ day < 1 ||
571
+ day > 31
572
+ ) {
573
+ return null;
574
+ }
575
+ } else {
576
+ return null; // Unsupported input type
577
+ }
578
+
579
+ // Create a Date object (month is 0-based, so subtract 1)
580
+ const date = new Date(year, month - 1, day);
581
+
582
+ // Verify if the Date object matches the provided year, month, and day
583
+ if (
584
+ date.getFullYear() !== year ||
585
+ date.getMonth() !== month - 1 ||
586
+ date.getDate() !== day
587
+ ) {
588
+ return null;
589
+ }
590
+
591
+ return date;
592
+ }
593
+
594
+ ngAfterViewInit(): void {
595
+ this.initializeTimePickers();
596
+ if (this.inLine || this.inCard) {
597
+ this.elementId = `question-${this.submissionIndex}-${this.question.id}`;
598
+ } else {
599
+ this.elementId = `question-${this.question.id}`;
600
+ }
601
+
602
+ this.tracker.registerElement(this.elementId);
603
+
604
+ if (this.subscriptions.length === 0) {
605
+ const routerSub = this.router.events.subscribe((event) => {
606
+ if (event instanceof NavigationEnd) {
607
+ this.closeTimepickers();
608
+ }
609
+ });
610
+ this.subscriptions.push(routerSub);
611
+ }
612
+ }
613
+
614
+ ngAfterViewChecked(): void {
615
+ // Ensure time picker subscriptions are attached even after conditional rendering
616
+ this.initializeTimePickers();
617
+ }
618
+
619
+ ngOnDestroy(): void {
620
+ this.closeTimepickers();
621
+ if (this.elementId) {
622
+ this.tracker.unregisterElement(this.elementId);
623
+ }
624
+ // Unsubscribe from all subscriptions
625
+ this.subscriptions.forEach((sub) => {
626
+ if (sub && typeof sub.unsubscribe === 'function') {
627
+ sub.unsubscribe();
628
+ }
629
+ });
630
+ }
631
+
632
+ /**
633
+ * Initialize and track time pickers
634
+ */
635
+ private initializeTimePickers(): void {
636
+ // Track fullTime3 if available
637
+ if (this.fullTime3 && !this.timePickersOpened['fullTime3']) {
638
+ this.trackTimePicker(this.fullTime3, 'fullTime3');
639
+ }
640
+
641
+ // Track fullTime4 if it exists after conditional rendering
642
+ if (this.fullTime4 && !this.timePickersOpened['fullTime4']) {
643
+ this.trackTimePicker(this.fullTime4, 'fullTime4');
644
+ }
645
+ }
646
+
647
+ private trackTimePicker(picker: NgxMaterialTimepickerComponent, pickerName: string): void {
648
+ if (picker) {
649
+ const sub = picker.opened.subscribe(() => {
650
+ this.timePickersOpened[pickerName] = true;
651
+ });
652
+
653
+ this.subscriptions.push(sub);
654
+ }
655
+ }
656
+
657
+ private closeTimepickers(): void {
658
+ if (this.fullTime3 && this.timePickersOpened['fullTime3'] && typeof this.fullTime3.close === 'function') {
659
+ this.fullTime3.close();
660
+ this.timePickersOpened['fullTime3'] = false;
661
+ }
662
+
663
+ // Check for fullTime4 only if it exists
664
+ if (this.fullTime4 && this.timePickersOpened['fullTime4'] && typeof this.fullTime4.close === 'function') {
665
+ this.fullTime4.close();
666
+ this.timePickersOpened['fullTime4'] = false;
667
+ }
668
+ }
669
+
670
+ handleValidation(isValid: boolean, message: string = 'This field is required') {
671
+ if (isValid) {
672
+ this.validationService.clearInvalid(this.buildElementId());
673
+ } else {
674
+ // this.validationService.setInvalid(this.question.id, message);
675
+ }
676
+ }
677
+
678
+ private buildElementId(): string {
679
+ return (this.inLine || this.inCard)
680
+ ? `${this.submissionIndex}-${this.question.id}`
681
+ : `${this.question.id}`;
682
+ }
683
+
684
+ get isInvalid(): boolean {
685
+ return !!this.validationService.getErrorMessage(this.buildElementId());
686
+ }
687
+
688
+ get errorMessage(): string | null {
689
+ return this.validationService.getErrorMessage(this.buildElementId());
690
+ }
691
+
692
+
693
+ }