diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-10-22 11:33:19 +0300 |
---|---|---|
committer | vempo <vitaliy.emporopulo@amdocs.com> | 2018-10-22 11:33:19 +0300 |
commit | 032929d287cbafefe8367e0fcee18dec4b1bf9f7 (patch) | |
tree | 6e4f28cd5303d810c24cd110fb69c6d95b875e98 /deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/shared/input/validators.ts | |
parent | a224f54637da8de90570beee979aef9069f467d5 (diff) |
Deleted deprecated workflow project
Change-Id: I2ad75adab7d47d8df5b3996a315a9b173fa4bbfe
Issue-ID: SDC-1855
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/shared/input/validators.ts')
-rw-r--r-- | deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/shared/input/validators.ts | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/shared/input/validators.ts b/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/shared/input/validators.ts deleted file mode 100644 index 137d5444..00000000 --- a/deprecated-workflow-designer/sdc-workflow-designer-ui/src/app/shared/input/validators.ts +++ /dev/null @@ -1,147 +0,0 @@ -import {AbstractControl, ValidationErrors} from '@angular/forms'; - -export function inRangeValidator(in_range: number[]): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - const value = parseFloat(control.value); - if (isNaN(value) || value > in_range[1] || value < in_range[0]) { - control.setErrors({ - in_range: true - }); - return { - in_range: true - } - } else { - return null; - } - } -} - -export function greaterOrEqualValidator(max: string): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - const value = parseFloat(control.value); - const maxValue: any = parseFloat(max); - if (!isNaN(maxValue) && (isNaN(value) || value < maxValue)) { - control.setErrors({ - greater_or_equal: true - }); - return { - greater_or_equal: true - } - } else { - return null; - } - } -} - -export function lessOrEqualValidator(min: string): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - const value = parseFloat(control.value); - const minValue: any = parseFloat(min); - if (!isNaN(minValue) && (isNaN(value) || value > minValue)) { - control.setErrors({ - less_or_equal: true - }); - return { - less_or_equal: true - } - } else { - return null; - } - } -} - -export function greaterThanValidator(max: string): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - const value = parseFloat(control.value); - const maxValue: any = parseFloat(max); - if (!isNaN(maxValue) && (isNaN(value) || value <= maxValue)) { - control.setErrors({ - greater_than: true - }); - return { - greater_than: true - } - } else { - return null; - } - } -} - -export function lessThanValidator(min: string): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - const value = parseFloat(control.value); - const minValue: any = parseFloat(min); - if (!isNaN(minValue) && (isNaN(value) || value >= minValue)) { - control.setErrors({ - less_than: true - }); - return { - less_than: true - } - } else { - return null; - } - } -} - -export function equalValidator(value: any): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - if (control.value != value) { - control.setErrors({ - equal: true - }); - return { - equal: true - } - } else { - return null; - } - } -} - -export function lengthValidator(length: number): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - if (control.value && control.value.length !== length) { - control.setErrors({ - length: true - }); - return { - length: true - } - } else { - return null; - } - } -} - -export function floatValidator(): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - let floatPattern = /^(-?\d+)(\.\d+)?$/; - if (control.value && !floatPattern.test(control.value)) { - control.setErrors({ - float: true - }); - return { - float: true - } - } else { - return null; - } - } -} - -export function integerValidator(): ValidationErrors|null { - return (control: AbstractControl): ValidationErrors => { - let integerPattern = /^-?\d+$/; - if (control.value && !integerPattern.test(control.value)) { - control.setErrors({ - integer: true - }); - return { - integer: true - } - } else { - return null; - } - } -}
\ No newline at end of file |