juvo-rafa-library
Version:
A comprehensive Angular component library featuring real-world components and validators extracted from the Juvo Rafa backoffice application. Now with improved select components and bug fixes.
29 lines (28 loc) • 929 B
TypeScript
import { ValidatorFn } from '@angular/forms';
/**
* Validator function for MAC addresses
*
* @description
* Validates that the input value matches a valid MAC address format.
* Supports both colon-separated (AA:BB:CC:DD:EE:FF) and hyphen-separated (AA-BB-CC-DD-EE-FF) formats.
*
* @example
* ```typescript
* // Basic usage in FormControl
* const macControl = new FormControl('', [macAddressValidator()]);
*
* // Usage in reactive forms
* this.deviceForm = this.fb.group({
* macAddress: ['', [Validators.required, macAddressValidator()]]
* });
*
* // Valid inputs: 'AA:BB:CC:DD:EE:FF', 'aa:bb:cc:dd:ee:ff', 'AA-BB-CC-DD-EE-FF'
* // Invalid inputs: 'invalid-mac', 'AA:BB:CC:DD:EE', 'GG:HH:II:JJ:KK:LL'
* ```
*
* @returns ValidatorFn that returns null if valid, or validation error object if invalid
*
* @since 2.0.0
* @author Juvo Rafa Team
*/
export declare function macAddressValidator(): ValidatorFn;