-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/cb2-14457 - ADR DFS Refactor (#1640)
* chore(cb2-0000): basic form * chore(cb2-0000): changes * chore(cb2-0000): add view and summary mode * chore(cb2-0000): add example directive * chore(cb2-0000): add dates and directives * chore(cb2-0000): adr section changes * chore(cb2-0000): fix issues with global error service * chore(cb2-0000): fix validation for ADR section * chore(cb2-0000): fix tc3 validator * chore(cb2-0000): general ADR section fixes * chore(cb2-0000): allow editing fields on different pages * chore(cb2-0000): replicate behaviour around explosives * chore(cb2-0000): fix unit tests * feat(cb2-14457): migrate styles and directives over * feat(cb2-14457): attempt at using new styles and directive * feat(cb2-14457): attempt at using new styles and directive * feat(cb2-14457): add automation ids * feat(cb2-14457): amend review screen * feat(cb2-14457): convert inputs to gds format * feat(cb2-14457): add body declaration * feat(cb2-14457): add ids to input labels * feat(cb2-14457): migrate last of inputs to gds * feat(cb2-14457): more radios * feat(cb2-14457): final radio * feat(cb2-14457): make dates less verbose * feat(cb2-14457): checkbox styling and small fixes * feat(cb2-14457): checkbox styling * feat(cb2-14457): directives rework * feat(cb2-14457): selects refactored * feat(cb2-14457): fix date errors * feat(cb2-14457): text area refactor * feat(cb2-14457): introduce styling for dates * feat(cb2-14457): label cleanup * feat(cb2-14457): fix date styling and unit tests * Feat/cb2 14457 (#1642) * chore(cb2-0000): basic form * chore(cb2-0000): changes * chore(cb2-0000): add view and summary mode * chore(cb2-0000): add example directive * chore(cb2-0000): add dates and directives * chore(cb2-0000): adr section changes * chore(cb2-0000): fix issues with global error service * chore(cb2-0000): fix validation for ADR section * chore(cb2-0000): fix tc3 validator * chore(cb2-0000): general ADR section fixes * chore(cb2-0000): allow editing fields on different pages * chore(cb2-0000): replicate behaviour around explosives * chore(cb2-0000): fix unit tests * feat(cb2-14457): migrate styles and directives over * feat(cb2-14457): attempt at using new styles and directive * feat(cb2-14457): attempt at using new styles and directive * feat(cb2-14457): add automation ids * feat(cb2-14457): amend review screen * feat(cb2-14457): convert inputs to gds format * feat(cb2-14457): add body declaration * feat(cb2-14457): add ids to input labels * feat(cb2-14457): migrate last of inputs to gds * feat(cb2-14457): more radios * feat(cb2-15038): allow current year +1 for year of manufacture (#1639) * feat(cb2-14457): final radio * feat(cb2-14457): make dates less verbose * feat(cb2-14457): checkbox styling and small fixes * feat(cb2-14457): checkbox styling * feat(cb2-14457): directives rework * feat(cb2-14457): selects refactored * feat(cb2-14457): fix date errors * feat(cb2-14457): text area refactor * feat(cb2-14457): introduce styling for dates * feat(cb2-14457): label cleanup * feat(cb2-14457): fix date styling and unit tests --------- Co-authored-by: Thomas Crawley <thomas.crawley@dvsa.gov.uk> * feat(cb2-14457): don't override element id * feat(cb2-14457): remove id and name * feat(cb2-14457): remove id and name (#1643) Co-authored-by: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> * feat(cb2-14457): add checkbox to ids * Feat/cb2 14457 (#1644) * feat(cb2-14457): remove id and name * feat(cb2-14457): add checkbox to ids --------- Co-authored-by: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> * feat(cb2-14457): character count id fix * Feat/cb2 14457 - text area id's (#1645) * feat(cb2-14457): remove id and name * feat(cb2-14457): add checkbox to ids * feat(cb2-14457): character count id fix --------- Co-authored-by: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> * feat(cb2-14457): character count corrections * feat(cb2-14457): add additional details * feat(cb2-14457): resolve validator message mismatch * feat/cb2-14457 (#1646) * feat(cb2-14457): remove id and name * feat(cb2-14457): add checkbox to ids * feat(cb2-14457): character count id fix * feat(cb2-14457): character count corrections * feat(cb2-14457): add additional details * feat(cb2-14457): resolve validator message mismatch --------- Co-authored-by: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> * feat(cb2-14457): amend additional examiner notes validator * Feat/cb2 14457 (#1647) * feat(cb2-14457): remove id and name * feat(cb2-14457): add checkbox to ids * feat(cb2-14457): character count id fix * feat(cb2-14457): character count corrections * feat(cb2-14457): add additional details * feat(cb2-14457): resolve validator message mismatch * feat(cb2-14457): amend additional examiner notes validator --------- Co-authored-by: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> * feat(cb2-14457): more additional examiner notes amendments * feat(cb2-14457): add ids to inline error messages * feat(cb2-14457): change to using element id, use correct id in label fors * feat(cb2-14457): fix labels * feat(cb2-14457): fix battery list applicable validation * feat(cb2-14457): test * feat(cb2-14457): fix error messages for automation pack * feat(cb2-14457): fix ADR specific issues * feat(cb2-14457): correct max length validation * feat(cb2-14457): correct more messages * feat(cb2-14457): fix batch plating * feat(cb2-14457): change wording * feat(cb2-14457): fix spelling * feat(cb2-14457): change date validation * feat(cb2-14457): year must be four digits * feat(cb2-14457): fix discrepancies with develop * feat(cb2-14457): add missing details * feat(cb2-14457): only show brake endurance with issue section * feat(cb2-14457): show brake endurance with issuer * feat(cb2-14457): improvments * feat(cb2-14457): improvments again * feat(cb2-14457): change conditions for displaying ADR details message * feat(cb2-14457): turn flags on --------- Co-authored-by: pbardy2000 <146740183+pbardy2000@users.noreply.github.com> Co-authored-by: Tom Evans <thomas.evans@dvsa.gov.uk>
- Loading branch information
1 parent
cc22891
commit 2634cf0
Showing
56 changed files
with
4,260 additions
and
226 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/app/directives/govuk-checkbox/govuk-checkbox.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Directive, ElementRef, OnDestroy, OnInit, inject, input } from '@angular/core'; | ||
import { ControlContainer } from '@angular/forms'; | ||
import { FormNodeWidth } from '@services/dynamic-forms/dynamic-form.types'; | ||
import { ReplaySubject, takeUntil } from 'rxjs'; | ||
|
||
@Directive({ | ||
selector: '[govukCheckbox]', | ||
}) | ||
export class GovukCheckboxDirective implements OnInit, OnDestroy { | ||
elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef); | ||
controlContainer = inject(ControlContainer); | ||
|
||
controlName = input<string>('', { alias: 'formControlName' }); | ||
width = input<FormNodeWidth>(); | ||
|
||
destroy$ = new ReplaySubject<boolean>(1); | ||
|
||
ngOnInit(): void { | ||
const controlName = this.controlName(); | ||
const control = this.controlContainer.control?.get(controlName); | ||
if (control) { | ||
this.elementRef.nativeElement.setAttribute('aria-labelledby', `${controlName}-label`); | ||
control.statusChanges.pipe(takeUntil(this.destroy$)).subscribe((statusChange) => { | ||
if (statusChange === 'INVALID' && control.touched) { | ||
this.elementRef.nativeElement.classList.add('govuk-checkbox--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', `${controlName}-error`); | ||
} | ||
|
||
if (statusChange === 'VALID') { | ||
this.elementRef.nativeElement.classList.remove('govuk-checkbox--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', ''); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.complete(); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/app/directives/govuk-date-input/govuk-date-input.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Directive, ElementRef, OnDestroy, OnInit, inject, input } from '@angular/core'; | ||
import { ControlContainer } from '@angular/forms'; | ||
import { NumberOnlyDirective } from '@directives/app-number-only/app-number-only.directive'; | ||
import { DateFocusNextDirective } from '@directives/date-focus-next/date-focus-next.directive'; | ||
import { ReplaySubject, takeUntil } from 'rxjs'; | ||
|
||
@Directive({ | ||
selector: '[govukDateInput]', | ||
standalone: true, | ||
hostDirectives: [DateFocusNextDirective, NumberOnlyDirective], | ||
}) | ||
export class GovukDateInputDirective implements OnInit, OnDestroy { | ||
elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef); | ||
controlContainer = inject(ControlContainer); | ||
|
||
govukDateInput = input.required<string>(); | ||
controlName = input.required<string>({ alias: 'formControlName' }); | ||
|
||
destroy$ = new ReplaySubject<boolean>(1); | ||
|
||
ngOnInit(): void { | ||
const parent = this.govukDateInput(); | ||
const controlName = this.controlName(); | ||
const id = `${parent}-${controlName}`; | ||
|
||
const control = this.controlContainer.control?.get(controlName); | ||
if (control) { | ||
this.elementRef.nativeElement.setAttribute('id', id); | ||
this.elementRef.nativeElement.setAttribute('name', id); | ||
this.elementRef.nativeElement.setAttribute('type', 'number'); | ||
this.elementRef.nativeElement.setAttribute('inputmode', 'numeric'); | ||
this.elementRef.nativeElement.classList.add('govuk-input', 'govuk-date-input__input'); | ||
|
||
control.statusChanges.pipe(takeUntil(this.destroy$)).subscribe((statusChange) => { | ||
if (statusChange === 'INVALID' && control.touched) { | ||
this.elementRef.nativeElement.classList.add('govuk-input--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', `${controlName}-error`); | ||
} | ||
|
||
if (statusChange === 'VALID') { | ||
this.elementRef.nativeElement.classList.remove('govuk-input--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', ''); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.complete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Directive, ElementRef, OnDestroy, OnInit, inject, input } from '@angular/core'; | ||
import { ControlContainer } from '@angular/forms'; | ||
import { ReplaySubject, takeUntil } from 'rxjs'; | ||
|
||
@Directive({ | ||
selector: '[govukInput]', | ||
}) | ||
export class GovukInputDirective implements OnInit, OnDestroy { | ||
elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef); | ||
controlContainer = inject(ControlContainer); | ||
|
||
controlName = input.required<string>({ alias: 'formControlName' }); | ||
|
||
destroy$ = new ReplaySubject<boolean>(1); | ||
|
||
ngOnInit(): void { | ||
const controlName = this.controlName(); | ||
const control = this.controlContainer.control?.get(controlName); | ||
if (control) { | ||
this.elementRef.nativeElement.setAttribute('id', controlName); | ||
this.elementRef.nativeElement.setAttribute('name', controlName); | ||
this.elementRef.nativeElement.setAttribute('aria-labelledby', `${controlName}-label`); | ||
this.elementRef.nativeElement.classList.add('govuk-input'); | ||
|
||
control.statusChanges.pipe(takeUntil(this.destroy$)).subscribe((statusChange) => { | ||
if (statusChange === 'INVALID' && control.touched) { | ||
this.elementRef.nativeElement.classList.add('govuk-input--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', `${controlName}-error`); | ||
} | ||
|
||
if (statusChange === 'VALID') { | ||
this.elementRef.nativeElement.classList.remove('govuk-input--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', ''); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.complete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Directive, ElementRef, OnDestroy, OnInit, inject, input } from '@angular/core'; | ||
import { ControlContainer } from '@angular/forms'; | ||
import { FormNodeWidth } from '@services/dynamic-forms/dynamic-form.types'; | ||
import { ReplaySubject, takeUntil } from 'rxjs'; | ||
|
||
@Directive({ | ||
selector: '[govukRadio]', | ||
}) | ||
export class GovukRadioDirective implements OnInit, OnDestroy { | ||
elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef); | ||
controlContainer = inject(ControlContainer); | ||
|
||
controlName = input.required<string>({ alias: 'formControlName' }); | ||
width = input<FormNodeWidth>(); | ||
|
||
destroy$ = new ReplaySubject<boolean>(1); | ||
|
||
ngOnInit(): void { | ||
this.elementRef.nativeElement.classList.add('govuk-radios__input'); | ||
|
||
const controlName = this.controlName(); | ||
const control = this.controlContainer.control?.get(controlName); | ||
if (control) { | ||
this.elementRef.nativeElement.setAttribute('aria-labelledby', `${controlName}-label`); | ||
control.statusChanges.pipe(takeUntil(this.destroy$)).subscribe((statusChange) => { | ||
if (statusChange === 'INVALID' && control.touched) { | ||
this.elementRef.nativeElement.classList.add('govuk-radio--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', `${controlName}-error`); | ||
} | ||
|
||
if (statusChange === 'VALID') { | ||
this.elementRef.nativeElement.classList.remove('govuk-radio--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', ''); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.complete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Directive, ElementRef, inject, input } from '@angular/core'; | ||
import { ControlContainer } from '@angular/forms'; | ||
import { ReplaySubject, takeUntil } from 'rxjs'; | ||
|
||
@Directive({ | ||
selector: '[govukSelect]', | ||
}) | ||
export class GovukSelectDirective { | ||
elementRef = inject<ElementRef<HTMLSelectElement>>(ElementRef); | ||
controlContainer = inject(ControlContainer); | ||
|
||
controlName = input.required<string>({ alias: 'formControlName' }); | ||
|
||
destroy$ = new ReplaySubject<boolean>(1); | ||
|
||
ngOnInit(): void { | ||
const controlName = this.controlName(); | ||
const control = this.controlContainer.control?.get(controlName); | ||
if (control) { | ||
this.elementRef.nativeElement.setAttribute('id', controlName); | ||
this.elementRef.nativeElement.setAttribute('name', controlName); | ||
this.elementRef.nativeElement.setAttribute('aria-labelledby', `${controlName}-label`); | ||
this.elementRef.nativeElement.classList.add('govuk-select'); | ||
|
||
control.statusChanges.pipe(takeUntil(this.destroy$)).subscribe((statusChange) => { | ||
if (statusChange === 'INVALID' && control.touched) { | ||
this.elementRef.nativeElement.classList.add('govuk-select--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', `${controlName}-error`); | ||
} | ||
|
||
if (statusChange === 'VALID') { | ||
this.elementRef.nativeElement.classList.remove('govuk-select--error'); | ||
this.elementRef.nativeElement.setAttribute('aria-describedby', ''); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.destroy$.next(true); | ||
this.destroy$.complete(); | ||
} | ||
} |
Oops, something went wrong.