mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Merge Feature/trial initiation (#3036)
* [SG-74] Trial Initiation Component with Vertical Stepper (#2913) * Vertical stepper PoC * Convert stepper css to tailwind * trial component start * trial component params * tailwind-ify header * Support teams, enterprise, and families layout param and more layout ui work * Some more theming fixes * Rename TrialModule to TrialInitiationModule * Stepper fixes, plus more functionality demo * Cleanup * layout params and placeholders * Only allow trial route to be hit if not logged in * fix typo * Use background-alt2 color for header * Move vertical stepper out of trial-initiation * Create components for the different plan types * Remove width on steps * Remove content projection for label * Tailwind style fixes * Extract step content into a component * Remove layout param for now * Remove step tags * remove pointer classes from step button * Remove most tailwind important designations * Update apps/web/src/app/modules/vertical-stepper/vertical-step.component.ts Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> * Tailwind and layout fixes * Remove container * lint & prettier fixes * Remove extra CdkStep declaration * Styles fixes * Style logo directly * Remove 0 margin on image * Fix tiling and responsiveness * Minor padding fixes for org pages * Update apps/web/src/app/modules/trial-initiation/trial-initiation.component.html Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> * prettier fix Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> * [SG-65] Reusable Registration Form (#2946) * created reusable registration form * fixed conflicts * replicated reactive form changes in other clients * removed comments * client template cleanup * client template cleanup * removed comments in template file * changed to component suffix * switched show password to use component * comments resolution * comments resolution * added toast disable functionality * removed unused locale * mode custom input validator generic * fixed button * fixed linter * removed horizontal rule * switched to button component Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> Co-authored-by: gbubemismith <gsmithwalter@gmail.com>
This commit is contained in:
13
libs/common/src/abstractions/formValidationErrors.service.ts
Normal file
13
libs/common/src/abstractions/formValidationErrors.service.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AbstractControl } from "@angular/forms";
|
||||
export interface AllValidationErrors {
|
||||
controlName: string;
|
||||
errorName: string;
|
||||
}
|
||||
|
||||
export interface FormGroupControls {
|
||||
[key: string]: AbstractControl;
|
||||
}
|
||||
|
||||
export abstract class FormValidationErrorsService {
|
||||
getFormValidationErrors: (controls: FormGroupControls) => AllValidationErrors[];
|
||||
}
|
||||
31
libs/common/src/services/formValidationErrors.service.ts
Normal file
31
libs/common/src/services/formValidationErrors.service.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { FormGroup, ValidationErrors } from "@angular/forms";
|
||||
|
||||
import {
|
||||
FormGroupControls,
|
||||
FormValidationErrorsService as FormValidationErrorsAbstraction,
|
||||
AllValidationErrors,
|
||||
} from "../abstractions/formValidationErrors.service";
|
||||
|
||||
export class FormValidationErrorsService implements FormValidationErrorsAbstraction {
|
||||
getFormValidationErrors(controls: FormGroupControls): AllValidationErrors[] {
|
||||
let errors: AllValidationErrors[] = [];
|
||||
Object.keys(controls).forEach((key) => {
|
||||
const control = controls[key];
|
||||
if (control instanceof FormGroup) {
|
||||
errors = errors.concat(this.getFormValidationErrors(control.controls));
|
||||
}
|
||||
|
||||
const controlErrors: ValidationErrors = controls[key].errors;
|
||||
if (controlErrors !== null) {
|
||||
Object.keys(controlErrors).forEach((keyError) => {
|
||||
errors.push({
|
||||
controlName: key,
|
||||
errorName: keyError,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user