diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts index d67fd93f7d3461c8d70a40df79bce45735b53eae..8a4a176cfa354c66d4425f888e4dfdf1134c6a53 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/color-error.enum.ts @@ -1,6 +1,6 @@ export enum ColorErrorEnum { - NONE, - COLOR_INVALID, - COLOR_TOO_LIGHT, - COLOR_TOO_DARK - } \ No newline at end of file + NONE, + COLOR_INVALID, + COLOR_TOO_LIGHT, + COLOR_TOO_DARK +} diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.ts index a9681655e95943b2a3b6a4c1c3c22d315d4057ad..0300950cbfe0a1716e055d16e61ff42b76a7f0c4 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-create/customer-colors-input/input-color/input-color.component.ts @@ -1,18 +1,16 @@ -import {Component, Input, OnInit, ViewChild} from '@angular/core'; -import {FormControl} from '@angular/forms'; -import {ColorErrorEnum} from './color-error.enum'; -import {ColorPickerDirective} from 'ngx-color-picker'; -import {hexToRgb, rgbToHsl} from 'ui-frontend-common'; +import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { FormControl } from '@angular/forms'; +import { ColorPickerDirective } from 'ngx-color-picker'; +import { hexToRgb, rgbToHsl } from 'ui-frontend-common'; + +import { ColorErrorEnum } from './color-error.enum'; @Component({ selector: 'app-input-color', templateUrl: './input-color.component.html', styleUrls: ['./input-color.component.scss'], }) - export class InputColorComponent implements OnInit { - - @Input() placeholder: string; @Input() disabled: boolean; @Input() colorInput: FormControl; @@ -20,21 +18,18 @@ export class InputColorComponent implements OnInit { public color: string; - @ViewChild('colorPickerInput', {read: ColorPickerDirective, static: false}) + @ViewChild('colorPickerInput', { read: ColorPickerDirective, static: false }) private colorPicker: ColorPickerDirective; + public colorErrorEnum: typeof ColorErrorEnum = ColorErrorEnum; + public colorError: ColorErrorEnum = ColorErrorEnum.NONE; - public colorErrorEnum : typeof ColorErrorEnum = ColorErrorEnum; - public colorError : ColorErrorEnum = ColorErrorEnum.NONE; - - constructor() {} + constructor() { } public ngOnInit(): void { - this.color = this.colorInput.value; this.colorInput.valueChanges.subscribe((color: string) => { this.color = color; - if(this.checkWarning) - { + if (this.checkWarning) { this.checkColor500(color); } }); @@ -45,19 +40,16 @@ export class InputColorComponent implements OnInit { const rgbValue = hexToRgb(color); if (rgbValue) { const hslValue = rgbToHsl(rgbValue); - if(hslValue) { - if(hslValue.l > 60) { + if (hslValue) { + if (hslValue.l > 60) { this.colorError = ColorErrorEnum.COLOR_TOO_LIGHT; - } - else if(hslValue.l < 40) { + } else if (hslValue.l < 40) { this.colorError = ColorErrorEnum.COLOR_TOO_DARK; } - } - else{ + } else { this.colorError = ColorErrorEnum.COLOR_INVALID; } - } - else { + } else { this.colorError = ColorErrorEnum.COLOR_INVALID; } } @@ -69,19 +61,18 @@ export class InputColorComponent implements OnInit { } public openPicker(): void { - if ( ! this.disabled) { + if (!this.disabled) { this.colorPicker.openDialog(); } } public forceHex(): void { - if (! this.colorInput.value.startsWith('#')) { + if (!this.colorInput.value.startsWith('#')) { this.colorInput.setValue('#' + this.colorInput.value); } } public handlePicker(pickerValue: string): void { - // Avoid 3 chars hex to become 6 chars (ex. #123 becoming instantly #112233...) let inputValue: string = this.colorInput.value.toUpperCase(); pickerValue = pickerValue.toUpperCase(); @@ -95,7 +86,10 @@ export class InputColorComponent implements OnInit { if (inputValue.length === 3 && pickerValue.length === 6) { for (let i = 0; i < 3; i++) { - if (inputValue.charAt(i) !== pickerValue.charAt(2 * i) || inputValue.charAt(i) !== pickerValue.charAt(2 * i + 1)) { + if ( + inputValue.charAt(i) !== pickerValue.charAt(2 * i) || + inputValue.charAt(i) !== pickerValue.charAt(2 * i + 1) + ) { continue; } return; @@ -103,5 +97,4 @@ export class InputColorComponent implements OnInit { } this.colorInput.setValue('#' + pickerValue); } - } diff --git a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.ts b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.ts index 57055db2fc4d1cc3baf424bd3fc66545414b0295..650237940b674cae6ca8bddcaa7eed9ea7b3f66f 100644 --- a/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.ts +++ b/ui/ui-frontend/projects/identity/src/app/customer/customer-preview/graphic-identity-tab/graphic-identity/graphic-identity-form/graphic-identity-form.component.ts @@ -41,8 +41,7 @@ export class GraphicIdentityFormComponent implements OnInit { } private applyTheme(): void { - if(this.graphicIdentityForm.valid) - { + if (this.graphicIdentityForm.valid) { const colors = this.themeService.getThemeColors(this.graphicIdentityForm.get('themeColors').value); this.themeService.overloadLocalTheme(colors, '#toOverride'); } diff --git a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts index 4051523f6a766b2cd13d82e8c0a5427e7b8036e0..e993211d1d7c96e3e3a4505bf8cc7590e84f7970 100644 --- a/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts +++ b/ui/ui-frontend/projects/identity/src/app/subrogation/subrogation.module.ts @@ -37,11 +37,11 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; -import { MatSidenavModule } from '@angular/material/sidenav'; import { MatDialogModule } from '@angular/material/dialog'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSelectModule } from '@angular/material/select'; +import { MatSidenavModule } from '@angular/material/sidenav'; import { VitamUICommonModule } from 'ui-frontend-common'; import { SharedModule } from '../shared/shared.module';