@hmcts/opal-frontend-common 0.0.57 → 0.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs +122 -19
- package/fesm2022/hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs.map +1 -1
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs +5 -2
- package/fesm2022/hmcts-opal-frontend-common-components-moj-moj-pagination.mjs.map +1 -1
- package/package.json +1 -1
- package/types/hmcts-opal-frontend-common-components-govuk-govuk-radio.d.ts +53 -5
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Input, ChangeDetectionStrategy, Component, HostBinding, inject, ElementRef, afterNextRender } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/common';
|
|
3
4
|
import { CommonModule } from '@angular/common';
|
|
4
5
|
import * as i1 from '@angular/forms';
|
|
5
6
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
6
7
|
|
|
7
8
|
class GovukRadiosConditionalComponent {
|
|
9
|
+
/**
|
|
10
|
+
* Id used by aria-controls to connect a radio input to this conditional panel.
|
|
11
|
+
*/
|
|
8
12
|
conditionalId;
|
|
9
|
-
class = 'govuk-radios__conditional';
|
|
10
|
-
id;
|
|
11
|
-
ngOnInit() {
|
|
12
|
-
this.id = `${this.conditionalId}-conditional`;
|
|
13
|
-
}
|
|
14
13
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GovukRadiosConditionalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: GovukRadiosConditionalComponent, isStandalone: true, selector: "opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]", inputs: { conditionalId: "conditionalId" },
|
|
14
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: GovukRadiosConditionalComponent, isStandalone: true, selector: "opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]", inputs: { conditionalId: "conditionalId" }, ngImport: i0, template: "<div class=\"govuk-radios__conditional govuk-radios__conditional--hidden\" [id]=\"conditionalId\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{display:block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
16
15
|
}
|
|
17
16
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GovukRadiosConditionalComponent, decorators: [{
|
|
18
17
|
type: Component,
|
|
19
|
-
args: [{ selector: 'opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>\n" }]
|
|
18
|
+
args: [{ selector: 'opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"govuk-radios__conditional govuk-radios__conditional--hidden\" [id]=\"conditionalId\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
20
19
|
}], propDecorators: { conditionalId: [{
|
|
21
20
|
type: Input,
|
|
22
21
|
args: [{ required: true }]
|
|
23
|
-
}], class: [{
|
|
24
|
-
type: HostBinding,
|
|
25
|
-
args: ['class']
|
|
26
|
-
}], id: [{
|
|
27
|
-
type: HostBinding,
|
|
28
|
-
args: ['id']
|
|
29
22
|
}] } });
|
|
30
23
|
|
|
31
24
|
class GovukRadiosDividerComponent {
|
|
@@ -47,20 +40,71 @@ class GovukRadiosItemComponent {
|
|
|
47
40
|
inputValue;
|
|
48
41
|
inputValueHint;
|
|
49
42
|
ariaControls;
|
|
43
|
+
/**
|
|
44
|
+
* Assigns the FormControl used to bind the radio input.
|
|
45
|
+
* @param abstractControl - Control instance from the parent form group.
|
|
46
|
+
* @remarks Casts to FormControl for template binding.
|
|
47
|
+
*/
|
|
50
48
|
set control(abstractControl) {
|
|
51
49
|
// Form controls are passed in as abstract controls, we need to re-cast it.
|
|
52
50
|
this._control = abstractControl;
|
|
53
51
|
}
|
|
54
52
|
class = 'govuk-radios__item';
|
|
53
|
+
/**
|
|
54
|
+
* Exposes the bound FormControl to the template.
|
|
55
|
+
*/
|
|
55
56
|
get getControl() {
|
|
56
57
|
return this._control;
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Normalizes the input name for safe binding.
|
|
61
|
+
* @returns Trimmed input name or empty string.
|
|
62
|
+
*/
|
|
63
|
+
get resolvedInputName() {
|
|
64
|
+
return this.inputName?.trim() ?? '';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Ensures the radio input id is prefixed with the input name when needed.
|
|
68
|
+
* @returns Normalized id used by the input and label.
|
|
69
|
+
*/
|
|
70
|
+
get resolvedInputId() {
|
|
71
|
+
const baseId = this.inputId?.trim() ?? '';
|
|
72
|
+
const inputName = this.resolvedInputName;
|
|
73
|
+
const prefix = inputName ? `${inputName}-` : '';
|
|
74
|
+
if (!baseId || !prefix || baseId === inputName || baseId.startsWith(prefix)) {
|
|
75
|
+
return baseId;
|
|
76
|
+
}
|
|
77
|
+
return `${prefix}${baseId}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Normalizes aria-controls to avoid empty attributes.
|
|
81
|
+
* @returns Trimmed value or null when not provided.
|
|
82
|
+
*/
|
|
83
|
+
get dataAriaControls() {
|
|
84
|
+
const controls = this.ariaControls?.trim();
|
|
85
|
+
return controls || null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Exposes the radio value for Angular's RadioControlValueAccessor.
|
|
89
|
+
* IMPORTANT: keep the original type (e.g. boolean) so Reactive Forms emits the correct value.
|
|
90
|
+
*/
|
|
91
|
+
get resolvedInputValue() {
|
|
92
|
+
return this.inputValue;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Normalizes the radio value to a string for the HTML attribute binding.
|
|
96
|
+
* @returns String value for the input's `value` attribute.
|
|
97
|
+
*/
|
|
98
|
+
get resolvedInputValueAttr() {
|
|
99
|
+
const v = this.inputValue;
|
|
100
|
+
return typeof v === 'string' ? v : String(v);
|
|
101
|
+
}
|
|
58
102
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GovukRadiosItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: GovukRadiosItemComponent, isStandalone: true, selector: "opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]", inputs: { labelText: "labelText", labelClasses: "labelClasses", inputId: "inputId", inputName: "inputName", inputClasses: "inputClasses", inputValue: "inputValue", inputValueHint: "inputValueHint", ariaControls: "ariaControls", control: "control" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: "<input\n class=\"govuk-radios__input {{ inputClasses }}\"\n [id]=\"
|
|
103
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: GovukRadiosItemComponent, isStandalone: true, selector: "opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]", inputs: { labelText: "labelText", labelClasses: "labelClasses", inputId: "inputId", inputName: "inputName", inputClasses: "inputClasses", inputValue: "inputValue", inputValueHint: "inputValueHint", ariaControls: "ariaControls", control: "control" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: "<input\n class=\"govuk-radios__input {{ inputClasses }}\"\n [id]=\"resolvedInputId\"\n [name]=\"resolvedInputName\"\n [attr.name]=\"resolvedInputName\"\n [formControl]=\"getControl\"\n type=\"radio\"\n [value]=\"resolvedInputValue\"\n [attr.value]=\"resolvedInputValueAttr\"\n [attr.aria-controls]=\"dataAriaControls || null\"\n [attr.aria-describedby]=\"inputValueHint ? resolvedInputId + '-item-hint' : null\"\n/>\n<label class=\"govuk-label govuk-radios__label {{ labelClasses }}\" [for]=\"resolvedInputId\"> {{ labelText }} </label>\n@if (inputValueHint) {\n <div id=\"{{ resolvedInputId }}-item-hint\" class=\"govuk-hint govuk-radios__hint\">\n {{ inputValueHint }}\n </div>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
60
104
|
}
|
|
61
105
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GovukRadiosItemComponent, decorators: [{
|
|
62
106
|
type: Component,
|
|
63
|
-
args: [{ selector: 'opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]', imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n class=\"govuk-radios__input {{ inputClasses }}\"\n [id]=\"
|
|
107
|
+
args: [{ selector: 'opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]', imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n class=\"govuk-radios__input {{ inputClasses }}\"\n [id]=\"resolvedInputId\"\n [name]=\"resolvedInputName\"\n [attr.name]=\"resolvedInputName\"\n [formControl]=\"getControl\"\n type=\"radio\"\n [value]=\"resolvedInputValue\"\n [attr.value]=\"resolvedInputValueAttr\"\n [attr.aria-controls]=\"dataAriaControls || null\"\n [attr.aria-describedby]=\"inputValueHint ? resolvedInputId + '-item-hint' : null\"\n/>\n<label class=\"govuk-label govuk-radios__label {{ labelClasses }}\" [for]=\"resolvedInputId\"> {{ labelText }} </label>\n@if (inputValueHint) {\n <div id=\"{{ resolvedInputId }}-item-hint\" class=\"govuk-hint govuk-radios__hint\">\n {{ inputValueHint }}\n </div>\n}\n" }]
|
|
64
108
|
}], propDecorators: { labelText: [{
|
|
65
109
|
type: Input,
|
|
66
110
|
args: [{ required: true }]
|
|
@@ -94,12 +138,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
94
138
|
}] } });
|
|
95
139
|
|
|
96
140
|
class GovukRadioComponent {
|
|
141
|
+
elementRef = inject((ElementRef));
|
|
97
142
|
fieldSetId;
|
|
98
143
|
legendText;
|
|
99
144
|
legendHint;
|
|
100
145
|
legendClasses;
|
|
101
146
|
radioClasses;
|
|
102
147
|
errors;
|
|
148
|
+
/**
|
|
149
|
+
* Builds the aria-describedby value for the fieldset based on hint/error ids.
|
|
150
|
+
* @returns Space-separated id list or null when there is nothing to describe.
|
|
151
|
+
*/
|
|
103
152
|
get describedBy() {
|
|
104
153
|
const ids = [];
|
|
105
154
|
if (this.legendHint) {
|
|
@@ -110,13 +159,67 @@ class GovukRadioComponent {
|
|
|
110
159
|
}
|
|
111
160
|
return ids.length ? ids.join(' ') : null;
|
|
112
161
|
}
|
|
162
|
+
constructor() {
|
|
163
|
+
afterNextRender(() => {
|
|
164
|
+
// Only trigger the render of the component in the browser
|
|
165
|
+
this.initOuterRadios();
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Initializes govuk-frontend radios behavior for this component's radio group.
|
|
170
|
+
* Side effects: dynamically imports govuk-frontend, mutates dataset, logs warnings on fallback.
|
|
171
|
+
*/
|
|
172
|
+
initOuterRadios() {
|
|
173
|
+
const host = this.elementRef.nativeElement;
|
|
174
|
+
const rootRadios = host.querySelector('.govuk-radios');
|
|
175
|
+
if (!rootRadios)
|
|
176
|
+
return;
|
|
177
|
+
if (rootRadios.dataset['opalGovukRadiosInitialised'] === 'true')
|
|
178
|
+
return;
|
|
179
|
+
rootRadios.dataset['opalGovukRadiosInitialised'] = 'true';
|
|
180
|
+
this.loadGovukFrontend()
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
|
+
.then((module) => {
|
|
183
|
+
// Prefer Radios constructor for a scoped init
|
|
184
|
+
const Radios = module.Radios ?? module.radios ?? module.default?.Radios;
|
|
185
|
+
if (typeof Radios === 'function') {
|
|
186
|
+
try {
|
|
187
|
+
// scoped init for just this root
|
|
188
|
+
// eslint-disable-next-line no-new
|
|
189
|
+
new Radios(rootRadios);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
console.warn('Govuk Radios constructor failed for rootRadios, falling back to initAll', e);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Fallback: prefer module.initAll({ scope }) when available
|
|
197
|
+
const initAll = module.initAll ?? module.default?.initAll;
|
|
198
|
+
if (typeof initAll === 'function') {
|
|
199
|
+
initAll({ scope: rootRadios });
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
console.warn('govuk-frontend radios init not found for rootRadios', module);
|
|
203
|
+
})
|
|
204
|
+
.catch((err) => {
|
|
205
|
+
console.error('Failed to import govuk-frontend for rootRadios init', err);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Loads the govuk-frontend module.
|
|
210
|
+
* Wrapped for testability so unit tests can stub the dynamic import.
|
|
211
|
+
*/
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
213
|
+
loadGovukFrontend() {
|
|
214
|
+
return import('govuk-frontend');
|
|
215
|
+
}
|
|
113
216
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GovukRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
114
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: GovukRadioComponent, isStandalone: true, selector: "opal-lib-govuk-radio", inputs: { fieldSetId: "fieldSetId", legendText: "legendText", legendHint: "legendHint", legendClasses: "legendClasses", radioClasses: "radioClasses", errors: "errors" }, ngImport: i0, template: "<div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <fieldset class=\"govuk-fieldset\" [id]=\"fieldSetId\" [attr.aria-describedby]=\"describedBy\">\n @if (legendText) {\n <legend class=\"govuk-fieldset__legend {{ legendClasses }}\">\n {{ legendText }}\n </legend>\n }\n @if (legendHint) {\n <div [id]=\"fieldSetId ? fieldSetId + '-hint' : ''\" class=\"govuk-hint\">\n {{ legendHint }}\n </div>\n }\n\n @if (errors) {\n <p id=\"{{ this.fieldSetId }}-error-message\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n <div class=\"govuk-radios {{ radioClasses }}\" data-module=\"govuk-radios\">\n
|
|
217
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: GovukRadioComponent, isStandalone: true, selector: "opal-lib-govuk-radio", inputs: { fieldSetId: "fieldSetId", legendText: "legendText", legendHint: "legendHint", legendClasses: "legendClasses", radioClasses: "radioClasses", errors: "errors" }, ngImport: i0, template: "<div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <fieldset class=\"govuk-fieldset\" [id]=\"fieldSetId\" [attr.aria-describedby]=\"describedBy\">\n @if (legendText) {\n <legend class=\"govuk-fieldset__legend {{ legendClasses }}\">\n {{ legendText }}\n </legend>\n }\n @if (legendHint) {\n <div [id]=\"fieldSetId ? fieldSetId + '-hint' : ''\" class=\"govuk-hint\">\n {{ legendHint }}\n </div>\n }\n\n @if (errors) {\n <p id=\"{{ this.fieldSetId }}-error-message\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n\n <!-- single reusable radios template -->\n <ng-template #radiosGroup>\n <div class=\"govuk-radios {{ radioClasses }}\" data-module=\"govuk-radios\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n\n <!-- render the radiosGroup inside the fieldset -->\n <ng-container *ngTemplateOutlet=\"radiosGroup\"></ng-container>\n </fieldset>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
115
218
|
}
|
|
116
219
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: GovukRadioComponent, decorators: [{
|
|
117
220
|
type: Component,
|
|
118
|
-
args: [{ selector: 'opal-lib-govuk-radio', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <fieldset class=\"govuk-fieldset\" [id]=\"fieldSetId\" [attr.aria-describedby]=\"describedBy\">\n @if (legendText) {\n <legend class=\"govuk-fieldset__legend {{ legendClasses }}\">\n {{ legendText }}\n </legend>\n }\n @if (legendHint) {\n <div [id]=\"fieldSetId ? fieldSetId + '-hint' : ''\" class=\"govuk-hint\">\n {{ legendHint }}\n </div>\n }\n\n @if (errors) {\n <p id=\"{{ this.fieldSetId }}-error-message\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n <div class=\"govuk-radios {{ radioClasses }}\" data-module=\"govuk-radios\">\n
|
|
119
|
-
}], propDecorators: { fieldSetId: [{
|
|
221
|
+
args: [{ selector: 'opal-lib-govuk-radio', imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <fieldset class=\"govuk-fieldset\" [id]=\"fieldSetId\" [attr.aria-describedby]=\"describedBy\">\n @if (legendText) {\n <legend class=\"govuk-fieldset__legend {{ legendClasses }}\">\n {{ legendText }}\n </legend>\n }\n @if (legendHint) {\n <div [id]=\"fieldSetId ? fieldSetId + '-hint' : ''\" class=\"govuk-hint\">\n {{ legendHint }}\n </div>\n }\n\n @if (errors) {\n <p id=\"{{ this.fieldSetId }}-error-message\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n\n <!-- single reusable radios template -->\n <ng-template #radiosGroup>\n <div class=\"govuk-radios {{ radioClasses }}\" data-module=\"govuk-radios\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n\n <!-- render the radiosGroup inside the fieldset -->\n <ng-container *ngTemplateOutlet=\"radiosGroup\"></ng-container>\n </fieldset>\n</div>\n" }]
|
|
222
|
+
}], ctorParameters: () => [], propDecorators: { fieldSetId: [{
|
|
120
223
|
type: Input,
|
|
121
224
|
args: [{ required: true }]
|
|
122
225
|
}], legendText: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs","sources":["../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-conditional/govuk-radios-conditional.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-conditional/govuk-radios-conditional.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-divider/govuk-radios-divider.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-divider/govuk-radios-divider.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-item/govuk-radios-item.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-item/govuk-radios-item.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radio.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radio.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/hmcts-opal-frontend-common-components-govuk-govuk-radio.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, HostBinding, Input, OnInit } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]',\n imports: [],\n templateUrl: './govuk-radios-conditional.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadiosConditionalComponent implements OnInit {\n @Input({ required: true }) conditionalId!: string;\n\n @HostBinding('class') class = 'govuk-radios__conditional';\n @HostBinding('id') id!: string;\n\n ngOnInit() {\n this.id = `${this.conditionalId}-conditional`;\n }\n}\n","<ng-content></ng-content>\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-govuk-radios-divider',\n imports: [],\n templateUrl: './govuk-radios-divider.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadiosDividerComponent {}\n","<div class=\"govuk-radios__divider\"><ng-content></ng-content></div>\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';\nimport { FormControl, AbstractControl, ReactiveFormsModule } from '@angular/forms';\n\n@Component({\n selector: 'opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]',\n imports: [CommonModule, ReactiveFormsModule],\n templateUrl: './govuk-radios-item.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadiosItemComponent {\n private _control!: FormControl;\n\n @Input({ required: true }) labelText!: string;\n @Input({ required: false }) labelClasses!: string;\n @Input({ required: true }) inputId!: string;\n @Input({ required: true }) inputName!: string;\n @Input({ required: false }) inputClasses!: string;\n @Input({ required: true }) inputValue!: string | boolean;\n @Input({ required: false }) inputValueHint!: string;\n @Input({ required: false }) ariaControls!: string;\n\n @Input({ required: true }) set control(abstractControl: AbstractControl | null) {\n // Form controls are passed in as abstract controls, we need to re-cast it.\n this._control = abstractControl as FormControl;\n }\n\n @HostBinding('class') class = 'govuk-radios__item';\n\n get getControl() {\n return this._control;\n }\n}\n","<input\n class=\"govuk-radios__input {{ inputClasses }}\"\n [id]=\"inputId\"\n [name]=\"inputName\"\n [formControl]=\"getControl\"\n type=\"radio\"\n [value]=\"inputValue\"\n [attr.data-aria-controls]=\"ariaControls\"\n [attr.aria-describedby]=\"inputValueHint ? inputId + '-item-hint' : null\"\n/>\n<label class=\"govuk-label govuk-radios__label {{ labelClasses }}\" [for]=\"inputId\"> {{ labelText }} </label>\n@if (inputValueHint) {\n <div id=\"{{ inputId }}-item-hint\" class=\"govuk-hint govuk-radios__hint\">\n {{ inputValueHint }}\n </div>\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-govuk-radio',\n imports: [],\n templateUrl: './govuk-radio.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadioComponent {\n @Input({ required: true }) fieldSetId!: string;\n\n @Input({ required: false }) legendText!: string;\n @Input({ required: false }) legendHint!: string;\n @Input({ required: false }) legendClasses!: string;\n @Input({ required: false }) radioClasses!: string;\n @Input({ required: false }) errors!: string | null;\n\n get describedBy(): string | null {\n const ids: string[] = [];\n\n if (this.legendHint) {\n ids.push(`${this.fieldSetId}-hint`);\n }\n\n if (this.errors) {\n ids.push(`${this.fieldSetId}-error-message`);\n }\n\n return ids.length ? ids.join(' ') : null;\n }\n}\n","<div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <fieldset class=\"govuk-fieldset\" [id]=\"fieldSetId\" [attr.aria-describedby]=\"describedBy\">\n @if (legendText) {\n <legend class=\"govuk-fieldset__legend {{ legendClasses }}\">\n {{ legendText }}\n </legend>\n }\n @if (legendHint) {\n <div [id]=\"fieldSetId ? fieldSetId + '-hint' : ''\" class=\"govuk-hint\">\n {{ legendHint }}\n </div>\n }\n\n @if (errors) {\n <p id=\"{{ this.fieldSetId }}-error-message\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n <div class=\"govuk-radios {{ radioClasses }}\" data-module=\"govuk-radios\">\n <ng-content></ng-content>\n </div>\n </fieldset>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAQa,+BAA+B,CAAA;AACf,IAAA,aAAa;IAElB,KAAK,GAAG,2BAA2B;AACtC,IAAA,EAAE;IAErB,QAAQ,GAAA;QACN,IAAI,CAAC,EAAE,GAAG,CAAA,EAAG,IAAI,CAAC,aAAa,cAAc;IAC/C;wGARW,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA/B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,+BAA+B,gPCR5C,6BACA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDOa,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAN3C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,wEAAwE,EAAA,OAAA,EACzE,EAAE,EAAA,eAAA,EAEM,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,6BAAA,EAAA;;sBAG9C,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAExB,WAAW;uBAAC,OAAO;;sBACnB,WAAW;uBAAC,IAAI;;;MEJN,2BAA2B,CAAA;wGAA3B,2BAA2B,EAAA,I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,SAAA,EAAA,IAAA,EAAA,mBAAmB,0PCRhC,0zBAuBA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDfa,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAN/B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,OAAA,EACvB,EAAE,EAAA,eAAA,EAEM,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,0zBAAA,EAAA;;sBAG9C,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAExB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;;AEf5B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-govuk-govuk-radio.mjs","sources":["../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-conditional/govuk-radios-conditional.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-conditional/govuk-radios-conditional.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-divider/govuk-radios-divider.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-divider/govuk-radios-divider.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-item/govuk-radios-item.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radios-item/govuk-radios-item.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radio.component.ts","../../../projects/opal-frontend-common/components/govuk/govuk-radio/govuk-radio.component.html","../../../projects/opal-frontend-common/components/govuk/govuk-radio/hmcts-opal-frontend-common-components-govuk-govuk-radio.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]',\n imports: [],\n templateUrl: './govuk-radios-conditional.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n styleUrls: ['./govuk-radios-conditional.component.scss'],\n})\nexport class GovukRadiosConditionalComponent {\n /**\n * Id used by aria-controls to connect a radio input to this conditional panel.\n */\n @Input({ required: true }) conditionalId!: string;\n}\n","<div class=\"govuk-radios__conditional govuk-radios__conditional--hidden\" [id]=\"conditionalId\">\n <ng-content></ng-content>\n</div>\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-govuk-radios-divider',\n imports: [],\n templateUrl: './govuk-radios-divider.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadiosDividerComponent {}\n","<div class=\"govuk-radios__divider\"><ng-content></ng-content></div>\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';\nimport { FormControl, AbstractControl, ReactiveFormsModule } from '@angular/forms';\n\n@Component({\n selector: 'opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]',\n imports: [CommonModule, ReactiveFormsModule],\n templateUrl: './govuk-radios-item.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadiosItemComponent {\n private _control!: FormControl;\n\n @Input({ required: true }) labelText!: string;\n @Input({ required: false }) labelClasses!: string;\n @Input({ required: true }) inputId!: string;\n @Input({ required: true }) inputName!: string;\n @Input({ required: false }) inputClasses!: string;\n @Input({ required: true }) inputValue!: string | boolean;\n @Input({ required: false }) inputValueHint!: string;\n @Input({ required: false }) ariaControls!: string;\n\n /**\n * Assigns the FormControl used to bind the radio input.\n * @param abstractControl - Control instance from the parent form group.\n * @remarks Casts to FormControl for template binding.\n */\n @Input({ required: true }) set control(abstractControl: AbstractControl | null) {\n // Form controls are passed in as abstract controls, we need to re-cast it.\n this._control = abstractControl as FormControl;\n }\n\n @HostBinding('class') class = 'govuk-radios__item';\n\n /**\n * Exposes the bound FormControl to the template.\n */\n get getControl() {\n return this._control;\n }\n\n /**\n * Normalizes the input name for safe binding.\n * @returns Trimmed input name or empty string.\n */\n get resolvedInputName(): string {\n return this.inputName?.trim() ?? '';\n }\n\n /**\n * Ensures the radio input id is prefixed with the input name when needed.\n * @returns Normalized id used by the input and label.\n */\n get resolvedInputId(): string {\n const baseId = this.inputId?.trim() ?? '';\n const inputName = this.resolvedInputName;\n const prefix = inputName ? `${inputName}-` : '';\n\n if (!baseId || !prefix || baseId === inputName || baseId.startsWith(prefix)) {\n return baseId;\n }\n\n return `${prefix}${baseId}`;\n }\n\n /**\n * Normalizes aria-controls to avoid empty attributes.\n * @returns Trimmed value or null when not provided.\n */\n get dataAriaControls(): string | null {\n const controls = this.ariaControls?.trim();\n return controls || null;\n }\n\n /**\n * Exposes the radio value for Angular's RadioControlValueAccessor.\n * IMPORTANT: keep the original type (e.g. boolean) so Reactive Forms emits the correct value.\n */\n get resolvedInputValue(): string | boolean {\n return this.inputValue;\n }\n\n /**\n * Normalizes the radio value to a string for the HTML attribute binding.\n * @returns String value for the input's `value` attribute.\n */\n get resolvedInputValueAttr(): string {\n const v = this.inputValue;\n return typeof v === 'string' ? v : String(v);\n }\n}\n","<input\n class=\"govuk-radios__input {{ inputClasses }}\"\n [id]=\"resolvedInputId\"\n [name]=\"resolvedInputName\"\n [attr.name]=\"resolvedInputName\"\n [formControl]=\"getControl\"\n type=\"radio\"\n [value]=\"resolvedInputValue\"\n [attr.value]=\"resolvedInputValueAttr\"\n [attr.aria-controls]=\"dataAriaControls || null\"\n [attr.aria-describedby]=\"inputValueHint ? resolvedInputId + '-item-hint' : null\"\n/>\n<label class=\"govuk-label govuk-radios__label {{ labelClasses }}\" [for]=\"resolvedInputId\"> {{ labelText }} </label>\n@if (inputValueHint) {\n <div id=\"{{ resolvedInputId }}-item-hint\" class=\"govuk-hint govuk-radios__hint\">\n {{ inputValueHint }}\n </div>\n}\n","import { afterNextRender, ChangeDetectionStrategy, Component, ElementRef, inject, Input } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\n@Component({\n selector: 'opal-lib-govuk-radio',\n imports: [CommonModule, ReactiveFormsModule],\n templateUrl: './govuk-radio.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class GovukRadioComponent {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n @Input({ required: true }) fieldSetId!: string;\n @Input({ required: false }) legendText!: string;\n @Input({ required: false }) legendHint!: string;\n @Input({ required: false }) legendClasses!: string;\n @Input({ required: false }) radioClasses!: string;\n @Input({ required: false }) errors!: string | null;\n\n /**\n * Builds the aria-describedby value for the fieldset based on hint/error ids.\n * @returns Space-separated id list or null when there is nothing to describe.\n */\n get describedBy(): string | null {\n const ids: string[] = [];\n\n if (this.legendHint) {\n ids.push(`${this.fieldSetId}-hint`);\n }\n\n if (this.errors) {\n ids.push(`${this.fieldSetId}-error-message`);\n }\n\n return ids.length ? ids.join(' ') : null;\n }\n\n constructor() {\n afterNextRender(() => {\n // Only trigger the render of the component in the browser\n this.initOuterRadios();\n });\n }\n\n /**\n * Initializes govuk-frontend radios behavior for this component's radio group.\n * Side effects: dynamically imports govuk-frontend, mutates dataset, logs warnings on fallback.\n */\n private initOuterRadios(): void {\n const host = this.elementRef.nativeElement;\n const rootRadios = host.querySelector('.govuk-radios') as HTMLElement | null;\n if (!rootRadios) return;\n\n if (rootRadios.dataset['opalGovukRadiosInitialised'] === 'true') return;\n rootRadios.dataset['opalGovukRadiosInitialised'] = 'true';\n\n this.loadGovukFrontend()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .then((module: any) => {\n // Prefer Radios constructor for a scoped init\n const Radios = module.Radios ?? module.radios ?? module.default?.Radios;\n if (typeof Radios === 'function') {\n try {\n // scoped init for just this root\n // eslint-disable-next-line no-new\n new Radios(rootRadios);\n return;\n } catch (e) {\n console.warn('Govuk Radios constructor failed for rootRadios, falling back to initAll', e);\n }\n }\n\n // Fallback: prefer module.initAll({ scope }) when available\n const initAll = module.initAll ?? module.default?.initAll;\n if (typeof initAll === 'function') {\n initAll({ scope: rootRadios });\n return;\n }\n\n console.warn('govuk-frontend radios init not found for rootRadios', module);\n })\n .catch((err) => {\n console.error('Failed to import govuk-frontend for rootRadios init', err);\n });\n }\n\n /**\n * Loads the govuk-frontend module.\n * Wrapped for testability so unit tests can stub the dynamic import.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected loadGovukFrontend(): Promise<any> {\n return import('govuk-frontend');\n }\n}\n","<div class=\"govuk-form-group\" [class.govuk-form-group--error]=\"!!errors\">\n <fieldset class=\"govuk-fieldset\" [id]=\"fieldSetId\" [attr.aria-describedby]=\"describedBy\">\n @if (legendText) {\n <legend class=\"govuk-fieldset__legend {{ legendClasses }}\">\n {{ legendText }}\n </legend>\n }\n @if (legendHint) {\n <div [id]=\"fieldSetId ? fieldSetId + '-hint' : ''\" class=\"govuk-hint\">\n {{ legendHint }}\n </div>\n }\n\n @if (errors) {\n <p id=\"{{ this.fieldSetId }}-error-message\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error: </span> {{ errors }}\n </p>\n }\n\n <!-- single reusable radios template -->\n <ng-template #radiosGroup>\n <div class=\"govuk-radios {{ radioClasses }}\" data-module=\"govuk-radios\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n\n <!-- render the radiosGroup inside the fieldset -->\n <ng-container *ngTemplateOutlet=\"radiosGroup\"></ng-container>\n </fieldset>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MASa,+BAA+B,CAAA;AAC1C;;AAEG;AACwB,IAAA,aAAa;wGAJ7B,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAA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,CAAC,MAAM,EAAA,QAAA,EAAA,oiCAAA,EAAA;;sBAK9C,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;sBACzB,KAAK;uBAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;;;AElB5B;;AAEG;;;;"}
|
|
@@ -123,6 +123,9 @@ class MojPaginationComponent {
|
|
|
123
123
|
if (event) {
|
|
124
124
|
event.preventDefault();
|
|
125
125
|
}
|
|
126
|
+
if (page === this.currentPage) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
126
129
|
this.changePage.emit(page);
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
@@ -133,11 +136,11 @@ class MojPaginationComponent {
|
|
|
133
136
|
this.calculatePages();
|
|
134
137
|
}
|
|
135
138
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: MojPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
136
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: MojPaginationComponent, isStandalone: true, selector: "opal-lib-moj-pagination", inputs: { id: "id", currentPage: "currentPage", total: "total", limit: "limit" }, outputs: { changePage: "changePage" }, usesOnChanges: true, ngImport: i0, template: "@if (totalPages > 1) {\n
|
|
139
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: MojPaginationComponent, isStandalone: true, selector: "opal-lib-moj-pagination", inputs: { id: "id", currentPage: "currentPage", total: "total", limit: "limit" }, outputs: { changePage: "changePage" }, usesOnChanges: true, ngImport: i0, template: "@if (total > 0 && limit > 0) {\n <div class=\"moj-pagination\">\n @if (totalPages > 1) {\n <nav class=\"govuk-pagination moj-pagination__pagination\" aria-label=\"Pagination\" [id]=\"id\">\n @if (currentPage > 1) {\n <div class=\"govuk-pagination__prev\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n rel=\"prev\"\n (click)=\"onPageChanged($event, currentPage - 1)\"\n >\n <svg\n class=\"govuk-pagination__icon govuk-pagination__icon--prev\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"13\"\n width=\"15\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 15 13\"\n >\n <path\n d=\"m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z\"\n ></path>\n </svg>\n <span class=\"govuk-pagination__link-title\">Previous<span class=\"govuk-visually-hidden\"> page</span></span>\n </a>\n </div>\n }\n\n <ul class=\"govuk-pagination__list\">\n @for (elipsedPage of elipsedPages(); track elipsedPage) {\n @if (elipsedPage === ELIPSIS) {\n <li class=\"govuk-pagination__item govuk-pagination__item--ellipses\">⋯</li>\n } @else {\n <li class=\"govuk-pagination__item\" [class.govuk-pagination__item--current]=\"elipsedPage === currentPage\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n (click)=\"onPageChanged($event, +elipsedPage)\"\n [attr.aria-label]=\"'Page ' + elipsedPage\"\n [attr.aria-current]=\"elipsedPage === currentPage ? 'page' : null\"\n >\n {{ elipsedPage }}\n </a>\n </li>\n }\n }\n </ul>\n\n @if (currentPage < totalPages) {\n <div class=\"govuk-pagination__next\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n rel=\"next\"\n (click)=\"onPageChanged($event, currentPage + 1)\"\n >\n <span class=\"govuk-pagination__link-title\">Next<span class=\"govuk-visually-hidden\"> page</span></span>\n <svg\n class=\"govuk-pagination__icon govuk-pagination__icon--next\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"13\"\n width=\"15\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 15 13\"\n >\n <path\n d=\"m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z\"\n ></path>\n </svg>\n </a>\n </div>\n }\n </nav>\n }\n <p class=\"moj-pagination__results\">Showing {{ pageStart }} to {{ pageEnd }} of {{ total }} total results</p>\n </div>\n}\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
137
140
|
}
|
|
138
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: MojPaginationComponent, decorators: [{
|
|
139
142
|
type: Component,
|
|
140
|
-
args: [{ selector: 'opal-lib-moj-pagination', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (totalPages > 1) {\n
|
|
143
|
+
args: [{ selector: 'opal-lib-moj-pagination', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (total > 0 && limit > 0) {\n <div class=\"moj-pagination\">\n @if (totalPages > 1) {\n <nav class=\"govuk-pagination moj-pagination__pagination\" aria-label=\"Pagination\" [id]=\"id\">\n @if (currentPage > 1) {\n <div class=\"govuk-pagination__prev\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n rel=\"prev\"\n (click)=\"onPageChanged($event, currentPage - 1)\"\n >\n <svg\n class=\"govuk-pagination__icon govuk-pagination__icon--prev\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"13\"\n width=\"15\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 15 13\"\n >\n <path\n d=\"m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z\"\n ></path>\n </svg>\n <span class=\"govuk-pagination__link-title\">Previous<span class=\"govuk-visually-hidden\"> page</span></span>\n </a>\n </div>\n }\n\n <ul class=\"govuk-pagination__list\">\n @for (elipsedPage of elipsedPages(); track elipsedPage) {\n @if (elipsedPage === ELIPSIS) {\n <li class=\"govuk-pagination__item govuk-pagination__item--ellipses\">⋯</li>\n } @else {\n <li class=\"govuk-pagination__item\" [class.govuk-pagination__item--current]=\"elipsedPage === currentPage\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n (click)=\"onPageChanged($event, +elipsedPage)\"\n [attr.aria-label]=\"'Page ' + elipsedPage\"\n [attr.aria-current]=\"elipsedPage === currentPage ? 'page' : null\"\n >\n {{ elipsedPage }}\n </a>\n </li>\n }\n }\n </ul>\n\n @if (currentPage < totalPages) {\n <div class=\"govuk-pagination__next\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n rel=\"next\"\n (click)=\"onPageChanged($event, currentPage + 1)\"\n >\n <span class=\"govuk-pagination__link-title\">Next<span class=\"govuk-visually-hidden\"> page</span></span>\n <svg\n class=\"govuk-pagination__icon govuk-pagination__icon--next\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"13\"\n width=\"15\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 15 13\"\n >\n <path\n d=\"m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z\"\n ></path>\n </svg>\n </a>\n </div>\n }\n </nav>\n }\n <p class=\"moj-pagination__results\">Showing {{ pageStart }} to {{ pageEnd }} of {{ total }} total results</p>\n </div>\n}\n" }]
|
|
141
144
|
}], propDecorators: { id: [{
|
|
142
145
|
type: Input,
|
|
143
146
|
args: [{ required: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmcts-opal-frontend-common-components-moj-moj-pagination.mjs","sources":["../../../projects/opal-frontend-common/components/moj/moj-pagination/moj-pagination.component.ts","../../../projects/opal-frontend-common/components/moj/moj-pagination/moj-pagination.component.html","../../../projects/opal-frontend-common/components/moj/moj-pagination/hmcts-opal-frontend-common-components-moj-moj-pagination.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, signal } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-moj-pagination',\n templateUrl: './moj-pagination.component.html',\n styleUrl: './moj-pagination.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MojPaginationComponent implements OnChanges {\n private readonly pages = signal<number[]>([]);\n\n @Input({ required: true }) id!: string;\n @Input({ required: true }) currentPage: number = 1;\n @Input({ required: true }) total: number = 0;\n @Input({ required: true }) limit: number = 25;\n @Output() changePage = new EventEmitter<number>();\n\n public readonly elipsedPages = signal<(number | string)[]>([]);\n public readonly ELIPSIS = '…';\n\n /**\n * Gets the total number of pages available.\n *\n * @returns The total count of pages as a number.\n */\n get totalPages(): number {\n return this.pages().length;\n }\n\n /**\n * Gets the starting item index for the current page in a paginated list.\n *\n * @returns {number} The index of the first item on the current page, or 0 if there are no items.\n *\n * If `total` is 0, returns 0. Otherwise, calculates the starting index based on the current page and the limit per page.\n */\n get pageStart(): number {\n return this.total === 0 ? 0 : (this.currentPage - 1) * this.limit + 1;\n }\n\n /**\n * Gets the index of the last item on the current page.\n *\n * @returns {number} The index of the last item displayed on the current page.\n * Returns 0 if there are no items (`total` is 0). Otherwise, returns the lesser of\n * `currentPage * limit` and `total`, ensuring the end index does not exceed the total number of items.\n */\n get pageEnd(): number {\n return this.total === 0 ? 0 : Math.min(this.currentPage * this.limit, this.total);\n }\n\n /**\n * Calculates and updates the pagination pages and elided (skipped) pages based on the current limit and total items.\n *\n * - If either `limit` or `total` is less than or equal to zero, clears the pages and elided pages.\n * - Otherwise, computes the total number of pages, updates the `pages` observable with the full range,\n * and updates the `elipsedPages` observable with the result of skipping pages for ellipsis display.\n *\n * @private\n */\n private calculatePages() {\n if (this.limit <= 0 || this.total <= 0) {\n this.pages.set([]);\n this.elipsedPages.set([]);\n return;\n }\n const pagesCount = Math.ceil(this.total / this.limit);\n this.pages.set(this.range(1, pagesCount + 1));\n this.elipsedPages.set(this.elipseSkippedPages(this.pages(), this.currentPage));\n }\n\n /**\n * Generates an array of numbers starting from `start` up to, but not including, `end`.\n *\n * @param start - The starting number of the range (inclusive).\n * @param end - The ending number of the range (exclusive).\n * @returns An array of numbers from `start` to `end - 1`.\n */\n private range(start: number, end: number): number[] {\n const result: number[] = [];\n for (let i = start; i < end; i++) {\n result.push(i);\n }\n return result;\n }\n /**\n * Generates a pagination array with ellipses (\"...\") to represent skipped page ranges.\n *\n * The resulting array always includes the first and last page numbers, the current page,\n * and up to one page before and after the current page. Ellipses are inserted where\n * there are skipped ranges between the displayed pages.\n *\n * @param pages - An array of page numbers representing all available pages.\n * @param currentPage - The currently active page number.\n * @returns An array containing page numbers and ellipsis strings (\"...\") to indicate skipped pages.\n */\n private elipseSkippedPages(pages: number[], currentPage: number): (number | string)[] {\n const totalPages = pages.length;\n const first = 1;\n const last = totalPages;\n\n const result: (number | string)[] = [];\n\n // Always show the first page\n result.push(first);\n\n // Determine left-side ellipsis\n if (currentPage > first + 2) {\n result.push(this.ELIPSIS);\n }\n\n // Middle pages: current - 1, current, current + 1\n for (let i = currentPage - 1; i <= currentPage + 1; i++) {\n if (i > first && i < last) {\n result.push(i);\n }\n }\n\n // Decide whether to add right-side ellipsis\n const lastIncluded = result.includes(last);\n const secondLast = last - 1;\n if (!result.includes(secondLast) && !lastIncluded) {\n result.push(this.ELIPSIS);\n }\n\n // Add last page if not already included\n if (!lastIncluded && last !== first) {\n result.push(last);\n }\n\n return result;\n }\n\n /**\n * Handles the page change event for the pagination component.\n *\n * Prevents the default action of the event (if provided) and emits the selected page number.\n *\n * @param event - The event triggered by the page change action. If provided, its default behavior will be prevented.\n * @param page - The page number to navigate to.\n */\n public onPageChanged(event: Event, page: number): void {\n if (event) {\n event.preventDefault();\n }\n this.changePage.emit(page);\n }\n\n /**\n * Lifecycle hook that is called when any data-bound property of the component changes.\n * Invokes the `calculatePages` method to update the pagination state based on the new input values.\n */\n public ngOnChanges(): void {\n this.calculatePages();\n }\n}\n","@if (totalPages > 1) {\n <nav class=\"moj-pagination moj-pagination-alignment\" aria-label=\"Pagination navigation\" [id]=\"id\">\n <ul class=\"moj-pagination__list\">\n @if (currentPage > 1) {\n <li class=\"moj-pagination__item moj-pagination__item--prev\">\n <a\n class=\"moj-pagination__link\"\n (click)=\"onPageChanged($event, currentPage - 1)\"\n (keydown.enter)=\"onPageChanged($event, currentPage - 1)\"\n tabindex=\"0\"\n >Previous<span class=\"govuk-visually-hidden\"> page</span></a\n >\n </li>\n }\n\n @for (elipsedPage of elipsedPages(); track elipsedPage) {\n @switch (elipsedPage) {\n @case (currentPage) {\n <li\n class=\"moj-pagination__item moj-pagination__item--active\"\n [attr.aria-label]=\"'Page ' + elipsedPage + ' of ' + totalPages\"\n aria-current=\"page\"\n >\n {{ elipsedPage }}\n </li>\n }\n @case (ELIPSIS) {\n <li class=\"moj-pagination__item moj-pagination__item--dots\">{{ ELIPSIS }}</li>\n }\n @default {\n <li class=\"moj-pagination__item\">\n <a\n class=\"moj-pagination__link\"\n (click)=\"onPageChanged($event, +elipsedPage)\"\n (keydown.enter)=\"onPageChanged($event, +elipsedPage)\"\n tabindex=\"0\"\n [attr.aria-label]=\"'Page ' + elipsedPage + ' of ' + totalPages\"\n >\n {{ elipsedPage }}\n </a>\n </li>\n }\n }\n }\n\n @if (currentPage < totalPages) {\n <li class=\"moj-pagination__item moj-pagination__item--next\">\n <a\n class=\"moj-pagination__link\"\n (click)=\"onPageChanged($event, currentPage + 1)\"\n (keydown.enter)=\"onPageChanged($event, currentPage + 1)\"\n tabindex=\"0\"\n >\n Next<span class=\"govuk-visually-hidden\"> page</span></a\n >\n </li>\n }\n </ul>\n <p class=\"moj-pagination__results govuk-!-text-align-right\">\n Showing <b>{{ pageStart }}</b> to <b>{{ pageEnd }}</b> of <b>{{ total }}</b> results\n </p>\n </nav>\n}\n","/**\n * Generated b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AAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB;;;AEfH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"hmcts-opal-frontend-common-components-moj-moj-pagination.mjs","sources":["../../../projects/opal-frontend-common/components/moj/moj-pagination/moj-pagination.component.ts","../../../projects/opal-frontend-common/components/moj/moj-pagination/moj-pagination.component.html","../../../projects/opal-frontend-common/components/moj/moj-pagination/hmcts-opal-frontend-common-components-moj-moj-pagination.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, signal } from '@angular/core';\n\n@Component({\n selector: 'opal-lib-moj-pagination',\n templateUrl: './moj-pagination.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MojPaginationComponent implements OnChanges {\n private readonly pages = signal<number[]>([]);\n\n @Input({ required: true }) id!: string;\n @Input({ required: true }) currentPage: number = 1;\n @Input({ required: true }) total: number = 0;\n @Input({ required: true }) limit: number = 25;\n @Output() changePage = new EventEmitter<number>();\n\n public readonly elipsedPages = signal<(number | string)[]>([]);\n public readonly ELIPSIS = '…';\n\n /**\n * Gets the total number of pages available.\n *\n * @returns The total count of pages as a number.\n */\n get totalPages(): number {\n return this.pages().length;\n }\n\n /**\n * Gets the starting item index for the current page in a paginated list.\n *\n * @returns {number} The index of the first item on the current page, or 0 if there are no items.\n *\n * If `total` is 0, returns 0. Otherwise, calculates the starting index based on the current page and the limit per page.\n */\n get pageStart(): number {\n return this.total === 0 ? 0 : (this.currentPage - 1) * this.limit + 1;\n }\n\n /**\n * Gets the index of the last item on the current page.\n *\n * @returns {number} The index of the last item displayed on the current page.\n * Returns 0 if there are no items (`total` is 0). Otherwise, returns the lesser of\n * `currentPage * limit` and `total`, ensuring the end index does not exceed the total number of items.\n */\n get pageEnd(): number {\n return this.total === 0 ? 0 : Math.min(this.currentPage * this.limit, this.total);\n }\n\n /**\n * Calculates and updates the pagination pages and elided (skipped) pages based on the current limit and total items.\n *\n * - If either `limit` or `total` is less than or equal to zero, clears the pages and elided pages.\n * - Otherwise, computes the total number of pages, updates the `pages` observable with the full range,\n * and updates the `elipsedPages` observable with the result of skipping pages for ellipsis display.\n *\n * @private\n */\n private calculatePages() {\n if (this.limit <= 0 || this.total <= 0) {\n this.pages.set([]);\n this.elipsedPages.set([]);\n return;\n }\n const pagesCount = Math.ceil(this.total / this.limit);\n this.pages.set(this.range(1, pagesCount + 1));\n this.elipsedPages.set(this.elipseSkippedPages(this.pages(), this.currentPage));\n }\n\n /**\n * Generates an array of numbers starting from `start` up to, but not including, `end`.\n *\n * @param start - The starting number of the range (inclusive).\n * @param end - The ending number of the range (exclusive).\n * @returns An array of numbers from `start` to `end - 1`.\n */\n private range(start: number, end: number): number[] {\n const result: number[] = [];\n for (let i = start; i < end; i++) {\n result.push(i);\n }\n return result;\n }\n /**\n * Generates a pagination array with ellipses (\"...\") to represent skipped page ranges.\n *\n * The resulting array always includes the first and last page numbers, the current page,\n * and up to one page before and after the current page. Ellipses are inserted where\n * there are skipped ranges between the displayed pages.\n *\n * @param pages - An array of page numbers representing all available pages.\n * @param currentPage - The currently active page number.\n * @returns An array containing page numbers and ellipsis strings (\"...\") to indicate skipped pages.\n */\n private elipseSkippedPages(pages: number[], currentPage: number): (number | string)[] {\n const totalPages = pages.length;\n const first = 1;\n const last = totalPages;\n\n const result: (number | string)[] = [];\n\n // Always show the first page\n result.push(first);\n\n // Determine left-side ellipsis\n if (currentPage > first + 2) {\n result.push(this.ELIPSIS);\n }\n\n // Middle pages: current - 1, current, current + 1\n for (let i = currentPage - 1; i <= currentPage + 1; i++) {\n if (i > first && i < last) {\n result.push(i);\n }\n }\n\n // Decide whether to add right-side ellipsis\n const lastIncluded = result.includes(last);\n const secondLast = last - 1;\n if (!result.includes(secondLast) && !lastIncluded) {\n result.push(this.ELIPSIS);\n }\n\n // Add last page if not already included\n if (!lastIncluded && last !== first) {\n result.push(last);\n }\n\n return result;\n }\n\n /**\n * Handles the page change event for the pagination component.\n *\n * Prevents the default action of the event (if provided) and emits the selected page number.\n *\n * @param event - The event triggered by the page change action. If provided, its default behavior will be prevented.\n * @param page - The page number to navigate to.\n */\n public onPageChanged(event: Event, page: number): void {\n if (event) {\n event.preventDefault();\n }\n if (page === this.currentPage) {\n return;\n }\n this.changePage.emit(page);\n }\n\n /**\n * Lifecycle hook that is called when any data-bound property of the component changes.\n * Invokes the `calculatePages` method to update the pagination state based on the new input values.\n */\n public ngOnChanges(): void {\n this.calculatePages();\n }\n}\n","@if (total > 0 && limit > 0) {\n <div class=\"moj-pagination\">\n @if (totalPages > 1) {\n <nav class=\"govuk-pagination moj-pagination__pagination\" aria-label=\"Pagination\" [id]=\"id\">\n @if (currentPage > 1) {\n <div class=\"govuk-pagination__prev\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n rel=\"prev\"\n (click)=\"onPageChanged($event, currentPage - 1)\"\n >\n <svg\n class=\"govuk-pagination__icon govuk-pagination__icon--prev\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"13\"\n width=\"15\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 15 13\"\n >\n <path\n d=\"m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z\"\n ></path>\n </svg>\n <span class=\"govuk-pagination__link-title\">Previous<span class=\"govuk-visually-hidden\"> page</span></span>\n </a>\n </div>\n }\n\n <ul class=\"govuk-pagination__list\">\n @for (elipsedPage of elipsedPages(); track elipsedPage) {\n @if (elipsedPage === ELIPSIS) {\n <li class=\"govuk-pagination__item govuk-pagination__item--ellipses\">⋯</li>\n } @else {\n <li class=\"govuk-pagination__item\" [class.govuk-pagination__item--current]=\"elipsedPage === currentPage\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n (click)=\"onPageChanged($event, +elipsedPage)\"\n [attr.aria-label]=\"'Page ' + elipsedPage\"\n [attr.aria-current]=\"elipsedPage === currentPage ? 'page' : null\"\n >\n {{ elipsedPage }}\n </a>\n </li>\n }\n }\n </ul>\n\n @if (currentPage < totalPages) {\n <div class=\"govuk-pagination__next\">\n <a\n class=\"govuk-link govuk-pagination__link\"\n href=\"#\"\n rel=\"next\"\n (click)=\"onPageChanged($event, currentPage + 1)\"\n >\n <span class=\"govuk-pagination__link-title\">Next<span class=\"govuk-visually-hidden\"> page</span></span>\n <svg\n class=\"govuk-pagination__icon govuk-pagination__icon--next\"\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"13\"\n width=\"15\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 15 13\"\n >\n <path\n d=\"m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z\"\n ></path>\n </svg>\n </a>\n </div>\n }\n </nav>\n }\n <p class=\"moj-pagination__results\">Showing {{ pageStart }} to {{ pageEnd }} of {{ total }} total results</p>\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAOa,sBAAsB,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAW,EAAE,iDAAC;AAElB,IAAA,EAAE;IACF,WAAW,GAAW,CAAC;IACvB,KAAK,GAAW,CAAC;IACjB,KAAK,GAAW,EAAE;AACnC,IAAA,UAAU,GAAG,IAAI,YAAY,EAAU;AAEjC,IAAA,YAAY,GAAG,MAAM,CAAsB,EAAE,wDAAC;IAC9C,OAAO,GAAG,GAAG;AAE7B;;;;AAIG;AACH,IAAA,IAAI,UAAU,GAAA;AACZ,QAAA,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM;IAC5B;AAEA;;;;;;AAMG;AACH,IAAA,IAAI,SAAS,GAAA;QACX,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,IA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ACvB;wGArJW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAtB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,sBAAsB,iOCPnC,stGAgFA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDzEa,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBALlC,SAAS;+BACE,yBAAyB,EAAA,eAAA,EAElB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,stGAAA,EAAA;;sBAK9C,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB;;;AEdH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnInit } from '@angular/core';
|
|
3
2
|
import { AbstractControl, FormControl } from '@angular/forms';
|
|
4
3
|
|
|
5
|
-
declare class GovukRadiosConditionalComponent
|
|
4
|
+
declare class GovukRadiosConditionalComponent {
|
|
5
|
+
/**
|
|
6
|
+
* Id used by aria-controls to connect a radio input to this conditional panel.
|
|
7
|
+
*/
|
|
6
8
|
conditionalId: string;
|
|
7
|
-
class: string;
|
|
8
|
-
id: string;
|
|
9
|
-
ngOnInit(): void;
|
|
10
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<GovukRadiosConditionalComponent, never>;
|
|
11
10
|
static ɵcmp: i0.ɵɵComponentDeclaration<GovukRadiosConditionalComponent, "opal-lib-govuk-radios-conditional, [opal-lib-govuk-radios-conditional]", never, { "conditionalId": { "alias": "conditionalId"; "required": true; }; }, {}, never, ["*"], true, never>;
|
|
12
11
|
}
|
|
@@ -26,21 +25,70 @@ declare class GovukRadiosItemComponent {
|
|
|
26
25
|
inputValue: string | boolean;
|
|
27
26
|
inputValueHint: string;
|
|
28
27
|
ariaControls: string;
|
|
28
|
+
/**
|
|
29
|
+
* Assigns the FormControl used to bind the radio input.
|
|
30
|
+
* @param abstractControl - Control instance from the parent form group.
|
|
31
|
+
* @remarks Casts to FormControl for template binding.
|
|
32
|
+
*/
|
|
29
33
|
set control(abstractControl: AbstractControl | null);
|
|
30
34
|
class: string;
|
|
35
|
+
/**
|
|
36
|
+
* Exposes the bound FormControl to the template.
|
|
37
|
+
*/
|
|
31
38
|
get getControl(): FormControl<any>;
|
|
39
|
+
/**
|
|
40
|
+
* Normalizes the input name for safe binding.
|
|
41
|
+
* @returns Trimmed input name or empty string.
|
|
42
|
+
*/
|
|
43
|
+
get resolvedInputName(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Ensures the radio input id is prefixed with the input name when needed.
|
|
46
|
+
* @returns Normalized id used by the input and label.
|
|
47
|
+
*/
|
|
48
|
+
get resolvedInputId(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Normalizes aria-controls to avoid empty attributes.
|
|
51
|
+
* @returns Trimmed value or null when not provided.
|
|
52
|
+
*/
|
|
53
|
+
get dataAriaControls(): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Exposes the radio value for Angular's RadioControlValueAccessor.
|
|
56
|
+
* IMPORTANT: keep the original type (e.g. boolean) so Reactive Forms emits the correct value.
|
|
57
|
+
*/
|
|
58
|
+
get resolvedInputValue(): string | boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Normalizes the radio value to a string for the HTML attribute binding.
|
|
61
|
+
* @returns String value for the input's `value` attribute.
|
|
62
|
+
*/
|
|
63
|
+
get resolvedInputValueAttr(): string;
|
|
32
64
|
static ɵfac: i0.ɵɵFactoryDeclaration<GovukRadiosItemComponent, never>;
|
|
33
65
|
static ɵcmp: i0.ɵɵComponentDeclaration<GovukRadiosItemComponent, "opal-lib-govuk-radios-item, [opal-lib-govuk-radios-item]", never, { "labelText": { "alias": "labelText"; "required": true; }; "labelClasses": { "alias": "labelClasses"; "required": false; }; "inputId": { "alias": "inputId"; "required": true; }; "inputName": { "alias": "inputName"; "required": true; }; "inputClasses": { "alias": "inputClasses"; "required": false; }; "inputValue": { "alias": "inputValue"; "required": true; }; "inputValueHint": { "alias": "inputValueHint"; "required": false; }; "ariaControls": { "alias": "ariaControls"; "required": false; }; "control": { "alias": "control"; "required": true; }; }, {}, never, never, true, never>;
|
|
34
66
|
}
|
|
35
67
|
|
|
36
68
|
declare class GovukRadioComponent {
|
|
69
|
+
private readonly elementRef;
|
|
37
70
|
fieldSetId: string;
|
|
38
71
|
legendText: string;
|
|
39
72
|
legendHint: string;
|
|
40
73
|
legendClasses: string;
|
|
41
74
|
radioClasses: string;
|
|
42
75
|
errors: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* Builds the aria-describedby value for the fieldset based on hint/error ids.
|
|
78
|
+
* @returns Space-separated id list or null when there is nothing to describe.
|
|
79
|
+
*/
|
|
43
80
|
get describedBy(): string | null;
|
|
81
|
+
constructor();
|
|
82
|
+
/**
|
|
83
|
+
* Initializes govuk-frontend radios behavior for this component's radio group.
|
|
84
|
+
* Side effects: dynamically imports govuk-frontend, mutates dataset, logs warnings on fallback.
|
|
85
|
+
*/
|
|
86
|
+
private initOuterRadios;
|
|
87
|
+
/**
|
|
88
|
+
* Loads the govuk-frontend module.
|
|
89
|
+
* Wrapped for testability so unit tests can stub the dynamic import.
|
|
90
|
+
*/
|
|
91
|
+
protected loadGovukFrontend(): Promise<any>;
|
|
44
92
|
static ɵfac: i0.ɵɵFactoryDeclaration<GovukRadioComponent, never>;
|
|
45
93
|
static ɵcmp: i0.ɵɵComponentDeclaration<GovukRadioComponent, "opal-lib-govuk-radio", never, { "fieldSetId": { "alias": "fieldSetId"; "required": true; }; "legendText": { "alias": "legendText"; "required": false; }; "legendHint": { "alias": "legendHint"; "required": false; }; "legendClasses": { "alias": "legendClasses"; "required": false; }; "radioClasses": { "alias": "radioClasses"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
46
94
|
}
|