@hmcts/opal-frontend-common 0.0.39 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/components/abstract/abstract-form-base/index.d.ts +51 -1
  2. package/fesm2022/hmcts-opal-frontend-common-access-denied.component-G2a2VrN1.mjs +21 -0
  3. package/fesm2022/hmcts-opal-frontend-common-access-denied.component-G2a2VrN1.mjs.map +1 -0
  4. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs +7 -7
  5. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-alias-base.mjs.map +1 -1
  6. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs +6 -6
  7. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-base.mjs.map +1 -1
  8. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-parent-base.mjs +4 -4
  9. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-parent-base.mjs.map +1 -1
  10. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs +6 -6
  11. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-array-removal-base.mjs.map +1 -1
  12. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs +102 -28
  13. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-base.mjs.map +1 -1
  14. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-parent-base.mjs +1 -1
  15. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-form-parent-base.mjs.map +1 -1
  16. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs +13 -11
  17. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-nested-form-base.mjs.map +1 -1
  18. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table-pagination.mjs +3 -3
  19. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs +5 -5
  20. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-sortable-table.mjs.map +1 -1
  21. package/fesm2022/hmcts-opal-frontend-common-components-abstract-abstract-table-filter.mjs +3 -3
  22. package/fesm2022/hmcts-opal-frontend-common-components-alphagov-alphagov-accessible-autocomplete.mjs +3 -3
  23. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item-custom-account-information-item-label.mjs +3 -3
  24. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item-custom-account-information-item-value.mjs +3 -3
  25. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information-custom-account-information-item.mjs +3 -3
  26. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-account-information.mjs +3 -3
  27. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-action-links.mjs +3 -3
  28. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-horizontal-scroll-pane.mjs +3 -3
  29. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-page-header.mjs +3 -3
  30. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-scrollable-panes-custom-scrollable-panes-inner-pane.mjs +3 -3
  31. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-scrollable-panes.mjs +3 -3
  32. 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
  33. 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
  34. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar-custom-summary-metric-bar-item.mjs +3 -3
  35. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-summary-metric-bar.mjs +3 -3
  36. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane-custom-vertical-scroll-pane-inner-pane.mjs +3 -3
  37. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane-custom-vertical-scroll-pane-outer-pane.mjs +3 -3
  38. package/fesm2022/hmcts-opal-frontend-common-components-custom-custom-vertical-scroll-pane.mjs +3 -3
  39. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-accordion.mjs +3 -3
  40. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-back-link.mjs +3 -3
  41. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-button.mjs +3 -3
  42. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-cancel-link.mjs +3 -3
  43. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-checkboxes.mjs +12 -12
  44. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-date-input.mjs +3 -3
  45. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-details.mjs +3 -3
  46. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-error-summary.mjs +3 -3
  47. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-footer.mjs +3 -3
  48. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-header.mjs +6 -6
  49. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-heading-with-caption.mjs +3 -3
  50. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-inset-text.mjs +3 -3
  51. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-list-govuk-list-link.mjs +3 -3
  52. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-list.mjs +3 -3
  53. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-notification-banner.mjs +3 -3
  54. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs +4 -4
  55. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-pagination.mjs.map +1 -1
  56. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-panel.mjs +3 -3
  57. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs +12 -12
  58. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-select.mjs +3 -3
  59. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-card-list.mjs +6 -6
  60. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-summary-list.mjs +12 -12
  61. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-table.mjs +12 -12
  62. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs-govuk-tabs-list-item.mjs +3 -3
  63. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs-govuk-tabs-panel.mjs +3 -3
  64. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tabs.mjs +3 -3
  65. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-tag.mjs +3 -3
  66. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-task-list.mjs +6 -6
  67. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-area.mjs +3 -3
  68. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs +5 -5
  69. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input-prefix-suffix.mjs.map +1 -1
  70. package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-text-input.mjs +3 -3
  71. package/fesm2022/hmcts-opal-frontend-common-components-hod-hod-loading-spinner.mjs +3 -3
  72. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-alert.mjs +25 -25
  73. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-alert.mjs.map +1 -1
  74. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-badge.mjs +3 -3
  75. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu-moj-button-menu-item.mjs +3 -3
  76. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-button-menu.mjs +3 -3
  77. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-date-picker.mjs +3 -3
  78. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-header.mjs +3 -3
  79. 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
  80. 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
  81. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-option.mjs +3 -3
  82. 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
  83. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel-moj-filter-panel-selected.mjs +3 -3
  84. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter-moj-filter-panel.mjs +3 -3
  85. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-filter.mjs +3 -3
  86. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-header.mjs +6 -6
  87. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-notification-badge.mjs +3 -3
  88. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-page-header.mjs +3 -3
  89. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs +3 -3
  90. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-primary-navigation.mjs +6 -6
  91. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs +21 -21
  92. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sortable-table.mjs.map +1 -1
  93. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-sub-navigation.mjs +6 -6
  94. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-ticket-panel.mjs +3 -3
  95. package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-timeline.mjs +6 -6
  96. package/fesm2022/hmcts-opal-frontend-common-directives-capitalisation.mjs +3 -3
  97. package/fesm2022/hmcts-opal-frontend-common-directives-govuk-button.mjs +3 -3
  98. package/fesm2022/hmcts-opal-frontend-common-guards-auth.mjs +1 -1
  99. package/fesm2022/hmcts-opal-frontend-common-guards-auth.mjs.map +1 -1
  100. package/fesm2022/hmcts-opal-frontend-common-interceptors-http-error.mjs +1 -1
  101. package/fesm2022/hmcts-opal-frontend-common-interceptors-http-error.mjs.map +1 -1
  102. package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-hiZGRfTW.mjs → hmcts-opal-frontend-common-pages-access-denied.component-G2a2VrN1.mjs} +4 -4
  103. package/fesm2022/{hmcts-opal-frontend-common-pages-access-denied.component-hiZGRfTW.mjs.map → hmcts-opal-frontend-common-pages-access-denied.component-G2a2VrN1.mjs.map} +1 -1
  104. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-DvotrIUM.mjs → hmcts-opal-frontend-common-pages-sign-in-stub.component-BWBYkTKY.mjs} +4 -4
  105. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in-stub.component-DvotrIUM.mjs.map → hmcts-opal-frontend-common-pages-sign-in-stub.component-BWBYkTKY.mjs.map} +1 -1
  106. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-Ck69JvR1.mjs → hmcts-opal-frontend-common-pages-sign-in.component-CpP-17NX.mjs} +4 -4
  107. package/fesm2022/{hmcts-opal-frontend-common-pages-sign-in.component-Ck69JvR1.mjs.map → hmcts-opal-frontend-common-pages-sign-in.component-CpP-17NX.mjs.map} +1 -1
  108. package/fesm2022/hmcts-opal-frontend-common-pages.mjs +2 -2
  109. package/fesm2022/hmcts-opal-frontend-common-pipes-date-format.mjs +3 -3
  110. package/fesm2022/hmcts-opal-frontend-common-pipes-days-ago.mjs +3 -3
  111. package/fesm2022/hmcts-opal-frontend-common-pipes-national-insurance.mjs +4 -4
  112. package/fesm2022/hmcts-opal-frontend-common-pipes-national-insurance.mjs.map +1 -1
  113. package/fesm2022/hmcts-opal-frontend-common-resolvers-title.mjs +3 -3
  114. package/fesm2022/hmcts-opal-frontend-common-services-app-initializer-service.mjs +3 -3
  115. package/fesm2022/hmcts-opal-frontend-common-services-app-insights-service.mjs +3 -3
  116. package/fesm2022/hmcts-opal-frontend-common-services-auth-service.mjs +3 -3
  117. package/fesm2022/hmcts-opal-frontend-common-services-date-service.mjs +3 -3
  118. package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs +3 -4
  119. package/fesm2022/hmcts-opal-frontend-common-services-launch-darkly-service.mjs.map +1 -1
  120. package/fesm2022/hmcts-opal-frontend-common-services-opal-user-service.mjs +3 -3
  121. package/fesm2022/hmcts-opal-frontend-common-services-permissions-service.mjs +3 -3
  122. package/fesm2022/hmcts-opal-frontend-common-services-session-service.mjs +3 -3
  123. package/fesm2022/hmcts-opal-frontend-common-services-sort-service.mjs +3 -3
  124. package/fesm2022/hmcts-opal-frontend-common-services-transfer-state-service.mjs +3 -3
  125. package/fesm2022/hmcts-opal-frontend-common-services-transformation-service.mjs +3 -3
  126. package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs +4 -4
  127. package/fesm2022/hmcts-opal-frontend-common-services-utils-service.mjs.map +1 -1
  128. package/fesm2022/hmcts-opal-frontend-common-sign-in-stub.component-BWBYkTKY.mjs +42 -0
  129. package/fesm2022/hmcts-opal-frontend-common-sign-in-stub.component-BWBYkTKY.mjs.map +1 -0
  130. package/fesm2022/hmcts-opal-frontend-common-sign-in.component-BsRXmHT1.mjs +28 -0
  131. package/fesm2022/hmcts-opal-frontend-common-sign-in.component-BsRXmHT1.mjs.map +1 -0
  132. package/fesm2022/hmcts-opal-frontend-common-validators-amount.mjs +1 -1
  133. package/fesm2022/hmcts-opal-frontend-common-validators-amount.mjs.map +1 -1
  134. package/fesm2022/hmcts-opal-frontend-common-validators-date-of-birth.mjs +1 -1
  135. package/fesm2022/hmcts-opal-frontend-common-validators-date-of-birth.mjs.map +1 -1
  136. package/fesm2022/hmcts-opal-frontend-common-validators-invalid-value.mjs +1 -1
  137. package/fesm2022/hmcts-opal-frontend-common-validators-invalid-value.mjs.map +1 -1
  138. package/fesm2022/hmcts-opal-frontend-common-validators-national-insurance-number.mjs +1 -1
  139. package/fesm2022/hmcts-opal-frontend-common-validators-national-insurance-number.mjs.map +1 -1
  140. package/fesm2022/hmcts-opal-frontend-common-validators-optional-valid-date.mjs +3 -3
  141. package/fesm2022/hmcts-opal-frontend-common-validators-optional-valid-date.mjs.map +1 -1
  142. package/fesm2022/hmcts-opal-frontend-common-validators-optional-valid-telephone.mjs +1 -1
  143. package/fesm2022/hmcts-opal-frontend-common-validators-optional-valid-telephone.mjs.map +1 -1
  144. package/fesm2022/hmcts-opal-frontend-common-validators-valid-value.mjs +1 -1
  145. package/fesm2022/hmcts-opal-frontend-common-validators-valid-value.mjs.map +1 -1
  146. package/fesm2022/hmcts-opal-frontend-common.mjs +65 -0
  147. package/fesm2022/hmcts-opal-frontend-common.mjs.map +1 -1
  148. package/index.d.ts +22 -1
  149. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
3
- import { FormGroup, ValidatorFn, FormControl } from '@angular/forms';
3
+ import { FormGroup, ValidatorFn, FormControl, FormRecord } from '@angular/forms';
4
4
  import { Subject } from 'rxjs';
5
5
  import { IAbstractFormControlErrorMessage, IAbstractFormBaseFormErrorSummaryMessage, IAbstractFormArrayControlValidation } from '@hmcts/opal-frontend-common/components/abstract/interfaces';
6
6
  import { UtilsService } from '@hmcts/opal-frontend-common/services/utils-service';
@@ -217,6 +217,56 @@ declare abstract class AbstractFormBaseComponent implements OnInit, OnDestroy {
217
217
  * Clears all error messages from the form.
218
218
  */
219
219
  protected clearAllErrorMessages(): void;
220
+ /**
221
+ * Create a plain object from a FormRecord of FormControls.
222
+ *
223
+ * What it does: copies each control's current value onto a plain object.
224
+ * When to use: when you need the raw values from a FormRecord (e.g. to send to an API).
225
+ *
226
+ * Example
227
+ * -------
228
+ * // record: FormRecord<FormControl<string | null>> with a single control 'firstName'
229
+ * const out = this.objectFromFormRecord(record, {
230
+ * mapKey: k => k, // optional (defaults to identity)
231
+ * mapValue: v => v ?? '' // turn null/undefined into ''
232
+ * });
233
+ * // out -> { firstName: '' }
234
+ *
235
+ * @typeParam T - Control value type.
236
+ * @typeParam U - Output value type (defaults to T).
237
+ * @typeParam K - Output key type (defaults to string). Control names are strings; provide `mapKey` if you need numbers.
238
+ */
239
+ protected objectFromFormRecord<T, U = T, K extends string | number = string>(controlRecord: FormRecord<FormControl<T | null | undefined>>, options?: {
240
+ mapKey?: (key: string) => K;
241
+ mapValue?: (value: T | null | undefined) => U;
242
+ }): Record<K, U>;
243
+ /**
244
+ * Patch a FormRecord of FormControls from a plain object.
245
+ *
246
+ * What it does: for each entry in `values`, finds the matching control by name
247
+ * (optionally mapped via `mapKey`) and sets its value **only if** it changes.
248
+ * When to use: when you need to patch many controls at once, without
249
+ * triggering extra updates for unchanged values.
250
+ *
251
+ * Example
252
+ * -------
253
+ * // controlRecord: FormRecord<FormControl<string>> with controls 'firstName', 'lastName'
254
+ * this.patchFormRecordFromObject(controlRecord, { firstName: 'Ada', lastName: 'Lovelace' }, {
255
+ * emitEvent: true,
256
+ * isEqual: (a, b) => a === b,
257
+ * // mapKey: k => `ctrl_${k as string}` // optional: map incoming keys to control names
258
+ * });
259
+ *
260
+ * @typeParam T - Control value type.
261
+ * @typeParam K - Keys present in the `values` object (string or number).
262
+ */
263
+ protected patchFormRecordFromObject<T, K extends string | number = string>(controlRecord: FormRecord<FormControl<T>>, values: Record<K, T>, options?: {
264
+ emitEvent?: boolean;
265
+ /** How provided keys map to control names (defaults to String(key)). */
266
+ mapKey?: (key: K) => string;
267
+ /** Equality check used to avoid unnecessary writes (defaults to Object.is). */
268
+ isEqual?: (a: T, b: T) => boolean;
269
+ }): void;
220
270
  /**
221
271
  * Clears the search form.
222
272
  */
@@ -0,0 +1,21 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { Router } from '@angular/router';
4
+ import { GovukButtonComponent } from '@hmcts/opal-frontend-common/components/govuk/govuk-button';
5
+
6
+ class AccessDeniedComponent {
7
+ router = inject(Router);
8
+ handleGoBackButtonClick() {
9
+ // For now, test page will act as our 'Dashboard' page
10
+ this.router.navigate(['/']);
11
+ }
12
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AccessDeniedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
13
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", 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
+ }
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AccessDeniedComponent, decorators: [{
16
+ type: Component,
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
+ }] });
19
+
20
+ export { AccessDeniedComponent };
21
+ //# sourceMappingURL=hmcts-opal-frontend-common-access-denied.component-G2a2VrN1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmcts-opal-frontend-common-access-denied.component-G2a2VrN1.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;uGANW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAArB,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;;2FAInB,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;;;;;"}
@@ -53,9 +53,9 @@ class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent {
53
53
  removeAllFormAliasControls(formArrayControls, formArrayName, fieldNames) {
54
54
  const control = this.form.get(formArrayName);
55
55
  // Clear the error messages...
56
- [...formArrayControls].forEach((_element, index) => {
56
+ for (const [index] of formArrayControls.entries()) {
57
57
  this.removeFormAliasControlsErrors(index, formArrayControls, fieldNames);
58
- });
58
+ }
59
59
  // Reset the form array controls...
60
60
  control.clear();
61
61
  // Return en empty array of form array controls...
@@ -105,9 +105,9 @@ class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent {
105
105
  removeFormAliasControlsErrors(index, formArrayControls, fieldNames) {
106
106
  const formArrayControl = formArrayControls[index];
107
107
  if (formArrayControl) {
108
- fieldNames.forEach((field) => {
108
+ for (const field of fieldNames) {
109
109
  delete this.formControlErrorMessages?.[formArrayControl[field].controlName];
110
- });
110
+ }
111
111
  }
112
112
  }
113
113
  /**
@@ -190,10 +190,10 @@ class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent {
190
190
  this['ngUnsubscribe'].complete();
191
191
  super.ngOnDestroy();
192
192
  }
193
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AbstractFormAliasBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
194
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: AbstractFormAliasBaseComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
193
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AbstractFormAliasBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
194
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: AbstractFormAliasBaseComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
195
195
  }
196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AbstractFormAliasBaseComponent, decorators: [{
196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AbstractFormAliasBaseComponent, decorators: [{
197
197
  type: Component,
198
198
  args: [{
199
199
  template: '',
@@ -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 } 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';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy {\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 [...formArrayControls].forEach((_element, index) => {\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 fieldNames.forEach((field) => {\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 this.aliasControls = shouldAddAlias\n ? this.buildFormAliasControls([0], formArrayName, this.aliasFields, this.aliasControlsValidation)\n : this.removeAllFormAliasControls(this.aliasControls, formArrayName, this.aliasFields);\n });\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 *\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 }\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":";;;;;;AAcM,MAAgB,8BAA+B,SAAQ,yBAAyB,CAAA;IAC7E,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,EACr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AAI,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;uGA1PoB,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;;;ACbD;;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 } 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';\n\n@Component({\n template: '',\n})\nexport abstract class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy {\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 this.aliasControls = shouldAddAlias\n ? this.buildFormAliasControls([0], formArrayName, this.aliasFields, this.aliasControlsValidation)\n : this.removeAllFormAliasControls(this.aliasControls, formArrayName, this.aliasFields);\n });\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 *\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 }\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":";;;;;;AAcM,MAAgB,8BAA+B,SAAQ,yBAAyB,CAAA;IAC7E,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,Q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,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;;;ACbD;;AAEG;;;;"}
@@ -89,9 +89,9 @@ class AbstractFormArrayBaseComponent extends AbstractFormBaseComponent {
89
89
  removeFormArrayControlsErrors(index, formArrayControls, fieldNames) {
90
90
  const formArrayControl = formArrayControls[index];
91
91
  if (formArrayControl) {
92
- fieldNames.forEach((field) => {
92
+ for (const field of fieldNames) {
93
93
  delete this.formControlErrorMessages?.[formArrayControl[field].controlName];
94
- });
94
+ }
95
95
  }
96
96
  }
97
97
  /**
@@ -151,7 +151,7 @@ class AbstractFormArrayBaseComponent extends AbstractFormBaseComponent {
151
151
  * @param formArrayName - The name of the form array.
152
152
  */
153
153
  removeFormArrayControlFromArray(formArrayControl, formArrayName) {
154
- const formArrayControlIndex = this.formArrayControls.findIndex((control) => control === formArrayControl);
154
+ const formArrayControlIndex = this.formArrayControls.indexOf(formArrayControl);
155
155
  this.removeFormArrayControls(formArrayControlIndex, formArrayName, this.formArrayControls, this.formArrayFields);
156
156
  }
157
157
  /**
@@ -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.1", ngImport: i0, type: AbstractFormArrayBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
238
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: AbstractFormArrayBaseComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
237
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AbstractFormArrayBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
238
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", 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.1", ngImport: i0, type: AbstractFormArrayBaseComponent, decorators: [{
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AbstractFormArrayBaseComponent, decorators: [{
241
241
  type: Component,
242
242
  args: [{
243
243
  template: '',
@@ -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 fieldNames.forEach((field) => {\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.findIndex((control) => control === 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,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A,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,EAA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A8B,EAAA,UAAA,EAAA,CAAA;kBAHnD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -15,12 +15,12 @@ class AbstractFormArrayParentBaseComponent extends AbstractFormParentBaseCompone
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  return data.reduce((result, indexedObject) => {
17
17
  let currentIndex;
18
- Object.keys(indexedObject).forEach((key) => {
19
- const match = RegExp(/^(.*)_(\d+)$/).exec(key);
18
+ for (const key of Object.keys(indexedObject)) {
19
+ const match = new RegExp(/^(.*)_(\d+)$/).exec(key);
20
20
  if (match) {
21
21
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
22
  const [_, baseKey, index] = match;
23
- const idx = parseInt(index, 10);
23
+ const idx = Number.parseInt(index, 10);
24
24
  currentIndex = idx; // Set the current index based on the last indexed key
25
25
  result[idx] = result[idx] ?? {};
26
26
  result[idx][baseKey] = indexedObject[key];
@@ -30,7 +30,7 @@ class AbstractFormArrayParentBaseComponent extends AbstractFormParentBaseCompone
30
30
  result[currentIndex] = result[currentIndex] ?? {};
31
31
  result[currentIndex][key] = indexedObject[key];
32
32
  }
33
- });
33
+ }
34
34
  return result;
35
35
  }, []);
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-array-parent-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-array-parent-base/abstract-form-array-parent-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-array-parent-base/hmcts-opal-frontend-common-components-abstract-abstract-form-array-parent-base.ts"],"sourcesContent":["import { AbstractFormParentBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-parent-base';\n\nexport abstract class AbstractFormArrayParentBaseComponent extends AbstractFormParentBaseComponent {\n /**\n * Removes index suffixes from keys in an array of objects and restructures the data.\n *\n * This function takes an array of objects where keys have an index suffix (e.g., `key_0`, `key_1`),\n * and returns a new array of objects where the keys are grouped by their base name without the index.\n *\n * @param data - The array of objects with indexed keys.\n * @returns A new array of objects with keys grouped by their base name.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public removeIndexFromFormArrayData(data: any[]): any[] {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return data.reduce((result: any[], indexedObject) => {\n let currentIndex!: number;\n Object.keys(indexedObject).forEach((key) => {\n const match = RegExp(/^(.*)_(\\d+)$/).exec(key);\n if (match) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, baseKey, index] = match;\n const idx = parseInt(index, 10);\n\n currentIndex = idx; // Set the current index based on the last indexed key\n\n result[idx] = result[idx] ?? {};\n result[idx][baseKey] = indexedObject[key];\n } else {\n // For non-indexed keys, use the currentIndex if available\n result[currentIndex] = result[currentIndex] ?? {};\n result[currentIndex][key] = indexedObject[key];\n }\n });\n return result;\n }, []);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEM,MAAgB,oCAAqC,SAAQ,+BAA+B,CAAA;AAChG;;;;;;;;AAQG;;AAEI,IAAA,4BAA4B,CAAC,IAAW,EAAA;;QAE7C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,MAAa,EAAE,aAAa,KAAI;AAClD,YAAA,IAAI,YAAqB;YACzB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;gBACzC,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBAC9C,IAAI,KAAK,EAAE;;oBAET,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,KAAK;oBACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;AAE/B,oBAAA,YAAY,GAAG,GAAG,CAAC;oBAEnB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;oBAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;gBAC3C;qBAAO;;oBAEL,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE;oBACjD,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;gBAChD;AACF,YAAA,CAAC,CAAC;AACF,YAAA,OAAO,MAAM;QACf,CAAC,EAAE,EAAE,CAAC;IACR;AACD;;ACrCD;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-components-abstract-abstract-form-array-parent-base.mjs","sources":["../../../projects/opal-frontend-common/components/abstract/abstract-form-array-parent-base/abstract-form-array-parent-base.component.ts","../../../projects/opal-frontend-common/components/abstract/abstract-form-array-parent-base/hmcts-opal-frontend-common-components-abstract-abstract-form-array-parent-base.ts"],"sourcesContent":["import { AbstractFormParentBaseComponent } from '@hmcts/opal-frontend-common/components/abstract/abstract-form-parent-base';\n\nexport abstract class AbstractFormArrayParentBaseComponent extends AbstractFormParentBaseComponent {\n /**\n * Removes index suffixes from keys in an array of objects and restructures the data.\n *\n * This function takes an array of objects where keys have an index suffix (e.g., `key_0`, `key_1`),\n * and returns a new array of objects where the keys are grouped by their base name without the index.\n *\n * @param data - The array of objects with indexed keys.\n * @returns A new array of objects with keys grouped by their base name.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public removeIndexFromFormArrayData(data: any[]): any[] {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return data.reduce((result: any[], indexedObject) => {\n let currentIndex!: number;\n for (const key of Object.keys(indexedObject)) {\n const match = new RegExp(/^(.*)_(\\d+)$/).exec(key);\n if (match) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, baseKey, index] = match;\n const idx = Number.parseInt(index, 10);\n\n currentIndex = idx; // Set the current index based on the last indexed key\n\n result[idx] = result[idx] ?? {};\n result[idx][baseKey] = indexedObject[key];\n } else {\n // For non-indexed keys, use the currentIndex if available\n result[currentIndex] = result[currentIndex] ?? {};\n result[currentIndex][key] = indexedObject[key];\n }\n }\n return result;\n }, []);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEM,MAAgB,oCAAqC,SAAQ,+BAA+B,CAAA;AAChG;;;;;;;;AAQG;;AAEI,IAAA,4BAA4B,CAAC,IAAW,EAAA;;QAE7C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,MAAa,EAAE,aAAa,KAAI;AAClD,YAAA,IAAI,YAAqB;YACzB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;AAC5C,gBAAA,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBAClD,IAAI,KAAK,EAAE;;oBAET,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,KAAK;oBACjC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;AAEtC,oBAAA,YAAY,GAAG,GAAG,CAAC;oBAEnB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;oBAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;gBAC3C;qBAAO;;oBAEL,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE;oBACjD,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;gBAChD;YACF;AACA,YAAA,OAAO,MAAM;QACf,CAAC,EAAE,EAAE,CAAC;IACR;AACD;;ACrCD;;AAEG;;;;"}
@@ -7,7 +7,7 @@ class AbstractFormArrayRemovalComponent {
7
7
  activatedRoute = inject(ActivatedRoute);
8
8
  getFormArrayControlValue(formArray, controlName, rowIndex, defaultValue) {
9
9
  const value = formArray.controls[rowIndex]?.get(controlName)?.value;
10
- if (typeof value === 'string' && !isNaN(Number(value))) {
10
+ if (typeof value === 'string' && !Number.isNaN(Number(value))) {
11
11
  return Number(value);
12
12
  }
13
13
  return value ?? defaultValue;
@@ -47,7 +47,7 @@ class AbstractFormArrayRemovalComponent {
47
47
  * @param dynamicFieldPrefix - The prefix to use for dynamic field keys.
48
48
  */
49
49
  updateControlKeys(formGroup, index, fieldNames, dynamicFieldPrefix) {
50
- fieldNames.forEach((field) => {
50
+ for (const field of fieldNames) {
51
51
  const currentKey = `${dynamicFieldPrefix}_${field}_${index + 1}`;
52
52
  const newKey = `${dynamicFieldPrefix}_${field}_${index}`;
53
53
  // Retrieve the current control, if it exists
@@ -58,7 +58,7 @@ class AbstractFormArrayRemovalComponent {
58
58
  // Add the control with the updated key
59
59
  formGroup.addControl(newKey, control);
60
60
  }
61
- });
61
+ }
62
62
  }
63
63
  /**
64
64
  * Handles route with the supplied route
@@ -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.1", ngImport: i0, type: AbstractFormArrayRemovalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
81
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: AbstractFormArrayRemovalComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
80
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AbstractFormArrayRemovalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
81
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: AbstractFormArrayRemovalComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
82
82
  }
83
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: AbstractFormArrayRemovalComponent, decorators: [{
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", 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' && !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 fieldNames.forEach((field) => {\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,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;AACtD,YAAA,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB;QAEA,OAAO,KAAK,IAAI,YAAY;IAC9B;AAEA;;;;;;;AAOG;AACO,IAAA,wBAAwB,CAChC,SAAoB,EACpB,WAAmB,EACnB,UAAoB,EACpB,kBAA0B,EAAA;AAE1B,QAAA,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC/B,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,CAAC;IAC/E;AAEA;;;;;;;;AAQG;AACO,IAAA,gBAAgB,CACxB,SAAoB,EACpB,UAAkB,EAClB,UAAoB,EACpB,kBAA0B,EAAA;QAE1B,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;AACvD,QAAA,KAAK,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE;AACrD,YAAA,IAAI,CAAC,iBAAiB,CAAC,SAAsB,EAAE,KAAK,GAAG,UAAU,EAAE,UAAU,EAAE,kBAAkB,CAAC;QACpG;IACF;AAEA;;;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,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAEQ,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAHtD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;;;ACPD;;AAEG;;;;"}
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,MA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