@hmcts/rpx-xui-common-lib 2.1.0-angular-upgrade-11 → 2.1.0

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 (361) hide show
  1. package/README.md +1 -1
  2. package/esm2022/hmcts-rpx-xui-common-lib.mjs +5 -0
  3. package/esm2022/lib/components/accessibility/accessibility.component.mjs +833 -0
  4. package/esm2022/lib/components/checkbox-list/checkbox-list.component.mjs +232 -0
  5. package/esm2022/lib/components/contact-details/contact-details.component.mjs +123 -0
  6. package/esm2022/lib/components/cookie-banner/cookie-banner.component.mjs +151 -0
  7. package/esm2022/lib/components/due-date/due-date.component.mjs +141 -0
  8. package/esm2022/lib/components/exui-main-wrapper/exui-page-wrapper.component.mjs +80 -0
  9. package/esm2022/lib/components/find-location/find-location.component.mjs +220 -0
  10. package/esm2022/lib/components/find-person/find-person.component.mjs +234 -0
  11. package/esm2022/lib/components/find-service/find-service.component.mjs +193 -0
  12. package/esm2022/lib/components/find-task-name/find-task-name.component.mjs +200 -0
  13. package/esm2022/lib/components/generic-filter/generic-filter-utils.mjs +21 -0
  14. package/esm2022/lib/components/generic-filter/generic-filter.component.mjs +1224 -0
  15. package/esm2022/lib/components/hmcts-session-dialog/hmcts-session-dialog.component.mjs +56 -0
  16. package/esm2022/lib/components/invite-user-form/invite-user-form.component.mjs +51 -0
  17. package/esm2022/lib/components/invite-user-permissions/invite-user-permission.component.mjs +54 -0
  18. package/esm2022/lib/components/loading-spinner/loading-spinner.component.mjs +33 -0
  19. package/esm2022/lib/components/pagination/pagination.component.mjs +92 -0
  20. package/esm2022/lib/components/public_api.mjs +39 -0
  21. package/esm2022/lib/components/search-judicials/search-judicials.component.mjs +185 -0
  22. package/esm2022/lib/components/search-location/search-location.component.mjs +240 -0
  23. package/esm2022/lib/components/search-service/search-service.component.mjs +94 -0
  24. package/esm2022/lib/components/search-venue/search-venue.component.mjs +188 -0
  25. package/esm2022/lib/components/selected-case/selected-case.component.mjs +381 -0
  26. package/esm2022/lib/components/selected-case-confirm/selected-case-confirm.component.mjs +135 -0
  27. package/esm2022/lib/components/selected-case-list/selected-case-list.component.mjs +98 -0
  28. package/esm2022/lib/components/service-message/service-message.component.mjs +62 -0
  29. package/esm2022/lib/components/service-messages/service-messages.component.mjs +165 -0
  30. package/esm2022/lib/components/share-case/share-case.component.mjs +427 -0
  31. package/esm2022/lib/components/share-case-confirm/share-case-confirm.component.mjs +85 -0
  32. package/esm2022/lib/components/tab/tab.component.mjs +40 -0
  33. package/esm2022/lib/components/tc-confirm/tc-confirm.component.mjs +66 -0
  34. package/esm2022/lib/components/terms-and-conditions/tc-display/tc-display-html/tc-display-html.component.mjs +17 -0
  35. package/esm2022/lib/components/terms-and-conditions/tc-display/tc-display-plain/tc-display-plain.component.mjs +17 -0
  36. package/esm2022/lib/components/terms-and-conditions/terms-and-conditions.component.mjs +58 -0
  37. package/esm2022/lib/components/user-details/user-details.component.mjs +276 -0
  38. package/esm2022/lib/components/user-list/user-list.component.mjs +100 -0
  39. package/esm2022/lib/components/user-select/user-select.component.mjs +94 -0
  40. package/esm2022/lib/components/write-address/write-address.component.mjs +342 -0
  41. package/esm2022/lib/components/write-address-inputs/write-address-inputs.component.mjs +165 -0
  42. package/esm2022/lib/directives/feature-toggle/feature-toggle.directive.mjs +41 -0
  43. package/esm2022/lib/directives/let/let.directive.mjs +29 -0
  44. package/esm2022/lib/exui-common-lib.module.mjs +313 -0
  45. package/esm2022/lib/gov-ui/components/gov-uk-checkbox/gov-uk-checkbox.component.mjs +55 -0
  46. package/esm2022/lib/gov-ui/components/gov-uk-checkboxes/gov-uk-checkboxes.component.mjs +137 -0
  47. package/esm2022/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.mjs +127 -0
  48. package/esm2022/lib/gov-ui/components/gov-uk-error-message/gov-uk-error-message.component.mjs +46 -0
  49. package/esm2022/lib/gov-ui/components/gov-uk-fieldset/gov-uk-fieldset.component.mjs +79 -0
  50. package/esm2022/lib/gov-ui/components/gov-uk-file-upload/gov-uk-file-upload.component.mjs +79 -0
  51. package/esm2022/lib/gov-ui/components/gov-uk-form-group-wrapper/gov-uk-form-group-wrapper.component.mjs +45 -0
  52. package/esm2022/lib/gov-ui/components/gov-uk-input/gov-uk-input.component.mjs +71 -0
  53. package/esm2022/lib/gov-ui/components/gov-uk-label/gov-uk-label.component.mjs +84 -0
  54. package/esm2022/lib/gov-ui/components/gov-uk-radio/gov-uk-radio.component.mjs +48 -0
  55. package/esm2022/lib/gov-ui/components/gov-uk-radios/gov-uk-radios.component.mjs +42 -0
  56. package/esm2022/lib/gov-ui/components/gov-uk-select/gov-uk-select.component.mjs +80 -0
  57. package/esm2022/lib/gov-ui/components/gov-uk-table/gov-uk-table.component.mjs +185 -0
  58. package/esm2022/lib/gov-ui/components/gov-uk-textarea/gov-uk-textarea.component.mjs +57 -0
  59. package/esm2022/lib/gov-ui/components/hmcts-banner/hmcts-banner-info.interface.mjs +2 -0
  60. package/esm2022/lib/gov-ui/components/hmcts-banner/hmcts-banner.component.mjs +111 -0
  61. package/esm2022/lib/gov-ui/components/hmcts-error-summary/hmcts-error-summary.component.mjs +140 -0
  62. package/esm2022/lib/gov-ui/components/hmcts-identity-bar/hmcts-identity-bar.component.mjs +34 -0
  63. package/esm2022/lib/gov-ui/components/hmcts-main-wrapper/hmcts-main-wrapper.component.mjs +129 -0
  64. package/esm2022/lib/gov-ui/components/hmcts-pagination/hmcts-pagination.component.mjs +204 -0
  65. package/esm2022/lib/gov-ui/components/hmcts-primary-navigation/hmcts-primary-navigation.component.mjs +60 -0
  66. package/esm2022/lib/gov-ui/components/hmcts-sub-navigation/hmcts-sub-navigation.component.mjs +58 -0
  67. package/esm2022/lib/gov-ui/directives/remove-host.directive.mjs +30 -0
  68. package/esm2022/lib/gov-ui/gov-ui.service.mjs +14 -0
  69. package/esm2022/lib/gov-ui/models/checkboxes-model.mjs +2 -0
  70. package/{esm2015/lib/gov-ui/models/gov-ui-config-model.js → esm2022/lib/gov-ui/models/gov-ui-config-model.mjs} +1 -1
  71. package/{esm2015/lib/gov-ui/models/public_api.js → esm2022/lib/gov-ui/models/public_api.mjs} +1 -2
  72. package/esm2022/lib/gov-ui/models/radio-buttons.model.mjs +2 -0
  73. package/esm2022/lib/gov-ui/util/helpers/html-templates.helper.mjs +22 -0
  74. package/{esm2015/lib/gov-ui/validators/checkboxes-be-checked.validator.js → esm2022/lib/gov-ui/validators/checkboxes-be-checked.validator.mjs} +1 -1
  75. package/{esm2015/lib/gov-ui/validators/date.validator.js → esm2022/lib/gov-ui/validators/date.validator.mjs} +1 -1
  76. package/esm2022/lib/gov-ui/validators/radio-group.validator.mjs +15 -0
  77. package/esm2022/lib/models/address-message.enum.mjs +11 -0
  78. package/esm2022/lib/models/address-option.model.mjs +21 -0
  79. package/esm2022/lib/models/address.model.mjs +4 -0
  80. package/esm2022/lib/models/case-share.model.mjs +7 -0
  81. package/{esm2015/lib/models/contact-details.model.js → esm2022/lib/models/contact-details.model.mjs} +1 -1
  82. package/esm2022/lib/models/feature-user.mjs +5 -0
  83. package/esm2022/lib/models/filter.model.mjs +3 -0
  84. package/esm2022/lib/models/index.mjs +19 -0
  85. package/esm2022/lib/models/location.model.mjs +7 -0
  86. package/esm2022/lib/models/person.model.mjs +19 -0
  87. package/{esm2015/lib/models/public_api.js → esm2022/lib/models/public_api.mjs} +2 -1
  88. package/{esm2015/lib/models/search-options.model.js → esm2022/lib/models/search-options.model.mjs} +1 -1
  89. package/esm2022/lib/models/service-message.model.mjs +2 -0
  90. package/esm2022/lib/models/task-name.model.mjs +2 -0
  91. package/esm2022/lib/models/user-access-type.model.mjs +2 -0
  92. package/esm2022/lib/models/user-details.model.mjs +2 -0
  93. package/esm2022/lib/pipes/capitalize/capitalize.pipe.mjs +15 -0
  94. package/esm2022/lib/pipes/index.mjs +2 -0
  95. package/esm2022/lib/services/address/address-parser.mjs +76 -0
  96. package/esm2022/lib/services/address/address-type.enum.mjs +7 -0
  97. package/esm2022/lib/services/address/address.service.mjs +55 -0
  98. package/esm2022/lib/services/case-sharing-state/case-sharing-state.service.mjs +170 -0
  99. package/esm2022/lib/services/cookie/cookie.service.mjs +48 -0
  100. package/esm2022/lib/services/feature-toggle/feature-toggle.guard.mjs +37 -0
  101. package/esm2022/lib/services/feature-toggle/feature-toggle.service.mjs +33 -0
  102. package/esm2022/lib/services/feature-toggle/launch-darkly.service.mjs +65 -0
  103. package/esm2022/lib/services/filter/filter.service.mjs +95 -0
  104. package/esm2022/lib/services/find-person/find-person.service.mjs +92 -0
  105. package/esm2022/lib/services/google-analytics/google-analytics.service.mjs +73 -0
  106. package/esm2022/lib/services/google-tag-manager/google-tag-manager.service.mjs +86 -0
  107. package/{esm2015/lib/services/loading/loading.service.js → esm2022/lib/services/loading/loading.service.mjs} +8 -6
  108. package/esm2022/lib/services/locations/location.service.mjs +38 -0
  109. package/{esm2015/lib/services/manage-session/manage-session.services.js → esm2022/lib/services/manage-session/manage-session.services.mjs} +8 -10
  110. package/esm2022/lib/services/public-api.mjs +18 -0
  111. package/esm2022/lib/services/ref-data/index.mjs +4 -0
  112. package/esm2022/lib/services/ref-data/models/ref-data-htmcs-service.model.mjs +2 -0
  113. package/esm2022/lib/services/ref-data/models/ref-data-region.model.mjs +2 -0
  114. package/esm2022/lib/services/ref-data/ref-data-data-access/models/ref-data-locations-by-service-code-response.model.mjs +2 -0
  115. package/esm2022/lib/services/ref-data/ref-data-data-access/ref-data-data-access.service.mjs +33 -0
  116. package/esm2022/lib/services/ref-data/ref-data.service.mjs +34 -0
  117. package/esm2022/lib/services/role-guard/role.guard.mjs +43 -0
  118. package/esm2022/lib/services/role-guard/role.service.mjs +22 -0
  119. package/esm2022/lib/services/storage/session-storage/session-storage.service.mjs +43 -0
  120. package/esm2022/lib/services/task-name/task-name.service.mjs +35 -0
  121. package/esm2022/lib/services/timeout-notifications/timeout-notifications.service.mjs +103 -0
  122. package/{esm2015/public-api.js → esm2022/public-api.mjs} +2 -1
  123. package/fesm2022/hmcts-rpx-xui-common-lib.mjs +10378 -0
  124. package/fesm2022/hmcts-rpx-xui-common-lib.mjs.map +1 -0
  125. package/index.d.ts +5 -0
  126. package/lib/components/accessibility/accessibility.component.d.ts +7 -1
  127. package/lib/components/checkbox-list/checkbox-list.component.d.ts +8 -2
  128. package/lib/components/contact-details/contact-details.component.d.ts +3 -0
  129. package/lib/components/cookie-banner/cookie-banner.component.d.ts +5 -1
  130. package/lib/components/due-date/due-date.component.d.ts +8 -2
  131. package/lib/components/exui-main-wrapper/exui-page-wrapper.component.d.ts +3 -0
  132. package/lib/components/find-location/find-location.component.d.ts +13 -6
  133. package/lib/components/find-person/find-person.component.d.ts +5 -2
  134. package/lib/components/find-service/find-service.component.d.ts +29 -0
  135. package/lib/components/find-task-name/find-task-name.component.d.ts +44 -0
  136. package/lib/components/generic-filter/generic-filter-utils.d.ts +2 -5
  137. package/lib/components/generic-filter/generic-filter.component.d.ts +25 -6
  138. package/lib/components/hmcts-session-dialog/hmcts-session-dialog.component.d.ts +3 -0
  139. package/lib/components/invite-user-form/invite-user-form.component.d.ts +3 -0
  140. package/lib/components/invite-user-permissions/invite-user-permission.component.d.ts +3 -0
  141. package/lib/components/loading-spinner/loading-spinner.component.d.ts +8 -1
  142. package/lib/components/pagination/pagination.component.d.ts +3 -0
  143. package/lib/components/public_api.d.ts +6 -0
  144. package/lib/components/search-judicials/search-judicials.component.d.ts +3 -0
  145. package/lib/components/search-location/search-location.component.d.ts +26 -18
  146. package/lib/components/search-service/search-service.component.d.ts +20 -0
  147. package/lib/components/search-venue/search-venue.component.d.ts +3 -1
  148. package/lib/components/selected-case/selected-case.component.d.ts +4 -1
  149. package/lib/components/selected-case-confirm/selected-case-confirm.component.d.ts +3 -0
  150. package/lib/components/selected-case-list/selected-case-list.component.d.ts +4 -0
  151. package/lib/components/service-message/service-message.component.d.ts +9 -4
  152. package/lib/components/service-messages/service-messages.component.d.ts +15 -5
  153. package/lib/components/share-case/share-case.component.d.ts +41 -2
  154. package/lib/components/share-case-confirm/share-case-confirm.component.d.ts +3 -0
  155. package/lib/components/tab/tab.component.d.ts +3 -0
  156. package/lib/components/tc-confirm/tc-confirm.component.d.ts +3 -0
  157. package/lib/components/terms-and-conditions/tc-display/tc-display-html/tc-display-html.component.d.ts +3 -0
  158. package/lib/components/terms-and-conditions/tc-display/tc-display-plain/tc-display-plain.component.d.ts +3 -0
  159. package/lib/components/terms-and-conditions/terms-and-conditions.component.d.ts +3 -0
  160. package/lib/components/user-details/user-details.component.d.ts +4 -0
  161. package/lib/components/user-list/user-list.component.d.ts +3 -0
  162. package/lib/components/user-select/user-select.component.d.ts +5 -3
  163. package/lib/components/write-address/write-address.component.d.ts +45 -0
  164. package/lib/components/write-address-inputs/write-address-inputs.component.d.ts +16 -0
  165. package/lib/directives/feature-toggle/feature-toggle.directive.d.ts +3 -0
  166. package/lib/directives/let/let.directive.d.ts +3 -0
  167. package/lib/exui-common-lib.module.d.ts +83 -4
  168. package/lib/gov-ui/components/gov-uk-checkbox/gov-uk-checkbox.component.d.ts +3 -0
  169. package/lib/gov-ui/components/gov-uk-checkboxes/gov-uk-checkboxes.component.d.ts +17 -5
  170. package/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.d.ts +3 -0
  171. package/lib/gov-ui/components/gov-uk-error-message/gov-uk-error-message.component.d.ts +3 -0
  172. package/lib/gov-ui/components/gov-uk-fieldset/gov-uk-fieldset.component.d.ts +3 -0
  173. package/lib/gov-ui/components/gov-uk-file-upload/gov-uk-file-upload.component.d.ts +3 -0
  174. package/lib/gov-ui/components/gov-uk-form-group-wrapper/gov-uk-form-group-wrapper.component.d.ts +3 -0
  175. package/lib/gov-ui/components/gov-uk-input/gov-uk-input.component.d.ts +4 -2
  176. package/lib/gov-ui/components/gov-uk-label/gov-uk-label.component.d.ts +4 -0
  177. package/lib/gov-ui/components/gov-uk-radio/gov-uk-radio.component.d.ts +3 -0
  178. package/lib/gov-ui/components/gov-uk-radios/gov-uk-radios.component.d.ts +5 -2
  179. package/lib/gov-ui/components/gov-uk-select/gov-uk-select.component.d.ts +3 -0
  180. package/lib/gov-ui/components/gov-uk-table/gov-uk-table.component.d.ts +3 -0
  181. package/lib/gov-ui/components/gov-uk-textarea/gov-uk-textarea.component.d.ts +3 -0
  182. package/lib/gov-ui/components/hmcts-banner/hmcts-banner-info.interface.d.ts +7 -0
  183. package/lib/gov-ui/components/hmcts-banner/hmcts-banner.component.d.ts +7 -2
  184. package/lib/gov-ui/components/hmcts-error-summary/hmcts-error-summary.component.d.ts +3 -0
  185. package/lib/gov-ui/components/hmcts-identity-bar/hmcts-identity-bar.component.d.ts +3 -0
  186. package/lib/gov-ui/components/hmcts-main-wrapper/hmcts-main-wrapper.component.d.ts +6 -3
  187. package/lib/gov-ui/components/hmcts-pagination/hmcts-pagination.component.d.ts +3 -0
  188. package/lib/gov-ui/components/hmcts-primary-navigation/hmcts-primary-navigation.component.d.ts +3 -0
  189. package/lib/gov-ui/components/hmcts-sub-navigation/hmcts-sub-navigation.component.d.ts +3 -0
  190. package/lib/gov-ui/directives/remove-host.directive.d.ts +3 -0
  191. package/lib/gov-ui/gov-ui.service.d.ts +3 -0
  192. package/lib/gov-ui/models/checkboxes-model.d.ts +4 -7
  193. package/lib/gov-ui/models/gov-ui-config-model.d.ts +2 -0
  194. package/lib/gov-ui/models/public_api.d.ts +0 -1
  195. package/lib/gov-ui/models/radio-buttons.model.d.ts +9 -0
  196. package/lib/models/address-message.enum.d.ts +9 -0
  197. package/lib/models/address-option.model.d.ts +9 -0
  198. package/lib/models/address.model.d.ts +9 -0
  199. package/lib/models/case-share.model.d.ts +5 -0
  200. package/lib/models/contact-details.model.d.ts +4 -0
  201. package/lib/models/feature-user.d.ts +4 -6
  202. package/lib/models/filter.model.d.ts +45 -9
  203. package/lib/models/index.d.ts +5 -0
  204. package/lib/models/location.model.d.ts +22 -11
  205. package/lib/models/person.model.d.ts +3 -0
  206. package/lib/models/public_api.d.ts +1 -0
  207. package/lib/models/search-options.model.d.ts +1 -1
  208. package/lib/models/service-message.model.d.ts +8 -0
  209. package/lib/models/task-name.model.d.ts +4 -0
  210. package/lib/models/user-access-type.model.d.ts +6 -0
  211. package/lib/models/user-details.model.d.ts +2 -0
  212. package/lib/pipes/capitalize/capitalize.pipe.d.ts +7 -0
  213. package/lib/pipes/index.d.ts +1 -0
  214. package/lib/services/address/address-parser.d.ts +17 -0
  215. package/lib/services/address/address-type.enum.d.ts +5 -0
  216. package/lib/services/address/address.service.d.ts +15 -0
  217. package/lib/services/case-sharing-state/case-sharing-state.service.d.ts +4 -1
  218. package/lib/services/cookie/cookie.service.d.ts +3 -0
  219. package/lib/services/feature-toggle/feature-toggle.guard.d.ts +8 -2
  220. package/lib/services/feature-toggle/feature-toggle.service.d.ts +4 -0
  221. package/lib/services/feature-toggle/launch-darkly.service.d.ts +14 -10
  222. package/lib/services/filter/filter.service.d.ts +6 -0
  223. package/lib/services/find-person/find-person.service.d.ts +5 -2
  224. package/lib/services/google-analytics/google-analytics.service.d.ts +4 -1
  225. package/lib/services/google-tag-manager/google-tag-manager.service.d.ts +5 -1
  226. package/lib/services/loading/loading.service.d.ts +3 -0
  227. package/lib/services/locations/location.service.d.ts +5 -2
  228. package/lib/services/manage-session/manage-session.services.d.ts +3 -0
  229. package/lib/services/public-api.d.ts +2 -0
  230. package/lib/services/ref-data/index.d.ts +3 -0
  231. package/lib/services/ref-data/models/ref-data-htmcs-service.model.d.ts +13 -0
  232. package/lib/services/ref-data/models/ref-data-region.model.d.ts +4 -0
  233. package/lib/services/ref-data/ref-data-data-access/models/ref-data-locations-by-service-code-response.model.d.ts +8 -0
  234. package/lib/services/ref-data/ref-data-data-access/ref-data-data-access.service.d.ts +18 -0
  235. package/lib/services/ref-data/ref-data.service.d.ts +17 -0
  236. package/lib/services/role-guard/role.guard.d.ts +7 -3
  237. package/lib/services/role-guard/role.service.d.ts +8 -4
  238. package/lib/services/{session-storage → storage/session-storage}/session-storage.service.d.ts +3 -0
  239. package/lib/services/task-name/task-name.service.d.ts +17 -0
  240. package/lib/services/timeout-notifications/timeout-notifications.service.d.ts +8 -2
  241. package/package.json +21 -11
  242. package/public-api.d.ts +1 -0
  243. package/bundles/hmcts-rpx-xui-common-lib.umd.js +0 -4893
  244. package/bundles/hmcts-rpx-xui-common-lib.umd.js.map +0 -1
  245. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js +0 -2
  246. package/bundles/hmcts-rpx-xui-common-lib.umd.min.js.map +0 -1
  247. package/esm2015/hmcts-rpx-xui-common-lib.js +0 -68
  248. package/esm2015/lib/components/accessibility/accessibility.component.js +0 -14
  249. package/esm2015/lib/components/checkbox-list/checkbox-list.component.js +0 -177
  250. package/esm2015/lib/components/contact-details/contact-details.component.js +0 -17
  251. package/esm2015/lib/components/cookie-banner/cookie-banner.component.js +0 -68
  252. package/esm2015/lib/components/due-date/due-date.component.js +0 -115
  253. package/esm2015/lib/components/exui-main-wrapper/exui-page-wrapper.component.js +0 -28
  254. package/esm2015/lib/components/find-location/find-location.component.js +0 -120
  255. package/esm2015/lib/components/find-person/find-person.component.js +0 -118
  256. package/esm2015/lib/components/generic-filter/generic-filter-utils.js +0 -21
  257. package/esm2015/lib/components/generic-filter/generic-filter.component.js +0 -381
  258. package/esm2015/lib/components/hmcts-session-dialog/hmcts-session-dialog.component.js +0 -27
  259. package/esm2015/lib/components/invite-user-form/invite-user-form.component.js +0 -25
  260. package/esm2015/lib/components/invite-user-permissions/invite-user-permission.component.js +0 -25
  261. package/esm2015/lib/components/loading-spinner/loading-spinner.component.js +0 -18
  262. package/esm2015/lib/components/pagination/pagination.component.js +0 -28
  263. package/esm2015/lib/components/public_api.js +0 -33
  264. package/esm2015/lib/components/search-judicials/search-judicials.component.js +0 -126
  265. package/esm2015/lib/components/search-location/search-location.component.js +0 -114
  266. package/esm2015/lib/components/search-venue/search-venue.component.js +0 -123
  267. package/esm2015/lib/components/selected-case/selected-case.component.js +0 -160
  268. package/esm2015/lib/components/selected-case-confirm/selected-case-confirm.component.js +0 -36
  269. package/esm2015/lib/components/selected-case-list/selected-case-list.component.js +0 -45
  270. package/esm2015/lib/components/service-message/service-message.component.js +0 -22
  271. package/esm2015/lib/components/service-messages/service-messages.component.js +0 -48
  272. package/esm2015/lib/components/share-case/share-case.component.js +0 -91
  273. package/esm2015/lib/components/share-case-confirm/share-case-confirm.component.js +0 -34
  274. package/esm2015/lib/components/tab/tab.component.js +0 -21
  275. package/esm2015/lib/components/tc-confirm/tc-confirm.component.js +0 -22
  276. package/esm2015/lib/components/terms-and-conditions/tc-display/tc-display-html/tc-display-html.component.js +0 -13
  277. package/esm2015/lib/components/terms-and-conditions/tc-display/tc-display-plain/tc-display-plain.component.js +0 -13
  278. package/esm2015/lib/components/terms-and-conditions/terms-and-conditions.component.js +0 -16
  279. package/esm2015/lib/components/user-details/user-details.component.js +0 -41
  280. package/esm2015/lib/components/user-list/user-list.component.js +0 -33
  281. package/esm2015/lib/components/user-select/user-select.component.js +0 -58
  282. package/esm2015/lib/directives/feature-toggle/feature-toggle.directive.js +0 -42
  283. package/esm2015/lib/directives/let/let.directive.js +0 -30
  284. package/esm2015/lib/exui-common-lib.module.js +0 -156
  285. package/esm2015/lib/gov-ui/components/gov-uk-checkbox/gov-uk-checkbox.component.js +0 -31
  286. package/esm2015/lib/gov-ui/components/gov-uk-checkboxes/gov-uk-checkboxes.component.js +0 -21
  287. package/esm2015/lib/gov-ui/components/gov-uk-date/gov-uk-date.component.js +0 -64
  288. package/esm2015/lib/gov-ui/components/gov-uk-error-message/gov-uk-error-message.component.js +0 -22
  289. package/esm2015/lib/gov-ui/components/gov-uk-fieldset/gov-uk-fieldset.component.js +0 -28
  290. package/esm2015/lib/gov-ui/components/gov-uk-file-upload/gov-uk-file-upload.component.js +0 -35
  291. package/esm2015/lib/gov-ui/components/gov-uk-form-group-wrapper/gov-uk-form-group-wrapper.component.js +0 -23
  292. package/esm2015/lib/gov-ui/components/gov-uk-input/gov-uk-input.component.js +0 -34
  293. package/esm2015/lib/gov-ui/components/gov-uk-label/gov-uk-label.component.js +0 -21
  294. package/esm2015/lib/gov-ui/components/gov-uk-radio/gov-uk-radio.component.js +0 -33
  295. package/esm2015/lib/gov-ui/components/gov-uk-radios/gov-uk-radios.component.js +0 -21
  296. package/esm2015/lib/gov-ui/components/gov-uk-select/gov-uk-select.component.js +0 -27
  297. package/esm2015/lib/gov-ui/components/gov-uk-table/gov-uk-table.component.js +0 -39
  298. package/esm2015/lib/gov-ui/components/gov-uk-textarea/gov-uk-textarea.component.js +0 -27
  299. package/esm2015/lib/gov-ui/components/hmcts-banner/hmcts-banner.component.js +0 -23
  300. package/esm2015/lib/gov-ui/components/hmcts-error-summary/hmcts-error-summary.component.js +0 -48
  301. package/esm2015/lib/gov-ui/components/hmcts-identity-bar/hmcts-identity-bar.component.js +0 -19
  302. package/esm2015/lib/gov-ui/components/hmcts-main-wrapper/hmcts-main-wrapper.component.js +0 -41
  303. package/esm2015/lib/gov-ui/components/hmcts-pagination/hmcts-pagination.component.js +0 -28
  304. package/esm2015/lib/gov-ui/components/hmcts-primary-navigation/hmcts-primary-navigation.component.js +0 -23
  305. package/esm2015/lib/gov-ui/components/hmcts-sub-navigation/hmcts-sub-navigation.component.js +0 -15
  306. package/esm2015/lib/gov-ui/directives/remove-host.directive.js +0 -29
  307. package/esm2015/lib/gov-ui/gov-ui.service.js +0 -13
  308. package/esm2015/lib/gov-ui/models/banner-data-model.js +0 -2
  309. package/esm2015/lib/gov-ui/models/checkboxes-model.js +0 -2
  310. package/esm2015/lib/gov-ui/models/isession-storage.interface.js +0 -2
  311. package/esm2015/lib/gov-ui/util/helpers/html-templates.helper.js +0 -22
  312. package/esm2015/lib/gov-ui/util/session-storage/session-storage-utils.js +0 -22
  313. package/esm2015/lib/gov-ui/validators/radio-group.validator.js +0 -15
  314. package/esm2015/lib/models/case-share.model.js +0 -2
  315. package/esm2015/lib/models/feature-user.js +0 -5
  316. package/esm2015/lib/models/filter.model.js +0 -3
  317. package/esm2015/lib/models/index.js +0 -14
  318. package/esm2015/lib/models/location.model.js +0 -2
  319. package/esm2015/lib/models/person.model.js +0 -17
  320. package/esm2015/lib/models/user-details.model.js +0 -2
  321. package/esm2015/lib/services/case-sharing-state/case-sharing-state.service.js +0 -143
  322. package/esm2015/lib/services/cookie/cookie.service.js +0 -47
  323. package/esm2015/lib/services/feature-toggle/feature-toggle.guard.js +0 -35
  324. package/esm2015/lib/services/feature-toggle/feature-toggle.service.js +0 -27
  325. package/esm2015/lib/services/feature-toggle/launch-darkly.service.js +0 -59
  326. package/esm2015/lib/services/filter/filter.service.js +0 -64
  327. package/esm2015/lib/services/find-person/find-person.service.js +0 -106
  328. package/esm2015/lib/services/google-analytics/google-analytics.service.js +0 -68
  329. package/esm2015/lib/services/google-tag-manager/google-tag-manager.service.js +0 -71
  330. package/esm2015/lib/services/locations/location.service.js +0 -39
  331. package/esm2015/lib/services/public-api.js +0 -16
  332. package/esm2015/lib/services/role-guard/role.guard.js +0 -37
  333. package/esm2015/lib/services/role-guard/role.service.js +0 -20
  334. package/esm2015/lib/services/session-storage/session-storage.service.js +0 -41
  335. package/esm2015/lib/services/timeout-notifications/timeout-notifications.service.js +0 -92
  336. package/fesm2015/hmcts-rpx-xui-common-lib.js +0 -3942
  337. package/fesm2015/hmcts-rpx-xui-common-lib.js.map +0 -1
  338. package/hmcts-rpx-xui-common-lib.d.ts +0 -67
  339. package/hmcts-rpx-xui-common-lib.metadata.json +0 -1
  340. package/lib/gov-ui/models/banner-data-model.d.ts +0 -4
  341. package/lib/gov-ui/models/isession-storage.interface.d.ts +0 -4
  342. package/lib/gov-ui/util/session-storage/session-storage-utils.d.ts +0 -6
  343. /package/{esm2015/lib/components/index.js → esm2022/lib/components/index.mjs} +0 -0
  344. /package/{esm2015/lib/directives/index.js → esm2022/lib/directives/index.mjs} +0 -0
  345. /package/{esm2015/lib/directives/public-api.js → esm2022/lib/directives/public-api.mjs} +0 -0
  346. /package/{esm2015/lib/gov-ui/components/index.js → esm2022/lib/gov-ui/components/index.mjs} +0 -0
  347. /package/{esm2015/lib/gov-ui/components/public_api.js → esm2022/lib/gov-ui/components/public_api.mjs} +0 -0
  348. /package/{esm2015/lib/gov-ui/index.js → esm2022/lib/gov-ui/index.mjs} +0 -0
  349. /package/{esm2015/lib/gov-ui/models/error-messages-model.js → esm2022/lib/gov-ui/models/error-messages-model.mjs} +0 -0
  350. /package/{esm2015/lib/gov-ui/models/index.js → esm2022/lib/gov-ui/models/index.mjs} +0 -0
  351. /package/{esm2015/lib/gov-ui/public_api.js → esm2022/lib/gov-ui/public_api.mjs} +0 -0
  352. /package/{esm2015/lib/gov-ui/validators/index.js → esm2022/lib/gov-ui/validators/index.mjs} +0 -0
  353. /package/{esm2015/lib/gov-ui/validators/public_api.js → esm2022/lib/gov-ui/validators/public_api.mjs} +0 -0
  354. /package/{esm2015/lib/models/due-date.model.js → esm2022/lib/models/due-date.model.mjs} +0 -0
  355. /package/{esm2015/lib/models/idle-config.model.js → esm2022/lib/models/idle-config.model.mjs} +0 -0
  356. /package/{esm2015/lib/models/pagination.model.js → esm2022/lib/models/pagination.model.mjs} +0 -0
  357. /package/{esm2015/lib/models/tcDocument.model.js → esm2022/lib/models/tcDocument.model.mjs} +0 -0
  358. /package/{esm2015/lib/models/timeout-notification.model.js → esm2022/lib/models/timeout-notification.model.mjs} +0 -0
  359. /package/{esm2015/lib/models/user.model.js → esm2022/lib/models/user.model.mjs} +0 -0
  360. /package/{esm2015/lib/services/index.js → esm2022/lib/services/index.mjs} +0 -0
  361. /package/{esm2015/lib/window.js → esm2022/lib/window.mjs} +0 -0
@@ -1,3942 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, EventEmitter, ViewEncapsulation, Input, Output, Injectable, ChangeDetectionStrategy, ViewChild, Inject, InjectionToken, ChangeDetectorRef, ElementRef, Directive, ViewContainerRef, TemplateRef, NgModule } from '@angular/core';
3
- import * as i4 from '@angular/common';
4
- import { formatDate, DOCUMENT, CommonModule } from '@angular/common';
5
- import { Validators, FormArray, FormGroup, FormControl, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
- import { BehaviorSubject, Subject, of, zip, combineLatest } from 'rxjs';
7
- import { distinctUntilChanged, map, tap, filter, debounceTime, mergeMap, switchMap, catchError, delay } from 'rxjs/operators';
8
- import * as i1 from '@angular/common/http';
9
- import { HttpClient } from '@angular/common/http';
10
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
11
- import { MatInputModule } from '@angular/material/input';
12
- import { MatTabsModule } from '@angular/material/tabs';
13
- import * as i1$1 from '@angular/router';
14
- import { RouterModule, Router, NavigationEnd } from '@angular/router';
15
- import { NgxPaginationModule, PaginatePipe } from 'ngx-pagination';
16
- import * as LDClient from 'launchdarkly-js-client-sdk';
17
- import * as i2 from '@angular/platform-browser';
18
- import { Title } from '@angular/platform-browser';
19
- import * as i1$2 from '@ng-idle/core';
20
- import { DocumentInterruptSource, Idle } from '@ng-idle/core';
21
- import * as i2$1 from '@ng-idle/keepalive';
22
- import { Keepalive } from '@ng-idle/keepalive';
23
-
24
- class AccessibilityComponent {
25
- constructor() {
26
- }
27
- }
28
- AccessibilityComponent.decorators = [
29
- { type: Component, args: [{
30
- selector: 'xuilib-accessibility',
31
- template: "<h1 class=\"govuk-heading-xl\" id=\"Accessibility-statement-for-Expert-UI\">Accessibility statement for Expert UI</h1>\n\n<ul class=\"govuk-list\">\n <li><a href=\"accessibility#immigration\">Immigration and Asylum</a></li>\n <li><a href=\"accessibility#family\">Family Public Law </a></li>\n</ul>\n\n<p class=\"govuk-body\">This website is run by HM Courts & Tribunals Service. We want as many people as possible to be\n able to use this website. For example, you should be able to:</p>\n\n<ul class=\"govuk-list govuk-list--bullet\">\n <li>change colours, contrast levels and fonts</li>\n <li>zoom in up to 300% without the text spilling off the screen</li>\n <li>navigate most of the website using just a keyboard</li>\n <li>navigate most of the website using speech recognition software</li>\n <li>listen to most of the website using a screen reader (including the most recent versions of JAWS, NVDA and\n VoiceOver)\n </li>\n</ul>\n\n<p class=\"govuk-body\">We\u2019ve also made the website text as simple as possible to understand.</p>\n\n<p class=\"govuk-body\"><a rel=\"noopener noreferrer\" target=\"_blank\" href=\"https://mcmw.abilitynet.org.uk/\">AbilityNet</a>\n has advice on making your device easier to use if you have a disability.</p>\n\n<h2 class=\"govuk-heading-l\" id=\"How-accessible-this-website-is\">How accessible this website is</h2>\n\n<p class=\"govuk-body\">We know some parts of the website are not fully accessible:</p>\n\n<ul class=\"govuk-list govuk-list--bullet\">\n <li>some pages are difficult to navigate using just a keyboard</li>\n <li>some pages can\u2019t be listened to in full using a screen reader</li>\n <li>some pages have problems with colour contrasts between text and background</li>\n <li>some PDFs may not be fully accessible to a screen reader</li>\n</ul>\n\n<h2 class=\"govuk-heading-l\" id=\"What-to-do-if-you-cannot-access-parts-of-this-website\">Feedback and contact\n information</h2>\n\n<p class=\"govuk-body\">If you need information on this website in a different format like accessible PDF, large print,\n easy read, audio recording or braille, you can:</p>\n\n<ul class=\"govuk-list govuk-list--bullet\">\n <li>email: <a href=\"mailto:HMCTSforms@justice.gov.uk\"> HMCTSforms@justice.gov.uk</a></li>\n <li>call: +44 (0) 300 123 1711</li>\n <li>contact your service representative</li>\n</ul>\n\n<p class=\"govuk-body\">We\u2019ll consider your request and get back to you in 10 working days.</p>\n\n<h2 class=\"govuk-heading-l\" id=\"Reporting-accessibility-problems-with-this-website\">Reporting accessibility problems\n with this website</h2>\n\n<p class=\"govuk-body\">We\u2019re always looking to improve the accessibility of this website. If you find any problems not\n listed on this page or think we\u2019re not meeting accessibility requirements, contact:</p>\n\n<ul class=\"govuk-list govuk-list--bullet\">\n <li>email: <a href=\"mailto:customer.service@justice.gov.uk\"> customer.service@justice.gov.uk</a></li>\n <li>telephone: +44 (0) 300 123 1711</li>\n</ul>\n\n<h2 class=\"govuk-heading-l\" id=\"Enforcement-procedure \">Enforcement procedure</h2>\n\n<p class=\"govuk-body\">The Equality and Human Rights Commission (EHRC) is responsible for enforcing the Public Sector\n Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018 (the \u2018accessibility\n regulations\u2019). </p>\n\n<p class=\"govuk-body\">If you\u2019re not happy with how we respond to your complaint, <a rel=\"noopener noreferrer\"\n target=\"_blank\"\n href=\"https://www.equalityadvisoryservice.com/\">contact\n the Equality Advisory and Support Service (EASS).</a></p>\n\n<h1 class=\"govuk-heading-l\" id=\"Contacting-us-by-phone-or-visiting-us-in-person\">Contacting us by phone or visiting us\n in person</h1>\n\n<p class=\"govuk-body\">We provide a text relay service for people who are D/deaf, hearing impaired or have a speech\n impediment.</p>\n\n<p class=\"govuk-body\">Our offices and tribunal venues have audio induction loops, or if you contact us before your visit\n we can arrange a British Sign Language (BSL) interpreter. You can also request step-free access or a foreign language\n interpreter.</p>\n\n<p class=\"govuk-body\">If you have a question about accessibility in our Tribunal venues, you can contact the First-tier\n Tribunal enquiry line: +44 (0) 300 123 1711. You can <a target=\"_blank\"\n href=\"https://courttribunalfinder.service.gov.uk/search/\">find\n the contact details for court and tribunal venues</a>. </p>\n\n<p class=\"govuk-body\">You can also contact your service representative for more information.</p>\n\n<h1 class=\"govuk-heading-l\" id=\"Technical-information-about-this-website\u2019s-accessibility\">Technical information about\n this website\u2019s accessibility</h1>\n\n<p class=\"govuk-body\">HMCTS is committed to making its website accessible, in accordance with the Public Sector Bodies\n (Websites and Mobile Applications) (No.2) Accessibility Regulations 2018.</p>\n\n<p class=\"govuk-body\">This website is partially compliant with the <a rel=\"noopener noreferrer\" target=\"_blank\"\n href=\"https://www.w3.org/TR/WCAG21/\">Web Content\n Accessibility Guidelines version 2.1</a>, due to the non-compliances listed below.</p>\n\n<h1 class=\"govuk-heading-l\" id=\"Non-accessible-content\">Non-accessible content </h1>\n\n<p class=\"govuk-body\">The content listed below is non-compliant for the following reasons.</p>\n\n<h2 class=\"govuk-heading-l\" id=\"Non-compliance-with-the-accessibility-regulations\">Non-compliance with the accessibility\n regulations</h2>\n\n<p class=\"govuk-body\">Some pages cannot be navigated completely using just a keyboard, so some people won\u2019t be able to\n tab through the pages. This fails WCAG 2.1 success criterion 2.1 (keyboard accessible).</p>\n\n<p class=\"govuk-body\">Some pages can\u2019t be listened to in full using a screen reader, so some people won\u2019t be able to\n access the information. This fails WCAG 2.1 success criterion 1.2.5 (audio description \u2013 prerecorded).</p>\n\n<p class=\"govuk-body\">Some of the contrast ratios don\u2019t meet the current accessibility requirements. This fails WCAG 2.1\n success criterion 1.4.3 (contrast \u2013 minimum).</p>\n\n<h3 class=\"govuk-heading-m\" id=\"immigration\">Immigration and Asylum</h3>\n\n<p class=\"govuk-body\">Some of the images on the service include text and are not accessible for some low vision users.\n We have identified a solution for this issue that we will implement as soon as possible.</p>\n\n<h3 class=\"govuk-heading-m\" id=\"family\">Family Public Law </h3>\n\n<ol class=\"govuk-list govuk-list--alpha\">\n <li>The navigation system used in family public law cannot be rendered well by screen readers, so features can\u2019t be\n listened to in full\n </li>\n <li>Some essential functions within the family public law digital service cannot be accessed properly using screen\n readers\n </li>\n <li>Some complex forms within the service will not be rendered correctly or cannot be listened to by screen readers\n </li>\n</ol>\n\n<h2 class=\"govuk-heading-m\" id=\"Disproportionate burden \">Disproportionate burden </h2>\n\n<p class=\"govuk-body\">For Manage organisation, Register organisation, Approve organisations and Manage cases, we found\n the following issues that are currently being triaged to find out if there is a disproportionate burden:</p>\n\n<ol class=\"govuk-list govuk-list--alpha\">\n <li>Screen readers can\u2019t switch between headers, read content in tabs and buttons</li>\n <li>Screen readers can\u2019t tab between radio buttons, read links or content</li>\n <li>Colour contrast ratios uneven between page background and content</li>\n <li>Some labels, fields, error messages and other content can\u2019t be clearly identified by screen readers and voice\n activation software\n </li>\n <li>Some page headings and titles don\u2019t follow a logical structure for screen readers</li>\n <li>The navigation of some pages isn\u2019t clear</li>\n <li>Some headings, links and button labels aren\u2019t clearly descriptive</li>\n</ol>\n\n<h2 class=\"govuk-heading-m\" id=\"Content-that\u2019s-not-within-the-scope-of-the-accessibility-regulations\">Content that\u2019s not\n within the scope of the accessibility regulations </h2>\n\n<p class=\"govuk-body\">PDFs, documents and attachments to email notifications published before 23 September 2018 may not\n meet accessibility standards. For example, they may not be structured so they\u2019re accessible to a screen reader.</p>\n\n<p class=\"govuk-body\">Any new PDFs or Word documents we publish will meet accessibility standards.</p>\n\n<h1 class=\"govuk-heading-l\" id=\"what-to-improve-accessibility\">What we\u2019re doing to improve accessibility</h1>\n\n<p class=\"govuk-body\">We\u2019re committed to ensuring our services are accessible to all our users and that they comply with\n level AA of the Web Content Accessibility Guidelines \u2013 WCAG 2.1.</p>\n\n<p class=\"govuk-body\">We\u2019re actively working to improve the identified issues and make them AA-compliant by 23 September\n 2020. We\u2019re also continuing to improve all other AAA-level accessibility issues as we iterate the service.</p>\n\n<h1 class=\"govuk-heading-l\" id=\"preparation-of-this-accessibility-statement\">Preparation of this accessibility\n statement</h1>\n\n<p class=\"govuk-body\">This statement was prepared on 16 September 2019. It was last reviewed on 16 September 2020.</p>\n\n<p class=\"govuk-body\">This website was last tested on 19 May 2020. The test was carried out by the <a target=\"_blank\"\n href=\"https://digitalaccessibilitycentre.org/\">Digital\n Accessibility Centre (DAC)</a>.</p>\n",
32
- styles: [".govuk-list--alpha{padding-left:20px;list-style-type:lower-alpha}"]
33
- },] }
34
- ];
35
- AccessibilityComponent.ctorParameters = () => [];
36
-
37
- class CheckboxListComponent {
38
- constructor() {
39
- /**
40
- * The options to show checkboxes for. Note that the type
41
- * within the array corresponds to the one for the component.
42
- */
43
- this.options = [];
44
- /**
45
- * Whenever the selection changes, this event fires. What is dispatched
46
- * is the current selection, also retrievable from .selection.
47
- */
48
- this.selectionChange = new EventEmitter();
49
- }
50
- /**
51
- * The currently selected values.
52
- * Note: This array is immutable, which means pushing and popping will
53
- * have no effect on which checkboxes are selected.
54
- */
55
- get selection() {
56
- return this.pSelection ? [...this.pSelection] : [];
57
- }
58
- set selection(value) {
59
- this.pSelection = this.getSelection(value);
60
- }
61
- /**
62
- * Indicates whether or not all of the items are selected.
63
- */
64
- get allSelected() {
65
- return this.selection.length === this.options.length;
66
- }
67
- // Catch any changes to any of the Input() properties.
68
- ngOnChanges() {
69
- // Set up the pre-selected values.
70
- this.setupPreselection();
71
- // Now check the current selection to make sure it's valid.
72
- this.checkSelection();
73
- }
74
- /**
75
- * Indicates whether or not there are any options to render.
76
- */
77
- get hasOptions() {
78
- return this.options && this.options.length > 0;
79
- }
80
- get isFunctional() {
81
- return this.labelFunction && this.hasOptions;
82
- }
83
- /**
84
- * Indicates whether or not an item is part of the current selection.
85
- * @param item The item in question.
86
- */
87
- isSelected(item) {
88
- return this.selection.includes(item);
89
- }
90
- /**
91
- * If an item is already selected, it will be removed from the selection.
92
- * Otherwise, it will be added to the selection..
93
- */
94
- toggleItemSelection(item) {
95
- if (this.pSelection === undefined) {
96
- // If we don't have any selection at all yet, make it just this item.
97
- this.pSelection = [item];
98
- }
99
- else if (this.isSelected(item)) {
100
- // If this item is already selected, remove it.
101
- this.pSelection.splice(this.pSelection.indexOf(item), 1);
102
- }
103
- else {
104
- // If it's not selected, add it.
105
- this.pSelection.push(item);
106
- }
107
- // Indicate that the user has now made an active selection.
108
- this.pSelectionMade = true;
109
- // Now emit an event so any containers know about the change to selection.
110
- this.selectionChange.emit(this.selection);
111
- }
112
- /**
113
- * If all of the items are selected, deselect them all.
114
- * Otherwise, select them all.
115
- */
116
- toggleSelectAll() {
117
- // Do we already have them all selected?
118
- if (this.allSelected) {
119
- // If so, clear out the selection.
120
- this.pSelection = [];
121
- }
122
- else {
123
- // If not, select all of them.
124
- this.pSelection = [...this.options];
125
- }
126
- // Indicate that the user has now made an active selection.
127
- this.pSelectionMade = true;
128
- // Now emit an event so any containers know about the change to selection.
129
- this.selectionChange.emit(this.pSelection);
130
- }
131
- /**
132
- * Use the labelFunction to determine whether the options include the item.
133
- * This is to handle partial objects being set in the pre-selection where
134
- * they may not be available by the same mechanism as the options.
135
- *
136
- * @param items The array of items in which to look for the item.
137
- * @param item The item to check in the options.
138
- */
139
- containsItem(items, item) {
140
- if (this.isFunctional) {
141
- const itemLabel = this.labelFunction(item);
142
- return items.some(opt => {
143
- return this.labelFunction(opt) === itemLabel;
144
- });
145
- }
146
- return false;
147
- }
148
- // Simple utility function to indicate whether there is an active preselection.
149
- get hasPreselection() {
150
- return this.preselection && this.preselection.length > 0;
151
- }
152
- // Set up the initially selected values.
153
- // NOTE: If the preselection changes and the user has NOT made an active selection,
154
- // the current selection will also be changed. As soon as the user has made an
155
- // active selection, however, the preselection is no longer relevant.
156
- setupPreselection() {
157
- if (this.isFunctional && !this.pSelectionMade && this.hasPreselection) {
158
- let changed = true; // Assume this is a change.
159
- if (this.pSelection) {
160
- // If there is no difference between the arrays, this is not a change.
161
- changed = this.pSelection.filter((item) => {
162
- return !this.containsItem(this.preselection, item);
163
- }).length > 0;
164
- }
165
- // If this is a change, update the selection and then emit an
166
- // event so any containers know about the change to selection.
167
- if (changed) {
168
- this.pSelection = this.getSelection(this.preselection);
169
- this.selectionChange.emit(this.selection);
170
- }
171
- }
172
- }
173
- getSelection(items) {
174
- return [
175
- ...this.options.filter(opt => {
176
- return this.containsItem(items, opt);
177
- })
178
- ];
179
- }
180
- // The options have changed. Let's make sure the selection
181
- // doesn't contain anything that's not currently an option.
182
- checkSelection() {
183
- if (this.isFunctional) {
184
- // Check which of the currently selected items are actually options.
185
- const allowedSelection = this.selection.filter((item) => {
186
- return this.containsItem(this.options, item);
187
- });
188
- // If any have dropped out, change the selection.
189
- if (allowedSelection.length !== this.selection.length) {
190
- this.pSelection = [...allowedSelection];
191
- // And emit an event so any containers know about the change to selection.
192
- this.selectionChange.emit(this.selection);
193
- }
194
- }
195
- }
196
- }
197
- CheckboxListComponent.decorators = [
198
- { type: Component, args: [{
199
- selector: 'xuilib-checkbox-list',
200
- template: "<div class=\"xui-checkbox-list govuk-checkboxes govuk-checkboxes--small\" *ngIf=\"isFunctional\">\n <div class=\"select-all govuk-checkboxes__item\">\n <input type=\"checkbox\" id=\"select_all\" class=\"govuk-checkboxes__input\" [checked]=\"allSelected\"\n (change)=\"toggleSelectAll()\" />\n <label for=\"select_all\" class=\"govuk-label govuk-checkboxes__label\">Select all / Deselect all</label>\n </div>\n <div class=\"checkbox-items\">\n <div *ngFor=\"let item of options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" [id]=\"'select_' + i\" class=\"govuk-checkboxes__input\" [checked]=\"isSelected(item)\"\n (change)=\"toggleItemSelection(item)\" />\n <label [for]=\"'select_' + i\" class=\"govuk-label govuk-checkboxes__label\">{{labelFunction(item)}}</label>\n </div>\n </div>\n</div>\n",
201
- encapsulation: ViewEncapsulation.None,
202
- styles: [".xui-checkbox-list .select-all{margin-bottom:10px}.xui-checkbox-list .checkbox-items{display:flex;flex-direction:column;flex-wrap:wrap;height:100%;max-height:100%;align-items:flex-start;align-content:flex-start;width:100%;max-width:100%;overflow-x:scroll}"]
203
- },] }
204
- ];
205
- CheckboxListComponent.propDecorators = {
206
- options: [{ type: Input }],
207
- preselection: [{ type: Input }],
208
- labelFunction: [{ type: Input }],
209
- selectionChange: [{ type: Output }],
210
- selection: [{ type: Input }]
211
- };
212
-
213
- class ContactDetailsComponent {
214
- constructor() {
215
- }
216
- }
217
- ContactDetailsComponent.decorators = [
218
- { type: Component, args: [{
219
- selector: 'xuilib-contact-details',
220
- template: "<div class=\"contact-details\" *ngIf=\"data\">\n <h3 class=\"govuk-heading-m\" *ngIf=\"data.title\">{{ data.title }}</h3>\n <p *ngIf=\"data.badgeText\"><span [className]=\"'hmcts-badge ' + data.badgeColour\">{{ data.badgeText }}</span></p>\n <div class=\"email\" *ngIf=\"data.email\"><span class=\"govuk-!-font-weight-bold\">Email: </span> <a href=\"mailto:{{ data.email }}\">{{ data.email }}</a></div>\n <div class=\"phone\" *ngIf=\"data.phone\"><span class=\"govuk-!-font-weight-bold\">Phone: </span>{{ data.phone }}</div>\n <div class=\"opening-times\" *ngIf=\"data.openingTimes\"><span class=\"govuk-!-font-weight-bold\">Opening times: </span>{{ data.openingTimes}}</div>\n</div>\n\n",
221
- styles: [".contact-details{margin-top:30px}.contact-details h3,.contact-details p{margin-bottom:10px}"]
222
- },] }
223
- ];
224
- ContactDetailsComponent.ctorParameters = () => [];
225
- ContactDetailsComponent.propDecorators = {
226
- data: [{ type: Input }]
227
- };
228
-
229
- var DateBadgeColour;
230
- (function (DateBadgeColour) {
231
- DateBadgeColour["RED"] = "hmcts-badge--red";
232
- DateBadgeColour["ORANGE"] = "hmcts-badge--orange";
233
- DateBadgeColour["GREEN"] = "hmcts-badge--green";
234
- })(DateBadgeColour || (DateBadgeColour = {}));
235
- const SECONDS_IN_A_DAY = 60 * 60 * 24;
236
-
237
- class DueDateComponent {
238
- constructor() {
239
- /**
240
- * This should be considered HIGH urgency if there are fewer than this
241
- * many days until the due date.
242
- * * Set to 0 if you want it to show HIGH if it was due yesterday.
243
- * * Set to 1 if you want it to show HIGH if it's due today.
244
- * * Set to 2 if you want it to show HIGH if it's due tomorrow.
245
- *
246
- * Defaults to 0 (ZERO), which means it won't show as HIGH urgency until the
247
- * due date is in the past.
248
- *
249
- * NOTE: If this is higher than the mediumUrgencyCutoff value, MEDIUM urgency
250
- * will never be shown.
251
- *
252
- * ALSO NOTE: Anything overdue is automatically considered HIGH urgency.
253
- */
254
- this.highUrgencyCutoff = 0; // Default
255
- /**
256
- * This should be considered MEDIUM urgency if there are fewer than this
257
- * many days until the due date.
258
- * * Set to 1 if you want it to show MEDIUM if it's due today.
259
- * * Set to 2 if you want it to show MEDIUM if it's due tomorrow.
260
- * * Set to 3 if you want it to show MEDIUM if it's due the day after tomorrow.
261
- *
262
- * Defaults to 2, which means it won't show as MEDIUM urgency unless the
263
- * due date is today or tomorrow.
264
- *
265
- * NOTE: If this is lower than the highUrgencyCutoff value, MEDIUM urgency
266
- * will never be shown.
267
- */
268
- this.mediumUrgencyCutoff = 2;
269
- }
270
- get badge() {
271
- return this.pBadge;
272
- }
273
- get label() {
274
- return this.pLabel;
275
- }
276
- get accessibleLabel() {
277
- return this.pAccessibleLabel;
278
- }
279
- get daysDiff() {
280
- return this.pDaysDiff;
281
- }
282
- // Catch any changes to any of the Input() properties.
283
- ngOnChanges() {
284
- this.handleInputChanges();
285
- }
286
- // Set up the label, urgency class, and accessibility fields.
287
- handleInputChanges() {
288
- // If we don't have a dueDate, skip out of here.
289
- if (!this.dueDate) {
290
- return;
291
- }
292
- // How many days from today is the due date?
293
- // Already happened means daysDiff > 0;
294
- // Today means daysDiff = 0;
295
- // Yet to come means daysDiff < 0;
296
- this.pDaysDiff = this.getDaysDifference(this.dueDate, new Date());
297
- // Is it overdue?
298
- if (this.daysDiff > 0) {
299
- this.pBadge = DateBadgeColour.RED;
300
- const daysLabel = this.daysDiff === 1 ? 'day' : 'days';
301
- this.pLabel = `+${this.daysDiff} ${daysLabel}`;
302
- this.pAccessibleLabel = `This task is ${this.daysDiff} ${daysLabel} past its due date`;
303
- }
304
- else {
305
- // Special label for "Today".
306
- if (this.daysDiff === 0) {
307
- this.pLabel = 'TODAY';
308
- this.pAccessibleLabel = 'This task is due to be completed today';
309
- }
310
- else {
311
- this.pLabel = `${formatDate(this.dueDate, 'd MMM', 'en-GB')}`;
312
- this.pAccessibleLabel = `This task is due to be completed by ${formatDate(this.dueDate, 'd MMMM y', 'en-GB')}`;
313
- }
314
- if (this.daysDiff + this.highUrgencyCutoff > 0) {
315
- this.pBadge = DateBadgeColour.RED;
316
- }
317
- else if (this.daysDiff + this.mediumUrgencyCutoff > 0) {
318
- this.pBadge = DateBadgeColour.ORANGE;
319
- }
320
- else {
321
- this.pBadge = DateBadgeColour.GREEN;
322
- }
323
- }
324
- }
325
- // This will return the difference between two dates.
326
- // If fromDate is BEFORE toDate, it will be a positive number.
327
- // If fromDate is AFTER toDate, it will be a negative number.
328
- getDaysDifference(fromDate, toDate) {
329
- const fromEpoch = fromDate.getTime();
330
- const toEpoch = toDate.getTime();
331
- const diffSecs = Math.floor((toEpoch - fromEpoch) / 1000);
332
- return Math.floor(diffSecs / SECONDS_IN_A_DAY);
333
- }
334
- }
335
- DueDateComponent.decorators = [
336
- { type: Component, args: [{
337
- selector: 'xuilib-due-date',
338
- template: "<span *ngIf=\"dueDate\" class=\"due-date hmcts-badge\" [ngClass]=\"badge\"\n [title]=\"accessibleLabel\" [attr.aria-label]=\"accessibleLabel\">\n {{label}}\n</span>",
339
- encapsulation: ViewEncapsulation.None,
340
- styles: [".due-date{white-space:nowrap}.due-date.hmcts-badge--orange{color:#f47738;border-color:#f47738}"]
341
- },] }
342
- ];
343
- DueDateComponent.propDecorators = {
344
- dueDate: [{ type: Input }],
345
- highUrgencyCutoff: [{ type: Input }],
346
- mediumUrgencyCutoff: [{ type: Input }]
347
- };
348
-
349
- class FilterService {
350
- constructor() {
351
- this.givenErrors = new BehaviorSubject(null);
352
- this.isInitialSetting = false;
353
- this.filterSettings = {};
354
- this.streams = {};
355
- }
356
- persist(setting, persistence) {
357
- switch (persistence) {
358
- case 'local':
359
- this.persistLocal(setting);
360
- break;
361
- case 'session':
362
- this.persistSession(setting);
363
- break;
364
- default:
365
- break;
366
- }
367
- this.persistMemory(setting);
368
- this.updateStreams(setting);
369
- }
370
- get(id) {
371
- if (this.filterSettings[id]) {
372
- return this.filterSettings[id];
373
- }
374
- if (sessionStorage.getItem(id)) {
375
- return JSON.parse(window.sessionStorage.getItem(id));
376
- }
377
- if (localStorage.getItem(id)) {
378
- return JSON.parse(window.localStorage.getItem(id));
379
- }
380
- return null;
381
- }
382
- getStream(id) {
383
- if (!this.streams[id]) {
384
- this.streams[id] = new BehaviorSubject(this.get(id));
385
- }
386
- return this.streams[id].asObservable();
387
- }
388
- persistLocal(setting) {
389
- window.localStorage.setItem(setting.id, JSON.stringify(setting));
390
- }
391
- persistSession(setting) {
392
- window.sessionStorage.setItem(setting.id, JSON.stringify(setting));
393
- }
394
- persistMemory(setting) {
395
- this.filterSettings[setting.id] = setting;
396
- }
397
- updateStreams(setting) {
398
- if (this.streams[setting.id]) {
399
- this.streams[setting.id].next(setting);
400
- }
401
- }
402
- }
403
- FilterService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FilterService_Factory() { return new FilterService(); }, token: FilterService, providedIn: "root" });
404
- FilterService.decorators = [
405
- { type: Injectable, args: [{
406
- providedIn: 'root'
407
- },] }
408
- ];
409
-
410
- function minSelectedValidator(min) {
411
- return (control) => {
412
- const values = control.value;
413
- return values.length && values.filter(value => value).length >= min ? null : { minLength: true };
414
- };
415
- }
416
- function maxSelectedValidator(max) {
417
- return (control) => {
418
- const values = control.value;
419
- return values.length && values.filter(value => value).length <= max ? null : { maxLength: true };
420
- };
421
- }
422
- function getValues(options, values) {
423
- return options.reduce((acc, option, index) => {
424
- if (values[index]) {
425
- return [...acc, option.key];
426
- }
427
- return acc;
428
- }, []);
429
- }
430
-
431
- class GenericFilterComponent {
432
- constructor(filterService, fb) {
433
- this.filterService = filterService;
434
- this.fb = fb;
435
- this.submitted = false;
436
- }
437
- get config() {
438
- return this._config;
439
- }
440
- set config(value) {
441
- this._config = Object.assign(Object.assign({}, value), { fields: value.fields.map(field => (Object.assign(Object.assign({}, field), { displayMinSelectedError: false, displayMaxSelectedError: false }))) });
442
- this._config = value;
443
- }
444
- get settings() {
445
- return this._settings;
446
- }
447
- set settings(value) {
448
- if (!value) {
449
- this.getSettings();
450
- }
451
- if (value && value.fields) {
452
- this.mergeDefaultFields(value);
453
- }
454
- this._settings = value;
455
- }
456
- static addFormValidators(field) {
457
- const validators = [];
458
- if (field && field.minSelected) {
459
- validators.push(minSelectedValidator(field.minSelected));
460
- }
461
- if (field && field.maxSelected) {
462
- validators.push(maxSelectedValidator(field.maxSelected));
463
- }
464
- return validators;
465
- }
466
- ngOnInit() {
467
- if (!this.settings) {
468
- this.getSettings();
469
- }
470
- this.mergeDefaultFields(this.settings);
471
- this.buildForm(this.config, this.settings);
472
- this.formSub = this.form.valueChanges.subscribe(() => this.submitted = false);
473
- }
474
- ngOnDestroy() {
475
- if (this.formSub) {
476
- this.formSub.unsubscribe();
477
- }
478
- }
479
- hidden(field, form) {
480
- if (!field.showCondition) {
481
- return false;
482
- }
483
- if (typeof field.showCondition === 'string') {
484
- const control = form.get(field.name);
485
- const [name, value] = field.showCondition.split('=');
486
- if (form.value && form.value[name] === value) {
487
- if (field.type === 'find-person') {
488
- control.get('email').setValidators(Validators.required);
489
- control.get('email').updateValueAndValidity();
490
- }
491
- else {
492
- control.setValidators(Validators.required);
493
- control.updateValueAndValidity();
494
- }
495
- return false;
496
- }
497
- else {
498
- if (field.type === 'find-person') {
499
- control.get('email').clearValidators();
500
- control.get('email').updateValueAndValidity();
501
- }
502
- else {
503
- control.clearValidators();
504
- control.updateValueAndValidity();
505
- }
506
- }
507
- }
508
- return true;
509
- }
510
- disabled(field, form) {
511
- if (!field.enableCondition) {
512
- return null;
513
- }
514
- if (typeof field.enableCondition === 'string') {
515
- const control = form.get(field.name);
516
- const [name, value] = field.enableCondition.split('=');
517
- if (form.value && form.value[name] === value) {
518
- if (field.type === 'find-person') {
519
- control.get('email').setValidators(Validators.required);
520
- control.get('email').updateValueAndValidity();
521
- }
522
- else {
523
- control.setValidators(Validators.required);
524
- control.updateValueAndValidity();
525
- }
526
- return null;
527
- }
528
- else {
529
- if (field.type === 'find-person') {
530
- control.get('email').clearValidators();
531
- control.get('email').updateValueAndValidity();
532
- }
533
- else {
534
- control.clearValidators();
535
- control.updateValueAndValidity();
536
- }
537
- }
538
- }
539
- // find-location is special case where need to reset textbox (by existing disabling functionality)
540
- // field.disable referred to component itself
541
- if (field.type === 'find-location') {
542
- return true;
543
- }
544
- // Note: field.disable decides whether to actually disable or not
545
- return field.disable ? field.disable : null;
546
- }
547
- applyFilter(form) {
548
- this.submitted = true;
549
- form.markAsTouched();
550
- if (form.valid) {
551
- this._settings = {
552
- id: this.config.id,
553
- fields: this.getSelectedValues(form.value, this.config)
554
- };
555
- this.filterService.givenErrors.next(null);
556
- const settings = Object.assign(Object.assign({}, this.settings), { reset: false });
557
- this.filterService.persist(settings, this.config.persistence);
558
- }
559
- else {
560
- this.emitFormErrors(form);
561
- }
562
- }
563
- // when domain changes ensure that person field is reset
564
- fieldChanged(field, form) {
565
- // TODO - Do similar with jurisdiction/service for caseworkers by services
566
- if (field.changeResetFields && field.changeResetFields.length) {
567
- for (const resetField of field.changeResetFields) {
568
- this.resetField(resetField, form);
569
- }
570
- }
571
- }
572
- // when user enters input change radio button
573
- inputChanged(field) {
574
- if (field.radioSelectionChange && typeof field.radioSelectionChange === 'string') {
575
- const [name, value] = field.enableCondition.split('=');
576
- this.form.get(name).patchValue(value);
577
- }
578
- }
579
- cancelFilter() {
580
- this.buildForm(this.config, this.settings, true);
581
- if (this.config && this.config.cancelSetting) {
582
- this._settings.fields = JSON.parse(JSON.stringify(this.config.cancelSetting.fields));
583
- }
584
- const settings = Object.assign(Object.assign({}, this.settings), { reset: true });
585
- this.filterService.persist(settings, this.config.persistence);
586
- this.filterService.givenErrors.next(null);
587
- this.submitted = false;
588
- }
589
- updatePersonControls(values, field) {
590
- let keys;
591
- if (!values) {
592
- keys = Object.keys(this.form.get(field.name).value);
593
- }
594
- else {
595
- keys = Object.keys(values);
596
- }
597
- for (const key of keys) {
598
- if (this.form.get(field.name) && this.form.get(field.name).get(key)) {
599
- const value = values && values[key] ? values[key] : null;
600
- this.form.get(field.name).get(key).patchValue(value);
601
- }
602
- }
603
- }
604
- toggleSelectAll(event, form, item, field) {
605
- const isChecked = event.target.checked;
606
- const formArray = form.get(field.name);
607
- if (!item.selectAll) {
608
- const allChecked = formArray.controls.every((control) => control.value);
609
- let index = null;
610
- const hasSelectAllOption = field.options.find((option, i) => {
611
- if (option.hasOwnProperty('selectAll')) {
612
- index = i;
613
- return true;
614
- }
615
- return false;
616
- });
617
- // tslint:disable-next-line:variable-name
618
- const isAllCheckedExcludingTheSelectAllOption = formArray.controls.filter((_control, i) => i !== index)
619
- .every((control) => control.value);
620
- if (!allChecked && hasSelectAllOption && !isChecked) {
621
- formArray.controls.forEach((control, i) => {
622
- if (index === i) {
623
- control.patchValue(false);
624
- return;
625
- }
626
- });
627
- }
628
- else if (hasSelectAllOption && !allChecked && isChecked && isAllCheckedExcludingTheSelectAllOption) {
629
- formArray.controls[index].patchValue(true);
630
- }
631
- return;
632
- }
633
- formArray.controls.forEach((control) => {
634
- if (isChecked) {
635
- control.patchValue(true);
636
- }
637
- else {
638
- control.patchValue(false);
639
- }
640
- });
641
- }
642
- resetField(resetField, form) {
643
- const control = form.get(resetField);
644
- const defaultValue = this.config.cancelSetting.fields.find((f) => f.name === resetField);
645
- if (control instanceof FormArray) {
646
- for (let i = 0; i < control.length; i++) {
647
- control.removeAt(i);
648
- }
649
- }
650
- else if (control instanceof FormGroup) {
651
- const keys = Object.keys(control.value);
652
- for (const key of keys) {
653
- this.resetField(key, control);
654
- }
655
- }
656
- else if (control instanceof FormControl) {
657
- const value = defaultValue && defaultValue.value && defaultValue.value.length ? defaultValue.value[0] : null;
658
- control.setValue(value);
659
- }
660
- }
661
- mergeDefaultFields(filter) {
662
- if (filter) {
663
- filter.fields = this.filterService.get(this.config.id) ? this.filterService.get(this.config.id).fields : filter.fields;
664
- }
665
- else if (this.config && this.config.cancelSetting) {
666
- this._settings = {
667
- id: this.config.id,
668
- fields: JSON.parse(JSON.stringify(this.config.cancelSetting.fields))
669
- };
670
- }
671
- }
672
- getSettings() {
673
- this._settings = this.filterService.get(this.config.id);
674
- }
675
- buildForm(config, settings, reset) {
676
- const findPersonControl = this.form ? this.form.get('findPersonControl') : null;
677
- this.form = this.fb.group({});
678
- if (findPersonControl) {
679
- // in order to maintain find person component, control needs to be kept
680
- this.form.addControl('findPersonControl', findPersonControl);
681
- }
682
- for (const field of config.fields) {
683
- if (field.type === 'checkbox' || field.type === 'checkbox-large') {
684
- const formArray = this.buildCheckBoxFormArray(field, settings);
685
- this.form.addControl(field.name, formArray);
686
- }
687
- else if (field.type === 'find-location') {
688
- const formArray = this.buildFindLocationFormArray(field, settings);
689
- this.form.addControl(field.name, formArray);
690
- }
691
- else {
692
- const validators = [];
693
- if (field.minSelected && field.minSelected > 0) {
694
- validators.push(Validators.required);
695
- }
696
- let defaultValue = null;
697
- if (reset && config.cancelSetting) {
698
- const cancelField = config.cancelSetting.fields.find((f) => f.name === field.name);
699
- defaultValue = cancelField && cancelField.value ? cancelField.value[0] : '';
700
- }
701
- else if (settings && settings.fields) {
702
- const lastSavedValue = settings.fields.find((f) => f.name === field.name);
703
- defaultValue = lastSavedValue && lastSavedValue ? lastSavedValue.value[0] : '';
704
- }
705
- // if field is find-person build a form group;
706
- if (field.type === 'find-person') {
707
- const formGroup = new FormGroup({
708
- domain: new FormControl(''),
709
- email: new FormControl(defaultValue && defaultValue.hasOwnProperty('email') ? defaultValue.email : '', validators),
710
- id: new FormControl(''),
711
- name: new FormControl(''),
712
- knownAs: new FormControl(''),
713
- });
714
- this.form.addControl(field.name, formGroup);
715
- }
716
- else {
717
- const control = new FormControl(defaultValue, validators);
718
- this.form.addControl(field.name, control);
719
- }
720
- // if field updates find person component set the initial domain
721
- if (field.findPersonField) {
722
- this.fieldChanged(field, this.form);
723
- }
724
- }
725
- }
726
- }
727
- buildCheckBoxFormArray(field, settings) {
728
- const validators = GenericFilterComponent.addFormValidators(field);
729
- const formArray = this.fb.array([], validators);
730
- let defaultValues;
731
- if (settings && settings.fields) {
732
- defaultValues = settings.fields.find((f) => f.name === field.name);
733
- }
734
- for (const option of field.options) {
735
- let checked = false;
736
- if (defaultValues && Array.isArray(defaultValues.value)) {
737
- checked = !!defaultValues.value.find((value) => value === option.key);
738
- }
739
- formArray.push(new FormControl(checked));
740
- }
741
- return formArray;
742
- }
743
- buildFindLocationFormArray(field, settings) {
744
- const validators = GenericFilterComponent.addFormValidators(field);
745
- const formArray = this.fb.array([], validators);
746
- let defaultValues;
747
- if (settings && settings.fields) {
748
- defaultValues = settings.fields.find((f) => f.name === field.name);
749
- if (defaultValues && defaultValues.value && defaultValues.value.length > 0) {
750
- for (const defaultValue of defaultValues.value) {
751
- formArray.push(new FormControl(defaultValue));
752
- }
753
- }
754
- }
755
- return formArray;
756
- }
757
- getSelectedValues(formValues, config) {
758
- return Object.keys(formValues).map((name) => {
759
- const values = formValues[name];
760
- if (Array.isArray(values)) {
761
- const field = config.fields.find(f => f.name === name);
762
- if (field.type === 'find-location') {
763
- return { value: values, name };
764
- }
765
- else {
766
- return { value: getValues(field.options, values), name };
767
- }
768
- }
769
- else {
770
- return { value: [values], name };
771
- }
772
- });
773
- }
774
- emitFormErrors(form) {
775
- const errors = [];
776
- for (const field of this.config.fields) {
777
- const formGroup = form.get(field.name);
778
- if (formGroup && formGroup.errors && formGroup.errors.minLength) {
779
- errors.push({ name: field.name, error: field.minSelectedError });
780
- }
781
- if (formGroup && formGroup.errors && formGroup.errors.maxLength) {
782
- errors.push({ name: field.name, error: field.minSelectedError });
783
- }
784
- }
785
- if (errors.length) {
786
- this.filterService.givenErrors.next(errors);
787
- }
788
- }
789
- }
790
- GenericFilterComponent.decorators = [
791
- { type: Component, args: [{
792
- selector: 'xuilib-generic-filter',
793
- template: "<form [formGroup]=\"form\" (ngSubmit)=\"applyFilter(form)\">\n <div class=\"contain-classes\" *ngFor=\"let field of config.fields\">\n <hr *ngIf=\"field.lineBreakBefore\" class=\"govuk-section-break govuk-section-break--visible elevated-break\">\n <div class=\"govuk-form-group xui-generic-filter\"\n [hidden]=\"hidden(field, form)\"\n [id]=\"field.name\"\n [ngClass]=\"{'form-group-error': submitted && (form.get(field.name).errors?.minLength || form.get(field.name).errors?.maxLength)}\">\n <h3 *ngIf=\"field.title\" class=\"govuk-heading-s\">{{field.title}}</h3>\n <p class=\"govuk-body\" *ngIf=\"field.subTitle\">{{field.subTitle}}</p>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMinSelectedError && submitted && form.get(field.name).errors?.minLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.minSelectedError}}\n </span>\n <span [id]=\"field.name + '-error'\" class=\"govuk-error-message\" *ngIf=\"field.displayMaxSelectedError && submitted && form.get(field.name).errors?.maxLength\">\n <span class=\"govuk-visually-hidden\">Error:</span> {{field.maxSelectedError}}\n </span>\n <div class=\"govuk-body\" [ngSwitch]=\"field.type\">\n <ng-container *ngSwitchCase=\"'select'\">\n <select class=\"govuk-select\" (change)=\"fieldChanged(field, form)\" [attr.disabled]=\"disabled(field, form)\" [name]=\"'select_' + field.name\" [id]=\"'select_' + field.name\" [formControlName]=\"field.name\">\n <option disabled selected hidden value=\"\">{{field.disabledText}}</option>\n <option class=\"govuk-radios__item\" *ngFor=\"let item of field.options\" [value]=\"item.key\">{{item.label}}</option>\n </select>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"govuk-checkboxes govuk-checkboxes--small\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'checkbox-large'\">\n <div class=\"govuk-checkboxes\" [formGroupName]=\"field.name\" [attr.field]=\"field.name\" [id]=\"'checkbox_' + field.name\">\n <div *ngFor=\"let item of field.options; let i = index\" class=\"govuk-checkboxes__item\">\n <input type=\"checkbox\" class=\"govuk-checkboxes__input\"\n [attr.disabled]=\"disabled(field, form)\"\n [formControlName]=\"i\"\n (change)=\"toggleSelectAll($event, form, item, field)\"\n [value]=\"item.key\" [id]=\"'checkbox_' + item.key\"\n [name]=\"'checkbox_' + item.key\"\n />\n <label\n [for]=\"'checkbox_' + item.key\"\n class=\"govuk-label govuk-checkboxes__label\"\n [ngClass]=\"{'govuk-!-font-weight-bold': item.selectAll}\"\n >{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'radio'\">\n <div class=\"govuk-radios\">\n <div *ngFor=\"let item of field.options\" class=\"govuk-radios__item\">\n <input type=\"radio\"\n [formControlName]=\"field.name\"\n [id]=\"'radio_' + item.key\"\n [attr.disabled]=\"disabled(field, form)\"\n [checked]=\"item.key === form.get(field.name).value\"\n class=\"govuk-radios__input\"\n [value]=\"item.key\"\n (change)=\"fieldChanged(field, form)\"\n />\n <label [for]=\"'radio_' + item.key\" class=\"govuk-label govuk-radios__label\">{{item.label}}</label>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-person'\">\n <xuilib-find-person subTitle=\"\" (personSelected)=\"updatePersonControls($event, field)\"\n (personFieldChanged)=\"inputChanged(field)\"\n [submitted]=\"submitted\"\n [disabled]=\"disabled(field, form)\"\n [domain]=\"form.get(field.domainField)?.value\"\n [findPersonGroup]=\"form\"\n [selectedPerson]=\"form.get(field.name)?.value?.email\"\n [userIncluded]=\"false\"\n ></xuilib-find-person>\n </ng-container>\n <ng-container *ngSwitchCase=\"'find-location'\">\n <xuilib-find-location (locationFieldChanged)=\"inputChanged(field)\"\n [form]=\"form\"\n [fields]=\"config.fields\"\n [locationTitle]=\"field.locationTitle\"\n [enableAddLocationButton]=\"field.enableAddLocationButton\"\n [disabled]=\"disabled(field, form)\"\n [disableInputField]=\"field.disable\"\n [selectedLocations]=\"form.get(field.name)?.value\"\n [submitted]=\"submitted\"\n [services]=\"form.get(field.findLocationField)?.value\"\n [field]=\"field\"\n ></xuilib-find-location>\n </ng-container>\n </div>\n </div>\n </div>\n <hr class=\"govuk-section-break govuk-section-break--m govuk-section-break--visible\"/>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-full\">\n <button\n class=\"govuk-button govuk-!-margin-right-1 govuk-!-margin-bottom-0\"\n type=\"submit\"\n id=\"applyFilter\"\n [disabled]=\"config.enableDisabledButton && form.invalid\"\n >{{config.applyButtonText || 'Apply'}}</button>\n <button *ngIf=\"config.showCancelFilterButton\"\n class=\"govuk-button govuk-button--secondary govuk-!-margin-bottom-0\"\n type=\"button\"\n id=\"cancelFilter\"\n (click)=\"cancelFilter()\">{{ config.cancelButtonText || 'Cancel'}}</button>\n </div>\n </div>\n</form>\n",
794
- changeDetection: ChangeDetectionStrategy.OnPush,
795
- encapsulation: ViewEncapsulation.None,
796
- styles: [".contain-classes .elevated-break{position:relative;top:-10px}.contain-classes .xui-generic-filter .select-all{margin-bottom:10px}.contain-classes .xui-generic-filter .govuk-checkboxes{display:flex;flex-wrap:wrap}.contain-classes .xui-generic-filter .govuk-checkboxes>div{flex-grow:1;flex-shrink:0}"]
797
- },] }
798
- ];
799
- GenericFilterComponent.ctorParameters = () => [
800
- { type: FilterService },
801
- { type: FormBuilder }
802
- ];
803
- GenericFilterComponent.propDecorators = {
804
- config: [{ type: Input }],
805
- settings: [{ type: Input }]
806
- };
807
-
808
- /*
809
- * Gov UK Dialog Component
810
- * Responsible for displaying dialog layout
811
- * using ng-content to display content from parent
812
- * */
813
- class HmctsSessionDialogComponent {
814
- constructor() {
815
- this.close = new EventEmitter();
816
- }
817
- onClose() {
818
- this.close.emit();
819
- }
820
- }
821
- HmctsSessionDialogComponent.decorators = [
822
- { type: Component, args: [{
823
- selector: 'xuilib-session-dialog',
824
- template: "<div class=\"gem-c-modal-dialogue\" data-module=\"modal-dialogue\" id=\"modal-default\" style=\"display: block;\">\n <div class=\"gem-c-modal-dialogue__overlay\"></div>\n <dialog class=\"gem-c-modal-dialogue__box\" aria-modal=\"true\" role=\"dialog\" tabindex=\"0\" [ngStyle]=\"{'margin-top': positionTop}\">\n <div class=\"gem-c-modal-dialogue__header\">\n <svg role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 38 38\" height=\"33\" width=\"33\">\n <style type=\"text/css\">\n .st0{fill:#FFFFFF;}\n </style>\n <g id=\"_4_-_granular_components_warning_icon\" transform=\"translate(0.5 0.5)\">\n <g id=\"Warning_icon\" transform=\"translate(0)\">\n <path id=\"Exclusion_1\" class=\"st0\" d=\"M18.5,37.5c-5.04,0.01-9.88-1.99-13.44-5.57C1.49,28.38-0.51,23.54-0.5,18.5\n c-0.01-5.04,1.99-9.88,5.56-13.43C8.62,1.49,13.46-0.51,18.5-0.5c5.04-0.01,9.88,1.99,13.44,5.56c3.57,3.56,5.58,8.39,5.56,13.44\n c0.01,5.04-1.99,9.88-5.56,13.44C28.38,35.51,23.54,37.51,18.5,37.5z M18.52,24.29c-0.4,0-0.8,0.08-1.17,0.23\n c-0.36,0.15-0.69,0.37-0.97,0.64c-0.28,0.27-0.5,0.59-0.65,0.95c-0.16,0.36-0.24,0.76-0.23,1.15c0,0.4,0.08,0.8,0.23,1.17\n c0.15,0.36,0.37,0.68,0.65,0.96c0.28,0.27,0.61,0.49,0.97,0.64c0.37,0.16,0.77,0.24,1.17,0.24c0.4,0,0.79-0.08,1.15-0.24\n c0.35-0.15,0.67-0.37,0.95-0.64c0.27-0.27,0.49-0.6,0.64-0.96c0.16-0.37,0.24-0.77,0.23-1.17c0-0.4-0.08-0.79-0.23-1.15\n c-0.15-0.35-0.37-0.67-0.64-0.95c-0.27-0.27-0.6-0.49-0.95-0.64C19.31,24.37,18.92,24.29,18.52,24.29L18.52,24.29z M16.11,7.5\n l0.42,14.87h3.91L20.86,7.5H16.11z\"/>\n </g>\n </g>\n </svg>\n <div class=\"gem-c-modal-dialogue__title\">We are about to sign you out</div>\n </div>\n <div class=\"gem-c-modal-dialogue__content\">\n <ng-content></ng-content>\n </div>\n </dialog>\n</div>\n",
825
- styles: [".gem-c-modal-dialogue{display:none;z-index:1000;overflow-x:hidden;overflow-y:scroll;outline:0}.gem-c-modal-dialogue,.gem-c-modal-dialogue__box{position:fixed;top:0;left:0;width:100%;height:100%}.gem-c-modal-dialogue__box{display:block;background:#fff;right:0;bottom:0;margin:0;padding:0;overflow-y:auto;border:0;font-family:GDS Transport,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:16px;font-size:1rem;line-height:1.25;color:#0b0c0c}.gem-c-modal-dialogue__box:focus{outline:3px solid #fd0}@media print{.gem-c-modal-dialogue__box{font-family:sans-serif}}@media (min-width:40.0625em){.gem-c-modal-dialogue__box{font-size:1.1875rem;line-height:1.3157894737}}@media print{.gem-c-modal-dialogue__box{font-size:14pt;line-height:1.15;color:#000}}@media (min-width:40.0625em){.gem-c-modal-dialogue__box{position:relative;top:inherit;right:inherit;bottom:inherit;left:inherit;width:auto;max-width:640px;height:auto;margin:30px auto;border:2px solid #0b0c0c}}@media (min-width:40.0625em){.gem-c-modal-dialogue__box--wide{max-width:960px}}@media (min-width:40.0625em) and (max-width:64em){.gem-c-modal-dialogue__box--wide{margin:30px}}.gem-c-modal-dialogue__overlay{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;opacity:.8;background:#0b0c0c;pointer-events:none;touch-action:none}@media screen{.gem-o-template--modal{overflow-y:inherit}}.gem-o-template__body--modal{overflow:hidden}.gem-o-template__body--blur .govuk-footer,.gem-o-template__body--blur .govuk-header,.gem-o-template__body--blur .govuk-main-wrapper,.gem-o-template__body--blur .govuk-phase-banner,.gem-o-template__body--blur .govuk-skip-link,.gem-o-template__body--blur .govuk-width-container .govuk-back-link{filter:blur(2px)}.govuk-warning-text__icon{margin:0 0 0 12px}.gem-c-modal-dialogue__header{padding:9px 15px 10px;color:#fff;background:#d4351d;display:flex}.gem-c-modal-dialogue__title{margin:5px 0 4px 12px}.gem-c-modal-dialogue__logotype-crown{fill:currentColor;vertical-align:middle}.gem-c-modal-dialogue__logotype-crown-fallback-image{width:30px;height:26px;border:0;vertical-align:middle}.gem-c-modal-dialogue__content{padding:15px;background:#fff}.gem-c-modal-dialogue__close-button{position:absolute;top:0;right:0;width:44px;height:44px;border:0;color:#fff;background:none;cursor:pointer;font-family:GDS Transport,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:700;font-size:1.5rem;line-height:1.3}@media print{.gem-c-modal-dialogue__close-button{font-family:sans-serif}}@media (min-width:40.0625em){.gem-c-modal-dialogue__close-button{font-size:2.25rem;line-height:1.3}}@media print{.gem-c-modal-dialogue__close-button{font-size:24pt;line-height:1.3}}@media (max-width:40.0525em){.gem-c-modal-dialogue__close-button{font-size:36px;line-height:1.3}}.gem-c-modal-dialogue__close-button:focus,.gem-c-modal-dialogue__close-button:hover{color:#0b0c0c;box-shadow:0 -2px #fd0,0 4px #0b0c0c;text-decoration:none;outline:none;background:#fd0}"]
826
- },] }
827
- ];
828
- HmctsSessionDialogComponent.ctorParameters = () => [];
829
- HmctsSessionDialogComponent.propDecorators = {
830
- positionTop: [{ type: Input }],
831
- close: [{ type: Output }]
832
- };
833
-
834
- class InviteUserFormComponent {
835
- constructor() {
836
- this.submitForm = new EventEmitter();
837
- }
838
- set errorMessages(value) {
839
- this.isInvalid = value || {};
840
- }
841
- onSubmit() {
842
- this.submitForm.emit();
843
- }
844
- }
845
- InviteUserFormComponent.decorators = [
846
- { type: Component, args: [{
847
- selector: 'xuilib-invite-user-form',
848
- template: "\n<form [formGroup]=\"inviteUserForm\" (ngSubmit)=\"onSubmit()\" >\n\n <xuilib-gov-uk-input\n [config]=\"{label: 'First name', hint: 'Include all middle names.', name: 'firstName', id: 'firstName', type: 'text', classes: 'testClass'}\"\n [errorMessage]=\"isInvalid.firstName\"\n [group]=\"inviteUserForm\">\n </xuilib-gov-uk-input>\n\n <xuilib-gov-uk-input\n [config]=\"{label: 'Last name', name: 'lastName', id: 'lastName', type: 'text'}\"\n [errorMessage]=\"isInvalid.lastName\"\n [group]=\"inviteUserForm\">\n </xuilib-gov-uk-input>\n\n <xuilib-gov-uk-input\n [config]=\"{label: 'Email address', name: 'email', id: 'email', type: 'email'}\"\n [errorMessage]=\"isInvalid.email\"\n [group]=\"inviteUserForm\">\n </xuilib-gov-uk-input>\n\n <xuilib-invite-permission-form [inviteUserForm]=\"inviteUserForm\" [errorMessages]=\"isInvalid.roles\">\n </xuilib-invite-permission-form>\n\n <button type=\"submit\" class=\"govuk-button\">\n Send invitation\n </button>\n</form>\n"
849
- },] }
850
- ];
851
- InviteUserFormComponent.propDecorators = {
852
- submitForm: [{ type: Output }],
853
- inviteUserForm: [{ type: Input }],
854
- errorMessages: [{ type: Input }]
855
- };
856
-
857
- class InviteUserPermissionComponent {
858
- constructor() {
859
- this.isPuiCaseManager = false;
860
- this.isPuiUserManager = false;
861
- this.isPuiOrganisationManager = false;
862
- this.isPuiFinanceManager = false;
863
- }
864
- }
865
- InviteUserPermissionComponent.decorators = [
866
- { type: Component, args: [{
867
- selector: 'xuilib-invite-permission-form',
868
- template: " <!--permissions -->\n <ng-container [formGroup]=\"inviteUserForm\">\n <xuilib-gov-uk-form-group-wrapper\n [config]=\"{hint: 'Choose what the user will be able to do. You can change this later.', legend: 'Permissions', key: 'roles'}\"\n [formGroupName]=\"'roles'\"\n [error]=\"errorMessages\">\n\n <div class=\"govuk-checkboxes\">\n <xuilib-gov-checkbox\n [group]=\"inviteUserForm.controls['roles']\"\n [isChecked]=\"isPuiCaseManager\"\n [config]=\"{value: 'pui-case-manager', label: 'Manage Cases', name: 'roles', hint: 'View, create and progress cases.', focusOn: 'roles'}\">\n </xuilib-gov-checkbox>\n\n <xuilib-gov-checkbox\n [group]=\"inviteUserForm.controls['roles']\"\n [isChecked]=\"isPuiUserManager\"\n [config]=\"{value: 'pui-user-manager', label: 'Manage Users', name: 'roles',\n hint: 'Invite users.'}\">\n </xuilib-gov-checkbox>\n\n <xuilib-gov-checkbox\n [group]=\"inviteUserForm.controls['roles']\"\n [isChecked]=\"isPuiOrganisationManager\"\n [config]=\"{value: 'pui-organisation-manager', label: 'Manage Organisation', name: 'roles',\n hint: 'View organisation name and addresses.'}\">\n </xuilib-gov-checkbox>\n\n <!-- <xuilib-gov-checkbox\n [group]=\"inviteUserForm.controls['roles']\"\n [isChecked]=\"isPuiFinanceManager\"\n [config]=\"{value: 'pui-finance-manager', label: 'Manage Payments', name: 'roles',\n hint: 'View account balances, available credit and transactions.'}\">\n </xuilib-gov-checkbox> -->\n </div>\n\n </xuilib-gov-uk-form-group-wrapper>\n</ng-container>"
869
- },] }
870
- ];
871
- InviteUserPermissionComponent.propDecorators = {
872
- inviteUserForm: [{ type: Input }],
873
- isPuiCaseManager: [{ type: Input }],
874
- isPuiUserManager: [{ type: Input }],
875
- isPuiOrganisationManager: [{ type: Input }],
876
- isPuiFinanceManager: [{ type: Input }],
877
- errorMessages: [{ type: Input }]
878
- };
879
-
880
- class LoadingSpinnerComponent {
881
- constructor() {
882
- this.loadingText = 'Loading';
883
- }
884
- }
885
- LoadingSpinnerComponent.decorators = [
886
- { type: Component, args: [{
887
- selector: 'xuilib-loading-spinner',
888
- template: "<div class=\"spinner-container\">\n <div class=\"spinner-inner-container\">\n <p>{{loadingText}}</p>\n <div class=\"spinner\" style=\"margin: auto;\"></div>\n </div>\n</div>\n",
889
- encapsulation: ViewEncapsulation.None,
890
- styles: [".spinner-container{position:fixed;top:0;left:0;height:100%;width:100%;display:flex;justify-content:center;align-items:center;background:hsla(0,0%,100%,.5);z-index:99}.spinner-container .spinner-inner-container p{text-align:center}.spinner-container .spinner-inner-container .spinner{border:10px solid #ddd;border-top-color:#000;border-radius:50%;width:40px;height:40px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"]
891
- },] }
892
- ];
893
- LoadingSpinnerComponent.propDecorators = {
894
- loadingText: [{ type: Input }]
895
- };
896
-
897
- class CaseSharingStateService {
898
- constructor() {
899
- this.caseState = [];
900
- this.subject = new BehaviorSubject(this.caseState);
901
- }
902
- get state() {
903
- return this.subject.asObservable().pipe(distinctUntilChanged());
904
- }
905
- setCases(cases) {
906
- this.caseState = [];
907
- cases.forEach(aCase => {
908
- this.caseState.push({ caseId: aCase.caseId, caseTitle: aCase.caseTitle, caseTypeId: aCase.caseTypeId, roles: aCase.roles,
909
- sharedWith: aCase.sharedWith, pendingShares: aCase.pendingShares, pendingUnshares: aCase.pendingUnshares });
910
- });
911
- this.subject.next(this.caseState);
912
- }
913
- getCases() {
914
- return this.caseState;
915
- }
916
- requestShare(user) {
917
- const oldSharedCases = this.caseState.slice();
918
- const newSharedCases = [];
919
- for (const sharedCase of oldSharedCases) {
920
- if (!sharedCase.pendingShares) {
921
- sharedCase.pendingShares = [];
922
- }
923
- const newPendingShares = sharedCase.pendingShares.slice();
924
- if (!sharedCase.pendingUnshares) {
925
- sharedCase.pendingUnshares = [];
926
- }
927
- const newPendingUnshares = sharedCase.pendingUnshares.slice();
928
- if (!this.userHasAccess(sharedCase, user)) {
929
- if (!newPendingShares.some(u => u.email === user.email)) {
930
- newPendingShares.push(user);
931
- }
932
- }
933
- else {
934
- for (let u = 0, ul = newPendingUnshares.length; u < ul; u++) {
935
- if (newPendingUnshares[u].email === user.email) {
936
- newPendingUnshares.splice(u, 1);
937
- break;
938
- }
939
- }
940
- }
941
- const newSharedCase = Object.assign(Object.assign({}, sharedCase), { pendingUnshares: newPendingUnshares, pendingShares: newPendingShares });
942
- newSharedCases.push(newSharedCase);
943
- }
944
- this.subject.next(newSharedCases);
945
- return newSharedCases;
946
- }
947
- requestUnshare(caseId, user) {
948
- const newSharedCases = [];
949
- for (const sharedCase of this.caseState) {
950
- if (sharedCase.caseId === caseId) {
951
- if (!sharedCase.pendingUnshares) {
952
- sharedCase.pendingUnshares = [];
953
- }
954
- const newPendingUnshares = sharedCase.pendingUnshares.slice();
955
- if (newPendingUnshares) {
956
- if (!newPendingUnshares.some(u => u.email === user.email)) {
957
- newPendingUnshares.push(user);
958
- }
959
- }
960
- else {
961
- newPendingUnshares.push(user);
962
- }
963
- const newSharedCase = Object.assign(Object.assign({}, sharedCase), { pendingUnshares: newPendingUnshares });
964
- newSharedCases.push(newSharedCase);
965
- }
966
- else {
967
- newSharedCases.push(sharedCase);
968
- }
969
- }
970
- this.subject.next(newSharedCases);
971
- return;
972
- }
973
- requestCancel(caseId, user) {
974
- const newSharedCases = [];
975
- for (const sharedCase of this.caseState) {
976
- if (sharedCase.caseId === caseId) {
977
- if (!sharedCase.pendingUnshares) {
978
- sharedCase.pendingUnshares = [];
979
- }
980
- const newPendingUnshares = sharedCase.pendingUnshares.slice();
981
- for (let iPendingUnshares = 0; iPendingUnshares < newPendingUnshares.length; iPendingUnshares++) {
982
- if (newPendingUnshares[iPendingUnshares].email === user.email) {
983
- newPendingUnshares.splice(iPendingUnshares, 1);
984
- break;
985
- }
986
- }
987
- if (!sharedCase.pendingShares) {
988
- sharedCase.pendingShares = [];
989
- }
990
- const newPendingShares = sharedCase.pendingShares.slice();
991
- for (let iPendingShares = 0; iPendingShares < newPendingShares.length; iPendingShares++) {
992
- if (newPendingShares[iPendingShares].email === user.email) {
993
- newPendingShares.splice(iPendingShares, 1);
994
- break;
995
- }
996
- }
997
- const newSharedCase = Object.assign(Object.assign({}, sharedCase), { pendingUnshares: newPendingUnshares, pendingShares: newPendingShares });
998
- newSharedCases.push(newSharedCase);
999
- }
1000
- else {
1001
- newSharedCases.push(sharedCase);
1002
- }
1003
- }
1004
- this.subject.next(newSharedCases);
1005
- return;
1006
- }
1007
- removeCase(caseId) {
1008
- for (let i = 0, l = this.caseState.length; i < l; i++) {
1009
- if (this.caseState[i].caseId === caseId) {
1010
- this.caseState.splice(i, 1);
1011
- this.subject.next(this.caseState);
1012
- return;
1013
- }
1014
- }
1015
- }
1016
- userHasAccess(c, user) {
1017
- if (!c.sharedWith) {
1018
- return false;
1019
- }
1020
- for (let i = 0, l = c.sharedWith.length; i < l; i++) {
1021
- if (c.sharedWith[i].email === user.email) {
1022
- return true;
1023
- }
1024
- }
1025
- return false;
1026
- }
1027
- }
1028
- CaseSharingStateService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CaseSharingStateService_Factory() { return new CaseSharingStateService(); }, token: CaseSharingStateService, providedIn: "root" });
1029
- CaseSharingStateService.decorators = [
1030
- { type: Injectable, args: [{
1031
- providedIn: 'root'
1032
- },] }
1033
- ];
1034
- CaseSharingStateService.ctorParameters = () => [];
1035
-
1036
- class SelectedCaseConfirmComponent {
1037
- constructor(stateService) {
1038
- this.stateService = stateService;
1039
- this.changeLink = '';
1040
- }
1041
- ngOnInit() {
1042
- this.shareCases$ = this.stateService.state;
1043
- this.shareCases$.subscribe(shareCases => this.shareCases = shareCases);
1044
- }
1045
- trackByUserId(user) {
1046
- return user.idamId;
1047
- }
1048
- showUserAccessBlock() {
1049
- if (this.sharedCase.pendingShares && this.sharedCase.pendingShares.length > 0) {
1050
- return true;
1051
- }
1052
- return this.sharedCase.pendingUnshares && this.sharedCase.pendingUnshares.length > 0;
1053
- }
1054
- }
1055
- SelectedCaseConfirmComponent.decorators = [
1056
- { type: Component, args: [{
1057
- selector: 'xuilib-selected-case-confirm',
1058
- template: "<div id=\"user-access-block-{{ sharedCase.caseId }}\" *ngIf=\"showUserAccessBlock()\">\n <h2 class=\"govuk-heading-m case-share-confirm__title\">{{ sharedCase.caseTitle }}</h2>\n <div class=\"case-share-confirm__caption-area\">\n <div class=\"govuk-caption-m case-share-confirm__caption\">\n {{ sharedCase.caseId }}\n </div>\n <a [routerLink]=\"changeLink\" class=\"case-share-confirm__change-link govuk-link govuk-!-font-size-19\">Change</a>\n </div>\n <table class=\"govuk-table\">\n <thead class=\"govuk-table__head\">\n <tr class=\"govuk-table__row\">\n <th class=\"govuk-table__header govuk-table-column-header\" scope=\"col\">Name</th>\n <th class=\"govuk-table__header govuk-table-column-header\" scope=\"col\">Email address</th>\n <th class=\"govuk-table__header govuk-table-column-actions\" scope=\"col\">Actions</th>\n </tr>\n </thead>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\" *ngFor=\"let user of sharedCase.pendingShares; trackBy: trackByUserId\">\n <td class=\"govuk-table__cell\">{{ user.firstName + ' ' + user.lastName }}</td>\n <td class=\"govuk-table__cell\">{{ user.email }}</td>\n <td class=\"govuk-table__cell\">\n <span class=\"hmcts-badge\">To be added</span>\n </td>\n </tr>\n <tr class=\"govuk-table__row\" *ngFor=\"let user of sharedCase.pendingUnshares; trackBy: trackByUserId\">\n <td class=\"govuk-table__cell\">{{ user.firstName + ' ' + user.lastName }}</td>\n <td class=\"govuk-table__cell\">{{ user.email }}</td>\n <td class=\"govuk-table__cell\">\n <span class=\"hmcts-badge hmcts-badge--red\">to be removed</span>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n",
1059
- styles: [".case-share-confirm__title{margin-bottom:0}.case-share-confirm__caption-area{border-bottom:1px solid #b1b4b6;padding-bottom:10px;display:inline-block;width:100%;clear:both}.case-share-confirm__caption{float:left}.case-share-confirm__change-link{float:right}.govuk-table-column-header{width:45%}.govuk-table-column-actions{width:10%}"]
1060
- },] }
1061
- ];
1062
- SelectedCaseConfirmComponent.ctorParameters = () => [
1063
- { type: CaseSharingStateService }
1064
- ];
1065
- SelectedCaseConfirmComponent.propDecorators = {
1066
- sharedCase: [{ type: Input }],
1067
- changeLink: [{ type: Input }]
1068
- };
1069
-
1070
- class SelectedCaseListComponent {
1071
- constructor(stateService) {
1072
- this.stateService = stateService;
1073
- this.shareCases = [];
1074
- this.toConfirm = false;
1075
- this.changeLink = '';
1076
- this.unselect = new EventEmitter();
1077
- this.synchronizeStore = new EventEmitter();
1078
- }
1079
- ngOnInit() {
1080
- this.shareCases$ = this.stateService.state;
1081
- this.shareCases$.subscribe(shareCases => this.shareCases = shareCases);
1082
- }
1083
- onUnselect(sharedCase) {
1084
- this.unselect.emit(sharedCase);
1085
- }
1086
- onSynchronizeStore(event) {
1087
- this.synchronizeStore.emit(event);
1088
- }
1089
- trackByCaseId(sharedCase) {
1090
- return sharedCase.caseId;
1091
- }
1092
- }
1093
- SelectedCaseListComponent.decorators = [
1094
- { type: Component, args: [{
1095
- selector: 'xuilib-selected-case-list',
1096
- template: "<ng-container *ngIf=\"!toConfirm\">\n <xuilib-selected-case\n *ngFor=\"let sharedCase of (shareCases$ | async); trackBy: trackByCaseId\"\n [sharedCase]=\"sharedCase\"\n [removeUserFromCaseToggleOn]=\"removeUserFromCaseToggleOn\"\n (unselect)=\"onUnselect($event)\"\n (synchronizeStore)=\"onSynchronizeStore($event)\"\n >\n </xuilib-selected-case>\n</ng-container>\n\n<ng-container *ngIf=\"toConfirm\">\n <xuilib-selected-case-confirm\n *ngFor=\"let sharedCase of (shareCases$ | async); trackBy: trackByCaseId\"\n [sharedCase]=\"sharedCase\"\n [changeLink]=\"changeLink\">\n </xuilib-selected-case-confirm>\n</ng-container>\n",
1097
- styles: [""]
1098
- },] }
1099
- ];
1100
- SelectedCaseListComponent.ctorParameters = () => [
1101
- { type: CaseSharingStateService }
1102
- ];
1103
- SelectedCaseListComponent.propDecorators = {
1104
- shareCases$: [{ type: Input }],
1105
- removeUserFromCaseToggleOn: [{ type: Input }],
1106
- toConfirm: [{ type: Input }],
1107
- changeLink: [{ type: Input }],
1108
- unselect: [{ type: Output }],
1109
- synchronizeStore: [{ type: Output }]
1110
- };
1111
-
1112
- class SelectedCaseComponent {
1113
- constructor(stateService) {
1114
- this.stateService = stateService;
1115
- this.opened = false;
1116
- this.unselect = new EventEmitter();
1117
- this.synchronizeStore = new EventEmitter();
1118
- }
1119
- ngOnInit() {
1120
- this.shareCases$ = this.stateService.state;
1121
- this.shareCases$.subscribe(shareCases => this.shareCases = shareCases);
1122
- }
1123
- ngOnChanges(changes) {
1124
- if (changes.sharedCase) {
1125
- const sharedWith = this.sharedCase.sharedWith ? this.sharedCase.sharedWith : [];
1126
- const pendingShares = this.sharedCase.pendingShares ? this.sharedCase.pendingShares : [];
1127
- this.combinedSortedShares = this.combineAndSortShares(sharedWith, pendingShares);
1128
- }
1129
- }
1130
- onUnselect() {
1131
- this.unselect.emit(this.sharedCase);
1132
- }
1133
- onDeselect(c) {
1134
- this.unselect.emit(c);
1135
- }
1136
- trackByUserId(user) {
1137
- return user.idamId;
1138
- }
1139
- canRemove(caseId, user) {
1140
- return this.shareCases$.pipe(map(cases => {
1141
- if (this.removeUserFromCaseToggleOn) {
1142
- for (const aCase of cases) {
1143
- if (aCase.caseId === caseId) {
1144
- if (aCase.pendingUnshares && aCase.pendingUnshares.some(u => u.idamId === user.idamId)) {
1145
- return false;
1146
- }
1147
- if (aCase.sharedWith && aCase.sharedWith.some(u => u.idamId === user.idamId)) {
1148
- return true;
1149
- }
1150
- }
1151
- }
1152
- }
1153
- return false;
1154
- }));
1155
- }
1156
- canCancel(caseId, user) {
1157
- return this.shareCases$.pipe(map(cases => {
1158
- for (const aCase of cases) {
1159
- if (aCase.caseId === caseId) {
1160
- if (aCase.pendingShares && aCase.pendingShares.some(u => u.idamId === user.idamId)) {
1161
- return true;
1162
- }
1163
- if (aCase.pendingUnshares && aCase.pendingUnshares.some(u => u.idamId === user.idamId)) {
1164
- return true;
1165
- }
1166
- return false;
1167
- }
1168
- }
1169
- }));
1170
- }
1171
- isToBeRemoved(caseId, user) {
1172
- return this.shareCases$.pipe(map(cases => {
1173
- for (const aCase of cases) {
1174
- if (aCase.caseId === caseId) {
1175
- return aCase.pendingUnshares && aCase.pendingUnshares.some(u => u.idamId === user.idamId);
1176
- }
1177
- }
1178
- }));
1179
- }
1180
- isToBeAdded(caseId, user) {
1181
- return this.shareCases$.pipe(map(cases => {
1182
- for (const aCase of cases) {
1183
- if (aCase.caseId === caseId) {
1184
- return aCase.pendingShares && aCase.pendingShares.some(u => u.idamId === user.idamId);
1185
- }
1186
- }
1187
- }));
1188
- }
1189
- onRemove(user, sharedCase) {
1190
- this.stateService.requestUnshare(sharedCase.caseId, user);
1191
- this.synchronizeStore.emit(this.shareCases);
1192
- }
1193
- onCancel(user, sharedCase) {
1194
- this.stateService.requestCancel(sharedCase.caseId, user);
1195
- this.synchronizeStore.emit(this.shareCases);
1196
- }
1197
- showNoUsersAccessInfo() {
1198
- // A user is added to a case
1199
- if (this.sharedCase.pendingShares) {
1200
- if (this.sharedCase.pendingShares.length > 0) {
1201
- return false;
1202
- }
1203
- }
1204
- // A case has 0 users with access to it
1205
- if (this.sharedCase.sharedWith) {
1206
- if (this.sharedCase.sharedWith.length === 0) {
1207
- return true;
1208
- }
1209
- }
1210
- // Access to the last user is removed
1211
- if (this.sharedCase.sharedWith && this.sharedCase.pendingUnshares) {
1212
- if (this.sharedCase.pendingUnshares.length > 0
1213
- && this.sharedCase.sharedWith.length === this.sharedCase.pendingUnshares.length) {
1214
- return true;
1215
- }
1216
- }
1217
- return false;
1218
- }
1219
- showUserHasAccessInfo() {
1220
- return !this.showNoUsersAccessInfo();
1221
- }
1222
- showUserAccessTable() {
1223
- if (this.sharedCase.pendingShares) {
1224
- if (this.sharedCase.pendingShares.length > 0) {
1225
- return true;
1226
- }
1227
- }
1228
- if (this.sharedCase.sharedWith) {
1229
- if (this.sharedCase.sharedWith.length > 0) {
1230
- return true;
1231
- }
1232
- }
1233
- return false;
1234
- }
1235
- combineAndSortShares(sharedWith, pendingShares) {
1236
- return [
1237
- ...sharedWith,
1238
- ...pendingShares
1239
- ].sort((user1, user2) => {
1240
- return user1.firstName.toLowerCase() > user2.firstName.toLowerCase() ? 1 : (user2.firstName.toLowerCase() > user1.firstName.toLowerCase() ? -1 : 0);
1241
- });
1242
- }
1243
- userIdSetter(isPending, id) {
1244
- return isPending ? `pendingShares-${id}` : `${id}`;
1245
- }
1246
- buildElementId(elementName) {
1247
- return `${elementName}-${this.sharedCase.caseId}`;
1248
- }
1249
- }
1250
- SelectedCaseComponent.decorators = [
1251
- { type: Component, args: [{
1252
- selector: 'xuilib-selected-case',
1253
- template: "<div id=\"{{buildElementId('govuk-accordion__section')}}\" class=\"govuk-accordion__section\">\n <div class=\"govuk-grid-row govuk-case-header\">\n <div class=\"govuk-grid-column-three-quarters\">\n <h3 id=\"{{buildElementId('case-title')}}\" class=\"govuk-case-title\">{{ sharedCase.caseTitle }}</h3>\n <h1 id=\"{{buildElementId('case-id')}}\" class=\"govuk-case-sub-title\">{{ sharedCase.caseId }}</h1>\n </div>\n <div class=\"govuk-grid-column-twenty-percent\">\n <button id=\"{{buildElementId('btn-deselect-case')}}\" class=\"govuk-button hmcts-button--secondary\" (click)=\"onDeselect(sharedCase)\" title=\"Deselect case\">Deselect case</button>\n </div>\n <div class=\"govuk-accordion__section-header govuk-grid-column-five-percent\">\n <div class=\"govuk-accordion__section-heading\">\n <button type=\"button\" id=\"{{buildElementId('accordion-with-summary-sections-heading')}}\"\n aria-controls=\"accordion-with-summary-sections-content-1\" class=\"govuk-accordion__section-button\"\n aria-describedby=\"accordion-with-summary-sections-summary-1\" aria-expanded=\"false\" title=\"Expand or Collapse\">\n <span class=\"govuk-accordion__icon\" aria-hidden=\"true\"></span></button>\n </div>\n </div>\n </div>\n <div id=\"{{buildElementId('accordion-with-summary-sections-content')}}\" class=\"govuk-accordion__section-content\"\n aria-labelledby=\"buildElementId('accordion-with-summary-sections-heading')\" >\n <div class=\"govuk-grid-row\" *ngIf=\"showNoUsersAccessInfo()\">\n <span id=\"{{buildElementId('access-info-no-user')}}\" class=\"govuk-div-align-left\">No users from your organisation currently have access to this case.</span>\n </div>\n <div class=\"govuk-grid-row\" *ngIf=\"showUserHasAccessInfo()\">\n <span id=\"{{buildElementId('access-info-has-users')}}\" class=\"govuk-div-align-left\">Users from your organisation with access to this case.</span>\n </div>\n <table class=\"govuk-table\" *ngIf=\"showUserAccessTable()\">\n <thead class=\"govuk-table__head\">\n <tr class=\"govuk-table__row\">\n <th id=\"{{buildElementId('name-heading')}}\" class=\"govuk-table__header govuk-table-column-header\" scope=\"col\">Name</th>\n <th id=\"{{buildElementId('email-heading')}}\" class=\"govuk-table__header govuk-table-column-header\" scope=\"col\">Email address</th>\n <th id=\"{{buildElementId('action-heading')}}\" class=\"govuk-table__header govuk-table-column-actions\" scope=\"col\">Actions</th>\n <th id=\"{{buildElementId('label-heading')}}\" class=\"govuk-table__header govuk-table-column-label\" scope=\"col\">&nbsp;&nbsp;</th>\n </tr>\n </thead>\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\" *ngFor=\"let user of combinedSortedShares; index as idx; trackBy: trackByUserId\">\n <td id=\"user-full-name-{{ userIdSetter(canCancel(sharedCase.caseId, user) | async, idx) }}\" class=\"govuk-table__cell\">{{ user.firstName + ' ' + user.lastName }}</td>\n <td id=\"user-email-{{ userIdSetter(canCancel(sharedCase.caseId, user) | async, idx) }}\" class=\"govuk-table__cell\">{{ user.email }}</td>\n <td class=\"govuk-table__cell\">\n <a *ngIf=\"canRemove(sharedCase.caseId, user) | async\" (click)=\"onRemove(user, sharedCase)\" href=\"javascript:void(0);\">Remove <span class=\"govuk-visually-hidden\">{{ user.firstName + ' ' + user.lastName }} from case</span></a>\n <a *ngIf=\"canCancel(sharedCase.caseId, user) | async\" (click)=\"onCancel(user, sharedCase)\" href=\"javascript:void(0);\">Cancel <span class=\"govuk-visually-hidden\">adding {{ user.firstName + ' ' + user.lastName }} to case</span></a>\n </td>\n <td class=\"govuk-table__cell\">\n <span *ngIf=\"isToBeRemoved(sharedCase.caseId, user) | async\" class=\"hmcts-badge hmcts-badge--red\">To be removed</span>\n <span *ngIf=\"isToBeAdded(sharedCase.caseId, user) | async\" class=\"hmcts-badge\">To be added</span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>\n",
1254
- styles: [".govuk-case-header{border-top:1px solid #bfc1c3}.govuk-case-title{font-size:24px;color:#005ea5;font-weight:700}.govuk-case-sub-title,.govuk-case-title{font-family:nta,Arial,sans-serif;padding-left:0}.govuk-case-sub-title{font-size:1rem!important;color:#6f777b;font-weight:400}.govuk-grid-row{margin-left:0;margin-right:0}.govuk-grid-column-three-quarters{padding-top:5px;padding-left:0}.govuk-grid-column-twenty-percent{box-sizing:border-box;padding-top:10px;width:20%;float:left}.govuk-grid-column-five-percent{box-sizing:border-box;padding-top:15px;width:5%;float:left}.govuk-table-column-header{width:40%}.govuk-table-column-actions,.govuk-table-column-label{width:10%}.govuk-div-align-left{font-family:nta,Arial,sans-serif;font-size:1.1875rem!important;line-height:1.31579!important;text-align:left;margin-bottom:20px;padding-left:0;color:#0b0c0c}.govuk-accordion__section-header{border-top:0}.govuk-accordion__section-content{padding-top:0}"]
1255
- },] }
1256
- ];
1257
- SelectedCaseComponent.ctorParameters = () => [
1258
- { type: CaseSharingStateService }
1259
- ];
1260
- SelectedCaseComponent.propDecorators = {
1261
- sharedCase: [{ type: Input }],
1262
- selectedUser: [{ type: Input }],
1263
- opened: [{ type: Input }],
1264
- removeUserFromCaseToggleOn: [{ type: Input }],
1265
- unselect: [{ type: Output }],
1266
- synchronizeStore: [{ type: Output }]
1267
- };
1268
-
1269
- class ServiceMessageComponent {
1270
- constructor() {
1271
- this.hideMessage = new EventEmitter();
1272
- }
1273
- onHideMessageEvent(key) {
1274
- this.hideMessage.emit(key);
1275
- }
1276
- }
1277
- ServiceMessageComponent.decorators = [
1278
- { type: Component, args: [{
1279
- selector: 'xuilib-service-message',
1280
- template: "<div class=\"hmcts-banner hmcts-banner--warning\">\n\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\"\n xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\">\n <path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\" />\n </svg>\n\n <div class=\"hmcts-banner__message\">\n <span class=\"hmcts-banner__assistive\">Warning</span>\n <h2 class=\"govuk-heading-s\" [innerHTML]=\"message\"></h2>\n <a [routerLink]=\"\" class=\"govuk-link--no-visited-state\" (click)=\"onHideMessageEvent(key)\">Hide message</a>\n </div>\n\n</div>"
1281
- },] }
1282
- ];
1283
- ServiceMessageComponent.ctorParameters = () => [];
1284
- ServiceMessageComponent.propDecorators = {
1285
- message: [{ type: Input }],
1286
- key: [{ type: Input }],
1287
- hideMessage: [{ type: Output }]
1288
- };
1289
-
1290
- class FeatureToggleService {
1291
- // tslint:disable-next-line: variable-name
1292
- initialize(_user, _clientId) {
1293
- throw new Error('Not implemented');
1294
- }
1295
- // tslint:disable-next-line: variable-name
1296
- isEnabled(_feature) {
1297
- throw new Error('Not implemented');
1298
- }
1299
- // tslint:disable-next-line: variable-name
1300
- getValue(_key, _defaultValue) {
1301
- throw new Error('Not implemented');
1302
- }
1303
- // tslint:disable-next-line: variable-name
1304
- getValueOnce(_key, _defaultValue) {
1305
- throw new Error('Not implemented');
1306
- }
1307
- }
1308
- FeatureToggleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FeatureToggleService_Factory() { return new FeatureToggleService(); }, token: FeatureToggleService, providedIn: "root" });
1309
- FeatureToggleService.decorators = [
1310
- { type: Injectable, args: [{
1311
- providedIn: 'root'
1312
- },] }
1313
- ];
1314
-
1315
- class ServiceMessagesComponent {
1316
- constructor(featureToggleService) {
1317
- this.featureToggleService = featureToggleService;
1318
- this.filteredMessages = new Map();
1319
- }
1320
- ngOnInit() {
1321
- this.getServiceMessages();
1322
- }
1323
- getServiceMessages() {
1324
- this.featureToggleService.getValue(this.featureToggleKey, null)
1325
- .subscribe(messages => {
1326
- if (!!messages) {
1327
- this.createFilteredMessages(messages);
1328
- }
1329
- });
1330
- }
1331
- createFilteredMessages(messages) {
1332
- this.hiddenBanners = JSON.parse(window.sessionStorage.getItem(this.serviceMessageCookie)) || [];
1333
- Object.keys(messages).forEach(key => {
1334
- const regEx = new RegExp(key);
1335
- if (this.userRoles.some(e => regEx.test(e)) && this.hiddenBanners.indexOf(key) === -1) {
1336
- this.filteredMessages.set(key, messages[key]);
1337
- }
1338
- });
1339
- }
1340
- hideMessage(key) {
1341
- this.filteredMessages.delete(key);
1342
- this.hiddenBanners.push(key);
1343
- window.sessionStorage.setItem(this.serviceMessageCookie, JSON.stringify(this.hiddenBanners));
1344
- }
1345
- }
1346
- ServiceMessagesComponent.decorators = [
1347
- { type: Component, args: [{
1348
- selector: 'xuilib-service-messages',
1349
- template: "<div *ngIf=\"filteredMessages?.size > 0\" class=\"govuk-width-container govuk-!-margin-top-6\">\n <xuilib-service-message *ngFor=\"let message of filteredMessages | keyvalue\" [key]=\"message.key\"\n [message]=\"message.value\" (hideMessage)=\"hideMessage($event)\"></xuilib-service-message>\n</div>"
1350
- },] }
1351
- ];
1352
- ServiceMessagesComponent.ctorParameters = () => [
1353
- { type: FeatureToggleService }
1354
- ];
1355
- ServiceMessagesComponent.propDecorators = {
1356
- userRoles: [{ type: Input }],
1357
- featureToggleKey: [{ type: Input }],
1358
- serviceMessageCookie: [{ type: Input }]
1359
- };
1360
-
1361
- class ShareCaseConfirmComponent {
1362
- constructor(stateService) {
1363
- this.stateService = stateService;
1364
- this.shareCases = []; // cases selected for sharing
1365
- this.changeLink = '';
1366
- this.completeLink = '';
1367
- }
1368
- ngOnInit() {
1369
- this.shareCases$.subscribe(shareCases => {
1370
- this.shareCases = shareCases;
1371
- this.stateService.setCases(shareCases);
1372
- });
1373
- this.shareCases$ = this.stateService.state;
1374
- }
1375
- }
1376
- ShareCaseConfirmComponent.decorators = [
1377
- { type: Component, args: [{
1378
- selector: 'xuilib-share-case-confirm',
1379
- template: "<div id=\"casesToConfirm\">\n <h3 class=\"govuk-heading-l\">Cases</h3>\n <div *ngIf=\"shareCases && shareCases.length > 0\" id=\"summarySections\">\n <xuilib-selected-case-list\n [shareCases$]=\"shareCases$\"\n [toConfirm]=\"true\"\n [changeLink]=\"changeLink\">\n </xuilib-selected-case-list>\n </div>\n\n <div id=\"noCaseDisplay\" *ngIf=\"shareCases && shareCases.length === 0\" class=\"govuk-hint\">\n No cases to display.\n </div>\n\n</div>\n\n<div id=\"share-case-nav\" *ngIf=\"shareCases && shareCases.length > 0\">\n <button class=\"govuk-button\" title=\"Confirm\" [routerLink]=\"completeLink\">Confirm</button>\n</div>\n",
1380
- styles: [""]
1381
- },] }
1382
- ];
1383
- ShareCaseConfirmComponent.ctorParameters = () => [
1384
- { type: CaseSharingStateService }
1385
- ];
1386
- ShareCaseConfirmComponent.propDecorators = {
1387
- shareCases$: [{ type: Input }],
1388
- changeLink: [{ type: Input }],
1389
- completeLink: [{ type: Input }]
1390
- };
1391
-
1392
- class UserSelectComponent {
1393
- constructor() {
1394
- this.selected = new EventEmitter();
1395
- this.control = new FormControl();
1396
- }
1397
- ngOnInit() {
1398
- this.filteredUsers = this.control.valueChanges.pipe(map(value => typeof value === typeof 'string' ? this.filterUsers(value) : this.users));
1399
- this.selected.emit(null);
1400
- }
1401
- displayValue(user) {
1402
- return user ? `${user.firstName} ${user.lastName} - ${user.email}` : '';
1403
- }
1404
- onSelected(e) {
1405
- this.selected.emit(e.option.value);
1406
- }
1407
- clear() {
1408
- this.control.setValue(null);
1409
- }
1410
- onUserChange(newUserValue) {
1411
- if (!newUserValue || !newUserValue.email) {
1412
- this.selected.emit(null);
1413
- }
1414
- }
1415
- filterUsers(value) {
1416
- if (value) {
1417
- value = value.toLowerCase();
1418
- return this.users.filter(user => {
1419
- if (user.firstName.toLowerCase().includes(value)) {
1420
- return true;
1421
- }
1422
- if (user.lastName.toLowerCase().includes(value)) {
1423
- return true;
1424
- }
1425
- if (user.email.toLowerCase().includes(value)) {
1426
- return true;
1427
- }
1428
- return false;
1429
- });
1430
- }
1431
- return [];
1432
- }
1433
- }
1434
- UserSelectComponent.decorators = [
1435
- { type: Component, args: [{
1436
- selector: 'xuilib-user-select',
1437
- template: "<input class=\"govuk-input\" type=\"text\" [matAutocomplete]=\"dropdown\" [formControl]=\"control\" (ngModelChange)=\"onUserChange($event)\" aria-labelledby=\"add-user-hint\">\n\n<mat-autocomplete #dropdown=\"matAutocomplete\" [displayWith]=\"displayValue\" autoActiveFirstOption (optionSelected)=\"onSelected($event)\">\n <mat-option *ngFor=\"let user of filteredUsers | async\" [value]=\"user\">\n {{ user.firstName }} {{ user.lastName }} - {{ user.email }}\n </mat-option>\n</mat-autocomplete>",
1438
- styles: [""]
1439
- },] }
1440
- ];
1441
- UserSelectComponent.ctorParameters = () => [];
1442
- UserSelectComponent.propDecorators = {
1443
- users: [{ type: Input }],
1444
- selected: [{ type: Output }]
1445
- };
1446
-
1447
- class ShareCaseComponent {
1448
- constructor(stateService) {
1449
- this.stateService = stateService;
1450
- this.shareCases = []; // cases selected for sharing
1451
- this.removeUserFromCaseToggleOn = false;
1452
- this.users = []; // users of this organisation the cases can be shared with
1453
- this.confirmLink = '';
1454
- this.unselect = new EventEmitter();
1455
- this.synchronizeStore = new EventEmitter();
1456
- }
1457
- ngOnInit() {
1458
- this.shareCases$.subscribe(shareCases => {
1459
- this.shareCases = shareCases;
1460
- this.stateService.setCases(shareCases);
1461
- });
1462
- this.shareCases$ = this.stateService.state;
1463
- }
1464
- onUnselect(c) {
1465
- this.unselect.emit(c);
1466
- this.stateService.removeCase(c.caseId);
1467
- }
1468
- onSynchronizeStore(event) {
1469
- this.synchronizeStore.emit(event);
1470
- }
1471
- onSelectedUser(user) {
1472
- this.selectedUser = user;
1473
- }
1474
- addUser() {
1475
- const newSharedCases = this.stateService.requestShare(this.selectedUser);
1476
- this.selectedUser = null;
1477
- if (this.userSelect) {
1478
- this.userSelect.clear();
1479
- }
1480
- this.synchronizeStore.emit(newSharedCases);
1481
- }
1482
- isDisabledAdd() {
1483
- return this.selectedUser === null || this.shareCases.length === 0;
1484
- }
1485
- isDisabledContinue() {
1486
- let isDisabled = true;
1487
- this.shareCases$.subscribe(shareCases => {
1488
- for (const caseState of shareCases) {
1489
- if (caseState.pendingShares && caseState.pendingShares.length > 0) {
1490
- isDisabled = false;
1491
- break;
1492
- }
1493
- if (caseState.pendingUnshares && caseState.pendingUnshares.length > 0) {
1494
- isDisabled = false;
1495
- break;
1496
- }
1497
- }
1498
- });
1499
- return isDisabled;
1500
- }
1501
- onDeselect(sharedCase) {
1502
- if (sharedCase !== null) {
1503
- const updated = [];
1504
- for (const element of this.shareCases) {
1505
- if (element.caseId !== sharedCase.caseId) {
1506
- updated.push(element);
1507
- }
1508
- }
1509
- this.shareCases = updated;
1510
- }
1511
- this.stateService.setCases(this.shareCases);
1512
- }
1513
- }
1514
- ShareCaseComponent.decorators = [
1515
- { type: Component, args: [{
1516
- selector: 'xuilib-share-case',
1517
- template: "<div id=\"add-user\">\n <label class=\"govuk-label govuk-!-font-weight-bold\" for=\"add-user-input\">Enter email address</label>\n <span id=\"add-user-hint\" class=\"govuk-hint\">\n Search by name or email address. You can only add people from your organisation individually - but you can add as many as you like.\n </span>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <xuilib-user-select\n id=\"add-user-input\"\n aria-describedby=\"add-user-hint\"\n [users]=\"users\"\n (selected)=\"onSelectedUser($event)\">\n </xuilib-user-select>\n </div>\n <div class=\"govuk-grid-column-one-thirds\">\n <button id=\"btn-add-user\" (click)=\"addUser()\" class=\"govuk-button\" [disabled]=\"isDisabledAdd()\" title=\"Add user to the case\">Add</button>\n </div>\n </div>\n <details id=\"add-user-help\" class=\"govuk-details\" data-module=\"govuk-details\">\n <summary class=\"govuk-details__summary\">\n <span id=\"content-why-can-not-find-email\" class=\"govuk-details__summary-text\">\n Can\u2019t find an email address?\n </span>\n </summary>\n <div id=\"content-reason-can-not-find-email\" class=\"govuk-details__text\">\n If you can\u2019t find your colleague\u2019s email address, they will need to complete their registration. Contact your\n administrator for help.\n </div>\n </details>\n</div>\n\n<div id=\"cases\">\n <h3 id=\"title-selected-cases\" class=\"govuk-heading-m\">Selected cases</h3>\n <div *ngIf=\"shareCases && shareCases.length > 0\" class=\"govuk-accordion\" data-module=\"govuk-accordion\" id=\"accordion-with-summary-sections\">\n <xuilib-selected-case-list\n [shareCases$]=\"shareCases$\"\n [removeUserFromCaseToggleOn]=\"removeUserFromCaseToggleOn\"\n (unselect)=\"onUnselect($event)\"\n (synchronizeStore)=\"onSynchronizeStore($event)\"\n >\n </xuilib-selected-case-list>\n </div>\n\n <div id=\"noCaseDisplay\" *ngIf=\"shareCases && shareCases.length === 0\" class=\"govuk-hint\">\n No cases to display.\n </div>\n\n</div>\n\n<div id=\"share-case-nav\">\n <button class=\"govuk-button\" [disabled]=\"isDisabledContinue()\" title=\"Continue\" [routerLink]=\"confirmLink\">Continue</button>\n</div>\n",
1518
- styles: [""]
1519
- },] }
1520
- ];
1521
- ShareCaseComponent.ctorParameters = () => [
1522
- { type: CaseSharingStateService }
1523
- ];
1524
- ShareCaseComponent.propDecorators = {
1525
- removeUserFromCaseToggleOn: [{ type: Input }],
1526
- shareCases$: [{ type: Input }],
1527
- users: [{ type: Input }],
1528
- confirmLink: [{ type: Input }],
1529
- unselect: [{ type: Output }],
1530
- synchronizeStore: [{ type: Output }],
1531
- userSelect: [{ type: ViewChild, args: [UserSelectComponent, { static: true },] }]
1532
- };
1533
-
1534
- class TabComponent {
1535
- constructor() {
1536
- this.tabChange = new EventEmitter();
1537
- }
1538
- tabChanged(event) {
1539
- this.tabChange.emit(event);
1540
- }
1541
- }
1542
- TabComponent.decorators = [
1543
- { type: Component, args: [{
1544
- selector: 'xuilib-tab',
1545
- template: "<mat-tab-group animationDuration=\"0ms\" (selectedTabChange)=\"tabChanged($event)\">\n <mat-tab *ngFor=\"let tabItem of tabItems; let last = last;\" [label]=\"tabItem.text\">\n </mat-tab>\n</mat-tab-group>"
1546
- },] }
1547
- ];
1548
- TabComponent.ctorParameters = () => [];
1549
- TabComponent.propDecorators = {
1550
- tabItems: [{ type: Input }],
1551
- tabChange: [{ type: Output }]
1552
- };
1553
-
1554
- class TcConfirmComponent {
1555
- constructor() {
1556
- this.confirm = new EventEmitter();
1557
- }
1558
- onClick() {
1559
- this.confirm.emit();
1560
- }
1561
- }
1562
- TcConfirmComponent.decorators = [
1563
- { type: Component, args: [{
1564
- selector: 'xuilib-tc-confirm',
1565
- template: "<div class=\"govuk-width-container\">\n <main role=\"main\" class=\"govuk-main-wrapper\">\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <div class=\"column-two-thirds\">\n <h1 class=\"govuk-heading-xl\">Using this service</h1>\n <h2 class=\"govuk-heading-m\">Terms and conditions</h2>\n <p>We've recently updated the\n <a\n routerLink=\"/terms-and-conditions\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >terms and conditions</a\n >.\n </p>\n <p>You must review and accept them.\n </p>\n <p>\n <button class=\"govuk-button\" (click)=\"onClick()\">\n {{ buttonText }}\n </button>\n </p>\n </div>\n </div>\n </div>\n <div class=\"govuk-grid-column-one-third\"></div>\n </main>\n</div>\n",
1566
- styles: [""]
1567
- },] }
1568
- ];
1569
- TcConfirmComponent.ctorParameters = () => [];
1570
- TcConfirmComponent.propDecorators = {
1571
- buttonText: [{ type: Input }],
1572
- confirm: [{ type: Output }]
1573
- };
1574
-
1575
- class TcDisplayHtmlComponent {
1576
- constructor() { }
1577
- }
1578
- TcDisplayHtmlComponent.decorators = [
1579
- { type: Component, args: [{
1580
- selector: 'xuilib-tc-display-html',
1581
- template: "<ng-content></ng-content>",
1582
- styles: [":host{display:block;width:100%}"]
1583
- },] }
1584
- ];
1585
- TcDisplayHtmlComponent.ctorParameters = () => [];
1586
-
1587
- class TcDisplayPlainComponent {
1588
- constructor() { }
1589
- }
1590
- TcDisplayPlainComponent.decorators = [
1591
- { type: Component, args: [{
1592
- selector: 'xuilib-tc-display-plain',
1593
- template: "<ng-content></ng-content>",
1594
- styles: [":host{display:block;width:100%}"]
1595
- },] }
1596
- ];
1597
- TcDisplayPlainComponent.ctorParameters = () => [];
1598
-
1599
- class TermsAndConditionsComponent {
1600
- constructor() { }
1601
- }
1602
- TermsAndConditionsComponent.decorators = [
1603
- { type: Component, args: [{
1604
- selector: 'xuilib-terms-and-conditions',
1605
- template: "<ng-container [ngSwitch]=\"document.mimeType\">\n <xuilib-tc-display-html *ngSwitchCase=\"'text/html'\">\n <div [innerHTML]=\"document.content\"></div>\n </xuilib-tc-display-html>\n <xuilib-tc-display-plain *ngSwitchCase=\"'text/plain'\">\n {{ document.content }}\n </xuilib-tc-display-plain>\n <div *ngSwitchDefault>\n An error occured. Please try again.\n </div>\n</ng-container>\n",
1606
- styles: [":host{display:block;width:100%}"]
1607
- },] }
1608
- ];
1609
- TermsAndConditionsComponent.ctorParameters = () => [];
1610
- TermsAndConditionsComponent.propDecorators = {
1611
- document: [{ type: Input }]
1612
- };
1613
-
1614
- class UserDetailsComponent {
1615
- constructor() {
1616
- this.showEditLink = false;
1617
- this.showHelpLink = false;
1618
- this.suspendUserEvent = new EventEmitter();
1619
- this.showSuspendUserButton = false;
1620
- this.reinvite = new EventEmitter();
1621
- }
1622
- reinviteClick(user) {
1623
- this.reinvite.emit(user);
1624
- }
1625
- suspendUser(suspendUser) {
1626
- this.suspendUserEvent.emit(suspendUser);
1627
- }
1628
- userHasRole(theRole) {
1629
- if (this.user && this.user.roles) {
1630
- return this.user.roles.includes(theRole);
1631
- }
1632
- return false;
1633
- }
1634
- }
1635
- UserDetailsComponent.decorators = [
1636
- { type: Component, args: [{
1637
- selector: 'xuilib-user-details',
1638
- template: "<div class=\"govuk-warning-text\" *ngIf=\"warningTitle && warningTitle !== ''\">\n<span class=\"govuk-warning-text__icon\">!</span>\n<strong class=\"govuk-warning-text__text\">\n {{ warningTitle }}\n</strong>\n</div>\n<table class=\"govuk-table\" *ngIf=\"user\">\n <tbody class=\"govuk-table__body\">\n <tr class=\"govuk-table__row\">\n <th class=\"govuk-table__header\" scope=\"row\">Name</th>\n <td class=\"govuk-table__cell\">{{user.fullName}}</td>\n <td class=\"govuk-table__cell\"></td>\n </tr>\n <tr class=\"govuk-table__row\">\n <th class=\"govuk-table__header\" scope=\"row\">Email address</th>\n <td class=\"govuk-table__cell\">{{user.email}}</td>\n <td class=\"govuk-table__cell\"></td>\n </tr>\n <tr class=\"govuk-table__row\" *ngIf=\"!user.resendInvite\">\n <th class=\"govuk-table__header\" scope=\"row\">Permissions</th>\n <td class=\"govuk-table__cell\">\n <div *ngIf=\"user.manageOrganisations === 'Yes'\">Manage organisations</div>\n <div *ngIf=\"user.manageUsers === 'Yes'\">Manage users</div>\n <div *ngIf=\"user.manageCases === 'Yes'\">Manage cases</div>\n <div *ngIf=\"userHasRole('pui-caa')\">Case access administrator</div>\n <div *ngIf=\"userHasRole('pui-finance-manager')\">Manage fee accounts</div>\n </td>\n <td class=\"govuk-table__cell\"><a *ngIf=\"editPermissionRouterLink && showEditLink\" [routerLink]=\"editPermissionRouterLink\">Change <span class=\"govuk-visually-hidden\">roles</span></a></td>\n </tr>\n </tbody>\n</table>\n<button *ngIf=\"showSuspendUserButton\" class=\"govuk-button govuk-button--warning\" (click)=\"suspendUser(user)\">\n Suspend account\n</button>\n<div *ngIf=\"user && user.resendInvite\">\n <div class=\"govuk-inset-text\">\n <p>This user has already been invited but has not activated their account.</p>\n <p>If you resend an invitation, they'll receive an email from HM Courts and Tribunals to finish setting up their account.</p>\n <p>You can't invite the same user more than once an hour.</p>\n </div>\n <a role=\"button\" draggable=\"false\" class=\"govuk-button\" (click)=\"reinviteClick(user)\" id=\"resend-invite-button\">\n Resend invitation\n </a>\n</div>\n<p class=\"govuk-body\" *ngIf=\"showHelpLink && suspendHelpLink\"><a [routerLink]=\"suspendHelpLink\" target=\"_blank\">Get help</a> to reactivate this account.</p>\n",
1639
- styles: [":host{display:block}"]
1640
- },] }
1641
- ];
1642
- UserDetailsComponent.propDecorators = {
1643
- user: [{ type: Input }],
1644
- editPermissionRouterLink: [{ type: Input }],
1645
- warningTitle: [{ type: Input }],
1646
- showEditLink: [{ type: Input }],
1647
- showHelpLink: [{ type: Input }],
1648
- suspendHelpLink: [{ type: Input }],
1649
- suspendUserEvent: [{ type: Output }],
1650
- showSuspendUserButton: [{ type: Input }],
1651
- reinvite: [{ type: Output }]
1652
- };
1653
-
1654
- class UserListComponent {
1655
- constructor() {
1656
- this.users = [];
1657
- this.userClick = new EventEmitter();
1658
- this.pageChange = new EventEmitter();
1659
- }
1660
- ngOnInit() {
1661
- this.pagination = { itemsPerPage: 50, currentPage: this.currentPageNumber, totalItems: this.pageTotalSize };
1662
- }
1663
- onUserClick(user) {
1664
- this.userClick.emit(user);
1665
- }
1666
- emitPageClickEvent(pageNumber) {
1667
- this.currentPageNumber = pageNumber;
1668
- this.pageChange.emit(pageNumber);
1669
- }
1670
- }
1671
- UserListComponent.decorators = [
1672
- { type: Component, args: [{
1673
- selector: 'xuilib-user-list',
1674
- template: "<table class=\"govuk-table\">\n\n <thead clas=\"govuk-table__head\">\n <tr class=\"govuk-table__row\">\n <th class=\"govuk-table__header\" scope=\"col\">Name</th>\n <th class=\"govuk-table__header\" scope=\"col\">Email</th>\n <th class=\"govuk-table__header\" scope=\"col\">Status</th>\n </tr>\n </thead>\n <tbody class=\"govuk-table__body\">\n <ng-container *ngFor=\"let u of users | paginate: { itemsPerPage: pagination.itemsPerPage, currentPage: currentPageNumber, totalItems: pagination.totalItems }\">\n <tr class=\"govuk-table__row\" data-selector=\"table-row\">\n <td class=\"govuk-table__cell\" data-selector=\"table-cell\">\n <a class=\"govuk-link\" [attr.title]=\"u.routerLinkTitle\" [routerLink]=\"u.routerLink\" (click)=\"onUserClick(u)\">{{ u.fullName }}</a>\n </td>\n <td class=\"govuk-table__cell\" data-selector=\"table-cell\">{{ u.email }}</td>\n <td class=\"govuk-table__cell\" data-selector=\"table-cell\">{{ u.status }}</td>\n </tr>\n </ng-container>\n </tbody>\n</table>\n<xuilib-hmcts-pagination (pageChange)=\"emitPageClickEvent($event)\" [pageSize]=\"pagination.itemsPerPage\"></xuilib-hmcts-pagination>\n",
1675
- styles: [":host{display:block}"]
1676
- },] }
1677
- ];
1678
- UserListComponent.propDecorators = {
1679
- users: [{ type: Input }],
1680
- currentPageNumber: [{ type: Input }],
1681
- pageTotalSize: [{ type: Input }],
1682
- userClick: [{ type: Output }],
1683
- pageChange: [{ type: Output }]
1684
- };
1685
-
1686
- class CookieService {
1687
- constructor(doc) {
1688
- this.document = doc;
1689
- }
1690
- setCookie(key, value, expiryDate) {
1691
- const expiry = expiryDate ? ` expires=${expiryDate}` : '';
1692
- const cookie = `${key}=${value};${expiry}`;
1693
- this.document.cookie = cookie;
1694
- }
1695
- getCookie(key) {
1696
- const cookieValue = this.document.cookie
1697
- .split('; ')
1698
- .find(row => row.startsWith(`${key}=`))
1699
- .split('=')[1];
1700
- return cookieValue;
1701
- }
1702
- deleteCookie(key, path, domain) {
1703
- const pathValue = path ? `; path=${path}` : '';
1704
- const domainValue = domain ? `; domain=${domain}` : '';
1705
- this.document.cookie = `${key}=${pathValue}${domainValue}; expires=Thu, 01 Jan 1970 00:00:01 GMT; max-age=0`;
1706
- }
1707
- deleteCookieByPartialMatch(key, path, domain) {
1708
- this.document.cookie
1709
- .split('; ')
1710
- .filter(row => row.startsWith(`${key}`))
1711
- .forEach(element => {
1712
- this.deleteCookie(element.split('=')[0], path, domain);
1713
- });
1714
- }
1715
- checkCookie(key) {
1716
- return this.document.cookie.split('; ').some(item => item.trim().startsWith(`${key}=`));
1717
- }
1718
- }
1719
- CookieService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CookieService_Factory() { return new CookieService(i0.ɵɵinject(i4.DOCUMENT)); }, token: CookieService, providedIn: "root" });
1720
- CookieService.decorators = [
1721
- { type: Injectable, args: [{
1722
- providedIn: 'root'
1723
- },] }
1724
- ];
1725
- CookieService.ctorParameters = () => [
1726
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
1727
- ];
1728
-
1729
- const windowToken = new InjectionToken('Window');
1730
- function windowProvider() { return window; }
1731
-
1732
- class CookieBannerComponent {
1733
- constructor(cookieService, window) {
1734
- this.cookieService = cookieService;
1735
- this.rejectionNotifier = new EventEmitter();
1736
- this.acceptanceNotifier = new EventEmitter();
1737
- this.isCookieBannerVisible = false;
1738
- this.window = window;
1739
- }
1740
- ngOnInit() {
1741
- this.setState();
1742
- }
1743
- acceptCookie() {
1744
- this.cookieService.setCookie(this.identifier, 'true', this.getExpiryDate());
1745
- this.setState(true);
1746
- }
1747
- rejectCookie() {
1748
- this.cookieService.setCookie(this.identifier, 'false', this.getExpiryDate());
1749
- this.setState(true);
1750
- }
1751
- setState(reload = false) {
1752
- this.isCookieBannerVisible = !this.cookieService.checkCookie(this.identifier);
1753
- if (this.areCookiesAccepted()) {
1754
- this.notifyAcceptance();
1755
- }
1756
- else {
1757
- this.notifyRejection();
1758
- }
1759
- if (reload) { // reload if any of the buttons are pressed
1760
- this.window.location.reload();
1761
- }
1762
- }
1763
- areCookiesAccepted() {
1764
- return this.cookieService.checkCookie(this.identifier) && this.cookieService.getCookie(this.identifier) === 'true';
1765
- }
1766
- notifyRejection() {
1767
- this.rejectionNotifier.emit();
1768
- }
1769
- notifyAcceptance() {
1770
- this.acceptanceNotifier.emit();
1771
- }
1772
- getExpiryDate() {
1773
- const now = new Date();
1774
- const time = now.getTime();
1775
- const expireTime = time + 31536000000; // in 365 days = 3600 * 1000 * 24 * 365
1776
- now.setTime(expireTime);
1777
- return now.toUTCString();
1778
- }
1779
- }
1780
- CookieBannerComponent.decorators = [
1781
- { type: Component, args: [{
1782
- selector: 'xuilib-cookie-banner',
1783
- template: "<div class=\"govuk-cookie-banner \" role=\"region\" attr.aria-label=\"'Cookies on {{appName}}'\" *ngIf=\"isCookieBannerVisible\">\n <div class=\"govuk-cookie-banner__message govuk-width-container\">\n\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <h2 class=\"govuk-cookie-banner__heading govuk-heading-m\">Cookies on {{appName}}</h2>\n\n <div class=\"govuk-cookie-banner__content\">\n <p>We use some essential cookies to make this service work.</p>\n <p>We\u2019d also like to use analytics cookies so we can understand how you use the service and make improvements.</p>\n </div>\n </div>\n </div>\n\n <div class=\"govuk-button-group\">\n <button value=\"accept\" type=\"button\" name=\"cookies\" class=\"govuk-button\" data-module=\"govuk-button\" (click)=\"acceptCookie()\">\n Accept analytics cookies\n </button>\n <button value=\"reject\" type=\"button\" name=\"cookies\" class=\"govuk-button\" data-module=\"govuk-button\" (click)=\"rejectCookie()\">\n Reject analytics cookies\n </button>\n <a class=\"govuk-link\" routerLink=\"/cookies\">View cookies</a>\n </div>\n </div>\n</div>"
1784
- },] }
1785
- ];
1786
- CookieBannerComponent.ctorParameters = () => [
1787
- { type: CookieService },
1788
- { type: undefined, decorators: [{ type: Inject, args: [windowToken,] }] }
1789
- ];
1790
- CookieBannerComponent.propDecorators = {
1791
- identifier: [{ type: Input }],
1792
- appName: [{ type: Input }],
1793
- rejectionNotifier: [{ type: Output }],
1794
- acceptanceNotifier: [{ type: Output }]
1795
- };
1796
-
1797
- class LocationService {
1798
- constructor(http) {
1799
- this.http = http;
1800
- }
1801
- /**
1802
- * @description getAllLocations from service Ids/location type/search term
1803
- * @param serviceIds: SSCS | SSCS,IA split with ','
1804
- * @param locationType: optional | hearing | case_management
1805
- * @param searchTerm: any search term for postcode | site name | venue name |court name | court address etc.
1806
- * @return Observable<LocationByEPIMMSModel[]>: Array of locationModel in Observable
1807
- */
1808
- getAllLocations(serviceIds, locationType, searchTerm) {
1809
- return this.http.get(`api/locations/getLocations?serviceIds=${serviceIds}&locationType=${locationType}&searchTerm=${searchTerm}`);
1810
- }
1811
- /**
1812
- * @description searchLocations from service Ids/location type/search term
1813
- * @param serviceIds: BBA3 | BBA3,BFA1 split with ','
1814
- * @param locationType: optional | hearing | case_management
1815
- * @param searchTerm: any search term for postcode | site name | venue name |court name | court address etc.
1816
- * @return Observable<LocationByEPIMMSModel[]>: Array of locationModel in Observable
1817
- */
1818
- searchLocations(serviceIds, locationType, searchTerm) {
1819
- return this.http.get(`api/prd/location/getLocations?serviceIds=${serviceIds}&locationType=${locationType}&searchTerm=${searchTerm}`);
1820
- }
1821
- }
1822
- LocationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocationService_Factory() { return new LocationService(i0.ɵɵinject(i1.HttpClient)); }, token: LocationService, providedIn: "root" });
1823
- LocationService.decorators = [
1824
- { type: Injectable, args: [{
1825
- providedIn: 'root'
1826
- },] }
1827
- ];
1828
- LocationService.ctorParameters = () => [
1829
- { type: HttpClient }
1830
- ];
1831
-
1832
- class SearchLocationComponent {
1833
- constructor(locationService, fb, cd) {
1834
- this.locationService = locationService;
1835
- this.fb = fb;
1836
- this.cd = cd;
1837
- this.disabled = null;
1838
- this.singleMode = false;
1839
- this.locationType = '';
1840
- this.serviceIds = '';
1841
- this.submitted = true;
1842
- this.delay = 500;
1843
- this.showAutocomplete = false;
1844
- this.locations = [];
1845
- this.locationSelected = new EventEmitter();
1846
- this.locationInputChanged = new EventEmitter();
1847
- this.searchLocationChanged = new EventEmitter();
1848
- this.minSearchCharacters = 3;
1849
- this.term = '';
1850
- this.pSelectedLocations = [];
1851
- this.pReset = true;
1852
- this.form = this.fb.group({
1853
- searchTerm: ['']
1854
- });
1855
- }
1856
- get reset() {
1857
- return this.pReset;
1858
- }
1859
- set reset(value) {
1860
- this.pReset = value;
1861
- this.resetSearchTerm();
1862
- }
1863
- get selectedLocations() {
1864
- return this.pSelectedLocations;
1865
- }
1866
- set selectedLocations(value) {
1867
- this.pSelectedLocations = value;
1868
- }
1869
- ngOnInit() {
1870
- if (this.singleMode && this.selectedLocations.length > 0) {
1871
- const location = this.selectedLocations[0];
1872
- this.form.controls.searchTerm.patchValue(location.site_name, { emitEvent: false, onlySelf: true });
1873
- }
1874
- this.search();
1875
- }
1876
- filter(term) {
1877
- this.getLocations(term).pipe(map((locations) => this.removeSelectedLocations(locations)));
1878
- }
1879
- onSelectionChange(location) {
1880
- this.form.controls.searchTerm.patchValue(location.site_name, { emitEvent: false, onlySelf: true });
1881
- this.locationSelected.emit(location);
1882
- }
1883
- search() {
1884
- this.form.controls.searchTerm.valueChanges
1885
- .pipe(tap((term) => this.locationInputChanged.next(term)), tap(() => this.locations = []), tap((term) => this.term = term), filter(term => !!term && term.length >= this.minSearchCharacters), debounceTime(this.delay), mergeMap(value => this.getLocations(value)), map((locations) => this.removeSelectedLocations(locations))).subscribe(locations => {
1886
- this.locations = locations;
1887
- this.cd.markForCheck();
1888
- if (locations.length === 1 && this.term === locations[0].site_name && !this.singleMode) {
1889
- this.locationSelected.emit(locations[0]);
1890
- this.showAutocomplete = false;
1891
- return;
1892
- }
1893
- this.showAutocomplete = true;
1894
- });
1895
- }
1896
- onInput() {
1897
- this.searchLocationChanged.emit();
1898
- }
1899
- getLocations(term) {
1900
- return this.locationService.getAllLocations(this.serviceIds, this.locationType, term);
1901
- }
1902
- resetSearchTerm() {
1903
- this.form.controls.searchTerm.patchValue('', { emitEvent: false, onlySelf: true });
1904
- }
1905
- removeSelectedLocations(locations) {
1906
- if (this.singleMode) {
1907
- return locations;
1908
- }
1909
- return locations.filter(location => !this.selectedLocations.map(selectedLocation => selectedLocation.epimms_id).includes(location.epimms_id) && location.site_name);
1910
- }
1911
- }
1912
- SearchLocationComponent.decorators = [
1913
- { type: Component, args: [{
1914
- selector: 'exui-search-location',
1915
- template: "<div class=\"auto-complete-container\">\n <input\n id=\"inputLocationSearch\"\n (input)=\"onInput()\"\n [formControl]=\"form.controls.searchTerm\"\n [matAutocomplete]=\"autoSearchLocation\"\n class=\"govuk-input\"\n [attr.disabled]=\"disabled\">\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #autoSearchLocation=\"matAutocomplete\">\n <mat-option *ngFor=\"let location of locations\"\n (onSelectionChange)=\"onSelectionChange(location)\">\n {{ location.site_name }}\n </mat-option>\n <mat-option *ngIf=\"!locations.length && showAutocomplete && term && term.length >= this.minSearchCharacters\">No results found</mat-option>\n </mat-autocomplete>\n</div>\n",
1916
- styles: [".autocomplete__input--show-all-values{padding:5px 34px 5px 5px;cursor:pointer}.autocomplete__dropdown-arrow-down{z-index:-1;display:inline-block;position:absolute;right:8px;width:24px;height:24px;top:10px}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{box-shadow:0 2px 6px rgba(0,0,0,.256863);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-left-width:0;border-bottom:1px solid #b1b4b6;border-right-width:0;border-top-width:1px;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#fafafa}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:0}.autocomplete__option--no-results{background-color:#fafafa;color:#646b6f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.31579}}.div-action{display:inline-block}.add-location{display:inline}.remove-location-button{margin:5px}.hide-autocomplete{display:none}.auto-complete-container{min-width:550px;display:inline-block;margin-right:4px}.autocomplete__input{line-height:24px;font-size:19px}"]
1917
- },] }
1918
- ];
1919
- SearchLocationComponent.ctorParameters = () => [
1920
- { type: LocationService },
1921
- { type: FormBuilder },
1922
- { type: ChangeDetectorRef }
1923
- ];
1924
- SearchLocationComponent.propDecorators = {
1925
- control: [{ type: Input }],
1926
- disabled: [{ type: Input }],
1927
- singleMode: [{ type: Input }],
1928
- locationType: [{ type: Input }],
1929
- serviceIds: [{ type: Input }],
1930
- submitted: [{ type: Input }],
1931
- delay: [{ type: Input }],
1932
- form: [{ type: Input }],
1933
- showAutocomplete: [{ type: Input }],
1934
- locations: [{ type: Input }],
1935
- locationSelected: [{ type: Output }],
1936
- locationInputChanged: [{ type: Output }],
1937
- searchLocationChanged: [{ type: Output }],
1938
- reset: [{ type: Input }],
1939
- selectedLocations: [{ type: Input }]
1940
- };
1941
-
1942
- class FindLocationComponent {
1943
- constructor() {
1944
- this.locationFieldChanged = new EventEmitter();
1945
- this.selectedLocations = [];
1946
- this.submitted = true;
1947
- this.enableAddLocationButton = true;
1948
- this.locationTitle = 'Search for a location by name';
1949
- this.disableInputField = false;
1950
- this.locations = [];
1951
- this.tempSelectedLocation = null;
1952
- this.serviceIds = 'SSCS,IA';
1953
- this.pServices = [];
1954
- this.pDisabled = false;
1955
- }
1956
- get disabled() {
1957
- return this.pDisabled;
1958
- }
1959
- set disabled(value) {
1960
- if (value) {
1961
- this.searchLocationComponent.resetSearchTerm();
1962
- this.removeSelectedValues();
1963
- }
1964
- this.pDisabled = this.disableInputField === true ? true : null;
1965
- }
1966
- get services() {
1967
- return this.pServices;
1968
- }
1969
- set services(value) {
1970
- this.pServices = value;
1971
- const field = this.fields.find(f => f.name === this.field.findLocationField);
1972
- if (field) {
1973
- if (typeof value === 'string') {
1974
- this.serviceIds = value;
1975
- }
1976
- else {
1977
- this.serviceIds = getValues(field.options, value).filter(x => x !== 'services_all').join(',');
1978
- }
1979
- }
1980
- }
1981
- addLocation() {
1982
- if (this.tempSelectedLocation) {
1983
- this.selectedLocations = [...this.selectedLocations, this.tempSelectedLocation];
1984
- this.addSelectedLocationsToForm([this.tempSelectedLocation]);
1985
- this.tempSelectedLocation = null;
1986
- this.locations = [];
1987
- this.searchLocationComponent.resetSearchTerm();
1988
- }
1989
- }
1990
- removeLocation(location) {
1991
- if (location.epimms_id) {
1992
- this.selectedLocations = this.selectedLocations.filter(selectedLocation => selectedLocation.epimms_id !== location.epimms_id);
1993
- const formArray = this.form.get(this.field.name);
1994
- const index = formArray.value.findIndex(selectedLocation => selectedLocation.epimms_id === location.epimms_id);
1995
- if (index > -1) {
1996
- formArray.removeAt(index);
1997
- }
1998
- }
1999
- }
2000
- onInputChanged(term) {
2001
- // if the filter is in single mode clear the selected locations
2002
- if (typeof term === 'string' && this.field.maxSelected === 1) {
2003
- this.removeSelectedValues();
2004
- }
2005
- }
2006
- onSearchInputChanged() {
2007
- this.locationFieldChanged.emit();
2008
- }
2009
- onLocationSelected(location) {
2010
- if (this.field.maxSelected === 1) {
2011
- this.removeSelectedValues();
2012
- this.addSelectedLocationsToForm([location]);
2013
- }
2014
- else {
2015
- if (!this.selectedLocations.find(x => x.epimms_id === location.epimms_id)) {
2016
- if (location.epimms_id) {
2017
- this.tempSelectedLocation = location;
2018
- }
2019
- }
2020
- }
2021
- }
2022
- removeSelectedValues() {
2023
- const formArray = this.form.get(this.field.name);
2024
- for (let i = 0; i < formArray.length; i++) {
2025
- formArray.removeAt(i);
2026
- }
2027
- this.selectedLocations = [];
2028
- }
2029
- addSelectedLocationsToForm(locations) {
2030
- const formArray = this.form.get(this.field.name);
2031
- for (const location of locations) {
2032
- formArray.push(new FormControl(location));
2033
- }
2034
- }
2035
- }
2036
- FindLocationComponent.decorators = [
2037
- { type: Component, args: [{
2038
- selector: 'xuilib-find-location',
2039
- template: "<div class=\"location-picker-custom\">\n <div class=\"search-location\">\n <div>\n <label id=\"input-selected-location-label\" *ngIf=\"locationTitle\">{{locationTitle}}</label>\n </div>\n <exui-search-location class=\"search-location\"\n [locations]=\"locations\"\n [selectedLocations]=\"selectedLocations\"\n [singleMode]=\"field.maxSelected === 1\"\n [delay]=\"300\"\n [disabled]=\"disabled\"\n [serviceIds]=\"serviceIds\"\n (locationInputChanged)=\"onInputChanged($event)\"\n (locationSelected)=\"onLocationSelected($event)\"\n (searchLocationChanged)=\"onSearchInputChanged()\"\n [locationType]=\"'case-management'\"></exui-search-location>\n <a href=\"javascript:void(0)\" (click)=\"addLocation()\" class=\"govuk-button\" data-module=\"govuk-button\" *ngIf=\"enableAddLocationButton\">\n Add location\n </a>\n </div>\n <ul class=\"hmcts-filter-tags selection-container\" *ngIf=\"field.maxSelected != 1\">\n <li class=\"location-selection\" *ngFor=\"let selection of selectedLocations\">\n <a class=\"hmcts-filter__tag\" (click)=\"removeLocation(selection)\" href=\"javascript:void(0)\">\n {{ selection.site_name }}\n </a>\n </li>\n </ul>\n</div>\n",
2040
- styles: [""]
2041
- },] }
2042
- ];
2043
- FindLocationComponent.propDecorators = {
2044
- locationFieldChanged: [{ type: Output }],
2045
- selectedLocations: [{ type: Input }],
2046
- submitted: [{ type: Input }],
2047
- enableAddLocationButton: [{ type: Input }],
2048
- form: [{ type: Input }],
2049
- field: [{ type: Input }],
2050
- fields: [{ type: Input }],
2051
- locationTitle: [{ type: Input }],
2052
- disableInputField: [{ type: Input }],
2053
- searchLocationComponent: [{ type: ViewChild, args: [SearchLocationComponent, { static: true },] }],
2054
- disabled: [{ type: Input }],
2055
- services: [{ type: Input }]
2056
- };
2057
-
2058
- class PaginationComponent {
2059
- constructor() {
2060
- this.previousPage = new EventEmitter();
2061
- this.nextPage = new EventEmitter();
2062
- }
2063
- onPrevious() {
2064
- this.previousPage.emit(null);
2065
- }
2066
- onNext() {
2067
- this.nextPage.emit(null);
2068
- }
2069
- }
2070
- PaginationComponent.decorators = [
2071
- { type: Component, args: [{
2072
- selector: 'xuilib-pagination',
2073
- template: "<nav class=\"hmcts-pagination\" id=\"pagination-label\">\n\n <p class=\"govuk-visually-hidden\" aria-labelledby=\"pagination-label\">Pagination navigation</p>\n\n <ul class=\"hmcts-pagination__list\">\n <li class=\"hmcts-pagination__item hmcts-pagination__item--prev\">\n <a *ngIf=\"firstRecord > 1; else noPrevious\" class=\"hmcts-pagination__link\" (click)=\"onPrevious()\" href=\"javascript:void(0)\">\n Previous page\n </a>\n <ng-template #noPrevious>\n <span class=\"hmcts-pagination__link\">Previous page</span>\n </ng-template>\n </li>\n\n <li class=\"hmcts-pagination__item hmcts-pagination__item--next\">\n <a *ngIf=\"moreItems; else noNext\" class=\"hmcts-pagination__link\" (click)=\"onNext()\" href=\"javascript:void(0)\">Next page</a>\n <ng-template #noNext>\n <span class=\"hmcts-pagination__link\">Next page</span>\n </ng-template>\n </li>\n </ul>\n</nav>\n",
2074
- styles: ["span.hmcts-pagination__link:hover{color:revert}"]
2075
- },] }
2076
- ];
2077
- PaginationComponent.ctorParameters = () => [];
2078
- PaginationComponent.propDecorators = {
2079
- moreItems: [{ type: Input }],
2080
- firstRecord: [{ type: Input }],
2081
- previousPage: [{ type: Output }],
2082
- nextPage: [{ type: Output }]
2083
- };
2084
-
2085
- class SearchVenueComponent {
2086
- constructor(locationService, fb) {
2087
- this.locationService = locationService;
2088
- this.disabled = null;
2089
- this.locationType = '';
2090
- this.serviceIds = '';
2091
- this.submitted = true;
2092
- this.showAutocomplete = false;
2093
- this.locationChanged = new EventEmitter();
2094
- this.minSearchCharacters = 3;
2095
- this.keyUpSubject$ = new Subject();
2096
- this.readyAfterContent = false;
2097
- this.searchInProgress = false;
2098
- this.findLocationFormGroup = fb.group({
2099
- findLocationFormControl: [null],
2100
- locationSelectedFormControl: [null]
2101
- });
2102
- this.selectedLocations = [];
2103
- }
2104
- ngAfterContentInit() {
2105
- this.readyAfterContent = true;
2106
- }
2107
- ngOnInit() {
2108
- this.displayedLocations = [];
2109
- if (this.control) {
2110
- if (this.findLocationFormGroup && this.findLocationFormGroup.controls) {
2111
- this.findLocationFormGroup.controls.locationSelectedFormControl = this.control;
2112
- }
2113
- }
2114
- this.keyUpSubject$.pipe(debounceTime(500)).subscribe(searchValue => this.search(searchValue));
2115
- }
2116
- onKeyDown() {
2117
- this.locationChanged.emit();
2118
- }
2119
- onKeyUp(event) {
2120
- this.showAutocomplete = false;
2121
- this.keyUpSubject$.next(event.target.value);
2122
- }
2123
- onFocus() {
2124
- this.showAutocomplete = false;
2125
- }
2126
- get displayedLocationsDuplicationFiltered() {
2127
- return this.displayedLocations.filter(location => !this.selectedLocations.map(selectedLocation => selectedLocation.epimms_id).includes(location.epimms_id) && location.court_name);
2128
- }
2129
- filter(term) {
2130
- this.searchLocations(term).pipe(mergeMap((apiData) => {
2131
- const apiFilter = apiData.filter(apiLocation => !this.selectedLocations.map(selectedLocation => selectedLocation.epimms_id).includes(apiLocation.epimms_id));
2132
- this.displayedLocations = apiFilter;
2133
- this.searchInProgress = false;
2134
- return apiFilter;
2135
- })).subscribe(location => {
2136
- if (term === location.court_name) {
2137
- this.findLocationFormGroup.controls.locationSelectedFormControl.setValue(location);
2138
- this.displayedLocations = [];
2139
- this.locationChanged.emit(location);
2140
- this.showAutocomplete = false;
2141
- }
2142
- this.searchInProgress = false;
2143
- });
2144
- }
2145
- onSelectionChange(selection) {
2146
- if (this.findLocationFormGroup.controls.findLocationFormControl instanceof FormArray) {
2147
- this.findLocationFormGroup.controls.locationSelectedFormControl.push(new FormControl(selection.epimms_id));
2148
- }
2149
- else {
2150
- this.findLocationFormGroup.controls.locationSelectedFormControl.setValue(selection);
2151
- }
2152
- this.locationChanged.emit(selection);
2153
- }
2154
- search(currentValue) {
2155
- this.searchInProgress = true;
2156
- this.showAutocomplete = !!currentValue && (currentValue.length >= this.minSearchCharacters);
2157
- if (!currentValue || !currentValue.length) {
2158
- this.findLocationFormGroup.controls.locationSelectedFormControl.markAsPristine();
2159
- this.findLocationFormGroup.controls.locationSelectedFormControl.reset();
2160
- }
2161
- if (this.showAutocomplete) {
2162
- this.filter(currentValue);
2163
- }
2164
- else {
2165
- this.searchInProgress = false;
2166
- }
2167
- }
2168
- getDisplayName(selectedLocation) {
2169
- return selectedLocation.court_name;
2170
- }
2171
- searchLocations(term) {
2172
- return this.locationService.searchLocations(this.serviceIds, this.locationType, term);
2173
- }
2174
- getControlCourtNameValue() {
2175
- return this.findLocationFormGroup && this.findLocationFormGroup.controls && this.findLocationFormGroup.controls.locationSelectedFormControl.value ?
2176
- this.findLocationFormGroup.controls.locationSelectedFormControl.value.court_name : '';
2177
- }
2178
- }
2179
- SearchVenueComponent.decorators = [
2180
- { type: Component, args: [{
2181
- selector: 'xuilib-search-venue',
2182
- template: "<div class=\"auto-complete-container\">\n <div *ngIf=\"readyAfterContent\" class=\"autocomplete__wrapper\">\n <input\n [formControl]=\"findLocationFormGroup.controls.findLocationFormControl\"\n [matAutocomplete]=\"autoSearchLocation\"\n (keydown)=\"onKeyDown()\"\n (keyup)=\"onKeyUp($event)\"\n (focus)=\"onFocus()\"\n class=\"autocomplete__input autocomplete__input--default search-box\"\n [attr.disabled]=\"!disabled ? null: disabled\"\n [value]=\"getControlCourtNameValue()\"\n #inputSelectedLocation>\n <mat-autocomplete class=\"mat-autocomplete-panel-extend\" autoActiveFirstOption #autoSearchLocation=\"matAutocomplete\">\n <mat-option *ngFor=\"let location of displayedLocationsDuplicationFiltered\"\n [value]=\"getDisplayName(location)\"\n (onSelectionChange)=\"onSelectionChange(location)\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete}\">\n {{ getDisplayName(location) }}\n </mat-option>\n <mat-option *ngIf=\"!displayedLocationsDuplicationFiltered?.length && showAutocomplete && !searchInProgress\">{{ 'No results found' }}</mat-option>\n </mat-autocomplete>\n </div>\n</div>\n",
2183
- styles: [".autocomplete__input{-webkit-appearance:none;border:2px solid #0b0c0c;border-radius:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin-bottom:0;width:100%;line-height:24px;font-size:19px;background-color:transparent;position:relative}.autocomplete__hint{color:#b1b4b6;position:absolute}.autocomplete__input--default{padding:5px}.autocomplete__input--focused{outline:3px solid #fd0;outline-offset:0;box-shadow:inset 0 0 0 2px}.autocomplete__input--show-all-values{padding:5px 34px 5px 5px;cursor:pointer}.autocomplete__dropdown-arrow-down{z-index:-1;display:inline-block;position:absolute;right:8px;width:24px;height:24px;top:10px}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{box-shadow:0 2px 6px rgba(0,0,0,.256863);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-left-width:0;border-bottom:1px solid #b1b4b6;border-right-width:0;border-top-width:1px;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#fafafa}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:0}.autocomplete__option--no-results{background-color:#fafafa;color:#646b6f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:13px;line-height:1.31579}}.div-action{display:inline-block}.add-location{display:inline}.remove-location-button{margin:5px}.hide-autocomplete{display:none}.auto-complete-container{min-width:550px;display:inline-block;margin-right:4px}"]
2184
- },] }
2185
- ];
2186
- SearchVenueComponent.ctorParameters = () => [
2187
- { type: LocationService },
2188
- { type: FormBuilder }
2189
- ];
2190
- SearchVenueComponent.propDecorators = {
2191
- control: [{ type: Input }],
2192
- disabled: [{ type: Input }],
2193
- locationType: [{ type: Input }],
2194
- selectedLocations: [{ type: Input }],
2195
- serviceIds: [{ type: Input }],
2196
- submitted: [{ type: Input }],
2197
- autoCompleteInputBox: [{ type: ViewChild, args: ['inputSelectedLocation', { read: ElementRef },] }],
2198
- showAutocomplete: [{ type: Input }],
2199
- displayedLocations: [{ type: Input }],
2200
- locationChanged: [{ type: Output }]
2201
- };
2202
-
2203
- const getAllCaseworkersFromServices = (caseworkersByService) => {
2204
- let allCaseworkers = [];
2205
- caseworkersByService.forEach(caseworkerListByService => {
2206
- allCaseworkers = allCaseworkers.concat(caseworkerListByService.caseworkers);
2207
- });
2208
- return allCaseworkers;
2209
- };
2210
- const getSessionStorageKeyForServiceId = (serviceId) => {
2211
- return `${serviceId}-caseworkers`;
2212
- };
2213
- const getCaseworkers = (serviceId, sessionStorageService) => {
2214
- const sessionKey = getSessionStorageKeyForServiceId(serviceId);
2215
- const value = sessionStorageService.getItem(sessionKey);
2216
- if (value) {
2217
- return JSON.parse(value);
2218
- }
2219
- };
2220
- const setCaseworkers = (serviceId, caseworkers, sessionStorageService) => {
2221
- const sessionKey = getSessionStorageKeyForServiceId(serviceId);
2222
- sessionStorageService.setItem(sessionKey, JSON.stringify(caseworkers));
2223
- };
2224
-
2225
- var BadgeColour;
2226
- (function (BadgeColour) {
2227
- BadgeColour["BADGE_RED"] = "hmcts-badge--red";
2228
- BadgeColour["BADGE_BLUE"] = "hmcts-badge--blue";
2229
- BadgeColour["BADGE_GREEN"] = "hmcts-badge--green";
2230
- })(BadgeColour || (BadgeColour = {}));
2231
-
2232
- class AnonymousFeatureUser {
2233
- }
2234
- class LoggedInFeatureUser {
2235
- }
2236
-
2237
- var PersonRole;
2238
- (function (PersonRole) {
2239
- PersonRole["JUDICIAL"] = "Judicial";
2240
- PersonRole["CASEWORKER"] = "Legal Ops";
2241
- PersonRole["ADMIN"] = "Admin";
2242
- PersonRole["ALL"] = "All";
2243
- })(PersonRole || (PersonRole = {}));
2244
- // Note: RoleCategory could replace PersonRole possibly
2245
- // However a lot of webapp logic is based on current PersonRole understanding
2246
- var RoleCategory;
2247
- (function (RoleCategory) {
2248
- RoleCategory["JUDICIAL"] = "JUDICIAL";
2249
- RoleCategory["CASEWORKER"] = "LEGAL_OPERATIONS";
2250
- RoleCategory["ADMIN"] = "ADMIN";
2251
- RoleCategory["ALL"] = "ALL";
2252
- })(RoleCategory || (RoleCategory = {}));
2253
-
2254
- class RadioFilterFieldConfig {
2255
- }
2256
-
2257
- class SessionStorageService {
2258
- /**
2259
- * Get an item from the session storage.
2260
- * If remove is true, the item will be removed once read
2261
- * @param removeAfterRead removed the key once it has been read
2262
- */
2263
- getItem(key, removeAfterRead = false) {
2264
- const item = sessionStorage.getItem(key);
2265
- if (removeAfterRead) {
2266
- this.removeItem(key);
2267
- }
2268
- return item;
2269
- }
2270
- /**
2271
- * Set an item in the session storage.
2272
- */
2273
- setItem(key, value) {
2274
- sessionStorage.setItem(key, value);
2275
- }
2276
- /**
2277
- * Remove an item in the session storage.
2278
- */
2279
- removeItem(key) {
2280
- sessionStorage.removeItem(key);
2281
- }
2282
- /**
2283
- * Clear all the items held in session storage.
2284
- */
2285
- clear() {
2286
- sessionStorage.clear();
2287
- }
2288
- }
2289
- SessionStorageService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SessionStorageService_Factory() { return new SessionStorageService(); }, token: SessionStorageService, providedIn: "root" });
2290
- SessionStorageService.decorators = [
2291
- { type: Injectable, args: [{
2292
- providedIn: 'root'
2293
- },] }
2294
- ];
2295
-
2296
- class FindAPersonService {
2297
- constructor(http, sessionStorageService) {
2298
- this.http = http;
2299
- this.sessionStorageService = sessionStorageService;
2300
- }
2301
- find(searchOptions) {
2302
- const userInfoStr = this.sessionStorageService.getItem('userDetails');
2303
- if (userInfoStr && !searchOptions.userIncluded) {
2304
- const userInfo = JSON.parse(userInfoStr);
2305
- this.userId = userInfo.id ? userInfo.id : userInfo.uid;
2306
- }
2307
- this.assignedUser = searchOptions.assignedUser ? searchOptions.assignedUser : null;
2308
- return this.http.post('/workallocation2/findPerson', { searchOptions })
2309
- .pipe(map(judiciary => judiciary.filter(judge => !([this.assignedUser, this.userId].includes(judge.id)))));
2310
- }
2311
- findCaseworkers(searchOptions) {
2312
- const userInfoStr = this.sessionStorageService.getItem('userDetails');
2313
- if (userInfoStr) {
2314
- const userInfo = JSON.parse(userInfoStr);
2315
- this.userId = userInfo.id ? userInfo.id : userInfo.uid;
2316
- }
2317
- this.assignedUser = searchOptions.assignedUser ? searchOptions.assignedUser : null;
2318
- const fullServices = searchOptions.services;
2319
- const storedServices = [];
2320
- const newServices = [];
2321
- const storedCaseworkersByService = [];
2322
- fullServices.forEach(serviceId => {
2323
- const serviceKey = getSessionStorageKeyForServiceId(serviceId);
2324
- if (this.sessionStorageService.getItem(serviceKey)) {
2325
- storedServices.push(serviceId);
2326
- storedCaseworkersByService.push({ service: serviceId, caseworkers: JSON.parse(this.sessionStorageService.getItem(serviceKey)) });
2327
- }
2328
- else {
2329
- newServices.push(serviceId);
2330
- }
2331
- });
2332
- // if all services are stored then return the stored caseworkers by service
2333
- if (storedServices.length === fullServices.length) {
2334
- const storedCaseworkers = getAllCaseworkersFromServices(storedCaseworkersByService);
2335
- return of(this.searchInCaseworkers(storedCaseworkers, searchOptions));
2336
- }
2337
- // all serviceIds passed in as node layer getting used anyway and caseworkers also stored there
2338
- return this.http.post('/workallocation2/retrieveCaseWorkersForServices', { fullServices }).pipe(tap(caseworkersByService => {
2339
- caseworkersByService.forEach(caseworkerListByService => {
2340
- // for any new service, ensure that they are then stored in the session
2341
- if (newServices.includes(caseworkerListByService.service)) {
2342
- setCaseworkers(caseworkerListByService.service, caseworkerListByService.caseworkers, this.sessionStorageService);
2343
- }
2344
- });
2345
- }), map(caseworkersByService => {
2346
- const givenCaseworkers = getAllCaseworkersFromServices(caseworkersByService);
2347
- return this.searchInCaseworkers(givenCaseworkers, searchOptions);
2348
- }));
2349
- }
2350
- mapCaseworkers(caseworkers, roleCategory) {
2351
- const people = [];
2352
- caseworkers.forEach((caseworker) => {
2353
- const thisPerson = {
2354
- email: caseworker.email,
2355
- name: `${caseworker.firstName} ${caseworker.lastName}`,
2356
- id: caseworker.idamId,
2357
- domain: caseworker.roleCategory === RoleCategory.CASEWORKER ? PersonRole.CASEWORKER : PersonRole.ADMIN,
2358
- };
2359
- if (caseworker.roleCategory === roleCategory || roleCategory === RoleCategory.ALL) {
2360
- people.push(thisPerson);
2361
- }
2362
- });
2363
- return people;
2364
- }
2365
- searchInCaseworkers(caseworkers, searchOptions) {
2366
- let roleCategory = RoleCategory.ALL;
2367
- if (!(searchOptions.userRole === PersonRole.ALL)) {
2368
- roleCategory = searchOptions.userRole === PersonRole.CASEWORKER ? RoleCategory.CASEWORKER : RoleCategory.ADMIN;
2369
- }
2370
- const searchTerm = searchOptions && searchOptions.searchTerm ? searchOptions.searchTerm.toLowerCase() : '';
2371
- const people = caseworkers ? this.mapCaseworkers(caseworkers, roleCategory) : [];
2372
- const finalPeopleList = people.filter(person => person && person.name && person.name.toLowerCase().includes(searchTerm));
2373
- return searchOptions.userIncluded ? finalPeopleList.filter(person => person && person.id !== this.assignedUser)
2374
- : finalPeopleList.filter(person => person && person.id !== this.userId && person.id !== this.assignedUser);
2375
- }
2376
- searchJudicial(value, serviceId) {
2377
- return this.http.post('api/prd/judicial/getJudicialUsersSearch', { searchString: value, serviceCode: serviceId });
2378
- }
2379
- }
2380
- FindAPersonService.caseworkersKey = 'caseworkers';
2381
- FindAPersonService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FindAPersonService_Factory() { return new FindAPersonService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(SessionStorageService)); }, token: FindAPersonService, providedIn: "root" });
2382
- FindAPersonService.decorators = [
2383
- { type: Injectable, args: [{
2384
- providedIn: 'root'
2385
- },] }
2386
- ];
2387
- FindAPersonService.ctorParameters = () => [
2388
- { type: HttpClient },
2389
- { type: SessionStorageService }
2390
- ];
2391
-
2392
- class SearchJudicialsComponent {
2393
- constructor(judicialService, fb) {
2394
- this.judicialService = judicialService;
2395
- this.disabled = null;
2396
- this.selectedJudicials = [];
2397
- this.submitted = true;
2398
- this.placeholderContent = '';
2399
- this.showAutocomplete = false;
2400
- this.judicialChanged = new EventEmitter();
2401
- this.idValue = '';
2402
- this.errorMessage = 'You must select a name';
2403
- this.serviceId = '';
2404
- this.minSearchCharacters = 3;
2405
- this.keyUpSubject$ = new Subject();
2406
- this.searchInProgress = false;
2407
- this.formGroup = fb.group({
2408
- formControl: [null],
2409
- selectedFormControl: [null]
2410
- });
2411
- }
2412
- ngOnInit() {
2413
- this.displayedJudicials = [];
2414
- if (this.control) {
2415
- if (this.formGroup && this.formGroup.controls) {
2416
- this.formGroup.controls.selectedFormControl = this.control;
2417
- this.formGroup.controls.formControl.setValue(this.getControlValueDisplayText());
2418
- }
2419
- }
2420
- this.keyUpSubject$.pipe(debounceTime(500)).subscribe(searchValue => this.search(searchValue));
2421
- }
2422
- onKeyDown() {
2423
- this.judicialChanged.emit();
2424
- }
2425
- onKeyUp(event) {
2426
- this.showAutocomplete = false;
2427
- this.keyUpSubject$.next(event.target.value);
2428
- }
2429
- onFocus() {
2430
- this.showAutocomplete = false;
2431
- }
2432
- get displayedJudicialsDuplicationFiltered() {
2433
- return this.displayedJudicials.filter(judicial => !this.selectedJudicials.map(selectedJudicial => selectedJudicial.idamId).includes(judicial.idamId));
2434
- }
2435
- filter(term) {
2436
- this.searchJudicials(term, this.serviceId).pipe(mergeMap((apiData) => {
2437
- const apiFilter = apiData.filter(apiJudicial => !this.selectedJudicials.map(selectedJudicial => selectedJudicial.idamId).includes(apiJudicial.idamId));
2438
- this.displayedJudicials = apiFilter;
2439
- this.searchInProgress = false;
2440
- return apiFilter;
2441
- })).subscribe(judicial => {
2442
- if (term === judicial.knownAs) {
2443
- this.formGroup.controls.selectedFormControl.setValue(judicial);
2444
- this.displayedJudicials = [];
2445
- this.judicialChanged.emit(judicial);
2446
- this.showAutocomplete = false;
2447
- }
2448
- this.searchInProgress = false;
2449
- });
2450
- }
2451
- onSelectionChange(selection) {
2452
- if (this.formGroup.controls.formControl instanceof FormArray) {
2453
- this.formGroup.controls.selectedFormControl.push(new FormControl(selection.idamId));
2454
- }
2455
- else {
2456
- this.formGroup.controls.selectedFormControl.setValue(selection);
2457
- }
2458
- this.judicialChanged.emit(selection);
2459
- }
2460
- search(currentValue) {
2461
- this.searchInProgress = true;
2462
- this.showAutocomplete = !!currentValue && (currentValue.length >= this.minSearchCharacters);
2463
- if (!!currentValue) {
2464
- this.formGroup.controls.selectedFormControl.markAsDirty();
2465
- }
2466
- else {
2467
- this.formGroup.controls.selectedFormControl.reset();
2468
- }
2469
- if (this.showAutocomplete) {
2470
- this.filter(currentValue);
2471
- }
2472
- else {
2473
- this.searchInProgress = false;
2474
- }
2475
- }
2476
- getDisplayName(selectedJudicial) {
2477
- return `${selectedJudicial.knownAs} (${selectedJudicial.emailId})`;
2478
- }
2479
- searchJudicials(term, serviceId) {
2480
- return this.judicialService.searchJudicial(term, serviceId);
2481
- }
2482
- getControlValueDisplayText() {
2483
- return this.formGroup && this.formGroup.controls && this.formGroup.controls.selectedFormControl.value ?
2484
- this.getDisplayName(this.formGroup.controls.selectedFormControl.value) : '';
2485
- }
2486
- }
2487
- SearchJudicialsComponent.decorators = [
2488
- { type: Component, args: [{
2489
- selector: 'xuilib-search-judicials',
2490
- template: "<div class=\"govuk-form-group\">\n <input id=\"inputSelectPerson{{idValue}}\" [placeholder]=\"placeholderContent\" [formControl]=\"formGroup.controls.formControl\"\n [matAutocomplete]=\"autoComplete\" (keydown)=\"onKeyDown()\" (keyup)=\"onKeyUp($event)\" (focus)=\"onFocus()\"\n class=\"govuk-input\" [attr.disabled]=\"!disabled ? null: disabled\" [value]=\"getControlValueDisplayText()\"\n #inputSelection>\n <mat-autocomplete autoActiveFirstOption #autoComplete=\"matAutocomplete\">\n <mat-option *ngFor=\"let judicial of displayedJudicialsDuplicationFiltered\" class=\"select-option\"\n [value]=\"getDisplayName(judicial)\" (onSelectionChange)=\"onSelectionChange(judicial)\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete}\">\n {{ getDisplayName(judicial) }}\n </mat-option>\n <mat-option class=\"select-option\"\n *ngIf=\"!displayedJudicialsDuplicationFiltered?.length && showAutocomplete && !searchInProgress\">\n {{ 'No results found' }}</mat-option>\n </mat-autocomplete>\n</div>\n",
2491
- styles: [".hide-autocomplete{display:none}.mat-option:hover{background:#2596be}.mat-option.select-option:hover{background:#1d70b8;color:#fff}"]
2492
- },] }
2493
- ];
2494
- SearchJudicialsComponent.ctorParameters = () => [
2495
- { type: FindAPersonService },
2496
- { type: FormBuilder }
2497
- ];
2498
- SearchJudicialsComponent.propDecorators = {
2499
- control: [{ type: Input }],
2500
- disabled: [{ type: Input }],
2501
- selectedJudicials: [{ type: Input }],
2502
- submitted: [{ type: Input }],
2503
- placeholderContent: [{ type: Input }],
2504
- showAutocomplete: [{ type: Input }],
2505
- displayedJudicials: [{ type: Input }],
2506
- judicialChanged: [{ type: Output }],
2507
- idValue: [{ type: Input }],
2508
- errorMessage: [{ type: Input }],
2509
- serviceId: [{ type: Input }],
2510
- autoCompleteInputBox: [{ type: ViewChild, args: ['inputSelection', { read: ElementRef, static: true },] }]
2511
- };
2512
-
2513
- class FindPersonComponent {
2514
- constructor(findPersonService, cd) {
2515
- this.findPersonService = findPersonService;
2516
- this.cd = cd;
2517
- this.personSelected = new EventEmitter();
2518
- this.personFieldChanged = new EventEmitter();
2519
- this.boldTitle = 'Find the person';
2520
- this.subTitle = 'Type the name of the person and select them.';
2521
- this.domain = PersonRole.ALL;
2522
- this.findPersonGroup = new FormGroup({});
2523
- this.submitted = true;
2524
- this.userIncluded = false;
2525
- this.placeholderContent = '';
2526
- this.isNoResultsShown = true;
2527
- this.showUpdatedColor = false;
2528
- this.selectedPersons = [];
2529
- this.errorMessage = 'You must select a name';
2530
- this.idValue = '';
2531
- this.services = ['IA'];
2532
- this.disabled = null;
2533
- this.showAutocomplete = false;
2534
- this.filteredOptions = [];
2535
- this.minSearchCharacters = 2;
2536
- }
2537
- ngOnDestroy() {
2538
- if (this.sub) {
2539
- this.sub.unsubscribe();
2540
- }
2541
- }
2542
- ngOnInit() {
2543
- this.findPersonControl = new FormControl(this.selectedPerson);
2544
- this.findPersonGroup.addControl('findPersonControl', this.findPersonControl);
2545
- this.sub = this.findPersonControl.valueChanges.pipe(tap(() => this.showAutocomplete = false), tap(() => this.filteredOptions = []), debounceTime(300), tap((searchTerm) => typeof searchTerm === 'string' ? this.personSelected.emit(null) : void 0), filter((searchTerm) => searchTerm && searchTerm.length > this.minSearchCharacters), switchMap((searchTerm) => this.filter(searchTerm).pipe(tap(() => this.showAutocomplete = true), catchError(() => this.filteredOptions = [])))).subscribe((people) => {
2546
- this.filteredOptions = people;
2547
- this.cd.detectChanges();
2548
- });
2549
- }
2550
- filter(searchTerm) {
2551
- const findJudicialPeople = this.findPersonService.find({ searchTerm, userRole: this.domain, services: this.services, userIncluded: this.userIncluded, assignedUser: this.assignedUser });
2552
- const findCaseworkersOrAdmins = this.findPersonService.findCaseworkers({ searchTerm, userRole: this.domain, services: this.services, userIncluded: this.userIncluded, assignedUser: this.assignedUser });
2553
- if (searchTerm && searchTerm.length > this.minSearchCharacters) {
2554
- switch (this.domain) {
2555
- case PersonRole.JUDICIAL: {
2556
- return findJudicialPeople.pipe(map(persons => {
2557
- const ids = this.selectedPersons.map(({ id }) => id);
2558
- return persons.filter(({ id }) => !ids.includes(id));
2559
- }));
2560
- }
2561
- case PersonRole.ALL: {
2562
- return zip(findJudicialPeople, findCaseworkersOrAdmins).pipe(map(separatePeople => separatePeople[0].concat(separatePeople[1])));
2563
- }
2564
- case PersonRole.CASEWORKER:
2565
- case PersonRole.ADMIN: {
2566
- return findCaseworkersOrAdmins;
2567
- }
2568
- default: {
2569
- return of([]);
2570
- }
2571
- }
2572
- }
2573
- return of([]);
2574
- }
2575
- onSelectionChange(selectedPerson) {
2576
- this.personSelected.emit(selectedPerson);
2577
- this.findPersonControl.setValue(this.getDisplayName(selectedPerson), { emitEvent: false, onlySelf: true });
2578
- }
2579
- getDisplayName(selectedPerson) {
2580
- if (!selectedPerson) {
2581
- return '';
2582
- }
2583
- if (selectedPerson.domain === PersonRole.JUDICIAL && selectedPerson.knownAs) {
2584
- return `${selectedPerson.knownAs} (${selectedPerson.email})`;
2585
- }
2586
- return selectedPerson.email ? `${selectedPerson.name} (${selectedPerson.email})` : selectedPerson.name;
2587
- }
2588
- onInput() {
2589
- this.personFieldChanged.emit();
2590
- }
2591
- }
2592
- FindPersonComponent.decorators = [
2593
- { type: Component, args: [{
2594
- selector: 'xuilib-find-person',
2595
- template: "<h1 class=\"govuk-heading-l\" *ngIf=\"title && title.length\">\n <span class=\"govuk-caption-l\">{{title}}</span>\n {{boldTitle}}\n</h1>\n<div class=\"govuk-form-group\" [formGroup]=\"findPersonGroup\"\n [ngClass]=\"{'form-group-error': findPersonGroup.get('findPersonControl').invalid && submitted}\">\n <fieldset class=\"govuk-fieldset\" aria-describedby=\"sub-title-hint\">\n <div id=\"sub-title-hint\" class=\"govuk-hint\" *ngIf=\"subTitle && subTitle.length\">\n {{subTitle}}\n </div>\n <span id=\"validation-error\" class=\"govuk-error-message\" *ngIf=\"findPersonGroup && findPersonGroup.errors\">\n <span class=\"govuk-visually-hidden\">Error:</span>{{findPersonGroup.errors.error ? findPersonGroup.errors.error : errorMessage}}\n </span>\n <input id=\"inputSelectPerson{{idValue}}\" type=\"text\" aria-label=\"select a person\"\n formControlName=\"findPersonControl\"\n [matAutocomplete]=\"auto\"\n class=\"govuk-input govuk-!-width-one-third\"\n [placeholder]=\"placeholderContent\"\n [attr.disabled]=\"disabled\"\n (input)=\"onInput()\">\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\" (optionSelected)=\"onSelectionChange($event.option.value)\">\n <mat-option *ngFor=\"let option of filteredOptions\"\n [value]=\"option\"\n [ngClass]=\"{'hide-autocomplete': !showAutocomplete, 'select-option': showUpdatedColor}\">\n {{getDisplayName(option)}}\n </mat-option>\n <mat-option [ngClass]=\"{'select-option': showUpdatedColor}\" *ngIf=\"isNoResultsShown && !filteredOptions.length && showAutocomplete\">No results found</mat-option>\n </mat-autocomplete>\n </fieldset>\n</div>\n",
2596
- styles: [".mat-option:hover{background:#2596be}.mat-option.select-option:hover{background:#1d70b8;color:#fff}.hide-autocomplete{display:none}"]
2597
- },] }
2598
- ];
2599
- FindPersonComponent.ctorParameters = () => [
2600
- { type: FindAPersonService },
2601
- { type: ChangeDetectorRef }
2602
- ];
2603
- FindPersonComponent.propDecorators = {
2604
- personSelected: [{ type: Output }],
2605
- personFieldChanged: [{ type: Output }],
2606
- title: [{ type: Input }],
2607
- boldTitle: [{ type: Input }],
2608
- subTitle: [{ type: Input }],
2609
- domain: [{ type: Input }],
2610
- findPersonGroup: [{ type: Input }],
2611
- selectedPerson: [{ type: Input }],
2612
- submitted: [{ type: Input }],
2613
- userIncluded: [{ type: Input }],
2614
- assignedUser: [{ type: Input }],
2615
- placeholderContent: [{ type: Input }],
2616
- isNoResultsShown: [{ type: Input }],
2617
- showUpdatedColor: [{ type: Input }],
2618
- selectedPersons: [{ type: Input }],
2619
- errorMessage: [{ type: Input }],
2620
- idValue: [{ type: Input }],
2621
- services: [{ type: Input }],
2622
- disabled: [{ type: Input }]
2623
- };
2624
-
2625
- /**
2626
- * Main Page Wrapper
2627
- * Responsible for:
2628
- * Wrapping content within the gov-uk html elements bellow
2629
- * @prop showBackLink - switch for back link
2630
- * @prop appHeaderTitle = appHeaderTitle
2631
- * @prop appFunctionalTitle = appFunctionalTitle
2632
- * @prop summaryErrors list of errors
2633
- * @prop back link, appHeaderTitle (appHeaderTitle), summaryErrors (array of errors)
2634
- */
2635
- class ExuiPageWrapperComponent {
2636
- constructor() { }
2637
- }
2638
- ExuiPageWrapperComponent.decorators = [
2639
- { type: Component, args: [{
2640
- selector: 'exui-page-wrapper',
2641
- template: "<div class=\"page\">\n <a *ngIf=\"backLink\" [routerLink]=\"backLink\" class=\"govuk-back-link\">Back</a>\n <div class=\"govuk-width-container\">\n <main id=\"content\" role=\"main\" class=\"govuk-main-wrapper\">\n <div class=\"govuk-grid-row\">\n <h1 *ngIf=\"title\" class=\"govuk-heading-xl\">\n <span *ngIf=\"fnTitle\" class=\"govuk-caption-xl\">{{fnTitle}}</span>\n {{title}}\n </h1>\n <ng-content>\n\n </ng-content>\n </div>\n </main>\n </div>\n</div>\n",
2642
- styles: [".page{width:100%}"]
2643
- },] }
2644
- ];
2645
- ExuiPageWrapperComponent.ctorParameters = () => [];
2646
- ExuiPageWrapperComponent.propDecorators = {
2647
- backLink: [{ type: Input }],
2648
- title: [{ type: Input }],
2649
- fnTitle: [{ type: Input }]
2650
- };
2651
-
2652
- class FeatureToggleDirective {
2653
- constructor(service, viewContainer, templateRef) {
2654
- this.service = service;
2655
- this.viewContainer = viewContainer;
2656
- this.templateRef = templateRef;
2657
- }
2658
- set xuilibFeatureToggle(feature) {
2659
- this.feature = feature;
2660
- this.updateSubscription();
2661
- }
2662
- ngOnDestroy() {
2663
- if (this.subscription) {
2664
- this.subscription.unsubscribe();
2665
- }
2666
- }
2667
- updateSubscription() {
2668
- this.subscription = this.service.isEnabled(this.feature).subscribe(enabled => {
2669
- if (enabled) {
2670
- this.viewContainer.createEmbeddedView(this.templateRef);
2671
- }
2672
- else {
2673
- this.viewContainer.clear();
2674
- }
2675
- });
2676
- }
2677
- }
2678
- FeatureToggleDirective.decorators = [
2679
- { type: Directive, args: [{
2680
- selector: '[xuilibFeatureToggle]'
2681
- },] }
2682
- ];
2683
- FeatureToggleDirective.ctorParameters = () => [
2684
- { type: FeatureToggleService },
2685
- { type: ViewContainerRef },
2686
- { type: TemplateRef }
2687
- ];
2688
- FeatureToggleDirective.propDecorators = {
2689
- xuilibFeatureToggle: [{ type: Input }]
2690
- };
2691
-
2692
- class LetContext {
2693
- constructor() {
2694
- this.$implicit = null;
2695
- this.xuilibLet = null;
2696
- }
2697
- }
2698
- class LetDirective {
2699
- constructor(viewContainer, templateRef) {
2700
- this.viewContainer = viewContainer;
2701
- this.context = new LetContext();
2702
- this.viewContainer.createEmbeddedView(templateRef, this.context);
2703
- }
2704
- set xuilibLet(condition) {
2705
- this.context.$implicit = this.context.xuilibLet = condition;
2706
- }
2707
- }
2708
- LetDirective.decorators = [
2709
- { type: Directive, args: [{
2710
- selector: '[xuilibLet]'
2711
- },] }
2712
- ];
2713
- LetDirective.ctorParameters = () => [
2714
- { type: ViewContainerRef },
2715
- { type: TemplateRef }
2716
- ];
2717
- LetDirective.propDecorators = {
2718
- xuilibLet: [{ type: Input }]
2719
- };
2720
-
2721
- /*
2722
- * Gov Uk Checkbox Dumb Component responsible for
2723
- * displaying checkbox input and hint
2724
- *
2725
- * */
2726
- class GovUkCheckboxComponent {
2727
- constructor() {
2728
- this.isChecked = false;
2729
- }
2730
- ngOnInit() {
2731
- const id = this.config.focusOn ? this.config.focusOn : this.config.value;
2732
- this.config.id = id;
2733
- this.config.classes = this.config.classes ?
2734
- this.config.classes.concat(' govuk-checkboxes__label') : 'govuk-checkboxes__label';
2735
- }
2736
- }
2737
- GovUkCheckboxComponent.decorators = [
2738
- { type: Component, args: [{
2739
- selector: 'xuilib-gov-checkbox',
2740
- template: "<div class=\"govuk-checkboxes__item\" [formGroup]=\"group\">\n <input class=\"govuk-checkboxes__input\" type=\"checkbox\" [attr.aria-describedby]=\"config.hint ? config.value+'-item-hint' : null\"\n [id]=\"config.id\" [name]=\"config.name\" [formControlName]=\"config.value\" [checked]=\"isChecked\">\n <xuilib-gov-label appRemoveHost [config]=\"config\"></xuilib-gov-label>\n <span [id]=\"config.value+'-item-hint'\" class=\"govuk-hint govuk-checkboxes__hint\">\n {{config.hint}}\n </span>\n</div>"
2741
- },] }
2742
- ];
2743
- GovUkCheckboxComponent.ctorParameters = () => [];
2744
- GovUkCheckboxComponent.propDecorators = {
2745
- group: [{ type: Input }],
2746
- config: [{ type: Input }],
2747
- isChecked: [{ type: Input }]
2748
- };
2749
-
2750
- /*
2751
- * CheckBox component - state less
2752
- * Responsible for displaying a list of gov-uk-checkboxes
2753
- * @param: options - object with data for wrapper (fieldset) and
2754
- * array of items for gov-uk-checkboxes
2755
- * @param: errors - array of error stings
2756
- * */
2757
- class GovUkCheckboxesComponent {
2758
- }
2759
- GovUkCheckboxesComponent.decorators = [
2760
- { type: Component, args: [{
2761
- selector: 'xuilib-gov-uk-checkboxes',
2762
- template: "<xuilib-gov-uk-form-group-wrapper\n[error]=\"errors\"\n[config]=\"options.config\"\n[group]=\"options.key\">\n<div class=\"govuk-checkboxes\">\n <xuilib-gov-checkbox *ngFor=\"let item of options.items\"\n [group]=\"item.group\"\n [config]=\"item.config\">\n </xuilib-gov-checkbox>\n</div>\n</xuilib-gov-uk-form-group-wrapper>"
2763
- },] }
2764
- ];
2765
- GovUkCheckboxesComponent.propDecorators = {
2766
- options: [{ type: Input }],
2767
- errors: [{ type: Input }]
2768
- };
2769
-
2770
- /*
2771
- * Gov UK Date Component
2772
- * Responsible for displaying 3 input fields:
2773
- * day / month / year
2774
- * displaying errorMessage messages
2775
- * */
2776
- class GovUkDateComponent {
2777
- constructor() {
2778
- this.isOptional = false;
2779
- }
2780
- ngOnInit() {
2781
- this.day = `${this.config.id}_day`;
2782
- this.month = `${this.config.id}_month`;
2783
- this.year = `${this.config.id}_year`;
2784
- const dateValidator = this.DateValidator();
2785
- this.formGroup.get(this.day).setValidators(dateValidator);
2786
- }
2787
- isValidDate(d, month, year) {
2788
- const dateCheck = !isNaN(d.getTime());
2789
- // Month mismatch occurs if the provided day or month are invalid, or either is omitted. **Note:** This is insufficient for
2790
- // checking date validity when the year is omitted because it defaults to 1900 - an extra check is required
2791
- const monthMatch = d.getMonth() === month;
2792
- const yearMatch = d.getFullYear() === year;
2793
- return dateCheck && monthMatch && yearMatch;
2794
- }
2795
- isEmpty(value) {
2796
- // Note: Intentional use of == to check for null or undefined
2797
- /* eslint-disable eqeqeq */
2798
- /* tslint:disable:triple-equals */
2799
- // NaN and < 0 checks required for month field
2800
- return value == null || value === '' || isNaN(value) || value < 0;
2801
- /* eslint-enable eqeqeq */
2802
- /* tslint:enable:triple-equals */
2803
- }
2804
- DateValidator() {
2805
- return () => {
2806
- const day = this.formGroup.get(this.day).value;
2807
- const month = this.formGroup.get(this.month).value - 1;
2808
- const year = this.formGroup.get(this.year).value;
2809
- // Validation should pass if the date field is optional and day, month, and year are all empty
2810
- if (this.isOptional && this.isEmpty(day) && this.isEmpty(month) && this.isEmpty(year)) {
2811
- return null;
2812
- }
2813
- // + to coerce year to a number
2814
- return !this.isValidDate(new Date(year, month, day), month, +year) ? { dateComponent: true } : null;
2815
- };
2816
- }
2817
- }
2818
- GovUkDateComponent.decorators = [
2819
- { type: Component, args: [{
2820
- selector: 'xuilib-gov-uk-date',
2821
- template: "<div class=\"govuk-form-group\" [ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\" [formGroup]=\"formGroup\">\n <div class=\"date-input-container\">\n <xuilib-gov-uk-fieldset\n [config]=\"{\n legend: config.label || 'Date component',\n classes: config.classes || 'govuk-label--m',\n id: config.id,\n hint: config.hint != null ? config.hint : 'For example, 12 11 2007',\n isPageHeading: config.isPageHeading || false}\"\n [errorMessage]=\"errorMessage\">\n <xuilib-gov-uk-error-message\n [config]=\"{id: 'passport'}\"\n *ngIf=\"errorMessage\"\n [errorMessage]=\"errorMessage\">\n </xuilib-gov-uk-error-message>\n <div class=\"govuk-date-input\" [id]=\"config.id+'-date'\">\n <div class=\"govuk-date-input__item\">\n <div class=\"govuk-form-group\">\n <xuilib-gov-label\n [config]=\"{label: 'Day', name: config.id+'-day', id: config.id+'-day', classes: 'govuk-date-input__label'}\">\n </xuilib-gov-label>\n <input class=\"govuk-input govuk-date-input__input govuk-input--width-2\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id\"\n [name]=\"config.id+'-day'\" type=\"number\" value=\"\" pattern=\"[0-9]*\"\n [formControlName]=\"config.id+'_day'\">\n </div>\n </div>\n <div class=\"govuk-date-input__item\">\n <div class=\"govuk-form-group\">\n <xuilib-gov-label\n [config]=\"{label: 'Month', name: config.id+'-month', id: config.id+'-month', classes: 'govuk-date-input__label'}\">\n </xuilib-gov-label>\n <input class=\"govuk-input govuk-date-input__input govuk-input--width-2\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id+'-month'\"\n [name]=\"config.id+'-month'\" type=\"number\" value=\"\" pattern=\"[0-9]*\"\n [formControlName]=\"config.id+'_month'\">\n </div>\n </div>\n <div class=\"govuk-date-input__item\">\n <div class=\"govuk-form-group\">\n <xuilib-gov-label\n [config]=\"{label: 'Year', name: config.id+'-year', id: config.id+'-year', classes: 'govuk-date-input__label'}\">\n </xuilib-gov-label>\n <input class=\"govuk-input govuk-date-input__input govuk-input--width-4\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id+'-year'\"\n [name]=\"config.id+'-year'\" type=\"number\" value=\"\" pattern=\"[0-9]*\"\n [formControlName]=\"config.id+'_year'\">\n </div>\n </div>\n </div>\n </xuilib-gov-uk-fieldset>\n </div>\n</div>\n",
2822
- styles: [".govuk-form-group .date-input-container{margin-bottom:30px}.govuk-form-group .date-input-container .govuk-date-input .govuk-date-input__item .govuk-form-group{margin-bottom:0}"]
2823
- },] }
2824
- ];
2825
- GovUkDateComponent.ctorParameters = () => [];
2826
- GovUkDateComponent.propDecorators = {
2827
- config: [{ type: Input }],
2828
- errorMessage: [{ type: Input }],
2829
- formGroup: [{ type: Input }],
2830
- isOptional: [{ type: Input }]
2831
- };
2832
-
2833
- /*
2834
- * Gov UK Error Message
2835
- * Responsible for displaying in-line error messages
2836
- * @prop config - obj with properties
2837
- * @prop errorMessage - all error bject with messages property that is arry of strings.
2838
- * */
2839
- class GovUkErrorMessageComponent {
2840
- constructor() { }
2841
- }
2842
- GovUkErrorMessageComponent.decorators = [
2843
- { type: Component, args: [{
2844
- selector: ' xuilib-gov-uk-error-message',
2845
- template: "<span class=\"govuk-error-message\" [id]=\"config.id + '-error'\" *ngFor=\"let message of errorMessage?.messages\">\n <span class=\"govuk-visually-hidden\">Error:</span>{{message}}\n</span>"
2846
- },] }
2847
- ];
2848
- GovUkErrorMessageComponent.ctorParameters = () => [];
2849
- GovUkErrorMessageComponent.propDecorators = {
2850
- config: [{ type: Input }],
2851
- errorMessage: [{ type: Input }]
2852
- };
2853
-
2854
- /*
2855
- * Helper Class
2856
- * Used for dynamic templates manipulation
2857
- * */
2858
- class HtmlTemplatesHelper {
2859
- /*
2860
- * Sets described by string depending if
2861
- * there is an error, error and hit or nothing
2862
- * */
2863
- static setDescribedBy(errorMessage, config) {
2864
- if (!errorMessage) {
2865
- return config.hint ? `${config.id}-hint` : null;
2866
- }
2867
- else if (errorMessage && errorMessage.isInvalid) {
2868
- return config.hint ? `${config.id}-hint ${config.id}-error` : `${config.id}-error`;
2869
- }
2870
- else {
2871
- return config.hint ? `${config.id}-hint` : null;
2872
- }
2873
- }
2874
- }
2875
-
2876
- /*
2877
- * Gov Uk Fieldset Component
2878
- * Used to wrap group fieldset elements
2879
- * it can conditionally display h1 tag
2880
- * @param config
2881
- * @param isHeading
2882
- * @param errorMessage - used for aria tag
2883
- * */
2884
- class GovUkFieldsetComponent {
2885
- constructor() { }
2886
- setDescribedBy() {
2887
- return HtmlTemplatesHelper.setDescribedBy(this.errorMessage, this.config);
2888
- }
2889
- }
2890
- GovUkFieldsetComponent.decorators = [
2891
- { type: Component, args: [{
2892
- selector: 'xuilib-gov-uk-fieldset',
2893
- template: "<fieldset class=\"govuk-fieldset\" [attr.aria-describedby]=\"setDescribedBy()\">\n <legend [class]=\"config.classes + ' govuk-fieldset__legend'\" *ngIf=\"!config.isPageHeading\">\n {{config.legend}}\n </legend>\n\n <legend [class]=\"config.classes + ' govuk-fieldset__legend'\" *ngIf=\"config.isPageHeading\">\n <h1>{{config.legend}}</h1>\n </legend>\n\n <span [id]=\"config.id+'-hint'\" class=\"govuk-hint\" *ngIf=\"config.hint\">\n {{config.hint}}\n </span>\n <ng-content></ng-content>\n</fieldset>"
2894
- },] }
2895
- ];
2896
- GovUkFieldsetComponent.ctorParameters = () => [];
2897
- GovUkFieldsetComponent.propDecorators = {
2898
- config: [{ type: Input }],
2899
- errorMessage: [{ type: Input }]
2900
- };
2901
-
2902
- /*
2903
- * Gov UK Input component
2904
- * Responsible for displaying input, hint and error messages
2905
- * @prop errorMessages - array of messages
2906
- * @prop focusOn - passing the FormGroup
2907
- * @prop config - adding configuration
2908
- * */
2909
- class GovUkFileUploadComponent {
2910
- constructor() {
2911
- // { label: string, hint: string; name: string; id: string, type: string; isPageHeading: boolean, classes: string };
2912
- this.reloadInput = true;
2913
- }
2914
- ngOnInit() {
2915
- this.config.classes = 'govuk-label--m';
2916
- }
2917
- setDescribedBy() {
2918
- return HtmlTemplatesHelper.setDescribedBy(this.errorMessage, this.config);
2919
- }
2920
- }
2921
- GovUkFileUploadComponent.decorators = [
2922
- { type: Component, args: [{
2923
- selector: 'xuilib-gov-uk-file-upload',
2924
- template: "<div class=\"govuk-form-group\" [formGroup]=\"group\"\n [ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\">\n\n <xuilib-gov-label [config]=\"config\"></xuilib-gov-label>\n\n <span *ngIf=\"config.hint\" [id]=\"config.id +'-hint'\" class=\"govuk-hint\">\n {{config.hint}}\n </span>\n\n <xuilib-gov-uk-error-message [config]=\"config\" [errorMessage]=\"errorMessage\"></xuilib-gov-uk-error-message>\n\n <input class=\"govuk-file-upload\"\n *ngIf=\"reloadInput\"\n [formControlName]=\"config.id\"\n [ngClass]=\"{'govuk-file-upload--error': errorMessage?.isInvalid}\"\n [id]=\"config.id\" [name]=\"config.name\"\n [attr.aria-describedby]=\"setDescribedBy()\"\n type=\"file\">\n </div>"
2925
- },] }
2926
- ];
2927
- GovUkFileUploadComponent.ctorParameters = () => [];
2928
- GovUkFileUploadComponent.propDecorators = {
2929
- errorMessage: [{ type: Input }],
2930
- group: [{ type: Input }],
2931
- config: [{ type: Input }]
2932
- };
2933
-
2934
- /*
2935
- * Gov Uk Form Group Wrapper
2936
- * Used to wrap group form elements in html tags below such as
2937
- * gov-uk-checkboxes and radio buttons
2938
- * and errorMessage messages
2939
- * */
2940
- class GovUkFormGroupWrapperComponent {
2941
- constructor() { }
2942
- }
2943
- GovUkFormGroupWrapperComponent.decorators = [
2944
- { type: Component, args: [{
2945
- selector: 'xuilib-gov-uk-form-group-wrapper',
2946
- template: "<div class=\"govuk-form-group\" [attr.formGroupName]=\"group\" [ngClass]=\"{'govuk-form-group--error': (error?.isInvalid)}\">\n <xuilib-gov-uk-fieldset\n [config]=\"{legend: config.legend, classes: 'govuk-label--m', id: config.key, hint: config.hint, isPageHeading: config.isPageHeading}\"\n [errorMessage]=\"error\">\n\n <xuilib-gov-uk-error-message [config]=\"{id: group}\" [errorMessage]=\"error\"></xuilib-gov-uk-error-message>\n\n <ng-content></ng-content>\n\n </xuilib-gov-uk-fieldset>\n</div>"
2947
- },] }
2948
- ];
2949
- GovUkFormGroupWrapperComponent.ctorParameters = () => [];
2950
- GovUkFormGroupWrapperComponent.propDecorators = {
2951
- error: [{ type: Input }],
2952
- group: [{ type: Input }],
2953
- config: [{ type: Input }]
2954
- };
2955
-
2956
- /*
2957
- * Gov UK Input component
2958
- * Responsible for displaying input, hint and error messages
2959
- * @prop errorMessages - array of messages
2960
- * @prop focusOn - passing the FormGroup
2961
- * @prop config - adding configuration
2962
- * */
2963
- class GovUkInputComponent {
2964
- constructor() { }
2965
- // { label: string, hint: string; name: string; id: string, type: string; isPageHeading: boolean, classes: string };
2966
- ngOnInit() {
2967
- this.config.classes = 'govuk-label--m';
2968
- }
2969
- setDescribedBy() {
2970
- return HtmlTemplatesHelper.setDescribedBy(this.errorMessage, this.config);
2971
- }
2972
- }
2973
- GovUkInputComponent.decorators = [
2974
- { type: Component, args: [{
2975
- selector: 'xuilib-gov-uk-input',
2976
- template: "<div class=\"govuk-form-group gov-uk-input\" [formGroup]=\"group\"\n[ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\">\n\n<xuilib-gov-label [config]=\"config\"></xuilib-gov-label>\n\n<span *ngIf=\"config.hint\" [id]=\"config.id +'-hint'\" class=\"govuk-hint\">\n {{config.hint}}\n</span>\n\n<xuilib-gov-uk-error-message [config]=\"config\" [errorMessage]=\"errorMessage\"></xuilib-gov-uk-error-message>\n\n<input class=\"govuk-input\"\n [ngClass]=\"{'govuk-input--error': errorMessage?.isInvalid}\"\n [id]=\"config.id\"\n [name]=\"config.name\"\n [type]=\"config.type\"\n [attr.aria-invalid]=\"errorMessage?.isInvalid\"\n [formControlName]=\"config.name\"\n [attr.aria-describedby]='setDescribedBy()'>\n</div>\n",
2977
- styles: [".gov-uk-input input:disabled{background:#b1b4b6}"]
2978
- },] }
2979
- ];
2980
- GovUkInputComponent.ctorParameters = () => [];
2981
- GovUkInputComponent.propDecorators = {
2982
- errorMessage: [{ type: Input }],
2983
- group: [{ type: Input }],
2984
- config: [{ type: Input }]
2985
- };
2986
-
2987
- /*
2988
- * Gov UK Label component
2989
- * Responsible for displaying label tag
2990
- * @prop isPageHading - boolean to display h1
2991
- * @prop config - obj with properties
2992
- * */
2993
- class GovUkLabelComponent {
2994
- constructor() { }
2995
- }
2996
- GovUkLabelComponent.decorators = [
2997
- { type: Component, args: [{
2998
- selector: 'xuilib-gov-label',
2999
- template: "<h1 *ngIf=\"config.isPageHeading else noHeading\">\n <label *ngIf=\"config.label\" [class]=\"config.classes + ' govuk-label'\"\n [for]=\"config.id\" [innerHTML]=\"config.label\">\n </label>\n</h1>\n<ng-template #noHeading>\n <label *ngIf=\"config.label\" [class]=\"config.classes + ' govuk-label'\"\n [for]=\"config.id\" [innerHTML]=\"config.label\">\n </label>\n</ng-template>"
3000
- },] }
3001
- ];
3002
- GovUkLabelComponent.ctorParameters = () => [];
3003
- GovUkLabelComponent.propDecorators = {
3004
- config: [{ type: Input }]
3005
- };
3006
-
3007
- /*
3008
- * Gov Uk Radio state-less Component responsible for
3009
- * displaying radios input and hint
3010
- *
3011
- * */
3012
- class GovUkRadioComponent {
3013
- constructor() { }
3014
- /*
3015
- * ngOnInIt
3016
- * needed to manage the focus id if passed on in config
3017
- * si it can focus on element when user clicks on error message in the header.
3018
- **/
3019
- ngOnInit() {
3020
- const id = this.config.focusOn ? this.config.focusOn : this.config.value;
3021
- this.config.id = id;
3022
- this.config.classes = this.config.classes ?
3023
- this.config.classes.concat(' govuk-radios__label') : 'govuk-radios__label';
3024
- }
3025
- }
3026
- GovUkRadioComponent.decorators = [
3027
- { type: Component, args: [{
3028
- selector: 'xuilib-gov-radio',
3029
- template: "<div class=\"govuk-radios__item\" [formGroup]=\"group\">\n <input [className]=\"'govuk-radios__input ' + config.classes\"\n [id]=\"config.id\"\n [value]=\"config.value\" type=\"radio\"\n [attr.data-aria-controls]=\"config.id\"\n [name]=\"config.name\"\n [formControl]=\"group.controls[config.name]\">\n <xuilib-gov-label appRemoveHost [config]=\"config\"></xuilib-gov-label>\n</div>"
3030
- },] }
3031
- ];
3032
- GovUkRadioComponent.ctorParameters = () => [];
3033
- GovUkRadioComponent.propDecorators = {
3034
- group: [{ type: Input }],
3035
- config: [{ type: Input }]
3036
- };
3037
-
3038
- /*
3039
- * Radios component - state less
3040
- * Responsible for displaying a list of gov-uk-radio components
3041
- * @param: options - object with data for wrapper (fieldset) and
3042
- * array of items for gov-uk-checkboxes
3043
- * @param: errors - array of error stings
3044
- * */
3045
- class GovUkRadiosComponent {
3046
- }
3047
- GovUkRadiosComponent.decorators = [
3048
- { type: Component, args: [{
3049
- selector: 'xuilib-gov-uk-radios',
3050
- template: "<xuilib-gov-uk-form-group-wrapper\n[error]=\"errors\"\n[config]=\"options.config\"\n[group]=\"options.key\">\n<div class=\"govuk-radios\">\n <xuilib-gov-radio\n appRemoveHost\n *ngFor=\"let item of options.items\"\n [group]=\"options.group\"\n [config]=\"item.config\">\n </xuilib-gov-radio>\n</div>\n</xuilib-gov-uk-form-group-wrapper>"
3051
- },] }
3052
- ];
3053
- GovUkRadiosComponent.propDecorators = {
3054
- options: [{ type: Input }],
3055
- errors: [{ type: Input }]
3056
- };
3057
-
3058
- /*
3059
- * Gov Uk Select Dumb Component responsible for
3060
- * dropdown input.
3061
- * */
3062
- class GovUkSelectComponent {
3063
- constructor() { }
3064
- setDescribedBy() {
3065
- return HtmlTemplatesHelper.setDescribedBy(this.errorMessage, this.config);
3066
- }
3067
- }
3068
- GovUkSelectComponent.decorators = [
3069
- { type: Component, args: [{
3070
- selector: 'xuilib-gov-select',
3071
- template: "<div class=\"govuk-form-group\" [formGroup]=\"group\"\n[ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\">\n<xuilib-gov-label [config]=\"config\"></xuilib-gov-label>\n<span *ngIf=\"config.hint\" [id]=\"config.id +'-hint'\" class=\"govuk-hint\">\n {{config.hint}}\n</span>\n<xuilib-gov-uk-error-message [config]=\"config\" [errorMessage]=\"errorMessage\"></xuilib-gov-uk-error-message>\n\n<select class=\"govuk-select\" [id]=\"config.id\" [name]=\"config.id\" [formControlName]=\"config.id\" [attr.aria-describedby]='setDescribedBy()'>\n<option value=\"{{item.value}}\" *ngFor=\"let item of items\">{{item.label}}</option>\n</select>\n</div>"
3072
- },] }
3073
- ];
3074
- GovUkSelectComponent.ctorParameters = () => [];
3075
- GovUkSelectComponent.propDecorators = {
3076
- errorMessage: [{ type: Input }],
3077
- group: [{ type: Input }],
3078
- config: [{ type: Input }],
3079
- items: [{ type: Input }]
3080
- };
3081
-
3082
- class GovukTableComponent {
3083
- constructor() {
3084
- this.classes = '';
3085
- this.caption = 'Dates and amounts';
3086
- this.firstCellIsHeader = true;
3087
- this.columnConfig = [
3088
- { header: 'Date', key: 'date', type: 'text' },
3089
- { header: 'Amount', key: 'amount' }
3090
- ];
3091
- }
3092
- formatDate(date) {
3093
- return formatDate(date, 'dd/MM/yyyy', 'en-UK');
3094
- }
3095
- }
3096
- GovukTableComponent.decorators = [
3097
- { type: Component, args: [{
3098
- selector: 'xuilib-gov-uk-table',
3099
- template: "<table class=\"{{'govuk-table ' + classes}}\">\n <caption class=\"govuk-table__caption\">{{caption}}</caption>\n <thead class=\"govuk-table__head\" >\n <tr class=\"govuk-table__row\">\n <th class=\"govuk-table__header\" scope=\"col\" *ngFor=\"let h of columnConfig\">{{h.header}}</th>\n </tr>\n </thead>\n <tbody class=\"govuk-table__body\">\n <tr data-selector=\"table-row\" class=\"govuk-table__row\" *ngFor=\"let r of rows\">\n <ng-container *ngFor=\"let col of columnConfig; first as isFirst\">\n <th data-selector=\"table-header\" class=\"govuk-table__header\" scope=\"row\" *ngIf=\"isFirst && firstCellIsHeader\">\n <ng-container *ngIf=\"!col.type || col.type === 'text' || !r.routerLink\">{{r[col.key]}}</ng-container>\n <ng-container *ngIf=\"col.type === 'link' && r.routerLink\">\n <a class=\"govuk-link\" [routerLink]=\"r.routerLink\">{{r[col.key]}}</a>\n </ng-container>\n </th>\n <td data-selector=\"table-cell\" class=\"govuk-table__cell\" *ngIf=\"!(isFirst && firstCellIsHeader)\">\n <ng-container *ngIf=\"col.type === 'date'\">{{formatDate(r[col.key])}}</ng-container>\n <ng-container *ngIf=\"!col.type || col.type === 'text' || !r.routerLink\">{{r[col.key]}}</ng-container>\n <ng-container *ngIf=\"col.type === 'link' && r.routerLink\">\n <a class=\"govuk-link\" [routerLink]=\"r.routerLink\">{{r[col.key]}}</a>\n </ng-container>\n </td>\n </ng-container>\n </tr>\n </tbody>\n</table>\n",
3100
- styles: [""]
3101
- },] }
3102
- ];
3103
- GovukTableComponent.ctorParameters = () => [];
3104
- GovukTableComponent.propDecorators = {
3105
- classes: [{ type: Input }],
3106
- caption: [{ type: Input }],
3107
- firstCellIsHeader: [{ type: Input }],
3108
- rows: [{ type: Input }],
3109
- columnConfig: [{ type: Input }]
3110
- };
3111
- class GovukTableColumnConfig {
3112
- constructor() {
3113
- this.header = '';
3114
- this.key = '';
3115
- this.type = 'text';
3116
- }
3117
- }
3118
-
3119
- /*
3120
- * CheckBox component - state less
3121
- * Responsible for displaying a list of gov-uk-checkboxes
3122
- * @param: options - object with data for wrapper (fieldset) and
3123
- * array of items for gov-uk-checkboxes
3124
- * @param: errors - array of errorMessage
3125
- * */
3126
- class GovUkTextareaComponent {
3127
- setDescribedBy() {
3128
- return HtmlTemplatesHelper.setDescribedBy(this.errorMessage, this.config);
3129
- }
3130
- }
3131
- GovUkTextareaComponent.decorators = [
3132
- { type: Component, args: [{
3133
- selector: 'xuilib-gov-uk-textarea',
3134
- template: "<div [formGroup]=\"group\" \nclass=\"govuk-form-group\" [ngClass]=\"{'govuk-form-group--error': errorMessage?.isInvalid}\">\n<xuilib-gov-label [config]=\"config\"></xuilib-gov-label>\n<span id=\"more-detail-hint\" class=\"govuk-hint\">\n {{config.hint}}\n</span>\n<xuilib-gov-uk-error-message [config]=\"config\" [errorMessage]=\"errorMessage\"></xuilib-gov-uk-error-message>\n<textarea\n class=\"govuk-textarea\" [formControlName]=\"config.key\"\n [ngClass]=\"{'govuk-textarea--error': errorMessage?.isInvalid}\"\n [id]=\"config.id\" name=\"more-detail\" [rows]=\"config.rows\" [attr.aria-describedby]=\"setDescribedBy()\"></textarea>\n</div>"
3135
- },] }
3136
- ];
3137
- GovUkTextareaComponent.propDecorators = {
3138
- config: [{ type: Input }],
3139
- errorMessage: [{ type: Input }],
3140
- group: [{ type: Input }]
3141
- };
3142
-
3143
- /*
3144
- * Hmcts Banner
3145
- * Responsible for displaying prominent message and related actions
3146
- * @prop message to display
3147
- * @prop type
3148
- * */
3149
- class HmctsBannerComponent {
3150
- constructor() { }
3151
- }
3152
- HmctsBannerComponent.decorators = [
3153
- { type: Component, args: [{
3154
- selector: 'xuilib-hmcts-banner',
3155
- template: "<div class=\"hmcts-banner hmcts-banner--{{type}}\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\">\n <path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\" /></svg>\n <div class=\"hmcts-banner__message\">\n <span class=\"hmcts-banner__assistive\">{{type}}</span>\n {{message}}\n </div>\n</div>",
3156
- styles: [":host{display:block;width:100%}"]
3157
- },] }
3158
- ];
3159
- HmctsBannerComponent.ctorParameters = () => [];
3160
- HmctsBannerComponent.propDecorators = {
3161
- type: [{ type: Input }],
3162
- message: [{ type: Input }]
3163
- };
3164
-
3165
- /*
3166
- Error Summary component
3167
- State Less component
3168
- @property errorMessages that is array of messages.
3169
- Component is also responsible for scrolling. Up and Down the page when user click on links
3170
- */
3171
- class HmctsErrorSummaryComponent {
3172
- constructor(document) {
3173
- this.document = document;
3174
- }
3175
- set errorMessages(value) {
3176
- this.messages = value;
3177
- }
3178
- ngAfterViewInit() {
3179
- this.scrollTo('errorSummary');
3180
- }
3181
- ngOnChanges(changes) {
3182
- if (changes.errorMessages) {
3183
- this.scrollTo('errorSummary');
3184
- }
3185
- }
3186
- scrollTo(selector) {
3187
- if (this.document.querySelector(`#${selector}`)) {
3188
- const el = this.document.querySelector(`#${selector}`);
3189
- el.focus();
3190
- }
3191
- }
3192
- hasElement(selector) {
3193
- return this.document.querySelector(`#${selector}`);
3194
- }
3195
- }
3196
- HmctsErrorSummaryComponent.decorators = [
3197
- { type: Component, args: [{
3198
- selector: 'xuilib-hmcts-error-summary',
3199
- template: "<div *ngIf=\"!showWarningMessage && messages && messages.length > 0\" id=\"errorSummary\" class=\"govuk-error-summary\" aria-labelledby=\"error-summary-title\" role=\"alert\" tabindex=\"-1\"\n data-module=\"error-summary\">\n <h2 class=\"govuk-error-summary__title\" id=\"error-summary-title\">\n {{header}}\n </h2>\n <div class=\"govuk-error-summary__body\">\n <ul class=\"govuk-list govuk-error-summary__list\">\n <li *ngFor=\"let message of messages\">\n <a (click)=\"scrollTo(message['id'])\" [routerLink]=\"\" [fragment]=\"message['id']\"\n *ngIf=\"hasElement(message['id'])\">{{message['message']}}</a>\n <span *ngIf=\"!hasElement(message['id'])\">{{message['message']}}</span>\n </li>\n </ul>\n </div>\n</div>\n<div *ngIf=\"showWarningMessage\" class=\"hmcts-banner hmcts-banner--warning\">\n <svg class=\"hmcts-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\">\n <path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\" /></svg>\n <div class=\"hmcts-banner__message\">\n <span class=\"hmcts-banner__assistive\">Warning</span>\n <p class=\"govuk-body\" *ngFor=\"let message of messages\">{{ message['message'] }}</p>\n </div>\n</div>"
3200
- },] }
3201
- ];
3202
- HmctsErrorSummaryComponent.ctorParameters = () => [
3203
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
3204
- ];
3205
- HmctsErrorSummaryComponent.propDecorators = {
3206
- errorMessages: [{ type: Input }],
3207
- header: [{ type: Input }],
3208
- showWarningMessage: [{ type: Input }]
3209
- };
3210
-
3211
- class HmctsIdentityBarComponent {
3212
- constructor() { }
3213
- set content(value) {
3214
- this.value = value.name;
3215
- }
3216
- }
3217
- HmctsIdentityBarComponent.decorators = [
3218
- { type: Component, args: [{
3219
- selector: 'xuilib-hmcts-identity-bar',
3220
- template: "<div class=\"hmcts-identity-bar\" *ngIf=\"value\">\n\n <div class=\"hmcts-identity-bar__container\">\n\n <div class=\"hmcts-identity-bar__details\">\n \n <span class=\"hmcts-identity-bar__title\">{{value}}</span>\n \n </div> \n\n </div>\n\n</div>",
3221
- styles: [""]
3222
- },] }
3223
- ];
3224
- HmctsIdentityBarComponent.ctorParameters = () => [];
3225
- HmctsIdentityBarComponent.propDecorators = {
3226
- content: [{ type: Input }]
3227
- };
3228
-
3229
- /*
3230
- * Main Content wrapper
3231
- * Responsible for:
3232
- * Wrapping content within the gov-uk html elements bellow
3233
- * @prop showBackLink - switch for back link
3234
- * @prop title = title
3235
- * @prop summaryErrors list of errors
3236
- * @prop back link, title (title), summaryErrors (array of errors)
3237
- * */
3238
- class HmctsMainWrapperComponent {
3239
- constructor() {
3240
- this.backEvent = new EventEmitter();
3241
- }
3242
- set banner(value) {
3243
- this.bannerData = value;
3244
- }
3245
- ngOnInit() {
3246
- this.hasBackLink = this.backLink !== undefined || this.backEvent.observers.length > 0;
3247
- }
3248
- onGoBack() {
3249
- this.backEvent.emit();
3250
- }
3251
- }
3252
- HmctsMainWrapperComponent.decorators = [
3253
- { type: Component, args: [{
3254
- selector: 'xuilib-hmcts-main-wrapper',
3255
- template: "<a *ngIf=\"hasBackLink\" [routerLink]=\"backLink\" (click)=\"onGoBack()\" class=\"govuk-back-link\">Back</a>\n<main id=\"content\" role=\"main\" class=\"govuk-main-wrapper\">\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <xuilib-hmcts-error-summary\n *ngIf=\"summaryErrors && !summaryErrors.isFromValid\"\n [errorMessages]=\"summaryErrors.items\"\n [header]=\"summaryErrors.header\"\n [showWarningMessage]=\"showWarningMessage\">\n </xuilib-hmcts-error-summary>\n <xuilib-hmcts-banner *ngIf=\"bannerData\" [message]=\"bannerData.message\" [type]=\"bannerData.type\"></xuilib-hmcts-banner>\n <h1 *ngIf=\"title\" class=\"govuk-heading-xl\">{{title}}</h1>\n <ng-content></ng-content>\n </div>\n <div class=\"govuk-grid-column-one-third\" *ngIf=\"actionButtons?.length > 0\">\n <div class=\"hmcts-page-heading__actions-wrapper\">\n <a\n *ngFor=\"let actionButton of actionButtons\"\n (click)=\"actionButton.action()\"\n role=\"button\"\n draggable=\"false\"\n class=\"govuk-button {{ actionButton.class }}\"\n >{{ actionButton.name }}</a>\n </div>\n </div>\n </div>\n</main>\n"
3256
- },] }
3257
- ];
3258
- HmctsMainWrapperComponent.ctorParameters = () => [];
3259
- HmctsMainWrapperComponent.propDecorators = {
3260
- backLink: [{ type: Input }],
3261
- title: [{ type: Input }],
3262
- summaryErrors: [{ type: Input }],
3263
- banner: [{ type: Input }],
3264
- actionButtons: [{ type: Input }],
3265
- showWarningMessage: [{ type: Input }],
3266
- backEvent: [{ type: Output }]
3267
- };
3268
-
3269
- class HmctsPaginationComponent {
3270
- constructor() {
3271
- this.maxSize = 7;
3272
- this.pageSize = 10;
3273
- this.showPageNumbers = true;
3274
- this.showResultCount = true;
3275
- this.pageChange = new EventEmitter();
3276
- this.pageBoundsCorrection = new EventEmitter();
3277
- }
3278
- }
3279
- HmctsPaginationComponent.decorators = [
3280
- { type: Component, args: [{
3281
- selector: 'xuilib-hmcts-pagination',
3282
- template: "<pagination-template #p=\"paginationApi\" [id]=\"id\" [maxSize]=\"maxSize\" (pageChange)=\"pageChange.emit($event)\"\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\">\n\n <nav class=\"hmcts-pagination\" id=\"pagination-label\">\n <p class=\"govuk-visually-hidden\" aria-labelledby=\"pagination-label\">Pagination navigation</p>\n <ul class=\"hmcts-pagination__list\" *ngIf=\"!(p.pages.length <= 1)\">\n\n <li class=\"hmcts-pagination__item hmcts-pagination__item--prev\" [class.disabled]=\"p.isFirstPage()\">\n <a [routerLink]=\"\" class=\"hmcts-pagination__link\" *ngIf=\"1 < p.getCurrent()\" (keyup.enter)=\"p.previous()\"\n (click)=\"p.previous()\">Previous <span class=\"govuk-visually-hidden\">set of pages</span></a>\n </li>\n\n <ng-container *ngIf=\"showPageNumbers\">\n <li class=\"hmcts-pagination__item\" [class.hmcts-pagination__item--active]=\"p.getCurrent() === page.value\"\n [class.hmcts-pagination__item--dots]=\"page.label === '...'\" *ngFor=\"let page of p.pages\">\n <a class=\"hmcts-pagination__link\" [routerLink]=\"\" (keyup.enter)=\"p.setCurrent(page.value)\"\n (click)=\"p.setCurrent(page.value)\" *ngIf=\"p.getCurrent() !== page.value\">\n <span class=\"govuk-visually-hidden\">page </span>\n <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>\n </a>\n <ng-container *ngIf=\"p.getCurrent() === page.value\">\n <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>\n </ng-container>\n </li>\n </ng-container>\n\n <li class=\"hmcts-pagination__item hmcts-pagination__item--next\" [class.disabled]=\"p.isLastPage()\">\n <a [routerLink]=\"\" class=\"hmcts-pagination__link\" *ngIf=\"!p.isLastPage()\" (keyup.enter)=\"p.next()\"\n (click)=\"p.next()\">Next<span class=\"govuk-visually-hidden\"> page</span></a>\n </li>\n\n </ul>\n <p class=\"hmcts-pagination__results\" *ngIf=\"showResultCount\">Showing <b>{{(p.getCurrent() * pageSize) - pageSize + 1}}</b>\n to <b>{{ p.getCurrent() * pageSize > p.getTotalItems() ? p.getTotalItems() : p.getCurrent() *\n pageSize}}</b> of <b>{{p.getTotalItems()}}</b> results</p>\n </nav>\n\n</pagination-template>",
3283
- styles: [".hmcts-pagination__results{float:right}"]
3284
- },] }
3285
- ];
3286
- HmctsPaginationComponent.propDecorators = {
3287
- id: [{ type: Input }],
3288
- maxSize: [{ type: Input }],
3289
- pageSize: [{ type: Input }],
3290
- showPageNumbers: [{ type: Input }],
3291
- showResultCount: [{ type: Input }],
3292
- pageChange: [{ type: Output }],
3293
- pageBoundsCorrection: [{ type: Output }]
3294
- };
3295
-
3296
- class HmctsPrimaryNavigationComponent {
3297
- constructor() {
3298
- }
3299
- set userLoggedIn(value) {
3300
- this.isUserLoggedIn = value;
3301
- }
3302
- }
3303
- HmctsPrimaryNavigationComponent.decorators = [
3304
- { type: Component, args: [{
3305
- selector: 'xuilib-hmcts-primary-navigation',
3306
- template: "<nav *ngIf=\"isUserLoggedIn\" class=\"hmcts-primary-navigation\" [attr.aria-label]=\"label\">\n <div class=\"hmcts-primary-navigation__container\">\n <div class=\"govuk-header__logo\" *ngIf=\"isBrandedHeader\"></div>\n <ul class=\"hmcts-primary-navigation__list\">\n <li class=\"hmcts-primary-navigation__item\" *ngFor=\"let item of items\">\n <a class=\"hmcts-primary-navigation__link\" [attr.aria-current]=\"item.active ? true: null\" [routerLink]=\"item.href\" [innerHTML]=\"item.text\"></a>\n </li>\n </ul>\n </div>\n</nav>\n",
3307
- styles: [""]
3308
- },] }
3309
- ];
3310
- HmctsPrimaryNavigationComponent.ctorParameters = () => [];
3311
- HmctsPrimaryNavigationComponent.propDecorators = {
3312
- userLoggedIn: [{ type: Input }],
3313
- label: [{ type: Input }],
3314
- items: [{ type: Input }],
3315
- isBrandedHeader: [{ type: Input }]
3316
- };
3317
-
3318
- class HmctsSubNavigationComponent {
3319
- }
3320
- HmctsSubNavigationComponent.decorators = [
3321
- { type: Component, args: [{
3322
- selector: 'xuilib-hmcts-sub-navigation',
3323
- template: "<nav class=\"hmcts-sub-navigation\" attr.aria-label=\"{{label}}\" role=\"navigation\" *ngIf=\"items\">\n <ul class=\"hmcts-sub-navigation__list\">\n <li class=\"hmcts-sub-navigation__item\" *ngFor=\"let item of items\">\n <a data-selector=\"sub-nav-link\" class=\"hmcts-sub-navigation__link\" [routerLink]=\"item.href\"\n [attr.aria-current]=\"item.active ? 'page' : null\">\n {{item.text}}\n\n <span *ngIf=\"item.roundel && item.roundel > 0 \" class=\"xui-alert-link__number\"> {{item.roundel}} </span>\n </a>\n </li>\n </ul>\n</nav>\n",
3324
- styles: [".xui-alert-link__number{font-family:nta,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:14px;font-size:.875rem;line-height:1.78571;border-radius:50%;background-color:#1d70b8;color:#fff;font-weight:700;width:25px;height:25px;margin-left:5px;text-align:center;display:inline-block;text-decoration:none}"]
3325
- },] }
3326
- ];
3327
- HmctsSubNavigationComponent.propDecorators = {
3328
- label: [{ type: Input }],
3329
- items: [{ type: Input }]
3330
- };
3331
-
3332
- /*
3333
- * Remove Host Directive
3334
- * Used to remove native angular host tags tags
3335
- * sometimes needed because of CSS dependencies
3336
- * */
3337
- class RemoveHostDirective {
3338
- constructor(el) {
3339
- this.el = el;
3340
- }
3341
- ngOnInit() {
3342
- const nativeElement = this.el.nativeElement;
3343
- const parentElement = nativeElement.parentElement;
3344
- // move all children out of the element
3345
- while (nativeElement.firstChild) {
3346
- parentElement.insertBefore(nativeElement.firstChild, nativeElement);
3347
- }
3348
- parentElement.removeChild(nativeElement);
3349
- }
3350
- }
3351
- RemoveHostDirective.decorators = [
3352
- { type: Directive, args: [{
3353
- selector: '[appRemoveHost]'
3354
- },] }
3355
- ];
3356
- RemoveHostDirective.ctorParameters = () => [
3357
- { type: ElementRef }
3358
- ];
3359
-
3360
- const COMMON_COMPONENTS = [
3361
- ExuiPageWrapperComponent,
3362
- TermsAndConditionsComponent,
3363
- TcDisplayHtmlComponent,
3364
- TcDisplayPlainComponent,
3365
- TcConfirmComponent,
3366
- ContactDetailsComponent,
3367
- FeatureToggleDirective,
3368
- LetDirective,
3369
- HmctsSessionDialogComponent,
3370
- UserListComponent,
3371
- UserDetailsComponent,
3372
- InviteUserPermissionComponent,
3373
- InviteUserFormComponent,
3374
- ShareCaseComponent,
3375
- ShareCaseConfirmComponent,
3376
- SelectedCaseListComponent,
3377
- SelectedCaseComponent,
3378
- SelectedCaseConfirmComponent,
3379
- UserSelectComponent,
3380
- TabComponent,
3381
- AccessibilityComponent,
3382
- DueDateComponent,
3383
- CheckboxListComponent,
3384
- ServiceMessageComponent,
3385
- ServiceMessagesComponent,
3386
- LoadingSpinnerComponent,
3387
- GenericFilterComponent,
3388
- CookieBannerComponent,
3389
- FindPersonComponent,
3390
- SearchJudicialsComponent,
3391
- FindLocationComponent,
3392
- SearchLocationComponent,
3393
- SearchVenueComponent,
3394
- PaginationComponent
3395
- ];
3396
- const GOV_UI_COMPONENTS = [
3397
- HmctsIdentityBarComponent,
3398
- HmctsPaginationComponent,
3399
- HmctsSubNavigationComponent,
3400
- HmctsPrimaryNavigationComponent,
3401
- HmctsErrorSummaryComponent,
3402
- HmctsMainWrapperComponent,
3403
- HmctsBannerComponent,
3404
- GovukTableComponent,
3405
- GovUkInputComponent,
3406
- GovUkCheckboxComponent,
3407
- GovUkFormGroupWrapperComponent,
3408
- GovUkLabelComponent,
3409
- GovUkErrorMessageComponent,
3410
- GovUkFieldsetComponent,
3411
- GovUkDateComponent,
3412
- GovUkCheckboxesComponent,
3413
- GovUkRadioComponent,
3414
- GovUkRadiosComponent,
3415
- GovUkSelectComponent,
3416
- GovUkTextareaComponent,
3417
- GovUkFileUploadComponent,
3418
- RemoveHostDirective
3419
- ];
3420
- const ɵ0 = windowProvider;
3421
- class ExuiCommonLibModule {
3422
- }
3423
- ExuiCommonLibModule.decorators = [
3424
- { type: NgModule, args: [{
3425
- declarations: [
3426
- ...COMMON_COMPONENTS,
3427
- ...GOV_UI_COMPONENTS
3428
- ],
3429
- imports: [
3430
- CommonModule,
3431
- FormsModule,
3432
- ReactiveFormsModule,
3433
- RouterModule.forChild([]),
3434
- MatAutocompleteModule,
3435
- MatTabsModule,
3436
- MatInputModule,
3437
- NgxPaginationModule
3438
- ],
3439
- providers: [
3440
- { provide: windowToken, useFactory: ɵ0 }
3441
- ],
3442
- exports: [
3443
- ...COMMON_COMPONENTS,
3444
- ...GOV_UI_COMPONENTS,
3445
- PaginatePipe
3446
- ]
3447
- },] }
3448
- ];
3449
-
3450
- class GovUiService {
3451
- constructor() { }
3452
- }
3453
- GovUiService.ɵprov = i0.ɵɵdefineInjectable({ factory: function GovUiService_Factory() { return new GovUiService(); }, token: GovUiService, providedIn: "root" });
3454
- GovUiService.decorators = [
3455
- { type: Injectable, args: [{
3456
- providedIn: 'root'
3457
- },] }
3458
- ];
3459
- GovUiService.ctorParameters = () => [];
3460
-
3461
- function checkboxesBeCheckedValidator(minRequired = 1) {
3462
- return function validate(formGroup) {
3463
- let checked = 0;
3464
- Object.keys(formGroup.controls).forEach(key => {
3465
- const control = formGroup.controls[key];
3466
- if (control.value === true) {
3467
- checked++;
3468
- }
3469
- });
3470
- if (checked < minRequired) {
3471
- return {
3472
- requireOneCheckboxToBeChecked: true,
3473
- };
3474
- }
3475
- return null;
3476
- };
3477
- }
3478
-
3479
- function dateValidator() {
3480
- return function validate(formGroup) {
3481
- const d = new Date(parseInt(formGroup.controls.day.value, 10), parseInt(formGroup.controls.month.value, 10) - 1, parseInt(formGroup.controls.year.value, 10) - 1);
3482
- function isValidDate(val) {
3483
- return val instanceof Date && !isNaN(+d);
3484
- }
3485
- if (!isValidDate(d)) {
3486
- return {
3487
- dateIsInvalid: true,
3488
- };
3489
- }
3490
- return null;
3491
- };
3492
- }
3493
-
3494
- function radioGroupValidator() {
3495
- return function validate(formGroup) {
3496
- if (formGroup.controls) {
3497
- for (const control in formGroup.controls) {
3498
- if (!formGroup.controls[control].valid) {
3499
- return {
3500
- isRadioGroupInvalid: true,
3501
- };
3502
- }
3503
- }
3504
- }
3505
- return null;
3506
- };
3507
- }
3508
-
3509
- /*
3510
- * Public API Surface of gov-ui
3511
- */
3512
-
3513
- /*
3514
- * Public API Surface of gov-ui
3515
- */
3516
-
3517
- class FeatureToggleGuard {
3518
- constructor(featureToggleService, router) {
3519
- this.featureToggleService = featureToggleService;
3520
- this.router = router;
3521
- }
3522
- /**
3523
- * Usage: Add the FeatureToggleGuard as the Guard for a route, and provide the following
3524
- * in the data array for the route:
3525
- * - needsFeaturesEnabled: An array of feature keys that need to be enabled for this route
3526
- * - featureDisabledRedirect: the URL to redirect to when the this route is not accessible due to disabled features
3527
- * @param route Automatically provided by Angular
3528
- */
3529
- canActivate(route) {
3530
- return combineLatest(...route.data.needsFeaturesEnabled.map(feature => this.featureToggleService.getValueOnce(feature, false))).pipe(map(featureStatuses => featureStatuses.every(status => status)), map(status => status || this.router.parseUrl(route.data.featureDisabledRedirect)));
3531
- }
3532
- }
3533
- FeatureToggleGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function FeatureToggleGuard_Factory() { return new FeatureToggleGuard(i0.ɵɵinject(FeatureToggleService), i0.ɵɵinject(i1$1.Router)); }, token: FeatureToggleGuard, providedIn: "root" });
3534
- FeatureToggleGuard.decorators = [
3535
- { type: Injectable, args: [{
3536
- providedIn: 'root'
3537
- },] }
3538
- ];
3539
- FeatureToggleGuard.ctorParameters = () => [
3540
- { type: FeatureToggleService },
3541
- { type: Router }
3542
- ];
3543
-
3544
- class LaunchDarklyService {
3545
- constructor() {
3546
- this.ready = new BehaviorSubject(false);
3547
- this.features = {};
3548
- this.user = { anonymous: true };
3549
- this.clientId = '';
3550
- }
3551
- initialize(user = { anonymous: true }, clientId) {
3552
- this.ready.next(false);
3553
- this.user = user;
3554
- this.clientId = clientId;
3555
- this.client = LDClient.initialize(this.clientId, this.user, {});
3556
- this.client.on('ready', () => {
3557
- this.client.identify(this.user).then(() => this.ready.next(true));
3558
- });
3559
- }
3560
- isEnabled(feature) {
3561
- return this.getValue(feature, false);
3562
- }
3563
- getArray(feature) {
3564
- return this.getValue(feature, []);
3565
- }
3566
- getValue(feature, defaultValue) {
3567
- if (!this.features.hasOwnProperty(feature)) {
3568
- this.features[feature] = new BehaviorSubject(defaultValue);
3569
- this.ready.pipe(filter(ready => ready), map(() => this.client.variation(feature, defaultValue))).subscribe(value => {
3570
- this.features[feature].next(value);
3571
- this.client.on(`change:${feature}`, (val) => {
3572
- this.features[feature].next(val);
3573
- });
3574
- });
3575
- }
3576
- return this.features[feature].pipe(distinctUntilChanged());
3577
- }
3578
- /**
3579
- * This method returns an observable that will only get the state of the feature toggle
3580
- * once. It calls the LD SDK directly, and should only be used in circumstances where
3581
- * only one value should be emitted, that value coming directly from LD. This will likely
3582
- * only apply for Guards, and should be used only when absolutely necessary.
3583
- * @see getValue for regular usage.
3584
- * @param feature string
3585
- * @param defaultValue R
3586
- */
3587
- getValueOnce(feature, defaultValue) {
3588
- return this.ready.pipe(filter(ready => ready), map(() => this.client.variation(feature, defaultValue)));
3589
- }
3590
- }
3591
- LaunchDarklyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LaunchDarklyService_Factory() { return new LaunchDarklyService(); }, token: LaunchDarklyService, providedIn: "root" });
3592
- LaunchDarklyService.decorators = [
3593
- { type: Injectable, args: [{
3594
- providedIn: 'root'
3595
- },] }
3596
- ];
3597
-
3598
- class GoogleAnalyticsService {
3599
- constructor(router, title, window, document) {
3600
- this.router = router;
3601
- this.title = title;
3602
- this.window = window;
3603
- this.document = document;
3604
- }
3605
- init(googleAnalyticsKey) {
3606
- this.googleAnalyticsKey = googleAnalyticsKey;
3607
- try {
3608
- const script1 = this.document.createElement('script');
3609
- script1.async = true;
3610
- script1.src = `https://www.googletagmanager.com/gtag/js?id=${this.googleAnalyticsKey}`;
3611
- this.document.head.appendChild(script1);
3612
- const script2 = this.document.createElement('script');
3613
- script2.innerHTML = `
3614
- window.dataLayer = window.dataLayer || [];
3615
- function gtag(){dataLayer.push(arguments);}
3616
- gtag('js', new Date());
3617
- gtag('config', '${this.googleAnalyticsKey}', {'send_page_view': false});
3618
- `;
3619
- this.document.head.appendChild(script2);
3620
- }
3621
- catch (ex) {
3622
- console.error('Error appending google analytics');
3623
- console.error(ex);
3624
- }
3625
- this.listenForRouteChanges();
3626
- }
3627
- listenForRouteChanges() {
3628
- if (this.googleAnalyticsKey) {
3629
- this.router.events.subscribe(event => {
3630
- if (event instanceof NavigationEnd) {
3631
- this.window.gtag('config', this.googleAnalyticsKey, {
3632
- page_path: event.urlAfterRedirects,
3633
- page_title: this.title.getTitle(),
3634
- });
3635
- }
3636
- });
3637
- }
3638
- }
3639
- event(eventName, params) {
3640
- this.window.gtag('event', eventName, params);
3641
- }
3642
- }
3643
- GoogleAnalyticsService.ɵprov = i0.ɵɵdefineInjectable({ factory: function GoogleAnalyticsService_Factory() { return new GoogleAnalyticsService(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(i2.Title), i0.ɵɵinject(windowToken), i0.ɵɵinject(i4.DOCUMENT)); }, token: GoogleAnalyticsService, providedIn: "root" });
3644
- GoogleAnalyticsService.decorators = [
3645
- { type: Injectable, args: [{
3646
- providedIn: 'root'
3647
- },] }
3648
- ];
3649
- GoogleAnalyticsService.ctorParameters = () => [
3650
- { type: Router },
3651
- { type: Title },
3652
- { type: undefined, decorators: [{ type: Inject, args: [windowToken,] }] },
3653
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
3654
- ];
3655
-
3656
- class GoogleTagManagerService {
3657
- constructor(router, title, window, document) {
3658
- this.router = router;
3659
- this.title = title;
3660
- this.window = window;
3661
- this.document = document;
3662
- }
3663
- init(googleTagManagerKey) {
3664
- this.googleTagManagerKey = googleTagManagerKey;
3665
- try {
3666
- this.window.dataLayer = this.window.dataLayer || [];
3667
- this.window.dataLayer.push({
3668
- 'gtm.start': new Date().getTime(),
3669
- event: 'gtm.js'
3670
- });
3671
- const script = this.document.createElement('script');
3672
- script.async = true;
3673
- script.src = `https://www.googletagmanager.com/gtm.js?id=${this.googleTagManagerKey}`;
3674
- this.document.head.appendChild(script);
3675
- }
3676
- catch (ex) {
3677
- console.error('Error appending google tag manager');
3678
- console.error(ex);
3679
- }
3680
- this.listenForRouteChanges();
3681
- }
3682
- listenForRouteChanges() {
3683
- if (this.googleTagManagerKey) {
3684
- this.router.events.subscribe(event => {
3685
- if (event instanceof NavigationEnd) {
3686
- this.window.dataLayer.push({
3687
- event: 'pageview',
3688
- page: {
3689
- path: event.urlAfterRedirects,
3690
- title: this.title.getTitle()
3691
- }
3692
- });
3693
- }
3694
- });
3695
- }
3696
- }
3697
- event(eventName, params) {
3698
- this.window.dataLayer.push({
3699
- event: eventName,
3700
- params
3701
- });
3702
- }
3703
- }
3704
- GoogleTagManagerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function GoogleTagManagerService_Factory() { return new GoogleTagManagerService(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(i2.Title), i0.ɵɵinject(windowToken), i0.ɵɵinject(i4.DOCUMENT)); }, token: GoogleTagManagerService, providedIn: "root" });
3705
- GoogleTagManagerService.decorators = [
3706
- { type: Injectable, args: [{
3707
- providedIn: 'root'
3708
- },] }
3709
- ];
3710
- GoogleTagManagerService.ctorParameters = () => [
3711
- { type: Router },
3712
- { type: Title },
3713
- { type: undefined, decorators: [{ type: Inject, args: [windowToken,] }] },
3714
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
3715
- ];
3716
-
3717
- class ManageSessionServices {
3718
- constructor(idle, keepalive) {
3719
- this.idle = idle;
3720
- this.keepalive = keepalive;
3721
- this.appStateEmitter = new Subject();
3722
- }
3723
- init(idleConfig) {
3724
- this.idle.setIdleName(idleConfig.idleServiceName);
3725
- this.idle.setTimeout(idleConfig.timeout);
3726
- const interrupt = new DocumentInterruptSource('mousedown keydown DOMMouseScroll mousewheel touchstart touchmove scroll');
3727
- this.idle.setInterrupts([interrupt]);
3728
- // adding delay so that user can click on sign out before the modal shuts
3729
- this.idle.onIdleEnd.pipe(delay(250)).subscribe(() => {
3730
- this.appStateEmitter.next({ type: 'modal', countdown: undefined, isVisible: false });
3731
- });
3732
- this.idle.onTimeout.subscribe(() => {
3733
- this.appStateEmitter.next({ type: 'signout' });
3734
- });
3735
- this.idle.onTimeoutWarning.pipe(map(sec => (sec > 60) ? `${Math.ceil(sec / 60)} minutes` : `${sec} seconds`), distinctUntilChanged()).subscribe((countdown) => {
3736
- this.appStateEmitter.next({ type: 'modal', countdown, isVisible: true });
3737
- });
3738
- this.keepalive.interval(idleConfig.keepAliveInSeconds);
3739
- this.keepalive.onPing.subscribe(() => {
3740
- this.appStateEmitter.next({ type: 'keepalive' });
3741
- });
3742
- const idleInSeconds = Math.floor((idleConfig.idleMilliseconds / 1000)) - idleConfig.timeout;
3743
- this.idle.setIdle(idleInSeconds);
3744
- this.idle.watch();
3745
- }
3746
- appStateChanges() {
3747
- return this.appStateEmitter.asObservable();
3748
- }
3749
- }
3750
- ManageSessionServices.ɵprov = i0.ɵɵdefineInjectable({ factory: function ManageSessionServices_Factory() { return new ManageSessionServices(i0.ɵɵinject(i1$2.Idle), i0.ɵɵinject(i2$1.Keepalive)); }, token: ManageSessionServices, providedIn: "root" });
3751
- ManageSessionServices.decorators = [
3752
- { type: Injectable, args: [{
3753
- providedIn: 'root'
3754
- },] }
3755
- ];
3756
- ManageSessionServices.ctorParameters = () => [
3757
- { type: Idle },
3758
- { type: Keepalive }
3759
- ];
3760
-
3761
- /**
3762
- * TimeoutNotificationsService
3763
- *
3764
- * The Timeout Notification Service allows your application to receive notifications
3765
- * when a User is approaching the the total time that a User has been idle for.
3766
- *
3767
- * This can be set by your application using the Timeout Notification Config object.
3768
- *
3769
- * Your application will then have to listen to events coming from the Timeout Notification Service,
3770
- * and handle these events within your application.
3771
- *
3772
- * @see README.md for implementation details and code, on how to implement the Timeout Notification
3773
- * Service within your application.
3774
- */
3775
- class TimeoutNotificationsService {
3776
- constructor(idle, keepalive) {
3777
- this.idle = idle;
3778
- this.keepalive = keepalive;
3779
- /**
3780
- * Convert milliseconds to seconds.
3781
- *
3782
- * @param milliseconds - 1000
3783
- * @return seconds - 1
3784
- */
3785
- this.millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
3786
- this.eventEmitter = new Subject();
3787
- }
3788
- /**
3789
- * Initialise
3790
- *
3791
- * Initialise the Timeout Notification Events.
3792
- *
3793
- * I made the decision not to make ' minutes' and ' seconds' configurable via input parameters -
3794
- * As I made an assumption that any Reform team would not need to change these to 'secs, mins' or 's, m'.
3795
- *
3796
- * idleModalDisplayTime and totalIdleTime need to be passed in, in milliseconds.
3797
- *
3798
- * @see README.md for more information on TimeoutNotificationService.
3799
- */
3800
- initialise(config) {
3801
- const DOCUMENT_INTERRUPTS = 'mousedown keydown DOMMouseScroll mousewheel touchstart touchmove scroll';
3802
- const MINUTES = ' minutes';
3803
- const SECONDS = ' seconds';
3804
- const SIGNOUT_EVENT = 'sign-out';
3805
- const COUNTDOWN_EVENT = 'countdown';
3806
- const KEEP_ALIVE_EVENT = 'keep-alive';
3807
- const { idleServiceName, idleModalDisplayTime, totalIdleTime } = config;
3808
- this.idle.setIdleName(idleServiceName);
3809
- const idleModalDisplayTimeInSeconds = this.millisecondsToSeconds(idleModalDisplayTime);
3810
- const totalIdleTimeInSeconds = this.millisecondsToSeconds(totalIdleTime);
3811
- this.idle.setTimeout(idleModalDisplayTimeInSeconds);
3812
- const interrupt = new DocumentInterruptSource(DOCUMENT_INTERRUPTS);
3813
- this.idle.setInterrupts([interrupt]);
3814
- this.idle.onTimeout.subscribe(() => {
3815
- this.eventEmitter.next({ eventType: SIGNOUT_EVENT });
3816
- });
3817
- this.idle.onTimeoutWarning.pipe(map(sec => (sec > 60) ? Math.ceil(sec / 60) + MINUTES : sec + SECONDS), distinctUntilChanged()).subscribe((countdown) => {
3818
- this.eventEmitter.next({ eventType: COUNTDOWN_EVENT, readableCountdown: countdown });
3819
- });
3820
- this.keepalive.onPing.subscribe(() => {
3821
- this.eventEmitter.next({ eventType: KEEP_ALIVE_EVENT });
3822
- });
3823
- const idleInSeconds = Math.floor(totalIdleTimeInSeconds) - idleModalDisplayTimeInSeconds;
3824
- this.idle.setIdle(idleInSeconds);
3825
- this.idle.watch();
3826
- }
3827
- /**
3828
- * Expose the notification events, so that a 3rd party service can listen to the notifications.
3829
- */
3830
- notificationOnChange() {
3831
- return this.eventEmitter.asObservable();
3832
- }
3833
- }
3834
- TimeoutNotificationsService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TimeoutNotificationsService_Factory() { return new TimeoutNotificationsService(i0.ɵɵinject(i1$2.Idle), i0.ɵɵinject(i2$1.Keepalive)); }, token: TimeoutNotificationsService, providedIn: "root" });
3835
- TimeoutNotificationsService.decorators = [
3836
- { type: Injectable, args: [{
3837
- providedIn: 'root'
3838
- },] }
3839
- ];
3840
- TimeoutNotificationsService.ctorParameters = () => [
3841
- { type: Idle },
3842
- { type: Keepalive }
3843
- ];
3844
-
3845
- class RoleService {
3846
- constructor() {
3847
- this.pRoles = [];
3848
- }
3849
- get roles() {
3850
- return this.pRoles;
3851
- }
3852
- set roles(roles) {
3853
- this.pRoles = roles;
3854
- }
3855
- }
3856
- RoleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RoleService_Factory() { return new RoleService(); }, token: RoleService, providedIn: "root" });
3857
- RoleService.decorators = [
3858
- { type: Injectable, args: [{
3859
- providedIn: 'root'
3860
- },] }
3861
- ];
3862
-
3863
- var RoleMatching;
3864
- (function (RoleMatching) {
3865
- RoleMatching[RoleMatching["ALL"] = 0] = "ALL";
3866
- RoleMatching[RoleMatching["ANY"] = 1] = "ANY";
3867
- })(RoleMatching || (RoleMatching = {}));
3868
- class RoleGuard {
3869
- constructor(roleService, router) {
3870
- this.roleService = roleService;
3871
- this.router = router;
3872
- }
3873
- canActivate(route) {
3874
- const roles = route.data.needsRole;
3875
- const check = (roleRegEx) => {
3876
- const regex = new RegExp(roleRegEx);
3877
- return this.roleService.roles.some(role => regex.test(role));
3878
- };
3879
- const match = route.data.roleMatching === RoleMatching.ALL ? roles.every(check) : roles.some(check);
3880
- return match || this.router.parseUrl(route.data.noRoleMatchRedirect);
3881
- }
3882
- }
3883
- RoleGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function RoleGuard_Factory() { return new RoleGuard(i0.ɵɵinject(RoleService), i0.ɵɵinject(i1$1.Router)); }, token: RoleGuard, providedIn: "root" });
3884
- RoleGuard.decorators = [
3885
- { type: Injectable, args: [{
3886
- providedIn: 'root'
3887
- },] }
3888
- ];
3889
- RoleGuard.ctorParameters = () => [
3890
- { type: RoleService },
3891
- { type: Router }
3892
- ];
3893
-
3894
- class HasLoadingState {
3895
- get isLoading() {
3896
- return;
3897
- }
3898
- }
3899
- class LoadingService {
3900
- constructor() {
3901
- this.registered = new Map();
3902
- this.loading = new BehaviorSubject(false);
3903
- }
3904
- get isLoading() {
3905
- return this.loading.asObservable().pipe(distinctUntilChanged());
3906
- }
3907
- register() {
3908
- const token = this.generateToken();
3909
- this.registered.set(token, token);
3910
- this.loading.next(true);
3911
- return token;
3912
- }
3913
- unregister(token) {
3914
- this.registered.delete(token);
3915
- this.loading.next(this.registered.size > 0);
3916
- }
3917
- generateToken() {
3918
- const timestamp = window.performance.now();
3919
- return `common-lib-loading-${timestamp}`; // format: [source-library]-[unique incrementing number]
3920
- }
3921
- }
3922
- LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
3923
- LoadingService.decorators = [
3924
- { type: Injectable, args: [{
3925
- providedIn: 'root'
3926
- },] }
3927
- ];
3928
-
3929
- /*
3930
- * Public API Surface of exui-common-lib
3931
- */
3932
-
3933
- /*
3934
- * Public API Surface of exui-common-lib
3935
- */
3936
-
3937
- /**
3938
- * Generated bundle index. Do not edit.
3939
- */
3940
-
3941
- export { AccessibilityComponent, AnonymousFeatureUser, BadgeColour, COMMON_COMPONENTS, CheckboxListComponent, ContactDetailsComponent, CookieBannerComponent, CookieService, DateBadgeColour, DueDateComponent, ExuiCommonLibModule, ExuiPageWrapperComponent, FeatureToggleDirective, FeatureToggleGuard, FeatureToggleService, FilterService, FindLocationComponent, FindPersonComponent, GOV_UI_COMPONENTS, GenericFilterComponent, GoogleAnalyticsService, GoogleTagManagerService, GovUiService, GovUkCheckboxComponent, GovUkCheckboxesComponent, GovUkDateComponent, GovUkErrorMessageComponent, GovUkFieldsetComponent, GovUkFileUploadComponent, GovUkFormGroupWrapperComponent, GovUkInputComponent, GovUkLabelComponent, GovUkRadioComponent, GovUkRadiosComponent, GovUkSelectComponent, GovUkTextareaComponent, GovukTableColumnConfig, GovukTableComponent, HasLoadingState, HmctsBannerComponent, HmctsErrorSummaryComponent, HmctsIdentityBarComponent, HmctsMainWrapperComponent, HmctsPaginationComponent, HmctsPrimaryNavigationComponent, HmctsSessionDialogComponent, HmctsSubNavigationComponent, InviteUserFormComponent, InviteUserPermissionComponent, LaunchDarklyService, LetContext, LetDirective, LoadingService, LoadingSpinnerComponent, LoggedInFeatureUser, ManageSessionServices, PaginationComponent, PersonRole, RadioFilterFieldConfig, RemoveHostDirective, RoleCategory, RoleGuard, RoleMatching, RoleService, SECONDS_IN_A_DAY, SearchJudicialsComponent, SearchLocationComponent, SearchVenueComponent, SelectedCaseComponent, SelectedCaseConfirmComponent, SelectedCaseListComponent, ServiceMessageComponent, ServiceMessagesComponent, ShareCaseComponent, ShareCaseConfirmComponent, TabComponent, TcConfirmComponent, TcDisplayHtmlComponent, TcDisplayPlainComponent, TermsAndConditionsComponent, TimeoutNotificationsService, UserDetailsComponent, UserListComponent, UserSelectComponent, checkboxesBeCheckedValidator, dateValidator, radioGroupValidator, windowProvider, windowToken, ɵ0, ExuiPageWrapperComponent as ɵa, TermsAndConditionsComponent as ɵb, ServiceMessageComponent as ɵba, ServiceMessagesComponent as ɵbb, LoadingSpinnerComponent as ɵbc, GenericFilterComponent as ɵbd, FilterService as ɵbe, CookieBannerComponent as ɵbf, CookieService as ɵbg, FindPersonComponent as ɵbh, FindAPersonService as ɵbi, SessionStorageService as ɵbj, SearchJudicialsComponent as ɵbk, FindLocationComponent as ɵbl, SearchLocationComponent as ɵbm, LocationService as ɵbn, SearchVenueComponent as ɵbo, PaginationComponent as ɵbp, HmctsIdentityBarComponent as ɵbq, HmctsPaginationComponent as ɵbr, HmctsSubNavigationComponent as ɵbs, HmctsPrimaryNavigationComponent as ɵbt, HmctsErrorSummaryComponent as ɵbu, HmctsMainWrapperComponent as ɵbv, HmctsBannerComponent as ɵbw, GovukTableComponent as ɵbx, GovUkInputComponent as ɵby, GovUkCheckboxComponent as ɵbz, TcDisplayHtmlComponent as ɵc, GovUkFormGroupWrapperComponent as ɵca, GovUkLabelComponent as ɵcb, GovUkErrorMessageComponent as ɵcc, GovUkFieldsetComponent as ɵcd, GovUkDateComponent as ɵce, GovUkCheckboxesComponent as ɵcf, GovUkRadioComponent as ɵcg, GovUkRadiosComponent as ɵch, GovUkSelectComponent as ɵci, GovUkTextareaComponent as ɵcj, GovUkFileUploadComponent as ɵck, RemoveHostDirective as ɵcl, TcDisplayPlainComponent as ɵd, TcConfirmComponent as ɵe, ContactDetailsComponent as ɵf, FeatureToggleDirective as ɵg, FeatureToggleService as ɵh, LetContext as ɵi, LetDirective as ɵj, HmctsSessionDialogComponent as ɵk, UserListComponent as ɵl, UserDetailsComponent as ɵm, InviteUserPermissionComponent as ɵn, InviteUserFormComponent as ɵo, ShareCaseComponent as ɵp, UserSelectComponent as ɵq, CaseSharingStateService as ɵr, ShareCaseConfirmComponent as ɵs, SelectedCaseListComponent as ɵt, SelectedCaseComponent as ɵu, SelectedCaseConfirmComponent as ɵv, TabComponent as ɵw, AccessibilityComponent as ɵx, DueDateComponent as ɵy, CheckboxListComponent as ɵz };
3942
- //# sourceMappingURL=hmcts-rpx-xui-common-lib.js.map