Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove unused validator on project form (#1339)
- Loading branch information
1 parent
bf9aecc
commit 0b9ad0c
Showing
13 changed files
with
41 additions
and
342 deletions.
There are no files selected for viewing
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
201 changes: 0 additions & 201 deletions
201
apps/dsp-app/src/app/main/directive/existing-name/existing-name.directive.spec.ts
This file was deleted.
Oops, something went wrong.
96 changes: 0 additions & 96 deletions
96
apps/dsp-app/src/app/main/directive/existing-name/existing-name.directive.ts
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
apps/dsp-app/src/app/main/directive/existing-name/existing-names.validator.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,27 @@ | ||
import { AbstractControl, ValidatorFn } from '@angular/forms'; | ||
|
||
/** | ||
* validation of existing name values. Array method (list of values) | ||
* Use it in a "formbuilder" group as a validator property | ||
* | ||
* @param {RegExp} valArrayRegexp List of regular expression values | ||
* @returns ValidatorFn | ||
*/ | ||
export function existingNamesValidator(valArrayRegexp: [RegExp]): ValidatorFn { | ||
return (control: AbstractControl): { [key: string]: any } => { | ||
let name; | ||
|
||
if (control.value) { | ||
name = control.value.toLowerCase(); | ||
} | ||
|
||
let no; | ||
for (const existing of valArrayRegexp) { | ||
no = existing.test(name); | ||
if (no) { | ||
return no ? { existingName: { name } } : null; | ||
} | ||
} | ||
return no ? { existingName: { name } } : null; | ||
}; | ||
} |
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
Oops, something went wrong.