@hmcts/opal-frontend-common 0.0.46 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{hmcts-opal-frontend-common-access-denied.component-C4LElGHn.mjs → hmcts-opal-frontend-common-access-denied.component-_O2kCY4u.mjs} +4 -4
- package/fesm2022/{hmcts-opal-frontend-common-access-denied.component-C4LElGHn.mjs.map → hmcts-opal-frontend-common-access-denied.component-_O2kCY4u.mjs.map} +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table-pagination.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table-pagination.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-table-filter.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-table-filter.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-alphagov-alphagov-accessible-autocomplete.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-alphagov-alphagov-accessible-autocomplete.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item-custom-account-information-item-label.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item-custom-account-information-item-label.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item-custom-account-information-item-value.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item-custom-account-information-item-value.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-action-links.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-action-links.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-horizontal-scroll-pane.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-horizontal-scroll-pane.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-page-header.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-page-header.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-scrollable-panes-custom-scrollable-panes-inner-pane.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-scrollable-panes-custom-scrollable-panes-inner-pane.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-scrollable-panes.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-scrollable-panes.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item-custom-summary-metric-bar-item-label.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item-custom-summary-metric-bar-item-label.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item-custom-summary-metric-bar-item-value.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item-custom-summary-metric-bar-item-value.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane-custom-vertical-scroll-pane-inner-pane.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane-custom-vertical-scroll-pane-inner-pane.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane-custom-vertical-scroll-pane-outer-pane.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane-custom-vertical-scroll-pane-outer-pane.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-accordion.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-accordion.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-back-link.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-back-link.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-button.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-button.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-cancel-link.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-cancel-link.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-checkboxes.mjs +12 -12
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-checkboxes.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-date-input.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-date-input.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-details.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-details.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-error-summary.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-error-summary.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-footer.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-footer.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-header.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-header.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-heading-with-caption.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-heading-with-caption.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-inset-text.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-inset-text.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-list-govuk-list-link.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-list-govuk-list-link.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-list.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-list.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-notification-banner.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-notification-banner.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-panel.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-panel.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs +12 -12
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-select.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-select.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-card-list.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-card-list.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-list.mjs +12 -12
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-list.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-table.mjs +12 -12
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-table.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs-govuk-tabs-list-item.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs-govuk-tabs-list-item.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs-govuk-tabs-panel.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs-govuk-tabs-panel.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tag.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tag.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-task-list.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-task-list.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-area.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-area.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input.mjs +4 -4
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-hod-hod-loading-spinner.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-hod-hod-loading-spinner.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-alert.mjs +21 -21
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-alert.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu-moj-button-menu-item.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu-moj-button-menu-item.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-header.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-header.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option-moj-filter-panel-option-form-group-item.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option-moj-filter-panel-option-form-group-item.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option-moj-filter-panel-option-form-group-keyword.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option-moj-filter-panel-option-form-group-keyword.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-selected-moj-filter-panel-selected-tag.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-selected-moj-filter-panel-selected-tag.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-selected.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-selected.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter.mjs +4 -4
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-header.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-header.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-notification-badge.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-notification-badge.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-page-header.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-page-header.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-primary-navigation.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-primary-navigation.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs +18 -18
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sub-navigation.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sub-navigation.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-ticket-panel.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-ticket-panel.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-timeline.mjs +6 -6
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-timeline.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-concurrency-failure.component-BioYsePu.mjs +15 -0
- package/fesm2022/hmcts-opal-frontend-common-concurrency-failure.component-BioYsePu.mjs.map +1 -0
- package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-directives-govuk-button.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-directives-govuk-button.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-interceptors-http-error.mjs +12 -3
- package/fesm2022/hmcts-opal-frontend-common-interceptors-http-error.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-internal-server-error.component-B0IF1mjH.mjs +25 -0
- package/fesm2022/hmcts-opal-frontend-common-internal-server-error.component-B0IF1mjH.mjs.map +1 -0
- package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-C4LElGHn.mjs → hmcts-opal-frontend-common-pages-access-denied.component-_O2kCY4u.mjs} +4 -4
- package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-C4LElGHn.mjs.map → hmcts-opal-frontend-common-pages-access-denied.component-_O2kCY4u.mjs.map} +1 -1
- package/fesm2022/hmcts-opal-frontend-common-pages-concurrency-failure.component-BioYsePu.mjs +15 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-concurrency-failure.component-BioYsePu.mjs.map +1 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-internal-server-error.component-B0IF1mjH.mjs +25 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-internal-server-error.component-B0IF1mjH.mjs.map +1 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-permission-denied.component-DaQwt-ux.mjs +15 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-permission-denied.component-DaQwt-ux.mjs.map +1 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-routing-constants.mjs +6 -0
- package/fesm2022/hmcts-opal-frontend-common-pages-routing-constants.mjs.map +1 -1
- package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-X0DpymsU.mjs → hmcts-opal-frontend-common-pages-sign-in-stub.component-DueZhjYc.mjs} +4 -4
- package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-X0DpymsU.mjs.map → hmcts-opal-frontend-common-pages-sign-in-stub.component-DueZhjYc.mjs.map} +1 -1
- package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-B8WpVEYN.mjs → hmcts-opal-frontend-common-pages-sign-in.component-Dxbn5B5M.mjs} +4 -4
- package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-B8WpVEYN.mjs.map → hmcts-opal-frontend-common-pages-sign-in.component-Dxbn5B5M.mjs.map} +1 -1
- package/fesm2022/hmcts-opal-frontend-common-pages.mjs +20 -2
- package/fesm2022/hmcts-opal-frontend-common-pages.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-permission-denied.component-DaQwt-ux.mjs +15 -0
- package/fesm2022/hmcts-opal-frontend-common-permission-denied.component-DaQwt-ux.mjs.map +1 -0
- package/fesm2022/hmcts-opal-frontend-common-pipes-date-format.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-pipes-date-format.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-pipes-days-ago.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-pipes-days-ago.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-pipes-national-insurance.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-pipes-national-insurance.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-resolvers-title.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-resolvers-title.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-app-insights-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-app-insights-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-auth-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-auth-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-date-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-date-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-opal-user-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-opal-user-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-permissions-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-permissions-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-session-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-session-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-sort-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-sort-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-transformation-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-transformation-service.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs +3 -3
- package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs.map +1 -1
- package/fesm2022/{hmcts-opal-frontend-common-sign-in-stub.component-X0DpymsU.mjs → hmcts-opal-frontend-common-sign-in-stub.component-DueZhjYc.mjs} +4 -4
- package/fesm2022/{hmcts-opal-frontend-common-sign-in-stub.component-X0DpymsU.mjs.map → hmcts-opal-frontend-common-sign-in-stub.component-DueZhjYc.mjs.map} +1 -1
- package/fesm2022/{hmcts-opal-frontend-common-sign-in.component-keH2kx9e.mjs → hmcts-opal-frontend-common-sign-in.component-BZ5lGBfF.mjs} +4 -4
- package/fesm2022/{hmcts-opal-frontend-common-sign-in.component-keH2kx9e.mjs.map → hmcts-opal-frontend-common-sign-in.component-BZ5lGBfF.mjs.map} +1 -1
- package/fesm2022/hmcts-opal-frontend-common.mjs +20 -2
- package/fesm2022/hmcts-opal-frontend-common.mjs.map +1 -1
- package/package.json +1 -1
- package/pages/routing/interfaces/index.d.ts +3 -0
|
@@ -9,13 +9,13 @@ class AccessDeniedComponent {
|
|
|
9
9
|
// For now, test page will act as our 'Dashboard' page
|
|
10
10
|
this.router.navigate(['/']);
|
|
11
11
|
}
|
|
12
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
13
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AccessDeniedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AccessDeniedComponent, isStandalone: true, selector: "opal-lib-access-denied", ngImport: i0, template: "<div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-l\">Access Denied</h1>\n <p class=\"govuk-body\">You do not have the appropriate permissions to access this page.</p>\n <p class=\"govuk-body\">\n <opal-lib-govuk-button\n buttonClasses=\"govuk-button--secondary\"\n buttonId=\"go-back\"\n (buttonClickEvent)=\"handleGoBackButtonClick()\"\n >\n Back to dashboard</opal-lib-govuk-button\n >\n </p>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: GovukButtonComponent, selector: "opal-lib-govuk-button", inputs: ["buttonId", "type", "buttonClasses"], outputs: ["buttonClickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AccessDeniedComponent, decorators: [{
|
|
16
16
|
type: Component,
|
|
17
17
|
args: [{ selector: 'opal-lib-access-denied', imports: [GovukButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-l\">Access Denied</h1>\n <p class=\"govuk-body\">You do not have the appropriate permissions to access this page.</p>\n <p class=\"govuk-body\">\n <opal-lib-govuk-button\n buttonClasses=\"govuk-button--secondary\"\n buttonId=\"go-back\"\n (buttonClickEvent)=\"handleGoBackButtonClick()\"\n >\n Back to dashboard</opal-lib-govuk-button\n >\n </p>\n </div>\n</div>\n" }]
|
|
18
18
|
}] });
|
|
19
19
|
|
|
20
20
|
export { AccessDeniedComponent };
|
|
21
|
-
//# sourceMappingURL=hmcts-opal-frontend-common-access-denied.component-
|
|
21
|
+
//# sourceMappingURL=hmcts-opal-frontend-common-access-denied.component-_O2kCY4u.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-access-denied.component-
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-access-denied.component-_O2kCY4u.mjs","sources":["../../../projects/opal-frontend-common/pages/access-denied/access-denied.component.ts","../../../projects/opal-frontend-common/pages/access-denied/access-denied.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { GovukButtonComponent } from '@hmcts/opal-frontend-common/components/govuk/govuk-button';\n\n@Component({\n selector: 'opal-lib-access-denied',\n imports: [GovukButtonComponent],\n templateUrl: './access-denied.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AccessDeniedComponent {\n private readonly router = inject(Router);\n\n public handleGoBackButtonClick(): void {\n // For now, test page will act as our 'Dashboard' page\n this.router.navigate(['/']);\n }\n}\n","<div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-two-thirds\">\n <h1 class=\"govuk-heading-l\">Access Denied</h1>\n <p class=\"govuk-body\">You do not have the appropriate permissions to access this page.</p>\n <p class=\"govuk-body\">\n <opal-lib-govuk-button\n buttonClasses=\"govuk-button--secondary\"\n buttonId=\"go-back\"\n (buttonClickEvent)=\"handleGoBackButtonClick()\"\n >\n Back to dashboard</opal-lib-govuk-button\n >\n </p>\n </div>\n</div>\n"],"names":[],"mappings":";;;;;MAUa,qBAAqB,CAAA;AACf,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAEjC,uBAAuB,GAAA;;QAE5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7B;wGANW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECVlC,ihBAeA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDTY,oBAAoB,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,eAAA,CAAA,EAAA,OAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAInB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBANjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,wBAAwB,WACzB,CAAC,oBAAoB,CAAC,EAAA,eAAA,EAEd,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,ihBAAA,EAAA;;;;;"}
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs
CHANGED
|
@@ -211,10 +211,10 @@ class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent {
|
|
|
211
211
|
this['ngUnsubscribe'].complete();
|
|
212
212
|
super.ngOnDestroy();
|
|
213
213
|
}
|
|
214
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
215
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
214
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormAliasBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
215
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AbstractFormAliasBaseComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "aliasFirstField", predicate: ["aliasFirstField"], descendants: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
216
216
|
}
|
|
217
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormAliasBaseComponent, decorators: [{
|
|
218
218
|
type: Component,
|
|
219
219
|
args: [{
|
|
220
220
|
template: '',
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-alias-base/abstract-form-alias-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-alias-base/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.ts"],"sourcesContent":["import { FormArray, FormControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { takeUntil } from 'rxjs';\nimport { Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core';\nimport { IAbstractFormAliasBaseAliasControls } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-alias-base/interfaces';\nimport { AbstractFormBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-base';\nimport {\n IAbstractFormArrayControlValidation,\n IAbstractFormArrayControls,\n IAbstractFormArrayControl,\n} from '@hmcts/opal-frontend-common/components/abstract/interfaces';\nimport { GovukTextInputComponent } from '@hmcts/opal-frontend-common/components/govuk/govuk-text-input';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy {\n @ViewChildren('aliasFirstField') aliasFirstField!: QueryList<GovukTextInputComponent>;\n public aliasControls: IAbstractFormAliasBaseAliasControls[] = [];\n public aliasControlsValidation: IAbstractFormArrayControlValidation[] = [];\n public aliasFields: string[] = [];\n\n /**\n * Builds an array of form controls for the given form array.\n *\n * @param formControlCount - An array of numbers representing the number of form controls to create.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - An array of field names.\n * @param controlValidation - An array of control validation objects.\n * @returns An array of form controls for the given form array.\n */\n private buildFormAliasControls(\n formControlCount: number[],\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): IAbstractFormArrayControls[] {\n // Directly map each index to a control\n return formControlCount.map((_element, index) =>\n this.addAliasControls(index, formArrayName, fieldNames, controlValidation),\n );\n }\n\n /**\n * Adds alias controls to the form array.\n *\n * @param index - The index of the form array.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - The names of the fields for the alias controls.\n * @param controlValidation - The validation rules for the alias controls.\n * @returns An object containing the form controls.\n */\n private addAliasControls(\n index: number,\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): { [key: string]: IAbstractFormArrayControl } {\n const formAliases = this.form.get(formArrayName) as FormArray;\n const formAliasesFormGroup = new FormGroup({});\n\n // Create the form controls...\n const controls = this.createAliasControls(fieldNames, index);\n\n // Add the controls to the form group...\n this.addControlsToFormGroup(formAliasesFormGroup, controlValidation, index);\n\n // Add the form group to the form array...\n formAliases.push(formAliasesFormGroup);\n\n // Return the form controls...\n return controls;\n }\n\n /**\n * Removes all form alias controls from a FormArray and clears any associated error messages.\n *\n * @param formArrayControls - An array of form array controls.\n * @param formArrayName - The name of the FormArray.\n * @param fieldNames - An array of field names associated with the form array controls.\n * @returns An empty array of form array controls.\n */\n private removeAllFormAliasControls(\n formArrayControls: IAbstractFormArrayControls[],\n formArrayName: string,\n fieldNames: string[],\n ): [] {\n const control = this.form.get(formArrayName) as FormArray;\n\n // Clear the error messages...\n for (const [index] of formArrayControls.entries()) {\n this.removeFormAliasControlsErrors(index, formArrayControls, fieldNames);\n }\n\n // Reset the form array controls...\n control.clear();\n\n // Return en empty array of form array controls...\n return [];\n }\n\n /**\n * Creates a FormArray with the specified validators and controls.\n *\n * @param validators - An array of validators to apply to the FormArray.\n * @param controls - An optional array of initial FormControl instances to add to the FormArray.\n * @returns A new FormArray instance.\n */\n protected createFormAlias(validators: ValidatorFn[], controls: FormControl[] = []): FormArray {\n return new FormArray(controls, { validators: [...validators] });\n }\n\n /**\n * Removes a form alias control at the specified index from the given form array controls.\n *\n * @param index - The index of the form alias control to remove.\n * @param formArrayControls - The array of form array controls.\n * @returns The updated array of form array controls after removing the specified control.\n */\n protected removeFormAliasControl(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n ): IAbstractFormArrayControls[] {\n formArrayControls.splice(index, 1);\n return formArrayControls;\n }\n\n /**\n * Sets up the alias form controls based on the provided alias count array and form array name.\n * If there are any aliases, the alias controls will be re-populated.\n *\n * @param aliasCountArray - An array containing the count of aliases.\n * @param formArrayName - The name of the form array.\n */\n protected setupAliasFormControls(aliasCountArray: number[], formArrayName: string): void {\n // Re-populate the alias controls if there are any aliases\n if (aliasCountArray.length) {\n this.aliasControls = this.buildFormAliasControls(\n aliasCountArray,\n formArrayName,\n this.aliasFields,\n this.aliasControlsValidation,\n );\n }\n }\n\n /**\n * Removes the form alias controls errors for a specific index in a form array.\n *\n * @param index - The index of the form array control.\n * @param formArrayControls - An array of form array controls.\n * @param fieldNames - An array of field names to remove errors from.\n */\n protected removeFormAliasControlsErrors(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): void {\n const formArrayControl = formArrayControls[index];\n\n if (formArrayControl) {\n for (const field of fieldNames) {\n delete this.formControlErrorMessages?.[formArrayControl[field].controlName];\n }\n }\n }\n\n /**\n * Creates alias controls for the given fields and index.\n * @param fields - The list of fields for which alias controls need to be created.\n * @param index - The index value used to generate unique identifiers for the controls.\n * @returns An object containing the alias controls.\n */\n protected createAliasControls(fields: string[], index: number): { [key: string]: IAbstractFormArrayControl } {\n return fields.reduce(\n (controls, field) => ({\n ...controls,\n [field]: {\n inputId: `${field}_${index}`,\n inputName: `${field}_${index}`,\n controlName: `${field}_${index}`,\n },\n }),\n {},\n );\n }\n\n /**\n * Sets up the alias checkbox listener.\n *\n * @param formCheckboxName - The name of the checkbox control in the form.\n * @param formArrayName - The name of the form array control in the form.\n */\n protected setUpAliasCheckboxListener(formCheckboxName: string, formArrayName: string): void {\n // Ensure any existing subscription is cleared to avoid memory leaks\n this['ngUnsubscribe'].next();\n this['ngUnsubscribe'].complete();\n\n const addAliasControl = this.form.get(formCheckboxName);\n if (!addAliasControl) {\n return;\n }\n\n addAliasControl.valueChanges.pipe(takeUntil(this['ngUnsubscribe'])).subscribe((shouldAddAlias) => {\n if (shouldAddAlias) {\n this.aliasControls = this.buildFormAliasControls(\n [0],\n formArrayName,\n this.aliasFields,\n this.aliasControlsValidation,\n );\n this.focusFirstAliasField();\n } else {\n this.aliasControls = this.removeAllFormAliasControls(this.aliasControls, formArrayName, this.aliasFields);\n }\n });\n }\n\n /**\n * Sets focus to the first input field of a newly added alias row.\n */\n public focusFirstAliasField(): void {\n this['changeDetectorRef'].detectChanges();\n setTimeout(() => {\n const index = this.aliasControls.length - 1;\n const inputId = this.aliasFirstField.get(index)?.inputId;\n if (inputId) {\n const el = document.getElementById(inputId);\n el?.focus();\n }\n }, 0);\n }\n\n /**\n * Removes a form alias control from a form array and updates the list of form array controls.\n * @param index - The index of the form alias control to be removed.\n * @param formArrayName - The name of the form array.\n * @param formArrayControls - The list of form array controls.\n * @param fieldNames - The names of the fields associated with the form array controls.\n * @returns The updated list of form array controls after removing the specified control.\n */\n public removeFormAliasControls(\n index: number,\n formArrayName: string,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): IAbstractFormArrayControls[] {\n // Get the form array...\n const control = this.form.get(formArrayName) as FormArray;\n\n // Remove the form array control based on index\n control.removeAt(index);\n\n // Then remove the form array controls errors...\n this.removeFormAliasControlsErrors(index, formArrayControls, fieldNames);\n\n // Return the new list of form array controls...\n return this.removeFormAliasControl(index, formArrayControls);\n }\n\n /**\n * Adds an alias to the specified index of the form array.\n * Sets user focus to the first field of the newly added alias.\n *\n * @param index - The index at which to add the alias.\n * @param formArrayName - The name of the form array.\n */\n public addAlias(index: number, formArrayName: string): void {\n this.aliasControls.push(\n this.addAliasControls(index, formArrayName, this.aliasFields, this.aliasControlsValidation),\n );\n this.focusFirstAliasField();\n }\n\n /**\n * Removes an alias from the form array.\n *\n * @param index - The index of the alias to remove.\n * @param formArrayName - The name of the form array.\n */\n public removeAlias(index: number, formArrayName: string): void {\n this.aliasControls = this.removeFormAliasControls(index, formArrayName, this.aliasControls, this.aliasFields);\n }\n\n public override ngOnInit(): void {\n super.ngOnInit();\n }\n\n public override ngOnDestroy(): void {\n this['ngUnsubscribe'].next();\n this['ngUnsubscribe'].complete();\n super.ngOnDestroy();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAeM,MAAgB,8BAA+B,SAAQ,yBAAyB,CAAA;AACnD,IAAA,eAAe;IACzC,aAAa,GAA0C,EAAE;IACzD,uBAAuB,GAA0C,EAAE;IACnE,WAAW,GAAa,EAAE;AAEjC;;;;;;;;AAQG;AACK,IAAA,sBAAsB,CAC5B,gBAA0B,EAC1B,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;;QAGxD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KAC1C,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAC3E;IACH;AAEA;;;;;;;;AAQG;AACK,IAAA,gBAAgB,CACtB,KAAa,EACb,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;QAExD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAc;AAC7D,QAAA,MAAM,oBAAoB,GAAG,IAAI,SAAS,CAAC,EAAE,CAAC;;QAG9C,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC;;QAG5D,IAAI,CAAC,sBAAsB,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,KAAK,CAAC;;AAG3E,QAAA,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC;;AAGtC,QAAA,OAAO,QAAQ;IACjB;AAEA;;;;;;;AAOG;AACK,IAAA,0BAA0B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uB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC;IAC/G;IAEgB,QAAQ,GAAA;QACtB,KAAK,CAAC,QAAQ,EAAE;IAClB;IAEgB,WAAW,GAAA;AACzB,QAAA,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE;AAC5B,QAAA,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;QAChC,KAAK,CAAC,WAAW,EAAE;IACrB;uGApRoB,8BAA8B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA9B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,8BAA8B,sMAFxC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAEQ,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAHnD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;sBAEE,YAAY;uBAAC,iBAAiB;;;AChBjC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-alias-base/abstract-form-alias-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-alias-base/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.ts"],"sourcesContent":["import { FormArray, FormControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { takeUntil } from 'rxjs';\nimport { Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core';\nimport { IAbstractFormAliasBaseAliasControls } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-alias-base/interfaces';\nimport { AbstractFormBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-base';\nimport {\n IAbstractFormArrayControlValidation,\n IAbstractFormArrayControls,\n IAbstractFormArrayControl,\n} from '@hmcts/opal-frontend-common/components/abstract/interfaces';\nimport { GovukTextInputComponent } from '@hmcts/opal-frontend-common/components/govuk/govuk-text-input';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy {\n @ViewChildren('aliasFirstField') aliasFirstField!: QueryList<GovukTextInputComponent>;\n public aliasControls: IAbstractFormAliasBaseAliasControls[] = [];\n public aliasControlsValidation: IAbstractFormArrayControlValidation[] = [];\n public aliasFields: string[] = [];\n\n /**\n * Builds an array of form controls for the given form array.\n *\n * @param formControlCount - An array of numbers representing the number of form controls to create.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - An array of field names.\n * @param controlValidation - An array of control validation objects.\n * @returns An array of form controls for the given form array.\n */\n private buildFormAliasControls(\n formControlCount: number[],\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): IAbstractFormArrayControls[] {\n // Directly map each index to a control\n return formControlCount.map((_element, index) =>\n this.addAliasControls(index, formArrayName, fieldNames, controlValidation),\n );\n }\n\n /**\n * Adds alias controls to the form array.\n *\n * @param index - The index of the form array.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - The names of the fields for the alias controls.\n * @param controlValidation - The validation rules for the alias controls.\n * @returns An object containing the form controls.\n */\n private addAliasControls(\n index: number,\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): { [key: string]: IAbstractFormArrayControl } {\n const formAliases = this.form.get(formArrayName) as FormArray;\n const formAliasesFormGroup = new FormGroup({});\n\n // Create the form controls...\n const controls = this.createAliasControls(fieldNames, index);\n\n // Add the controls to the form group...\n this.addControlsToFormGroup(formAliasesFormGroup, controlValidation, index);\n\n // Add the form group to the form array...\n formAliases.push(formAliasesFormGroup);\n\n // Return the form controls...\n return controls;\n }\n\n /**\n * Removes all form alias controls from a FormArray and clears any associated error messages.\n *\n * @param formArrayControls - An array of form array controls.\n * @param formArrayName - The name of the FormArray.\n * @param fieldNames - An array of field names associated with the form array controls.\n * @returns An empty array of form array controls.\n */\n private removeAllFormAliasControls(\n formArrayControls: IAbstractFormArrayControls[],\n formArrayName: string,\n fieldNames: string[],\n ): [] {\n const control = this.form.get(formArrayName) as FormArray;\n\n // Clear the error messages...\n for (const [index] of formArrayControls.entries()) {\n this.removeFormAliasControlsErrors(index, formArrayControls, fieldNames);\n }\n\n // Reset the form array controls...\n control.clear();\n\n // Return en empty array of form array controls...\n return [];\n }\n\n /**\n * Creates a FormArray with the specified validators and controls.\n *\n * @param validators - An array of validators to apply to the FormArray.\n * @param controls - An optional array of initial FormControl instances to add to the FormArray.\n * @returns A new FormArray instance.\n */\n protected createFormAlias(validators: ValidatorFn[], controls: FormControl[] = []): FormArray {\n return new FormArray(controls, { validators: [...validators] });\n }\n\n /**\n * Removes a form alias control at the specified index from the given form array controls.\n *\n * @param index - The index of the form alias control to remove.\n * @param formArrayControls - The array of form array controls.\n * @returns The updated array of form array controls after removing the specified control.\n */\n protected removeFormAliasControl(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n ): IAbstractFormArrayControls[] {\n formArrayControls.splice(index, 1);\n return formArrayControls;\n }\n\n /**\n * Sets up the alias form controls based on the provided alias count array and form array name.\n * If there are any aliases, the alias controls will be re-populated.\n *\n * @param aliasCountArray - An array containing the count of aliases.\n * @param formArrayName - The name of the form array.\n */\n protected setupAliasFormControls(aliasCountArray: number[], formArrayName: string): void {\n // Re-populate the alias controls if there are any aliases\n if (aliasCountArray.length) {\n this.aliasControls = this.buildFormAliasControls(\n aliasCountArray,\n formArrayName,\n this.aliasFields,\n this.aliasControlsValidation,\n );\n }\n }\n\n /**\n * Removes the form alias controls errors for a specific index in a form array.\n *\n * @param index - The index of the form array control.\n * @param formArrayControls - An array of form array controls.\n * @param fieldNames - An array of field names to remove errors from.\n */\n protected removeFormAliasControlsErrors(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): void {\n const formArrayControl = formArrayControls[index];\n\n if (formArrayControl) {\n for (const field of fieldNames) {\n delete this.formControlErrorMessages?.[formArrayControl[field].controlName];\n }\n }\n }\n\n /**\n * Creates alias controls for the given fields and index.\n * @param fields - The list of fields for which alias controls need to be created.\n * @param index - The index value used to generate unique identifiers for the controls.\n * @returns An object containing the alias controls.\n */\n protected createAliasControls(fields: string[], index: number): { [key: string]: IAbstractFormArrayControl } {\n return fields.reduce(\n (controls, field) => ({\n ...controls,\n [field]: {\n inputId: `${field}_${index}`,\n inputName: `${field}_${index}`,\n controlName: `${field}_${index}`,\n },\n }),\n {},\n );\n }\n\n /**\n * Sets up the alias checkbox listener.\n *\n * @param formCheckboxName - The name of the checkbox control in the form.\n * @param formArrayName - The name of the form array control in the form.\n */\n protected setUpAliasCheckboxListener(formCheckboxName: string, formArrayName: string): void {\n // Ensure any existing subscription is cleared to avoid memory leaks\n this['ngUnsubscribe'].next();\n this['ngUnsubscribe'].complete();\n\n const addAliasControl = this.form.get(formCheckboxName);\n if (!addAliasControl) {\n return;\n }\n\n addAliasControl.valueChanges.pipe(takeUntil(this['ngUnsubscribe'])).subscribe((shouldAddAlias) => {\n if (shouldAddAlias) {\n this.aliasControls = this.buildFormAliasControls(\n [0],\n formArrayName,\n this.aliasFields,\n this.aliasControlsValidation,\n );\n this.focusFirstAliasField();\n } else {\n this.aliasControls = this.removeAllFormAliasControls(this.aliasControls, formArrayName, this.aliasFields);\n }\n });\n }\n\n /**\n * Sets focus to the first input field of a newly added alias row.\n */\n public focusFirstAliasField(): void {\n this['changeDetectorRef'].detectChanges();\n setTimeout(() => {\n const index = this.aliasControls.length - 1;\n const inputId = this.aliasFirstField.get(index)?.inputId;\n if (inputId) {\n const el = document.getElementById(inputId);\n el?.focus();\n }\n }, 0);\n }\n\n /**\n * Removes a form alias control from a form array and updates the list of form array controls.\n * @param index - The index of the form alias control to be removed.\n * @param formArrayName - The name of the form array.\n * @param formArrayControls - The list of form array controls.\n * @param fieldNames - The names of the fields associated with the form array controls.\n * @returns The updated list of form array controls after removing the specified control.\n */\n public removeFormAliasControls(\n index: number,\n formArrayName: string,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): IAbstractFormArrayControls[] {\n // Get the form array...\n const control = this.form.get(formArrayName) as FormArray;\n\n // Remove the form array control based on index\n control.removeAt(index);\n\n // Then remove the form array controls errors...\n this.removeFormAliasControlsErrors(index, formArrayControls, fieldNames);\n\n // Return the new list of form array controls...\n return this.removeFormAliasControl(index, formArrayControls);\n }\n\n /**\n * Adds an alias to the specified index of the form array.\n * Sets user focus to the first field of the newly added alias.\n *\n * @param index - The index at which to add the alias.\n * @param formArrayName - The name of the form array.\n */\n public addAlias(index: number, formArrayName: string): void {\n this.aliasControls.push(\n this.addAliasControls(index, formArrayName, this.aliasFields, this.aliasControlsValidation),\n );\n this.focusFirstAliasField();\n }\n\n /**\n * Removes an alias from the form array.\n *\n * @param index - The index of the alias to remove.\n * @param formArrayName - The name of the form array.\n */\n public removeAlias(index: number, formArrayName: string): void {\n this.aliasControls = this.removeFormAliasControls(index, formArrayName, this.aliasControls, this.aliasFields);\n }\n\n public override ngOnInit(): void {\n super.ngOnInit();\n }\n\n public override ngOnDestroy(): void {\n this['ngUnsubscribe'].next();\n this['ngUnsubscribe'].complete();\n super.ngOnDestroy();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAeM,MAAgB,8BAA+B,SAAQ,yBAAyB,CAAA;AACnD,IAAA,eAAe;IACzC,aAAa,GAA0C,EAAE;IACzD,uBAAuB,GAA0C,EAAE;IACnE,WAAW,GAAa,EAAE;AAEjC;;;;;;;;AAQG;AACK,IAAA,sBAAsB,CAC5B,gBAA0B,EAC1B,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;;QAGxD,OAAO,gBAAgB,CA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EAAA,CAAA;;4FAEQ,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAHnD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;sBAEE,YAAY;uBAAC,iBAAiB;;;AChBjC;;AAEG;;;;"}
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs
CHANGED
|
@@ -234,10 +234,10 @@ class AbstractFormArrayBaseComponent extends AbstractFormBaseComponent {
|
|
|
234
234
|
this.ngUnsubscribe.complete();
|
|
235
235
|
super.ngOnDestroy();
|
|
236
236
|
}
|
|
237
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
238
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormArrayBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
238
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AbstractFormArrayBaseComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
239
239
|
}
|
|
240
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormArrayBaseComponent, decorators: [{
|
|
241
241
|
type: Component,
|
|
242
242
|
args: [{
|
|
243
243
|
template: '',
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-array-base/abstract-form-array-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-array-base/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.ts"],"sourcesContent":["import { Component, OnDestroy, OnInit } from '@angular/core';\nimport { AbstractFormBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-base';\nimport {\n IAbstractFormArrayControls,\n IAbstractFormArrayControlValidation,\n IAbstractFormArrayControl,\n} from '@hmcts/opal-frontend-common/components/abstract/interfaces';\nimport { AbstractControl, FormArray, FormControl, FormGroup, ValidatorFn } from '@angular/forms';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormArrayBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy {\n public formArrayControls: IAbstractFormArrayControls[] = [];\n public formArrayControlsValidation: IAbstractFormArrayControlValidation[] = [];\n public formArrayFields: string[] = [];\n\n /**\n * Builds an array of form controls for a form array.\n *\n * @param formControlCount - An array of numbers representing the number of form controls to create.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - An array of field names for the form controls.\n * @param controlValidation - An array of control validation configurations.\n * @returns An array of form controls for the form array.\n */\n private buildFormArrayControls(\n formControlCount: number[],\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): IAbstractFormArrayControls[] {\n // Directly map each index to a control\n return formControlCount.map((_element, index) =>\n this.addFormArrayControls(index, formArrayName, fieldNames, controlValidation),\n );\n }\n\n /**\n * Adds form array controls to the specified form array.\n *\n * @param index - The index at which the form array controls should be added.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - The names of the form controls to be created.\n * @param controlValidation - The validation rules for the form controls.\n * @returns An object containing the form controls that were added.\n */\n private addFormArrayControls(\n index: number,\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): { [key: string]: IAbstractFormArrayControl } {\n const formArray = this.form.get(formArrayName) as FormArray;\n const formArrayFormGroup = new FormGroup({});\n\n // Create the form controls...\n const controls = this.createFormArrayControls(fieldNames, index);\n\n // Add the controls to the form group...\n this.addControlsToFormGroup(formArrayFormGroup, controlValidation, index);\n\n // Add the form group to the form array...\n formArray.push(formArrayFormGroup);\n\n // Return the form controls...\n return controls;\n }\n\n /**\n * Creates a new instance of FormArray with the specified validators and controls.\n *\n * @param validators - An array of validator functions to be applied to the form array.\n * @param controls - An optional array of form controls to initialize the form array with.\n * @returns A new instance of FormArray.\n */\n protected createFormArray(validators: ValidatorFn[], controls: FormControl[] = []): FormArray {\n return new FormArray(controls, { validators: [...validators] });\n }\n\n /**\n * Sets up the form array form controls based on the provided parameters.\n *\n * @param formArrayCountArray - An array of numbers representing the count of form array controls.\n * @param formArrayName - The name of the form array.\n */\n protected setupFormArrayFormControls(formArrayCountArray: number[], formArrayName: string): void {\n if (formArrayCountArray.length) {\n this.formArrayControls = this.buildFormArrayControls(\n formArrayCountArray,\n formArrayName,\n this.formArrayFields,\n this.formArrayControlsValidation,\n );\n }\n }\n\n /**\n * Creates an object with form array controls based on the given fields and index.\n *\n * @param fields - An array of field names.\n * @param index - The index of the form array.\n * @returns An object with form array controls.\n */\n protected createFormArrayControls(fields: string[], index: number): { [key: string]: IAbstractFormArrayControl } {\n return fields.reduce(\n (controls, field) => ({\n ...controls,\n [field]: {\n inputId: `${field}_${index}`,\n inputName: `${field}_${index}`,\n controlName: `${field}_${index}`,\n },\n }),\n {},\n );\n }\n\n /**\n * Removes form array controls errors for a specific index.\n *\n * @param index - The index of the form array control.\n * @param formArrayControls - An array of form array controls.\n * @param fieldNames - An array of field names to remove errors from.\n */\n protected removeFormArrayControlsErrors(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): void {\n const formArrayControl = formArrayControls[index];\n\n if (formArrayControl) {\n for (const field of fieldNames) {\n delete this.formControlErrorMessages?.[formArrayControl[field].controlName];\n }\n }\n }\n\n /**\n * Removes a form array control at the specified index from the given array of form array controls.\n *\n * @param index - The index of the form array control to be removed.\n * @param formArrayControls - The array of form array controls.\n * @returns The updated array of form array controls after removing the specified control.\n */\n protected removeFormArrayControl(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n ): IAbstractFormArrayControls[] {\n formArrayControls.splice(index, 1);\n return formArrayControls;\n }\n\n /**\n * Retrieves the value of a form control or returns a default value if the control is null or undefined.\n *\n * @param control - The form control to retrieve the value from.\n * @param defaultValue - The default value to return if the control is null or undefined.\n * @returns The value of the control if it exists, otherwise the default value.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected getControlValueOrDefault(control: AbstractControl | null, defaultValue: any): any {\n return control?.value ?? defaultValue;\n }\n\n /**\n * Removes a form array control at the specified index and updates the form array controls and errors.\n *\n * @param index - The index of the form array control to remove.\n * @param formArrayName - The name of the form array.\n * @param formArrayControls - The list of form array controls.\n * @param fieldNames - The names of the fields associated with the form array controls.\n * @returns The updated list of form array controls.\n */\n public removeFormArrayControls(\n index: number,\n formArrayName: string,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): IAbstractFormArrayControls[] {\n // Get the form array...\n const control = this.form.get(formArrayName) as FormArray;\n\n // Remove the form array control based on index\n control.removeAt(index);\n\n // Then remove the form array controls errors...\n this.removeFormArrayControlsErrors(index, formArrayControls, fieldNames);\n\n // Return the new list of form array controls...\n return this.removeFormArrayControl(index, formArrayControls);\n }\n\n /**\n * Removes controls from a form array at the specified index.\n *\n * @param index - The index at which to remove the controls.\n * @param formArrayName - The name of the form array.\n */\n public removeControlsFromFormArray(index: number, formArrayName: string): void {\n this.formArrayControls = this.removeFormArrayControls(\n index,\n formArrayName,\n this.formArrayControls,\n this.formArrayFields,\n );\n }\n\n /**\n * Removes a form array control from the specified form array.\n *\n * @param formArrayControl - The form array control to remove.\n * @param formArrayName - The name of the form array.\n */\n public removeFormArrayControlFromArray(formArrayControl: IAbstractFormArrayControls, formArrayName: string): void {\n const formArrayControlIndex = this.formArrayControls.indexOf(formArrayControl);\n this.removeFormArrayControls(formArrayControlIndex, formArrayName, this.formArrayControls, this.formArrayFields);\n }\n\n /**\n * Retrieves the FormGroup at the specified index from a FormArray.\n *\n * @param index - The index of the FormGroup to retrieve.\n * @param formArrayName - The name of the FormArray.\n * @returns The FormGroup at the specified index.\n */\n public getFormArrayFormGroup(index: number, formArrayName: string): FormGroup {\n const formArray = this.form.get(formArrayName) as FormArray;\n return formArray.controls[index] as FormGroup;\n }\n\n /**\n * Retrieves the FormControl from a FormGroup within a FormArray at the specified index.\n *\n * @param formGroup - The FormGroup containing the FormControl.\n * @param controlName - The name of the FormControl.\n * @param index - The index of the FormArray.\n * @returns The FormControl at the specified index.\n */\n public getFormArrayFormGroupControl(formGroup: FormGroup, controlName: string, index: number): FormControl {\n return formGroup.controls[`${controlName}_${index}`] as FormControl;\n }\n\n /**\n * Adds validators to a specific form control within a form array group.\n *\n * @param formGroup - The form group containing the form array.\n * @param controlName - The name of the form control within the form array group.\n * @param index - The index of the form array group within the form array.\n * @param validators - An array of validator functions to be added to the form control.\n */\n public addFormArrayFormGroupControlValidators(formControl: FormControl, validators: ValidatorFn[]): void {\n formControl.setValidators(validators);\n formControl.updateValueAndValidity({ emitEvent: false });\n }\n\n /**\n * Removes validators from a specific form control within a form array group.\n * @param formGroup - The form group containing the form array.\n * @param controlName - The name of the form control within the form array group.\n * @param index - The index of the form array group within the form array.\n */\n public removeFormArrayFormGroupControlValidators(formControl: FormControl): void {\n formControl.clearValidators();\n formControl.setErrors(null);\n formControl.setValue(null, { emitEvent: false });\n formControl.updateValueAndValidity({ emitEvent: false });\n }\n\n /**\n * Reverses the form array data by appending the index to each key in the objects.\n *\n * @param data - An array of objects containing form data.\n * @returns An array of objects with keys modified to include their index in the original array.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public addIndexToFormArrayData(data: any[]): { [key: string]: any }[] {\n return data.map((item, index) =>\n Object.entries(item).reduce(\n (indexedObject, [key, value]) => {\n if (value !== undefined) {\n indexedObject[`${key}_${index}`] = value;\n }\n return indexedObject;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {} as { [key: string]: any },\n ),\n );\n }\n\n /**\n * Adds controls to the form array at the specified index.\n *\n * @param index - The index at which the controls should be added.\n * @param formArrayName - The name of the form array.\n */\n public addControlsToFormArray(index: number, formArrayName: string): void {\n this.formArrayControls.push(\n this.addFormArrayControls(index, formArrayName, this.formArrayFields, this.formArrayControlsValidation),\n );\n }\n\n public override ngOnInit(): void {\n super.ngOnInit();\n }\n\n public override ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n super.ngOnDestroy();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAYM,MAAgB,8BAA+B,SAAQ,yBAAyB,CAAA;IAC7E,iBAAiB,GAAiC,EAAE;IACpD,2BAA2B,GAA0C,EAAE;IACvE,eAAe,GAAa,EAAE;AAErC;;;;;;;;AAQG;AACK,IAAA,sBAAsB,CAC5B,gBAA0B,EAC1B,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;;QAGxD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KAC1C,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAC/E;IACH;AAEA;;;;;;;;AAQG;AACK,IAAA,oBAAoB,CAC1B,KAAa,EACb,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;QAExD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAc;AAC3D,QAAA,MAAM,kBAAkB,GAAG,IAAI,SAAS,CAAC,EAAE,CAAC;;QAG5C,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,KAAK,CAAC;;QAGhE,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,CAAC;;AAGzE,QAAA,SAAS,CAAC,IAAI,CAAC,kB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AA4B,CAC7B,CACF;IACH;AAEA;;;;;AAKG;IACI,sBAAsB,CAAC,KAAa,EAAE,aAAqB,EAAA;QAChE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CACzB,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,2BAA2B,CAAC,CACxG;IACH;IAEgB,QAAQ,GAAA;QACtB,KAAK,CAAC,QAAQ,EAAE;IAClB;IAEgB,WAAW,GAAA;AACzB,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE;AACzB,QAAA,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE;QAC7B,KAAK,CAAC,WAAW,EAAE;IACrB;uGA5SoB,8BAA8B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA9B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,8BAA8B,+FAFxC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAEQ,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAHnD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-array-base/abstract-form-array-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-array-base/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.ts"],"sourcesContent":["import { Component, OnDestroy, OnInit } from '@angular/core';\nimport { AbstractFormBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-base';\nimport {\n IAbstractFormArrayControls,\n IAbstractFormArrayControlValidation,\n IAbstractFormArrayControl,\n} from '@hmcts/opal-frontend-common/components/abstract/interfaces';\nimport { AbstractControl, FormArray, FormControl, FormGroup, ValidatorFn } from '@angular/forms';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormArrayBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy {\n public formArrayControls: IAbstractFormArrayControls[] = [];\n public formArrayControlsValidation: IAbstractFormArrayControlValidation[] = [];\n public formArrayFields: string[] = [];\n\n /**\n * Builds an array of form controls for a form array.\n *\n * @param formControlCount - An array of numbers representing the number of form controls to create.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - An array of field names for the form controls.\n * @param controlValidation - An array of control validation configurations.\n * @returns An array of form controls for the form array.\n */\n private buildFormArrayControls(\n formControlCount: number[],\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): IAbstractFormArrayControls[] {\n // Directly map each index to a control\n return formControlCount.map((_element, index) =>\n this.addFormArrayControls(index, formArrayName, fieldNames, controlValidation),\n );\n }\n\n /**\n * Adds form array controls to the specified form array.\n *\n * @param index - The index at which the form array controls should be added.\n * @param formArrayName - The name of the form array.\n * @param fieldNames - The names of the form controls to be created.\n * @param controlValidation - The validation rules for the form controls.\n * @returns An object containing the form controls that were added.\n */\n private addFormArrayControls(\n index: number,\n formArrayName: string,\n fieldNames: string[],\n controlValidation: IAbstractFormArrayControlValidation[],\n ): { [key: string]: IAbstractFormArrayControl } {\n const formArray = this.form.get(formArrayName) as FormArray;\n const formArrayFormGroup = new FormGroup({});\n\n // Create the form controls...\n const controls = this.createFormArrayControls(fieldNames, index);\n\n // Add the controls to the form group...\n this.addControlsToFormGroup(formArrayFormGroup, controlValidation, index);\n\n // Add the form group to the form array...\n formArray.push(formArrayFormGroup);\n\n // Return the form controls...\n return controls;\n }\n\n /**\n * Creates a new instance of FormArray with the specified validators and controls.\n *\n * @param validators - An array of validator functions to be applied to the form array.\n * @param controls - An optional array of form controls to initialize the form array with.\n * @returns A new instance of FormArray.\n */\n protected createFormArray(validators: ValidatorFn[], controls: FormControl[] = []): FormArray {\n return new FormArray(controls, { validators: [...validators] });\n }\n\n /**\n * Sets up the form array form controls based on the provided parameters.\n *\n * @param formArrayCountArray - An array of numbers representing the count of form array controls.\n * @param formArrayName - The name of the form array.\n */\n protected setupFormArrayFormControls(formArrayCountArray: number[], formArrayName: string): void {\n if (formArrayCountArray.length) {\n this.formArrayControls = this.buildFormArrayControls(\n formArrayCountArray,\n formArrayName,\n this.formArrayFields,\n this.formArrayControlsValidation,\n );\n }\n }\n\n /**\n * Creates an object with form array controls based on the given fields and index.\n *\n * @param fields - An array of field names.\n * @param index - The index of the form array.\n * @returns An object with form array controls.\n */\n protected createFormArrayControls(fields: string[], index: number): { [key: string]: IAbstractFormArrayControl } {\n return fields.reduce(\n (controls, field) => ({\n ...controls,\n [field]: {\n inputId: `${field}_${index}`,\n inputName: `${field}_${index}`,\n controlName: `${field}_${index}`,\n },\n }),\n {},\n );\n }\n\n /**\n * Removes form array controls errors for a specific index.\n *\n * @param index - The index of the form array control.\n * @param formArrayControls - An array of form array controls.\n * @param fieldNames - An array of field names to remove errors from.\n */\n protected removeFormArrayControlsErrors(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): void {\n const formArrayControl = formArrayControls[index];\n\n if (formArrayControl) {\n for (const field of fieldNames) {\n delete this.formControlErrorMessages?.[formArrayControl[field].controlName];\n }\n }\n }\n\n /**\n * Removes a form array control at the specified index from the given array of form array controls.\n *\n * @param index - The index of the form array control to be removed.\n * @param formArrayControls - The array of form array controls.\n * @returns The updated array of form array controls after removing the specified control.\n */\n protected removeFormArrayControl(\n index: number,\n formArrayControls: IAbstractFormArrayControls[],\n ): IAbstractFormArrayControls[] {\n formArrayControls.splice(index, 1);\n return formArrayControls;\n }\n\n /**\n * Retrieves the value of a form control or returns a default value if the control is null or undefined.\n *\n * @param control - The form control to retrieve the value from.\n * @param defaultValue - The default value to return if the control is null or undefined.\n * @returns The value of the control if it exists, otherwise the default value.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected getControlValueOrDefault(control: AbstractControl | null, defaultValue: any): any {\n return control?.value ?? defaultValue;\n }\n\n /**\n * Removes a form array control at the specified index and updates the form array controls and errors.\n *\n * @param index - The index of the form array control to remove.\n * @param formArrayName - The name of the form array.\n * @param formArrayControls - The list of form array controls.\n * @param fieldNames - The names of the fields associated with the form array controls.\n * @returns The updated list of form array controls.\n */\n public removeFormArrayControls(\n index: number,\n formArrayName: string,\n formArrayControls: IAbstractFormArrayControls[],\n fieldNames: string[],\n ): IAbstractFormArrayControls[] {\n // Get the form array...\n const control = this.form.get(formArrayName) as FormArray;\n\n // Remove the form array control based on index\n control.removeAt(index);\n\n // Then remove the form array controls errors...\n this.removeFormArrayControlsErrors(index, formArrayControls, fieldNames);\n\n // Return the new list of form array controls...\n return this.removeFormArrayControl(index, formArrayControls);\n }\n\n /**\n * Removes controls from a form array at the specified index.\n *\n * @param index - The index at which to remove the controls.\n * @param formArrayName - The name of the form array.\n */\n public removeControlsFromFormArray(index: number, formArrayName: string): void {\n this.formArrayControls = this.removeFormArrayControls(\n index,\n formArrayName,\n this.formArrayControls,\n this.formArrayFields,\n );\n }\n\n /**\n * Removes a form array control from the specified form array.\n *\n * @param formArrayControl - The form array control to remove.\n * @param formArrayName - The name of the form array.\n */\n public removeFormArrayControlFromArray(formArrayControl: IAbstractFormArrayControls, formArrayName: string): void {\n const formArrayControlIndex = this.formArrayControls.indexOf(formArrayControl);\n this.removeFormArrayControls(formArrayControlIndex, formArrayName, this.formArrayControls, this.formArrayFields);\n }\n\n /**\n * Retrieves the FormGroup at the specified index from a FormArray.\n *\n * @param index - The index of the FormGroup to retrieve.\n * @param formArrayName - The name of the FormArray.\n * @returns The FormGroup at the specified index.\n */\n public getFormArrayFormGroup(index: number, formArrayName: string): FormGroup {\n const formArray = this.form.get(formArrayName) as FormArray;\n return formArray.controls[index] as FormGroup;\n }\n\n /**\n * Retrieves the FormControl from a FormGroup within a FormArray at the specified index.\n *\n * @param formGroup - The FormGroup containing the FormControl.\n * @param controlName - The name of the FormControl.\n * @param index - The index of the FormArray.\n * @returns The FormControl at the specified index.\n */\n public getFormArrayFormGroupControl(formGroup: FormGroup, controlName: string, index: number): FormControl {\n return formGroup.controls[`${controlName}_${index}`] as FormControl;\n }\n\n /**\n * Adds validators to a specific form control within a form array group.\n *\n * @param formGroup - The form group containing the form array.\n * @param controlName - The name of the form control within the form array group.\n * @param index - The index of the form array group within the form array.\n * @param validators - An array of validator functions to be added to the form control.\n */\n public addFormArrayFormGroupControlValidators(formControl: FormControl, validators: ValidatorFn[]): void {\n formControl.setValidators(validators);\n formControl.updateValueAndValidity({ emitEvent: false });\n }\n\n /**\n * Removes validators from a specific form control within a form array group.\n * @param formGroup - The form group containing the form array.\n * @param controlName - The name of the form control within the form array group.\n * @param index - The index of the form array group within the form array.\n */\n public removeFormArrayFormGroupControlValidators(formControl: FormControl): void {\n formControl.clearValidators();\n formControl.setErrors(null);\n formControl.setValue(null, { emitEvent: false });\n formControl.updateValueAndValidity({ emitEvent: false });\n }\n\n /**\n * Reverses the form array data by appending the index to each key in the objects.\n *\n * @param data - An array of objects containing form data.\n * @returns An array of objects with keys modified to include their index in the original array.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public addIndexToFormArrayData(data: any[]): { [key: string]: any }[] {\n return data.map((item, index) =>\n Object.entries(item).reduce(\n (indexedObject, [key, value]) => {\n if (value !== undefined) {\n indexedObject[`${key}_${index}`] = value;\n }\n return indexedObject;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {} as { [key: string]: any },\n ),\n );\n }\n\n /**\n * Adds controls to the form array at the specified index.\n *\n * @param index - The index at which the controls should be added.\n * @param formArrayName - The name of the form array.\n */\n public addControlsToFormArray(index: number, formArrayName: string): void {\n this.formArrayControls.push(\n this.addFormArrayControls(index, formArrayName, this.formArrayFields, this.formArrayControlsValidation),\n );\n }\n\n public override ngOnInit(): void {\n super.ngOnInit();\n }\n\n public override ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n super.ngOnDestroy();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAYM,MAAgB,8BAA+B,SAAQ,yBAAyB,CAAA;IAC7E,iBAAiB,GAAiC,EAAE;IACpD,2BAA2B,GAA0C,EAAE;IACvE,eAAe,GAAa,EAAE;AAErC;;;;;;;;AAQG;AACK,IAAA,sBAAsB,CAC5B,gBAA0B,EAC1B,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;;QAGxD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KAC1C,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAC/E;IACH;AAEA;;;;;;;;AAQG;AACK,IAAA,oBAAoB,CAC1B,KAAa,EACb,aAAqB,EACrB,UAAoB,EACpB,iBAAwD,EAAA;QAExD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAc;AAC3D,QAAA,MAAM,kBAAkB,GAAG,IAAI,SAAS,CAAC,EAAE,CAAC;;QAG5C,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,KAAK,CAAC;;QAGhE,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,CAAC;;AAGzE,QAAA,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC;;AAGlC,QAAA,OAAO,QAAQ;IACjB;AAEA;;;;;;AAMG;AACO,IAAA,eAAe,CAAC,UAAyB,EAAE,QAAA,GAA0B,EAAE,EAAA;AAC/E,QAAA,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CA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AC,CACxG;IACH;IAEgB,QAAQ,GAAA;QACtB,KAAK,CAAC,QAAQ,EAAE;IAClB;IAEgB,WAAW,GAAA;AACzB,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE;AACzB,QAAA,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE;QAC7B,KAAK,CAAC,WAAW,EAAE;IACrB;wGA5SoB,8BAA8B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA9B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,8BAA8B,+FAFxC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;4FAEQ,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAHnD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;;ACXD;;AAEG;;;;"}
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs
CHANGED
|
@@ -77,10 +77,10 @@ class AbstractFormArrayRemovalComponent {
|
|
|
77
77
|
this.router.navigate([route], { relativeTo: this.activatedRoute.parent });
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
81
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
80
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormArrayRemovalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
81
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AbstractFormArrayRemovalComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
82
82
|
}
|
|
83
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormArrayRemovalComponent, decorators: [{
|
|
84
84
|
type: Component,
|
|
85
85
|
args: [{
|
|
86
86
|
template: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-array-removal-base/abstract-form-array-removal-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-array-removal-base/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.ts"],"sourcesContent":["import { FormArray, FormGroup } from '@angular/forms';\nimport { Component, inject } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { IAbstractFormArrayRemovalBaseControlValue } from './interfaces/abstract-form-array-removal-base-control-value.interface';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormArrayRemovalComponent {\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n\n protected getFormArrayControlValue(\n formArray: FormArray,\n controlName: string,\n rowIndex: number,\n defaultValue: IAbstractFormArrayRemovalBaseControlValue[keyof IAbstractFormArrayRemovalBaseControlValue],\n ): IAbstractFormArrayRemovalBaseControlValue[keyof IAbstractFormArrayRemovalBaseControlValue] {\n const value = formArray.controls[rowIndex]?.get(controlName)?.value;\n\n if (typeof value === 'string' && !Number.isNaN(Number(value))) {\n return Number(value);\n }\n\n return value ?? defaultValue;\n }\n\n /**\n * Removes a control from the given form array at the specified index and renumbers the remaining controls.\n *\n * @param formArray - The form array from which to remove the control.\n * @param removeIndex - The index of the control to remove.\n * @param fieldNames - The names of the fields associated with the controls.\n * @param dynamicFieldPrefix - The prefix used for dynamically generated field names.\n */\n protected removeControlAndRenumber(\n formArray: FormArray,\n removeIndex: number,\n fieldNames: string[],\n dynamicFieldPrefix: string,\n ): void {\n formArray.removeAt(removeIndex);\n this.renumberControls(formArray, removeIndex, fieldNames, dynamicFieldPrefix);\n }\n\n /**\n * Renumber the controls in a FormArray starting from a specific index.\n * This method updates the control keys of each FormGroup within the FormArray.\n *\n * @param formArray - The FormArray to renumber the controls for.\n * @param startIndex - The index to start renumbering the controls from.\n * @param fieldNames - The names of the fields in the FormGroup.\n * @param dynamicFieldPrefix - The prefix to use for dynamic field names.\n */\n protected renumberControls(\n formArray: FormArray,\n startIndex: number,\n fieldNames: string[],\n dynamicFieldPrefix: string,\n ): void {\n const formGroups = formArray.controls.slice(startIndex);\n for (const [index, formGroup] of formGroups.entries()) {\n this.updateControlKeys(formGroup as FormGroup, index + startIndex, fieldNames, dynamicFieldPrefix);\n }\n }\n\n /**\n * Updates the control keys in a form group based on the provided parameters.\n * @param formGroup - The form group to update.\n * @param index - The index of the form group within an array.\n * @param fieldNames - An array of field names to update.\n * @param dynamicFieldPrefix - The prefix to use for dynamic field keys.\n */\n protected updateControlKeys(\n formGroup: FormGroup,\n index: number,\n fieldNames: string[],\n dynamicFieldPrefix: string,\n ): void {\n for (const field of fieldNames) {\n const currentKey = `${dynamicFieldPrefix}_${field}_${index + 1}`;\n const newKey = `${dynamicFieldPrefix}_${field}_${index}`;\n\n // Retrieve the current control, if it exists\n const control = formGroup.get(currentKey);\n\n if (control) {\n // Remove the old control first, then add it with the new key\n formGroup.removeControl(currentKey);\n\n // Add the control with the updated key\n formGroup.addControl(newKey, control);\n }\n }\n }\n\n /**\n * Handles route with the supplied route\n *\n * @param route string of route\n * @param nonRelative boolean indicating if route is relative to the parent\n */\n public handleRoute(route: string, nonRelative: boolean = false, event?: Event): void {\n if (event) {\n event.preventDefault();\n }\n if (nonRelative) {\n this.router.navigate([route]);\n } else {\n this.router.navigate([route], { relativeTo: this.activatedRoute.parent });\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\n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AAoB,EACpB,kBAA0B,EAAA;AAE1B,QAAA,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE;YAC9B,MAAM,UAAU,GAAG,CAAA,EAAG,kBAAkB,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,EAAI,KAAK,GAAG,CAAC,CAAA,CAAE;YAChE,MAAM,MAAM,GAAG,CAAA,EAAG,kBAAkB,IAAI,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE;;YAGxD,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAEzC,IAAI,OAAO,EAAE;;AAEX,gBAAA,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC;;AAGnC,gBAAA,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC;YACvC;QACF;IACF;AAEA;;;;;AAKG;AACI,IAAA,WAAW,CAAC,KAAa,EAAE,WAAA,GAAuB,KAAK,EAAE,KAAa,EAAA;QAC3E,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,cAAc,EAAE;QACxB;QACA,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/B;aAAO;AACL,YAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3E;IACF;
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-array-removal-base/abstract-form-array-removal-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-array-removal-base/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.ts"],"sourcesContent":["import { FormArray, FormGroup } from '@angular/forms';\nimport { Component, inject } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { IAbstractFormArrayRemovalBaseControlValue } from './interfaces/abstract-form-array-removal-base-control-value.interface';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormArrayRemovalComponent {\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n\n protected getFormArrayControlValue(\n formArray: FormArray,\n controlName: string,\n rowIndex: number,\n defaultValue: IAbstractFormArrayRemovalBaseControlValue[keyof IAbstractFormArrayRemovalBaseControlValue],\n ): IAbstractFormArrayRemovalBaseControlValue[keyof IAbstractFormArrayRemovalBaseControlValue] {\n const value = formArray.controls[rowIndex]?.get(controlName)?.value;\n\n if (typeof value === 'string' && !Number.isNaN(Number(value))) {\n return Number(value);\n }\n\n return value ?? defaultValue;\n }\n\n /**\n * Removes a control from the given form array at the specified index and renumbers the remaining controls.\n *\n * @param formArray - The form array from which to remove the control.\n * @param removeIndex - The index of the control to remove.\n * @param fieldNames - The names of the fields associated with the controls.\n * @param dynamicFieldPrefix - The prefix used for dynamically generated field names.\n */\n protected removeControlAndRenumber(\n formArray: FormArray,\n removeIndex: number,\n fieldNames: string[],\n dynamicFieldPrefix: string,\n ): void {\n formArray.removeAt(removeIndex);\n this.renumberControls(formArray, removeIndex, fieldNames, dynamicFieldPrefix);\n }\n\n /**\n * Renumber the controls in a FormArray starting from a specific index.\n * This method updates the control keys of each FormGroup within the FormArray.\n *\n * @param formArray - The FormArray to renumber the controls for.\n * @param startIndex - The index to start renumbering the controls from.\n * @param fieldNames - The names of the fields in the FormGroup.\n * @param dynamicFieldPrefix - The prefix to use for dynamic field names.\n */\n protected renumberControls(\n formArray: FormArray,\n startIndex: number,\n fieldNames: string[],\n dynamicFieldPrefix: string,\n ): void {\n const formGroups = formArray.controls.slice(startIndex);\n for (const [index, formGroup] of formGroups.entries()) {\n this.updateControlKeys(formGroup as FormGroup, index + startIndex, fieldNames, dynamicFieldPrefix);\n }\n }\n\n /**\n * Updates the control keys in a form group based on the provided parameters.\n * @param formGroup - The form group to update.\n * @param index - The index of the form group within an array.\n * @param fieldNames - An array of field names to update.\n * @param dynamicFieldPrefix - The prefix to use for dynamic field keys.\n */\n protected updateControlKeys(\n formGroup: FormGroup,\n index: number,\n fieldNames: string[],\n dynamicFieldPrefix: string,\n ): void {\n for (const field of fieldNames) {\n const currentKey = `${dynamicFieldPrefix}_${field}_${index + 1}`;\n const newKey = `${dynamicFieldPrefix}_${field}_${index}`;\n\n // Retrieve the current control, if it exists\n const control = formGroup.get(currentKey);\n\n if (control) {\n // Remove the old control first, then add it with the new key\n formGroup.removeControl(currentKey);\n\n // Add the control with the updated key\n formGroup.addControl(newKey, control);\n }\n }\n }\n\n /**\n * Handles route with the supplied route\n *\n * @param route string of route\n * @param nonRelative boolean indicating if route is relative to the parent\n */\n public handleRoute(route: string, nonRelative: boolean = false, event?: Event): void {\n if (event) {\n event.preventDefault();\n }\n if (nonRelative) {\n this.router.navigate([route]);\n } else {\n this.router.navigate([route], { relativeTo: this.activatedRoute.parent });\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAQsB,iCAAiC,CAAA;AACpC,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAE9C,IAAA,wBAAwB,CAChC,SAAoB,EACpB,WAAmB,EACnB,QAAgB,EAChB,YAAwG,EAAA;AAExG,QAAA,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,EAAE,KAAK;AAEnE,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;AAC7D,YAAA,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB;QAEA,OAAO,KAAK,IAAI,YAAY;IAC9B;AAEA;;;;;;;AAOG;AACO,IAAA,wBAAwB,CAChC,SAAoB,EACpB,WAA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KAAK,EAAE;YACT,KAAK,CAAC,cAAc,EAAE;QACxB;QACA,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/B;aAAO;AACL,YAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3E;IACF;wGAvGoB,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAjC,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,iCAAiC,wEAF3C,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;4FAEQ,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAHtD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;;ACPD;;AAEG;;;;"}
|
|
@@ -594,10 +594,10 @@ class AbstractFormBaseComponent {
|
|
|
594
594
|
this.ngUnsubscribe.next();
|
|
595
595
|
this.ngUnsubscribe.complete();
|
|
596
596
|
}
|
|
597
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
598
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
597
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
598
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AbstractFormBaseComponent, isStandalone: true, selector: "ng-component", outputs: { unsavedChanges: "unsavedChanges", formSubmit: "formSubmit" }, ngImport: i0, template: '', isInline: true });
|
|
599
599
|
}
|
|
600
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
600
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractFormBaseComponent, decorators: [{
|
|
601
601
|
type: Component,
|
|
602
602
|
args: [{
|
|
603
603
|
template: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-base/abstract-form-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-base/hmcts-opal-frontend-common-components-abstract-abstract-form-base.ts"],"sourcesContent":["import { ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit, Output, inject } from '@angular/core';\nimport { FormArray, FormControl, FormGroup, FormRecord, ValidatorFn } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { Subject, takeUntil } from 'rxjs';\nimport { IAbstractFormBaseFieldError } from './interfaces/abstract-form-base-field-error.interface';\nimport { IAbstractFormBaseFieldErrors } from './interfaces/abstract-form-base-field-errors.interface';\nimport { IAbstractFormBaseFormError } from './interfaces/abstract-form-base-form-error.interface';\nimport {\n IAbstractFormBaseFormErrorSummaryMessage,\n IAbstractFormControlErrorMessage,\n IAbstractFormArrayControlValidation,\n} from '@hmcts/opal-frontend-common/components/abstract/interfaces';\nimport { IAbstractFormBaseHighPriorityFormError } from './interfaces/abstract-form-base-high-priority-form-error.interface';\nimport { IAbstractFormBaseForm } from './interfaces/abstract-form-base-form.interface';\nimport { UtilsService } from '@hmcts/opal-frontend-common/services/utils-service';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormBaseComponent implements OnInit, OnDestroy {\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n\n @Output() protected unsavedChanges = new EventEmitter<boolean>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Output() protected formSubmit = new EventEmitter<IAbstractFormBaseForm<any>>();\n protected readonly utilsService = inject(UtilsService);\n protected fieldErrors!: IAbstractFormBaseFieldErrors;\n protected formSubmitted = false;\n protected readonly ngUnsubscribe = new Subject<void>();\n\n public form!: FormGroup;\n public formControlErrorMessages!: IAbstractFormControlErrorMessage;\n public formErrorSummaryMessage!: IAbstractFormBaseFormErrorSummaryMessage[];\n public formErrors!: IAbstractFormBaseFormError[];\n\n constructor() {}\n\n /**\n * Scrolls to a specific form field and attempts to focus on it.\n *\n * This method locates the target field or its associated label/legend\n * based on the provided `fieldId`. It ensures that the field or its\n * nested focusable element is brought into view and focused, if possible.\n *\n * The scrolling behavior is smooth, and the method prioritizes the following\n * elements in order:\n * 1. A label associated with an autocomplete field (`label[for=\"${fieldId}-autocomplete\"]`).\n * 2. A regular label associated with the field (`label[for=\"${fieldId}\"]`).\n * 3. A legend within a fieldset associated with the field (`[id=\"${fieldId}\"] .govuk-fieldset__legend`).\n * 4. The field itself or its nested focusable element.\n *\n * @param fieldId - The ID of the form field to scroll to and focus on.\n */\n private scroll(fieldId: string): void {\n const autocompleteLabel = document.querySelector<HTMLElement>(`label[for=\"${fieldId}-autocomplete\"]`);\n const regularLabel = document.querySelector<HTMLElement>(`label[for=\"${fieldId}\"]`);\n const fieldsetLegend = document.querySelector<HTMLElement>(`[id=\"${fieldId}\"] .govuk-fieldset__legend`);\n\n const labelTarget = autocompleteLabel ?? regularLabel ?? fieldsetLegend ?? null;\n const focusableSelector = 'input:not([type=\"hidden\"]), select, textarea, button, [tabindex]:not([tabindex=\"-1\"])';\n\n let fieldElement = document.getElementById(`${fieldId}-autocomplete`) ?? document.getElementById(fieldId);\n\n if (fieldElement && !this.canReceiveFocus(fieldElement)) {\n const nestedFocusable = fieldElement.querySelector<HTMLElement>(focusableSelector);\n if (nestedFocusable) {\n fieldElement = nestedFocusable;\n }\n }\n\n fieldElement ??= document.querySelector<HTMLElement>(`[id=\"${fieldId}\"] ${focusableSelector}`);\n\n if (labelTarget) {\n labelTarget.scrollIntoView({ behavior: 'smooth' });\n } else if (fieldElement) {\n fieldElement.scrollIntoView({ behavior: 'smooth' });\n }\n\n fieldElement?.focus();\n }\n\n /**\n * Determines whether a given HTML element can receive focus.\n *\n * An element is considered focusable if:\n * - It has a `tabIndex` greater than or equal to 0 and does not have the `disabled` attribute.\n * - It is an anchor (`<a>`) element with a valid `href` attribute.\n * - It is one of the following tags: `INPUT`, `SELECT`, `TEXTAREA`, or `BUTTON`,\n * and it is not disabled.\n *\n * @param element - The HTML element to check for focusability.\n * @returns `true` if the element can receive focus, otherwise `false`.\n */\n private canReceiveFocus(element: HTMLElement): boolean {\n if (element.tabIndex >= 0 && !element.hasAttribute('disabled')) {\n return true;\n }\n\n if (element instanceof HTMLAnchorElement && element.hasAttribute('href') && element.href) {\n return !!element.href;\n }\n\n const focusableTags = ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'];\n if (focusableTags.includes(element.tagName)) {\n return !(element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLButtonElement).disabled;\n }\n\n return false;\n }\n\n /**\n * Returns the highest priority form error from the given error keys and field errors.\n * @param errorKeys - An array of error keys.\n * @param fieldErrors - An object containing field errors.\n * @returns The highest priority form error or null if no errors are found.\n */\n private getHighestPriorityError(\n errorKeys: string[] = [],\n fieldErrors: IAbstractFormBaseFieldError = {},\n ): IAbstractFormBaseHighPriorityFormError | null {\n if (errorKeys.length && Object.keys(fieldErrors).length) {\n const errors = errorKeys.map((errorType: string) => {\n return {\n ...fieldErrors[errorType],\n type: errorType,\n };\n });\n\n const sortedErrors = [...errors].sort((a, b) => a.priority - b.priority);\n\n return sortedErrors[0];\n }\n return null;\n }\n\n /**\n * Retrieves the details of the highest priority form error for a given control path.\n * @param controlPath - The path to the control in the form.\n * @returns The details of the highest priority form error, or null if there are no errors.\n */\n private getFieldErrorDetails(controlPath: (string | number)[]): IAbstractFormBaseHighPriorityFormError | null {\n // Get the control\n const control = this.form.get(controlPath);\n\n // If we have errors\n const controlErrors = control?.errors;\n\n if (controlErrors) {\n /// Get all the error keys\n // Use Array.prototype.at for clarity when accessing the last segment of the control path\n const controlKey = controlPath.at(-1);\n const errorKeys = Object.keys(controlErrors) || [];\n const fieldErrors = controlKey === undefined ? {} : this.fieldErrors[controlKey] || {};\n\n if (errorKeys.length && Object.keys(fieldErrors).length) {\n return this.getHighestPriorityError(errorKeys, fieldErrors);\n }\n }\n return null;\n }\n\n /**\n * Retrieves all form errors from the provided form and its nested form groups.\n *\n * @param form - The form group to retrieve errors from.\n * @param controlPath - An optional array representing the path to the current control within the form group.\n * @returns An array of form errors, each containing the field ID, error message, priority, and type.\n */\n private getFormErrors(form: FormGroup, controlPath: (string | number)[] = []): IAbstractFormBaseFormError[] {\n // recursively get all errors from all controls in the form including nested form group controls\n const formControls = form.controls;\n\n const errorSummary = Object.keys(formControls)\n .filter((controlName) => formControls[controlName].invalid)\n .flatMap((controlName) => {\n const control = formControls[controlName];\n\n if (control instanceof FormRecord) {\n // We only support FormControls in FormRecords\n const recordFieldErrorDetails = this.getFieldErrorDetails([...controlPath, controlName]);\n\n return {\n fieldId: controlName,\n message: recordFieldErrorDetails?.message ?? null,\n priority: recordFieldErrorDetails?.priority ?? 999999999,\n type: recordFieldErrorDetails?.type ?? null,\n };\n }\n\n if (control instanceof FormGroup) {\n return this.getFormErrors(control, [...controlPath, controlName]);\n }\n\n if (control instanceof FormArray) {\n return control.controls.flatMap((controlItem, index) => {\n // We only support FormGroups in FormArrays\n if (controlItem instanceof FormGroup) {\n return this.getFormErrors(controlItem, [...controlPath, controlName, index]);\n }\n return [];\n });\n }\n\n const getFieldErrorDetails = this.getFieldErrorDetails([...controlPath, controlName]);\n\n // Return the error summary entry\n // If we don't have the error details, return a null message\n return {\n fieldId: controlName,\n message: getFieldErrorDetails?.message ?? null,\n priority: getFieldErrorDetails?.priority ?? 999999999,\n type: getFieldErrorDetails?.type ?? null,\n };\n });\n\n // Remove any null errors\n return errorSummary.filter((item) => item?.message !== null);\n }\n\n /**\n * Sets the error messages for the form controls and error summary based on the provided form errors.\n * @param formErrors - An array of form errors containing field IDs and error messages.\n */\n private setErrorMessages(formErrors: IAbstractFormBaseFormError[]) {\n // Reset the form error messages\n this.formControlErrorMessages = {};\n this.formErrorSummaryMessage = [];\n\n // Set the form error messages based on the error summary entries\n for (const entry of formErrors) {\n this.formControlErrorMessages[entry.fieldId] = entry.message;\n this.formErrorSummaryMessage.push({ fieldId: entry.fieldId, message: entry.message });\n }\n }\n\n /**\n * Gets the indexes of the date fields to remove based on the form error summary message.\n * @returns An array of indexes representing the date fields to remove.\n */\n private getDateFieldsToRemoveIndexes(): number[] {\n const indexesToRemove: number[] = [];\n // The order of the field ids is important\n // this is the order in which we want to remove them\n const foundIndexes = this.getFormErrorSummaryIndex(\n ['dayOfMonth', 'monthOfYear', 'year'],\n this.formErrorSummaryMessage,\n );\n\n // Determine which indexes to remove based on the found fields\n switch (foundIndexes.length) {\n case 3:\n // All three date fields are present\n indexesToRemove.push(foundIndexes[1], foundIndexes[2]);\n break;\n case 2:\n // Two date fields are present\n indexesToRemove.push(foundIndexes[1]);\n break;\n }\n\n return indexesToRemove;\n }\n\n /**\n * Returns an array of indices corresponding to the positions of the given field IDs in the form error summary message array.\n *\n * @param fieldIds - An array of field IDs to search for in the form error summary message array.\n * @param formErrorSummaryMessage - An array of form error summary messages.\n * @returns An array of indices corresponding to the positions of the field IDs in the form error summary message array.\n */\n private getFormErrorSummaryIndex(\n fieldIds: string[],\n formErrorSummaryMessage: IAbstractFormBaseFormErrorSummaryMessage[],\n ): number[] {\n return fieldIds.reduce((acc: number[], field) => {\n const index = formErrorSummaryMessage.findIndex((error) => error.fieldId === field);\n if (index === -1) {\n return acc;\n }\n return [...acc, index];\n }, []);\n }\n\n /**\n * Removes error summary messages from the given array based on the specified indexes.\n *\n * @param formErrorSummaryMessage - The array of error summary messages.\n * @param indexes - The indexes of the error summary messages to be removed.\n * @returns The updated array of error summary messages.\n */\n private removeErrorSummaryMessages(\n formErrorSummaryMessage: IAbstractFormBaseFormErrorSummaryMessage[],\n indexes: number[],\n ): IAbstractFormBaseFormErrorSummaryMessage[] {\n return formErrorSummaryMessage.filter((_, index) => !indexes.includes(index));\n }\n\n /**\n * Splits the form errors into two arrays based on the provided field IDs.\n * Errors with field IDs included in the fieldIds array will be moved to the removedFormErrors array,\n * while the remaining errors will be moved to the cleanFormErrors array.\n *\n * @param fieldIds - An array of field IDs to filter the form errors.\n * @param formErrors - An array of form errors to be split.\n * @returns An array containing two arrays: cleanFormErrors and removedFormErrors.\n */\n private splitFormErrors(\n fieldIds: string[],\n formErrors: IAbstractFormBaseFormError[],\n ): IAbstractFormBaseFormError[][] {\n const cleanFormErrors: IAbstractFormBaseFormError[] = [];\n const removedFormErrors: IAbstractFormBaseFormError[] = [];\n\n for (const error of formErrors) {\n if (fieldIds.includes(error.fieldId)) {\n removedFormErrors.push(error);\n } else {\n cleanFormErrors.push(error);\n }\n }\n\n return [cleanFormErrors, removedFormErrors];\n }\n\n /**\n * Manipulates the error message for specific fields in the formErrors array.\n * @param fields - An array of field IDs to target for error message manipulation.\n * @param messageOverride - The new error message to be used for the targeted fields.\n * @param errorType - The type of error to match for the targeted fields.\n * @param formErrors - An array of IFormError objects representing the form errors.\n * @returns An array of IFormError objects with the manipulated error messages.\n */\n private manipulateFormErrorMessage(\n fields: string[],\n messageOverride: string,\n errorType: string,\n formErrors: IAbstractFormBaseFormError[],\n ): IAbstractFormBaseFormError[] {\n const manipulatedFields: IAbstractFormBaseFormError[] = [];\n for (const field of formErrors) {\n if (fields.includes(field.fieldId)) {\n if (field.type === errorType) {\n manipulatedFields.push({ ...field, message: messageOverride });\n } else {\n manipulatedFields.push(field);\n }\n continue;\n }\n manipulatedFields.push(field);\n }\n\n return manipulatedFields;\n }\n\n /**\n * Retrieves the form errors with the highest priority.\n *\n * @param formErrors - An array of form errors.\n * @returns An array of form errors with the highest priority.\n */\n private getHighPriorityFormErrors(formErrors: IAbstractFormBaseFormError[]): IAbstractFormBaseFormError[] {\n // Get the lowest priority (1 is the highest priority, 3 is the lowest priority)\n const lowestPriority = Math.min(...formErrors.map((item) => item.priority));\n return formErrors.filter((item) => item.priority === lowestPriority);\n }\n\n /**\n * Focuses on the error summary element and scrolls to the top of the page.\n *\n * This method first triggers change detection to ensure the view is up-to-date.\n * It then selects the error summary element with the class 'govuk-error-summary'.\n * If the error summary element is found, it sets focus on it without scrolling the page.\n * Finally, it calls a utility service to scroll to the top of the page.\n *\n * @private\n */\n private focusAndScrollToErrorSummary(): void {\n this.changeDetectorRef.detectChanges();\n\n const errorSummary = document.querySelector('.govuk-error-summary') as HTMLElement;\n if (errorSummary) {\n errorSummary.focus({ preventScroll: true });\n this.utilsService.scrollToTop();\n }\n }\n\n /**\n * Setup listener for the form value changes and to emit hasUnsavedChanges\n */\n private setupListener(): void {\n this.form.valueChanges.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.unsavedChanges.emit(this.hasUnsavedChanges());\n });\n }\n\n /**\n * Adds controls to a form group.\n *\n * @param formGroup - The form group to add controls to.\n * @param controls - An array of form array control validations.\n * @param index - The index of the form array control.\n */\n protected addControlsToFormGroup(\n formGroup: FormGroup,\n controls: IAbstractFormArrayControlValidation[],\n index: number,\n ): void {\n for (const { controlName, validators } of controls) {\n formGroup.addControl(`${controlName}_${index}`, new FormControl(null, validators));\n }\n }\n\n /**\n * Creates a form control with the specified validators and initial value.\n *\n * @param validators - An array of validator functions.\n * @param initialValue - The initial value for the form control. Defaults to null.\n * @returns The created form control.\n */\n protected createFormControl(validators: ValidatorFn[], initialValue: string | null = null): FormControl {\n return new FormControl(initialValue, { validators: [...validators] });\n }\n\n /**\n * Handles the error messages and populates the relevant variables\n */\n protected handleErrorMessages(): void {\n this.formErrors = this.getFormErrors(this.form);\n\n this.setErrorMessages(this.formErrors);\n\n this.formErrorSummaryMessage = this.removeErrorSummaryMessages(\n this.formErrorSummaryMessage,\n this.getDateFieldsToRemoveIndexes(),\n );\n }\n\n /**\n * Checks whether the form has been touched and submitted\n *\n * @returns boolean\n */\n protected hasUnsavedChanges(): boolean {\n return this.form.dirty && !this.formSubmitted;\n }\n\n /**\n * Sets the value of a form control specified by its path and marks it as touched.\n *\n * @param value - The value to set for the form control.\n * @param controlPath - The dot-delimited path to the form control within the form group.\n */\n protected setInputValue(value: string, controlPath: string): void {\n const control = this.form.get(controlPath);\n if (control) {\n control.patchValue(value);\n control.markAsTouched();\n }\n }\n\n /**\n * Handles the form errors for the date input fields.\n * @param formErrors - An array of form errors.\n * @returns An array of form errors with the manipulated error messages.\n */\n protected handleDateInputFormErrors() {\n const dateInputFields = ['dayOfMonth', 'monthOfYear', 'year'];\n const splitFormErrors = this.splitFormErrors(dateInputFields, this.formErrors);\n const highPriorityDateControlErrors = this.getHighPriorityFormErrors(splitFormErrors[1]);\n let manipulatedFormErrors: IAbstractFormBaseFormError[] = highPriorityDateControlErrors;\n\n // If we have more than one error then we want to manipulate the error message\n if (highPriorityDateControlErrors.length > 1) {\n manipulatedFormErrors = this.manipulateFormErrorMessage(\n dateInputFields,\n 'Please enter a DOB',\n 'required',\n manipulatedFormErrors,\n );\n }\n\n return [...splitFormErrors[0], ...manipulatedFormErrors];\n }\n\n /**\n * Sets the initial error messages for the form controls.\n *\n * @param form - The FormGroup instance.\n */\n protected setInitialErrorMessages(): void {\n const formControls = this.form.controls;\n const initialFormControlErrorMessages: IAbstractFormControlErrorMessage = {};\n\n for (const controlName of Object.keys(formControls)) {\n initialFormControlErrorMessages[controlName] = null;\n }\n\n this.formControlErrorMessages = initialFormControlErrorMessages;\n this.formErrorSummaryMessage = [];\n }\n\n /**\n * Repopulates the search form with the data from the account enquiry search.\n * @param state - The state object containing the search form data.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected rePopulateForm(state: any): void {\n this.form.patchValue(state);\n }\n\n /**\n * Adds a new form control to the form group.\n *\n * @param controlName - The name of the control to add.\n * @param validators - An array of validators to apply to the control.\n */\n protected createControl(controlName: string, validators: ValidatorFn[]): void {\n this.form.addControl(controlName, new FormControl(null, validators));\n }\n\n /**\n * Updates the validators of an existing form control.\n *\n * @param controlName - The name of the control to update.\n * @param validators - An array of validators to apply to the control.\n */\n protected updateControl(controlName: string, validators: ValidatorFn[]): void {\n const control = this.form.get(controlName);\n if (control) {\n control.setValidators(validators);\n control.updateValueAndValidity();\n } else {\n this.createControl(controlName, validators);\n }\n }\n\n /**\n * Removes a control from the form.\n *\n * @param controlName - The name of the control to remove.\n */\n protected removeControl(controlName: string): void {\n if (this.formControlErrorMessages[controlName]) {\n this.removeControlErrors(controlName);\n }\n this.form.removeControl(controlName);\n }\n\n /**\n * Removes the error message associated with the specified control name from the formControlErrorMessages object.\n *\n * @param controlName - The name of the control for which to remove the error message.\n */\n protected removeControlErrors(controlName: string): void {\n delete this.formControlErrorMessages[controlName];\n }\n\n /**\n * Clears all error messages from the form.\n */\n protected clearAllErrorMessages(): void {\n this.formControlErrorMessages = {};\n this.formErrorSummaryMessage = [];\n this.formErrors = [];\n this.form.updateValueAndValidity({ onlySelf: false, emitEvent: false });\n }\n\n /**\n * Create a plain object from a FormRecord of FormControls.\n *\n * What it does: copies each control's current value onto a plain object.\n * When to use: when you need the raw values from a FormRecord (e.g. to send to an API).\n *\n * Example\n * -------\n * // record: FormRecord<FormControl<string | null>> with a single control 'firstName'\n * const out = this.objectFromFormRecord(record, {\n * mapKey: k => k, // optional (defaults to identity)\n * mapValue: v => v ?? '' // turn null/undefined into ''\n * });\n * // out -> { firstName: '' }\n *\n * @typeParam T - Control value type.\n * @typeParam U - Output value type (defaults to T).\n * @typeParam K - Output key type (defaults to string). Control names are strings; provide `mapKey` if you need numbers.\n */\n protected objectFromFormRecord<T, U = T, K extends string | number = string>(\n controlRecord: FormRecord<FormControl<T | null | undefined>>,\n options?: {\n mapKey?: (key: string) => K;\n mapValue?: (value: T | null | undefined) => U;\n },\n ): Record<K, U> {\n const mapKey = options?.mapKey ?? ((k: string) => k as unknown as K);\n const mapValue = options?.mapValue ?? ((v: T | null | undefined) => v as unknown as U);\n\n const result = {} as Record<K, U>;\n\n for (const [name, control] of Object.entries(controlRecord.controls)) {\n result[mapKey(name)] = mapValue(control.value);\n }\n\n return result;\n }\n\n /**\n * Patch a FormRecord of FormControls from a plain object.\n *\n * What it does: for each entry in `values`, finds the matching control by name\n * (optionally mapped via `mapKey`) and sets its value **only if** it changes.\n * When to use: when you need to patch many controls at once, without\n * triggering extra updates for unchanged values.\n *\n * Example\n * -------\n * // controlRecord: FormRecord<FormControl<string>> with controls 'firstName', 'lastName'\n * this.patchFormRecordFromObject(controlRecord, { firstName: 'Ada', lastName: 'Lovelace' }, {\n * emitEvent: true,\n * isEqual: (a, b) => a === b,\n * // mapKey: k => `ctrl_${k as string}` // optional: map incoming keys to control names\n * });\n *\n * @typeParam T - Control value type.\n * @typeParam K - Keys present in the `values` object (string or number).\n */\n protected patchFormRecordFromObject<T, K extends string | number = string>(\n controlRecord: FormRecord<FormControl<T>>,\n values: Record<K, T>,\n options?: {\n emitEvent?: boolean;\n /** How provided keys map to control names (defaults to String(key)). */\n mapKey?: (key: K) => string;\n /** Equality check used to avoid unnecessary writes (defaults to Object.is). */\n isEqual?: (a: T, b: T) => boolean;\n },\n ): void {\n const emitEvent = options?.emitEvent ?? false;\n const mapKey = options?.mapKey ?? String;\n const isEqual = options?.isEqual ?? Object.is;\n\n for (const [k, v] of Object.entries(values) as [K, T][]) {\n const controlName = mapKey(k);\n const ctrl = controlRecord.get(controlName) as FormControl<T> | null;\n if (!ctrl) {\n // If the control isn't present, skip silently. Callers can validate separately.\n continue;\n }\n if (!isEqual(ctrl.value, v)) {\n ctrl.setValue(v, { emitEvent });\n }\n }\n }\n\n /**\n * Clears the search form.\n */\n public handleClearForm(): void {\n this.form.reset();\n }\n\n /**\n * Handles the scroll of the component error from the summary\n *\n * @param fieldId - Field id of the component\n */\n public scrollTo(fieldId: string): void {\n this['scroll'](fieldId);\n }\n\n /**\n * Handles route with the supplied route\n *\n * @param route string of route\n * @param nonRelative boolean indicating if route is relative to the parent\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public handleRoute(route: string, nonRelative: boolean = false, event?: Event, routeData?: any): void {\n if (event) {\n event.preventDefault();\n }\n\n this.unsavedChanges.emit(this.hasUnsavedChanges());\n\n const navigationExtras = {\n ...(nonRelative ? {} : { relativeTo: this.activatedRoute.parent }),\n ...(routeData === undefined ? {} : { state: routeData }),\n };\n\n this.router.navigate([route], navigationExtras);\n }\n\n /**\n * Handles the form submission event.\n *\n * @param event - The form submission event.\n * @returns void\n */\n public handleFormSubmit(event: SubmitEvent): void {\n this.handleErrorMessages();\n\n if (this.form.valid) {\n this.formSubmitted = true;\n const nestedFlow = event.submitter ? event.submitter.className.includes('nested-flow') : false;\n this.unsavedChanges.emit(this.hasUnsavedChanges());\n this.formSubmit.emit({ formData: this.form.value, nestedFlow: nestedFlow });\n } else {\n this.focusAndScrollToErrorSummary();\n }\n }\n\n /**\n * Handles the input event to convert all letters in the input value to uppercase.\n * This method is triggered by an input event and modifies the input value directly.\n *\n * @param event - The input event triggered by the user.\n */\n public handleUppercaseInputMask(event: Event): void {\n const input = event.target as HTMLInputElement;\n input.value = this.utilsService.upperCaseAllLetters(input.value);\n }\n\n public ngOnInit(): void {\n if (this.form) {\n this.setupListener();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAmBsB,yBAAyB,CAAA;AAC5B,IAAA,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC7C,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAA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AAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAzB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,yBAAyB,iJAFnC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAEQ,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAH9C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;sBAME;;sBAEA;;;AC1BH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-base/abstract-form-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-base/hmcts-opal-frontend-common-components-abstract-abstract-form-base.ts"],"sourcesContent":["import { ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit, Output, inject } from '@angular/core';\nimport { FormArray, FormControl, FormGroup, FormRecord, ValidatorFn } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { Subject, takeUntil } from 'rxjs';\nimport { IAbstractFormBaseFieldError } from './interfaces/abstract-form-base-field-error.interface';\nimport { IAbstractFormBaseFieldErrors } from './interfaces/abstract-form-base-field-errors.interface';\nimport { IAbstractFormBaseFormError } from './interfaces/abstract-form-base-form-error.interface';\nimport {\n IAbstractFormBaseFormErrorSummaryMessage,\n IAbstractFormControlErrorMessage,\n IAbstractFormArrayControlValidation,\n} from '@hmcts/opal-frontend-common/components/abstract/interfaces';\nimport { IAbstractFormBaseHighPriorityFormError } from './interfaces/abstract-form-base-high-priority-form-error.interface';\nimport { IAbstractFormBaseForm } from './interfaces/abstract-form-base-form.interface';\nimport { UtilsService } from '@hmcts/opal-frontend-common/services/utils-service';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormBaseComponent implements OnInit, OnDestroy {\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n\n @Output() protected unsavedChanges = new EventEmitter<boolean>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Output() protected formSubmit = new EventEmitter<IAbstractFormBaseForm<any>>();\n protected readonly utilsService = inject(UtilsService);\n protected fieldErrors!: IAbstractFormBaseFieldErrors;\n protected formSubmitted = false;\n protected readonly ngUnsubscribe = new Subject<void>();\n\n public form!: FormGroup;\n public formControlErrorMessages!: IAbstractFormControlErrorMessage;\n public formErrorSummaryMessage!: IAbstractFormBaseFormErrorSummaryMessage[];\n public formErrors!: IAbstractFormBaseFormError[];\n\n constructor() {}\n\n /**\n * Scrolls to a specific form field and attempts to focus on it.\n *\n * This method locates the target field or its associated label/legend\n * based on the provided `fieldId`. It ensures that the field or its\n * nested focusable element is brought into view and focused, if possible.\n *\n * The scrolling behavior is smooth, and the method prioritizes the following\n * elements in order:\n * 1. A label associated with an autocomplete field (`label[for=\"${fieldId}-autocomplete\"]`).\n * 2. A regular label associated with the field (`label[for=\"${fieldId}\"]`).\n * 3. A legend within a fieldset associated with the field (`[id=\"${fieldId}\"] .govuk-fieldset__legend`).\n * 4. The field itself or its nested focusable element.\n *\n * @param fieldId - The ID of the form field to scroll to and focus on.\n */\n private scroll(fieldId: string): void {\n const autocompleteLabel = document.querySelector<HTMLElement>(`label[for=\"${fieldId}-autocomplete\"]`);\n const regularLabel = document.querySelector<HTMLElement>(`label[for=\"${fieldId}\"]`);\n const fieldsetLegend = document.querySelector<HTMLElement>(`[id=\"${fieldId}\"] .govuk-fieldset__legend`);\n\n const labelTarget = autocompleteLabel ?? regularLabel ?? fieldsetLegend ?? null;\n const focusableSelector = 'input:not([type=\"hidden\"]), select, textarea, button, [tabindex]:not([tabindex=\"-1\"])';\n\n let fieldElement = document.getElementById(`${fieldId}-autocomplete`) ?? document.getElementById(fieldId);\n\n if (fieldElement && !this.canReceiveFocus(fieldElement)) {\n const nestedFocusable = fieldElement.querySelector<HTMLElement>(focusableSelector);\n if (nestedFocusable) {\n fieldElement = nestedFocusable;\n }\n }\n\n fieldElement ??= document.querySelector<HTMLElement>(`[id=\"${fieldId}\"] ${focusableSelector}`);\n\n if (labelTarget) {\n labelTarget.scrollIntoView({ behavior: 'smooth' });\n } else if (fieldElement) {\n fieldElement.scrollIntoView({ behavior: 'smooth' });\n }\n\n fieldElement?.focus();\n }\n\n /**\n * Determines whether a given HTML element can receive focus.\n *\n * An element is considered focusable if:\n * - It has a `tabIndex` greater than or equal to 0 and does not have the `disabled` attribute.\n * - It is an anchor (`<a>`) element with a valid `href` attribute.\n * - It is one of the following tags: `INPUT`, `SELECT`, `TEXTAREA`, or `BUTTON`,\n * and it is not disabled.\n *\n * @param element - The HTML element to check for focusability.\n * @returns `true` if the element can receive focus, otherwise `false`.\n */\n private canReceiveFocus(element: HTMLElement): boolean {\n if (element.tabIndex >= 0 && !element.hasAttribute('disabled')) {\n return true;\n }\n\n if (element instanceof HTMLAnchorElement && element.hasAttribute('href') && element.href) {\n return !!element.href;\n }\n\n const focusableTags = ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'];\n if (focusableTags.includes(element.tagName)) {\n return !(element as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLButtonElement).disabled;\n }\n\n return false;\n }\n\n /**\n * Returns the highest priority form error from the given error keys and field errors.\n * @param errorKeys - An array of error keys.\n * @param fieldErrors - An object containing field errors.\n * @returns The highest priority form error or null if no errors are found.\n */\n private getHighestPriorityError(\n errorKeys: string[] = [],\n fieldErrors: IAbstractFormBaseFieldError = {},\n ): IAbstractFormBaseHighPriorityFormError | null {\n if (errorKeys.length && Object.keys(fieldErrors).length) {\n const errors = errorKeys.map((errorType: string) => {\n return {\n ...fieldErrors[errorType],\n type: errorType,\n };\n });\n\n const sortedErrors = [...errors].sort((a, b) => a.priority - b.priority);\n\n return sortedErrors[0];\n }\n return null;\n }\n\n /**\n * Retrieves the details of the highest priority form error for a given control path.\n * @param controlPath - The path to the control in the form.\n * @returns The details of the highest priority form error, or null if there are no errors.\n */\n private getFieldErrorDetails(controlPath: (string | number)[]): IAbstractFormBaseHighPriorityFormError | null {\n // Get the control\n const control = this.form.get(controlPath);\n\n // If we have errors\n const controlErrors = control?.errors;\n\n if (controlErrors) {\n /// Get all the error keys\n // Use Array.prototype.at for clarity when accessing the last segment of the control path\n const controlKey = controlPath.at(-1);\n const errorKeys = Object.keys(controlErrors) || [];\n const fieldErrors = controlKey === undefined ? {} : this.fieldErrors[controlKey] || {};\n\n if (errorKeys.length && Object.keys(fieldErrors).length) {\n return this.getHighestPriorityError(errorKeys, fieldErrors);\n }\n }\n return null;\n }\n\n /**\n * Retrieves all form errors from the provided form and its nested form groups.\n *\n * @param form - The form group to retrieve errors from.\n * @param controlPath - An optional array representing the path to the current control within the form group.\n * @returns An array of form errors, each containing the field ID, error message, priority, and type.\n */\n private getFormErrors(form: FormGroup, controlPath: (string | number)[] = []): IAbstractFormBaseFormError[] {\n // recursively get all errors from all controls in the form including nested form group controls\n const formControls = form.controls;\n\n const errorSummary = Object.keys(formControls)\n .filter((controlName) => formControls[controlName].invalid)\n .flatMap((controlName) => {\n const control = formControls[controlName];\n\n if (control instanceof FormRecord) {\n // We only support FormControls in FormRecords\n const recordFieldErrorDetails = this.getFieldErrorDetails([...controlPath, controlName]);\n\n return {\n fieldId: controlName,\n message: recordFieldErrorDetails?.message ?? null,\n priority: recordFieldErrorDetails?.priority ?? 999999999,\n type: recordFieldErrorDetails?.type ?? null,\n };\n }\n\n if (control instanceof FormGroup) {\n return this.getFormErrors(control, [...controlPath, controlName]);\n }\n\n if (control instanceof FormArray) {\n return control.controls.flatMap((controlItem, index) => {\n // We only support FormGroups in FormArrays\n if (controlItem instanceof FormGroup) {\n return this.getFormErrors(controlItem, [...controlPath, controlName, index]);\n }\n return [];\n });\n }\n\n const getFieldErrorDetails = this.getFieldErrorDetails([...controlPath, controlName]);\n\n // Return the error summary entry\n // If we don't have the error details, return a null message\n return {\n fieldId: controlName,\n message: getFieldErrorDetails?.message ?? null,\n priority: getFieldErrorDetails?.priority ?? 999999999,\n type: getFieldErrorDetails?.type ?? null,\n };\n });\n\n // Remove any null errors\n return errorSummary.filter((item) => item?.message !== null);\n }\n\n /**\n * Sets the error messages for the form controls and error summary based on the provided form errors.\n * @param formErrors - An array of form errors containing field IDs and error messages.\n */\n private setErrorMessages(formErrors: IAbstractFormBaseFormError[]) {\n // Reset the form error messages\n this.formControlErrorMessages = {};\n this.formErrorSummaryMessage = [];\n\n // Set the form error messages based on the error summary entries\n for (const entry of formErrors) {\n this.formControlErrorMessages[entry.fieldId] = entry.message;\n this.formErrorSummaryMessage.push({ fieldId: entry.fieldId, message: entry.message });\n }\n }\n\n /**\n * Gets the indexes of the date fields to remove based on the form error summary message.\n * @returns An array of indexes representing the date fields to remove.\n */\n private getDateFieldsToRemoveIndexes(): number[] {\n const indexesToRemove: number[] = [];\n // The order of the field ids is important\n // this is the order in which we want to remove them\n const foundIndexes = this.getFormErrorSummaryIndex(\n ['dayOfMonth', 'monthOfYear', 'year'],\n this.formErrorSummaryMessage,\n );\n\n // Determine which indexes to remove based on the found fields\n switch (foundIndexes.length) {\n case 3:\n // All three date fields are present\n indexesToRemove.push(foundIndexes[1], foundIndexes[2]);\n break;\n case 2:\n // Two date fields are present\n indexesToRemove.push(foundIndexes[1]);\n break;\n }\n\n return indexesToRemove;\n }\n\n /**\n * Returns an array of indices corresponding to the positions of the given field IDs in the form error summary message array.\n *\n * @param fieldIds - An array of field IDs to search for in the form error summary message array.\n * @param formErrorSummaryMessage - An array of form error summary messages.\n * @returns An array of indices corresponding to the positions of the field IDs in the form error summary message array.\n */\n private getFormErrorSummaryIndex(\n fieldIds: string[],\n formErrorSummaryMessage: IAbstractFormBaseFormErrorSummaryMessage[],\n ): number[] {\n return fieldIds.reduce((acc: number[], field) => {\n const index = formErrorSummaryMessage.findIndex((error) => error.fieldId === field);\n if (index === -1) {\n return acc;\n }\n return [...acc, index];\n }, []);\n }\n\n /**\n * Removes error summary messages from the given array based on the specified indexes.\n *\n * @param formErrorSummaryMessage - The array of error summary messages.\n * @param indexes - The indexes of the error summary messages to be removed.\n * @returns The updated array of error summary messages.\n */\n private removeErrorSummaryMessages(\n formErrorSummaryMessage: IAbstractFormBaseFormErrorSummaryMessage[],\n indexes: number[],\n ): IAbstractFormBaseFormErrorSummaryMessage[] {\n return formErrorSummaryMessage.filter((_, index) => !indexes.includes(index));\n }\n\n /**\n * Splits the form errors into two arrays based on the provided field IDs.\n * Errors with field IDs included in the fieldIds array will be moved to the removedFormErrors array,\n * while the remaining errors will be moved to the cleanFormErrors array.\n *\n * @param fieldIds - An array of field IDs to filter the form errors.\n * @param formErrors - An array of form errors to be split.\n * @returns An array containing two arrays: cleanFormErrors and removedFormErrors.\n */\n private splitFormErrors(\n fieldIds: string[],\n formErrors: IAbstractFormBaseFormError[],\n ): IAbstractFormBaseFormError[][] {\n const cleanFormErrors: IAbstractFormBaseFormError[] = [];\n const removedFormErrors: IAbstractFormBaseFormError[] = [];\n\n for (const error of formErrors) {\n if (fieldIds.includes(error.fieldId)) {\n removedFormErrors.push(error);\n } else {\n cleanFormErrors.push(error);\n }\n }\n\n return [cleanFormErrors, removedFormErrors];\n }\n\n /**\n * Manipulates the error message for specific fields in the formErrors array.\n * @param fields - An array of field IDs to target for error message manipulation.\n * @param messageOverride - The new error message to be used for the targeted fields.\n * @param errorType - The type of error to match for the targeted fields.\n * @param formErrors - An array of IFormError objects representing the form errors.\n * @returns An array of IFormError objects with the manipulated error messages.\n */\n private manipulateFormErrorMessage(\n fields: string[],\n messageOverride: string,\n errorType: string,\n formErrors: IAbstractFormBaseFormError[],\n ): IAbstractFormBaseFormError[] {\n const manipulatedFields: IAbstractFormBaseFormError[] = [];\n for (const field of formErrors) {\n if (fields.includes(field.fieldId)) {\n if (field.type === errorType) {\n manipulatedFields.push({ ...field, message: messageOverride });\n } else {\n manipulatedFields.push(field);\n }\n continue;\n }\n manipulatedFields.push(field);\n }\n\n return manipulatedFields;\n }\n\n /**\n * Retrieves the form errors with the highest priority.\n *\n * @param formErrors - An array of form errors.\n * @returns An array of form errors with the highest priority.\n */\n private getHighPriorityFormErrors(formErrors: IAbstractFormBaseFormError[]): IAbstractFormBaseFormError[] {\n // Get the lowest priority (1 is the highest priority, 3 is the lowest priority)\n const lowestPriority = Math.min(...formErrors.map((item) => item.priority));\n return formErrors.filter((item) => item.priority === lowestPriority);\n }\n\n /**\n * Focuses on the error summary element and scrolls to the top of the page.\n *\n * This method first triggers change detection to ensure the view is up-to-date.\n * It then selects the error summary element with the class 'govuk-error-summary'.\n * If the error summary element is found, it sets focus on it without scrolling the page.\n * Finally, it calls a utility service to scroll to the top of the page.\n *\n * @private\n */\n private focusAndScrollToErrorSummary(): void {\n this.changeDetectorRef.detectChanges();\n\n const errorSummary = document.querySelector('.govuk-error-summary') as HTMLElement;\n if (errorSummary) {\n errorSummary.focus({ preventScroll: true });\n this.utilsService.scrollToTop();\n }\n }\n\n /**\n * Setup listener for the form value changes and to emit hasUnsavedChanges\n */\n private setupListener(): void {\n this.form.valueChanges.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.unsavedChanges.emit(this.hasUnsavedChanges());\n });\n }\n\n /**\n * Adds controls to a form group.\n *\n * @param formGroup - The form group to add controls to.\n * @param controls - An array of form array control validations.\n * @param index - The index of the form array control.\n */\n protected addControlsToFormGroup(\n formGroup: FormGroup,\n controls: IAbstractFormArrayControlValidation[],\n index: number,\n ): void {\n for (const { controlName, validators } of controls) {\n formGroup.addControl(`${controlName}_${index}`, new FormControl(null, validators));\n }\n }\n\n /**\n * Creates a form control with the specified validators and initial value.\n *\n * @param validators - An array of validator functions.\n * @param initialValue - The initial value for the form control. Defaults to null.\n * @returns The created form control.\n */\n protected createFormControl(validators: ValidatorFn[], initialValue: string | null = null): FormControl {\n return new FormControl(initialValue, { validators: [...validators] });\n }\n\n /**\n * Handles the error messages and populates the relevant variables\n */\n protected handleErrorMessages(): void {\n this.formErrors = this.getFormErrors(this.form);\n\n this.setErrorMessages(this.formErrors);\n\n this.formErrorSummaryMessage = this.removeErrorSummaryMessages(\n this.formErrorSummaryMessage,\n this.getDateFieldsToRemoveIndexes(),\n );\n }\n\n /**\n * Checks whether the form has been touched and submitted\n *\n * @returns boolean\n */\n protected hasUnsavedChanges(): boolean {\n return this.form.dirty && !this.formSubmitted;\n }\n\n /**\n * Sets the value of a form control specified by its path and marks it as touched.\n *\n * @param value - The value to set for the form control.\n * @param controlPath - The dot-delimited path to the form control within the form group.\n */\n protected setInputValue(value: string, controlPath: string): void {\n const control = this.form.get(controlPath);\n if (control) {\n control.patchValue(value);\n control.markAsTouched();\n }\n }\n\n /**\n * Handles the form errors for the date input fields.\n * @param formErrors - An array of form errors.\n * @returns An array of form errors with the manipulated error messages.\n */\n protected handleDateInputFormErrors() {\n const dateInputFields = ['dayOfMonth', 'monthOfYear', 'year'];\n const splitFormErrors = this.splitFormErrors(dateInputFields, this.formErrors);\n const highPriorityDateControlErrors = this.getHighPriorityFormErrors(splitFormErrors[1]);\n let manipulatedFormErrors: IAbstractFormBaseFormError[] = highPriorityDateControlErrors;\n\n // If we have more than one error then we want to manipulate the error message\n if (highPriorityDateControlErrors.length > 1) {\n manipulatedFormErrors = this.manipulateFormErrorMessage(\n dateInputFields,\n 'Please enter a DOB',\n 'required',\n manipulatedFormErrors,\n );\n }\n\n return [...splitFormErrors[0], ...manipulatedFormErrors];\n }\n\n /**\n * Sets the initial error messages for the form controls.\n *\n * @param form - The FormGroup instance.\n */\n protected setInitialErrorMessages(): void {\n const formControls = this.form.controls;\n const initialFormControlErrorMessages: IAbstractFormControlErrorMessage = {};\n\n for (const controlName of Object.keys(formControls)) {\n initialFormControlErrorMessages[controlName] = null;\n }\n\n this.formControlErrorMessages = initialFormControlErrorMessages;\n this.formErrorSummaryMessage = [];\n }\n\n /**\n * Repopulates the search form with the data from the account enquiry search.\n * @param state - The state object containing the search form data.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected rePopulateForm(state: any): void {\n this.form.patchValue(state);\n }\n\n /**\n * Adds a new form control to the form group.\n *\n * @param controlName - The name of the control to add.\n * @param validators - An array of validators to apply to the control.\n */\n protected createControl(controlName: string, validators: ValidatorFn[]): void {\n this.form.addControl(controlName, new FormControl(null, validators));\n }\n\n /**\n * Updates the validators of an existing form control.\n *\n * @param controlName - The name of the control to update.\n * @param validators - An array of validators to apply to the control.\n */\n protected updateControl(controlName: string, validators: ValidatorFn[]): void {\n const control = this.form.get(controlName);\n if (control) {\n control.setValidators(validators);\n control.updateValueAndValidity();\n } else {\n this.createControl(controlName, validators);\n }\n }\n\n /**\n * Removes a control from the form.\n *\n * @param controlName - The name of the control to remove.\n */\n protected removeControl(controlName: string): void {\n if (this.formControlErrorMessages[controlName]) {\n this.removeControlErrors(controlName);\n }\n this.form.removeControl(controlName);\n }\n\n /**\n * Removes the error message associated with the specified control name from the formControlErrorMessages object.\n *\n * @param controlName - The name of the control for which to remove the error message.\n */\n protected removeControlErrors(controlName: string): void {\n delete this.formControlErrorMessages[controlName];\n }\n\n /**\n * Clears all error messages from the form.\n */\n protected clearAllErrorMessages(): void {\n this.formControlErrorMessages = {};\n this.formErrorSummaryMessage = [];\n this.formErrors = [];\n this.form.updateValueAndValidity({ onlySelf: false, emitEvent: false });\n }\n\n /**\n * Create a plain object from a FormRecord of FormControls.\n *\n * What it does: copies each control's current value onto a plain object.\n * When to use: when you need the raw values from a FormRecord (e.g. to send to an API).\n *\n * Example\n * -------\n * // record: FormRecord<FormControl<string | null>> with a single control 'firstName'\n * const out = this.objectFromFormRecord(record, {\n * mapKey: k => k, // optional (defaults to identity)\n * mapValue: v => v ?? '' // turn null/undefined into ''\n * });\n * // out -> { firstName: '' }\n *\n * @typeParam T - Control value type.\n * @typeParam U - Output value type (defaults to T).\n * @typeParam K - Output key type (defaults to string). Control names are strings; provide `mapKey` if you need numbers.\n */\n protected objectFromFormRecord<T, U = T, K extends string | number = string>(\n controlRecord: FormRecord<FormControl<T | null | undefined>>,\n options?: {\n mapKey?: (key: string) => K;\n mapValue?: (value: T | null | undefined) => U;\n },\n ): Record<K, U> {\n const mapKey = options?.mapKey ?? ((k: string) => k as unknown as K);\n const mapValue = options?.mapValue ?? ((v: T | null | undefined) => v as unknown as U);\n\n const result = {} as Record<K, U>;\n\n for (const [name, control] of Object.entries(controlRecord.controls)) {\n result[mapKey(name)] = mapValue(control.value);\n }\n\n return result;\n }\n\n /**\n * Patch a FormRecord of FormControls from a plain object.\n *\n * What it does: for each entry in `values`, finds the matching control by name\n * (optionally mapped via `mapKey`) and sets its value **only if** it changes.\n * When to use: when you need to patch many controls at once, without\n * triggering extra updates for unchanged values.\n *\n * Example\n * -------\n * // controlRecord: FormRecord<FormControl<string>> with controls 'firstName', 'lastName'\n * this.patchFormRecordFromObject(controlRecord, { firstName: 'Ada', lastName: 'Lovelace' }, {\n * emitEvent: true,\n * isEqual: (a, b) => a === b,\n * // mapKey: k => `ctrl_${k as string}` // optional: map incoming keys to control names\n * });\n *\n * @typeParam T - Control value type.\n * @typeParam K - Keys present in the `values` object (string or number).\n */\n protected patchFormRecordFromObject<T, K extends string | number = string>(\n controlRecord: FormRecord<FormControl<T>>,\n values: Record<K, T>,\n options?: {\n emitEvent?: boolean;\n /** How provided keys map to control names (defaults to String(key)). */\n mapKey?: (key: K) => string;\n /** Equality check used to avoid unnecessary writes (defaults to Object.is). */\n isEqual?: (a: T, b: T) => boolean;\n },\n ): void {\n const emitEvent = options?.emitEvent ?? false;\n const mapKey = options?.mapKey ?? String;\n const isEqual = options?.isEqual ?? Object.is;\n\n for (const [k, v] of Object.entries(values) as [K, T][]) {\n const controlName = mapKey(k);\n const ctrl = controlRecord.get(controlName) as FormControl<T> | null;\n if (!ctrl) {\n // If the control isn't present, skip silently. Callers can validate separately.\n continue;\n }\n if (!isEqual(ctrl.value, v)) {\n ctrl.setValue(v, { emitEvent });\n }\n }\n }\n\n /**\n * Clears the search form.\n */\n public handleClearForm(): void {\n this.form.reset();\n }\n\n /**\n * Handles the scroll of the component error from the summary\n *\n * @param fieldId - Field id of the component\n */\n public scrollTo(fieldId: string): void {\n this['scroll'](fieldId);\n }\n\n /**\n * Handles route with the supplied route\n *\n * @param route string of route\n * @param nonRelative boolean indicating if route is relative to the parent\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public handleRoute(route: string, nonRelative: boolean = false, event?: Event, routeData?: any): void {\n if (event) {\n event.preventDefault();\n }\n\n this.unsavedChanges.emit(this.hasUnsavedChanges());\n\n const navigationExtras = {\n ...(nonRelative ? {} : { relativeTo: this.activatedRoute.parent }),\n ...(routeData === undefined ? {} : { state: routeData }),\n };\n\n this.router.navigate([route], navigationExtras);\n }\n\n /**\n * Handles the form submission event.\n *\n * @param event - The form submission event.\n * @returns void\n */\n public handleFormSubmit(event: SubmitEvent): void {\n this.handleErrorMessages();\n\n if (this.form.valid) {\n this.formSubmitted = true;\n const nestedFlow = event.submitter ? event.submitter.className.includes('nested-flow') : false;\n this.unsavedChanges.emit(this.hasUnsavedChanges());\n this.formSubmit.emit({ formData: this.form.value, nestedFlow: nestedFlow });\n } else {\n this.focusAndScrollToErrorSummary();\n }\n }\n\n /**\n * Handles the input event to convert all letters in the input value to uppercase.\n * This method is triggered by an input event and modifies the input value directly.\n *\n * @param event - The input event triggered by the user.\n */\n public handleUppercaseInputMask(event: Event): void {\n const input = event.target as HTMLInputElement;\n input.value = this.utilsService.upperCaseAllLetters(input.value);\n }\n\n public ngOnInit(): void {\n if (this.form) {\n this.setupListener();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAmBsB,yBAAyB,CAAA;AAC5B,IAAA,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC7C,I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AC,QAAQ,EAAE;IAC/B;wGAzsBoB,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAzB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,yBAAyB,iJAFnC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;4FAEQ,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAH9C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;sBAME;;sBAEA;;;AC1BH;;AAEG;;;;"}
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs
CHANGED
|
@@ -125,10 +125,10 @@ class AbstractNestedFormBaseComponent extends AbstractFormBaseComponent {
|
|
|
125
125
|
}
|
|
126
126
|
super.ngOnDestroy();
|
|
127
127
|
}
|
|
128
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
129
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
128
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractNestedFormBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
129
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: AbstractNestedFormBaseComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
130
130
|
}
|
|
131
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AbstractNestedFormBaseComponent, decorators: [{
|
|
132
132
|
type: Component,
|
|
133
133
|
args: [{
|
|
134
134
|
template: '',
|
package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-nested-form-base/abstract-nested-form-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-nested-form-base/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { AbstractControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { AbstractFormBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-base';\nimport { merge } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractNestedFormBaseComponent extends AbstractFormBaseComponent {\n /**\n * Installs all controls from a **detached** builder group into a target FormGroup (defaults to `this.form`).\n *\n * @param source A FormGroup created locally (its controls must not already belong to another parent).\n * @param target The FormGroup to install the controls into. Defaults to `this.form`.\n *\n * Notes:\n * - This method **moves** the control instances from `source` into `target` (no cloning).\n * - If a control already has a parent, Angular will throw when adding it to `target`.\n */\n protected addControlsToNestedFormGroup(source: FormGroup, target: FormGroup = this.form): void {\n for (const [name, ctrl] of Object.entries(source.controls)) {\n target.addControl(name, ctrl);\n }\n }\n\n /**\n * Removes controls from `target` whose names are present in `source` (defaults to `this.form`).\n *\n * @param source A FormGroup whose control names identify which controls to remove.\n * @param target The FormGroup to remove controls from. Defaults to `this.form`.\n *\n * Use this with the same builder group you used to add controls so you only remove what you added.\n */\n protected removeControlsFromNestedFormGroup(source: FormGroup, target: FormGroup = this.form): void {\n for (const name of Object.keys(source.controls)) {\n target.removeControl(name);\n }\n }\n\n /**\n * Adds or removes one or more validators on a control and updates validity without emitting events.\n *\n * @param control The control to modify. If null/undefined, the method no-ops and returns `false`.\n * @param validators A single `ValidatorFn` or an array of `ValidatorFn`s to add/remove.\n * @param present When `true`, validators are added; when `false`, the same validators are removed.\n * @returns The `present` flag (for convenient inline use in conditionals).\n */\n protected setValidatorPresence(\n control: AbstractControl | null,\n validators: ValidatorFn | ValidatorFn[],\n present: boolean,\n ): boolean {\n if (!control) return false;\n const list = Array.isArray(validators) ? validators : [validators];\n if (present) {\n control.addValidators(list);\n } else {\n control.removeValidators(list);\n }\n control.updateValueAndValidity({ emitEvent: false, onlySelf: true });\n return present;\n }\n\n /**\n * Truthy-value helper used by multiple sub-forms.\n *\n * Returns `false` for `null`/`undefined`. For strings, trims whitespace and checks for non-zero length.\n * For all other types, returns `true` (treat non-string values as present).\n */\n protected hasValue(v: unknown): boolean {\n if (v == null) return false;\n return typeof v === 'string' ? v.trim().length > 0 : true;\n }\n\n /**\n * Resets a list of controls and re-computes validity without emitting value-change events.\n *\n * For each control: clears errors, resets the value to `null`, and calls `updateValueAndValidity`.\n * This means built-in validators (e.g. `required`) will be re-applied after reset.\n */\n protected resetAndValidateControls(controls: (AbstractControl | null)[]): void {\n for (const c of controls) {\n if (!c) continue;\n c.setErrors(null);\n c.reset(null, { emitEvent: false });\n c.updateValueAndValidity({ emitEvent: false, onlySelf: true });\n }\n }\n\n /**\n * Resets a FormGroup’s value/state and re-computes validity without emitting value-change events.\n *\n * Performs: `group.reset(undefined)`, marks pristine/untouched, then `updateValueAndValidity`.\n */\n protected resetAndValidateFormGroup(group: FormGroup): void {\n group.reset(undefined, { emitEvent: false });\n group.markAsPristine();\n group.markAsUntouched();\n group.updateValueAndValidity({ emitEvent: false, onlySelf: true });\n }\n\n /**\n * Subscribes a handler to the `valueChanges` of multiple controls, with auto-unsubscribe on destroy.\n *\n * @param handler Function invoked whenever **any** provided control emits a value change.\n * @param controls One or more controls to observe; falsy entries are ignored.\n *\n * Implementation detail: merges the streams and unsubscribes via `takeUntil(this.ngUnsubscribe)`.\n */\n protected subscribeValidation(handler: () => void, ...controls: (AbstractControl | null)[]): void {\n const streams = controls.filter(Boolean).map((c) => c!.valueChanges);\n if (!streams.length) return;\n merge(...streams)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(handler);\n }\n\n /**\n * @inheritdoc\n *\n * Handles cleanup logic when the component is destroyed.\n *\n * - Clears local child error definitions and emits an empty map to the parent.\n * - Removes all controls added by this sub-form from the parent form, if nested.\n * - Calls the base class's `ngOnDestroy` for additional teardown.\n */\n public override ngOnDestroy(): void {\n // Remove controls this sub-form added to the parent (if nested)\n if (this.form?.parent) {\n for (const name of Object.keys(this.form.controls)) {\n this.form.removeControl(name);\n }\n }\n\n super.ngOnDestroy();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AASM,MAAgB,+BAAgC,SAAQ,yBAAyB,CAAA;AACrF;;;;;;;;;AASG;AACO,IAAA,4BAA4B,CAAC,MAAiB,EAAE,MAAA,GAAoB,IAAI,CAAC,IAAI,EAAA;AACrF,QAAA,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;AAC1D,YAAA,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC;QAC/B;IACF;AAEA;;;;;;;AAOG;AACO,IAAA,iCAAiC,CAAC,MAAiB,EAAE,MAAA,GAAoB,IAAI,CAAC,IAAI,EAAA;AAC1F,QAAA,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;AAC/C,YAAA,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;QAC5B;IACF;AAEA;;;;;;;AAOG;AACO,IAAA,oBAAoB,CAC5B,OAA+B,EAC/B,UAAuC,EACvC,OAAgB,EAAA;AAEhB,QAAA,IAAI,CAAC,OAAO;AAAE,YAAA,OAAO,KAAK;AAC1B,QAAA,MAAM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,IAAI,EAAE,CAAC;IACpE;AAEA;;;;;;;AAOG;AACO,IAAA,mBAAmB,CAAC,OAAmB,EAAE,GAAG,QAAoC,EAAA;QACxF,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAE,CAAC,YAAY,CAAC;QACpE,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE;QACrB,KAAK,CAAC,GAAG,OAAO;AACb,aAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;aAClC,SAAS,CAAC,OAAO,CAAC;IACvB;AAEA;;;;;;;;AAQG;IACa,WAAW,GAAA;;AAEzB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE;AACrB,YAAA,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;AAClD,gBAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/B;QACF;QAEA,KAAK,CAAC,WAAW,EAAE;IACrB;
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-nested-form-base/abstract-nested-form-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-nested-form-base/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { AbstractControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { AbstractFormBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-base';\nimport { merge } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractNestedFormBaseComponent extends AbstractFormBaseComponent {\n /**\n * Installs all controls from a **detached** builder group into a target FormGroup (defaults to `this.form`).\n *\n * @param source A FormGroup created locally (its controls must not already belong to another parent).\n * @param target The FormGroup to install the controls into. Defaults to `this.form`.\n *\n * Notes:\n * - This method **moves** the control instances from `source` into `target` (no cloning).\n * - If a control already has a parent, Angular will throw when adding it to `target`.\n */\n protected addControlsToNestedFormGroup(source: FormGroup, target: FormGroup = this.form): void {\n for (const [name, ctrl] of Object.entries(source.controls)) {\n target.addControl(name, ctrl);\n }\n }\n\n /**\n * Removes controls from `target` whose names are present in `source` (defaults to `this.form`).\n *\n * @param source A FormGroup whose control names identify which controls to remove.\n * @param target The FormGroup to remove controls from. Defaults to `this.form`.\n *\n * Use this with the same builder group you used to add controls so you only remove what you added.\n */\n protected removeControlsFromNestedFormGroup(source: FormGroup, target: FormGroup = this.form): void {\n for (const name of Object.keys(source.controls)) {\n target.removeControl(name);\n }\n }\n\n /**\n * Adds or removes one or more validators on a control and updates validity without emitting events.\n *\n * @param control The control to modify. If null/undefined, the method no-ops and returns `false`.\n * @param validators A single `ValidatorFn` or an array of `ValidatorFn`s to add/remove.\n * @param present When `true`, validators are added; when `false`, the same validators are removed.\n * @returns The `present` flag (for convenient inline use in conditionals).\n */\n protected setValidatorPresence(\n control: AbstractControl | null,\n validators: ValidatorFn | ValidatorFn[],\n present: boolean,\n ): boolean {\n if (!control) return false;\n const list = Array.isArray(validators) ? validators : [validators];\n if (present) {\n control.addValidators(list);\n } else {\n control.removeValidators(list);\n }\n control.updateValueAndValidity({ emitEvent: false, onlySelf: true });\n return present;\n }\n\n /**\n * Truthy-value helper used by multiple sub-forms.\n *\n * Returns `false` for `null`/`undefined`. For strings, trims whitespace and checks for non-zero length.\n * For all other types, returns `true` (treat non-string values as present).\n */\n protected hasValue(v: unknown): boolean {\n if (v == null) return false;\n return typeof v === 'string' ? v.trim().length > 0 : true;\n }\n\n /**\n * Resets a list of controls and re-computes validity without emitting value-change events.\n *\n * For each control: clears errors, resets the value to `null`, and calls `updateValueAndValidity`.\n * This means built-in validators (e.g. `required`) will be re-applied after reset.\n */\n protected resetAndValidateControls(controls: (AbstractControl | null)[]): void {\n for (const c of controls) {\n if (!c) continue;\n c.setErrors(null);\n c.reset(null, { emitEvent: false });\n c.updateValueAndValidity({ emitEvent: false, onlySelf: true });\n }\n }\n\n /**\n * Resets a FormGroup’s value/state and re-computes validity without emitting value-change events.\n *\n * Performs: `group.reset(undefined)`, marks pristine/untouched, then `updateValueAndValidity`.\n */\n protected resetAndValidateFormGroup(group: FormGroup): void {\n group.reset(undefined, { emitEvent: false });\n group.markAsPristine();\n group.markAsUntouched();\n group.updateValueAndValidity({ emitEvent: false, onlySelf: true });\n }\n\n /**\n * Subscribes a handler to the `valueChanges` of multiple controls, with auto-unsubscribe on destroy.\n *\n * @param handler Function invoked whenever **any** provided control emits a value change.\n * @param controls One or more controls to observe; falsy entries are ignored.\n *\n * Implementation detail: merges the streams and unsubscribes via `takeUntil(this.ngUnsubscribe)`.\n */\n protected subscribeValidation(handler: () => void, ...controls: (AbstractControl | null)[]): void {\n const streams = controls.filter(Boolean).map((c) => c!.valueChanges);\n if (!streams.length) return;\n merge(...streams)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(handler);\n }\n\n /**\n * @inheritdoc\n *\n * Handles cleanup logic when the component is destroyed.\n *\n * - Clears local child error definitions and emits an empty map to the parent.\n * - Removes all controls added by this sub-form from the parent form, if nested.\n * - Calls the base class's `ngOnDestroy` for additional teardown.\n */\n public override ngOnDestroy(): void {\n // Remove controls this sub-form added to the parent (if nested)\n if (this.form?.parent) {\n for (const name of Object.keys(this.form.controls)) {\n this.form.removeControl(name);\n }\n }\n\n super.ngOnDestroy();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AASM,MAAgB,+BAAgC,SAAQ,yBAAyB,CAAA;AACrF;;;;;;;;;AASG;AACO,IAAA,4BAA4B,CAAC,MAAiB,EAAE,MAAA,GAAoB,IAAI,CAAC,IAAI,EAAA;AACrF,QAAA,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CA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