@progress/kendo-angular-barcodes
Version:
Kendo UI Angular Barcodes
30 lines (29 loc) • 1.3 kB
TypeScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { ValidatorFn } from '@angular/forms';
import { geometry } from '@progress/kendo-drawing';
import { BarcodeType } from './chart-types';
/**
* Creates a value validator for a particular Barcode type.
*
* @param {BarcodeType} type The type of the Barcode.
* @param {Size} size The size of the barcode, excluding the text label, padding and border. Optional.
* @returns {ValidatorFn} A validator function that returns an error map with the `barcode` property if the validation check fails, otherwise `null`.
*
* @example
* ```ts-no-run
* const control = new FormControl('1234', createBarcodeValidator('EAN8'));
* console.log(control.errors);
*
* // {
* // barcode: {
* // message: 'The value of the "EAN13" encoding should be 12 symbols',
* // value: '1234',
* // type: 'EAN13'
* // }
* // }
* ```
*/
export declare const createBarcodeValidator: (type: BarcodeType, size?: geometry.Size) => ValidatorFn;