turbogui-angular
Version:
A library that tries to help with the most common user interface elements on several frameworks and platforms
58 lines • 2.56 kB
TypeScript
/**
* TurboGUI is A library that helps with the most common and generic UI elements and functionalities
*
* Website : -> http://www.turbogui.org
* License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
* License Url : -> http://www.apache.org/licenses/LICENSE-2.0
* CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
*/
import { FormControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';
/**
* Validation class that extends the base angular Form Validators class and adds extra useful validators
*/
export declare class ValidatorsPlus extends Validators {
/**
* Verify that the data of a form value is required and also Not semantically empty, just like the
* TurboCommons StringUtils.isEmpty method does
*/
static nonEmpty(control: FormControl): ValidationErrors | null;
/**
* Validator to check that at least one of the specified form controls has a non empty value.
* Non empty criteria is the same as the nonEmpty validator on this same class, which verifies that the value is not semantically empty.
*
* To use this validator, you need to pass an array of control names that you want to check. And set it to the validators property
* of the form builder group.
*
* @param controlNames An array of control names to check. For example, ['name', 'surname'].
*
* @returns A validator function.
*/
static atLeastOneIsNotEmpty(controlNames: string[]): ValidatorFn;
/**
* Validator to check that a control value is a valid mobile phone number with country code.
*
* The expected format is: +<country code><number>, where:
* - <country code> is 1 to 3 digits
* - <number> is 6 to 14 digits
*
* The country code must be prefixed with a plus sign (+). Spaces, dots (.), and hyphens (-) are allowed as separators.
*
* Examples of valid formats:
* - +1 1234567890
* - +44-1234-567890
* - +91.9876543210
*
* Examples of invalid formats:
* - 1234567890 (missing country code)
* - +123 (too short)
* - +123456789012345671 (too long)
*
* @param control The form control to validate.
*
* @returns An object with the validation error if invalid, or null if valid.
*/
static mobilePhoneWithCountryCode(control: FormControl): {
mobilePhoneWithCountryCode: boolean;
} | null;
}
//# sourceMappingURL=ValidatorsPlus.d.ts.map