UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

44 lines (43 loc) 1.94 kB
import { StaticProvider } from '@angular/core'; import { FormControl } from '@angular/forms'; import { ValidationAlerts } from '../validation-alert/validation-alert'; import { FormValidatorBase } from './base-validator'; import * as i0 from "@angular/core"; /** * Provider for the FormFieldValidatorDirective directive */ export declare const INPUT_VALIDATOR: StaticProvider; /** * A Directive that marks a field as invalid if it contains standard invalid characters. Primarily used to prevent * html tags for security reasons. */ export declare class InputValidatorDirective extends FormValidatorBase { /** * Regex to detect invalid characters. Does not allow: * - backslash (\) * - slash mark (/) * - asterisk (*) * - question mark (?) * - single quotation mark (') * - double quotation mark (") * - less than sign (<) * - greater than sign (>) * - vertical bar (|) */ private readonly defaultInvalidCharacters; invalidCharacters: RegExp; errorMessage: string; /** * Instantiates a new instance of InputValidatorDirective */ constructor(); /** * Implementation of Validator interface. * Validates the value of the field attached to this control to be a valid input * @param c The FormControl attached to this element * @return null when valid, otherwise returns a validation object */ validate(c: FormControl): ValidationAlerts | null; static ɵfac: i0.ɵɵFactoryDeclaration<InputValidatorDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<InputValidatorDirective, "sme-form-field[smeInputValidation][formControlName],sme-form-field[smeInputValidation][formControl],sme-form-field[smeInputValidation][ngModel]", never, { "invalidCharacters": "invalidCharacters"; "errorMessage": "errorMessage"; }, {}, never, never, false, never>; }