UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

48 lines (47 loc) 2.16 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 CAPSLOCK_VALIDATOR: StaticProvider; /** * A Directive that adds the adds a warning when the CAPSLOCK key is on. * Applies to sme-form-field[type="password] and [smeCapsLock] */ export declare class CapsLockValidatorDirective extends FormValidatorBase { /** * Indicates that a warning should be thrown if capslock is on */ get warnOnCapsLock(): boolean; set warnOnCapsLock(value: boolean); /** * Internal placeholder for warnOnCapsLock */ private internalWarnOnCapsLock; /** * Indicates the state of the capslock key */ private isCapsLockOn; /** * Instantiates a new instance of CapsLockValidatorDirective */ constructor(); /** * Implementation of Validator interface. * Validates the state of the capslock key for this form control * @param c The FormControl attached to this element * @return null when valid, otherwise returns a validation object */ validate(c: FormControl): ValidationAlerts | null; /** * We dont have a way to truly monitor for capslock. * The best we can do is listen to every keydown and turn the warning on if we detect that its on * @param event the event data. */ onKeydown(event: KeyboardEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration<CapsLockValidatorDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<CapsLockValidatorDirective, "sme-form-field[smeCapsLock][formControlName],sme-form-field[smeCapsLock][formControl],sme-form-field[smeCapsLock][ngModel],sme-form-field[type=\"password\"][formControlName],sme-form-field[type=\"password\"][formControl],sme-form-field[type=\"password\"][ngModel]", never, { "warnOnCapsLock": "smeCapsLock"; }, {}, never, never, false, never>; }