UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

471 lines (459 loc) • 13.2 kB
/** * DevExtreme (ui/validation_engine.d.ts) * Version: 19.2.6 * Build date: Thu Jan 30 2020 * * Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import '../jquery_augmentation'; import { dxValidationGroupResult } from './validation_group'; /** An object that serves as a namespace for the methods required to perform validation. */ export default class validationEngine { /** * @docid validationEngineMethods.getGroupConfig * @section Core * @publicName getGroupConfig() * @return object * @static * @prevFileNamespace DevExpress.ui * @public */ static getGroupConfig(): any; /** * @docid validationEngineMethods.getGroupConfig * @section Core * @publicName getGroupConfig(group) * @param1 group:string|object * @return object * @static * @prevFileNamespace DevExpress.ui * @public */ static getGroupConfig(group: string | any): any; /** * @docid validationEngineMethods.registerModelForValidation * @publicName registerModelForValidation(model) * @param1 model:object * @static * @prevFileNamespace DevExpress.integration * @public */ static registerModelForValidation(model: any): void; /** * @docid validationEngineMethods.resetGroup * @section Core * @publicName resetGroup() * @static * @prevFileNamespace DevExpress.ui * @public */ static resetGroup(): void; /** * @docid validationEngineMethods.resetGroup * @section Core * @publicName resetGroup(group) * @param1 group:string|object * @static * @prevFileNamespace DevExpress.ui * @public */ static resetGroup(group: string | any): void; /** * @docid validationEngineMethods.unregisterModelForValidation * @publicName unregisterModelForValidation(model) * @param1 model:object * @static * @prevFileNamespace DevExpress.integration * @public */ static unregisterModelForValidation(model: any): void; /** * @docid validationEngineMethods.validateGroup * @section Core * @publicName validateGroup() * @return dxValidationGroupResult * @static * @prevFileNamespace DevExpress.ui * @public */ static validateGroup(): dxValidationGroupResult; /** * @docid validationEngineMethods.validateGroup * @section Core * @publicName validateGroup(group) * @param1 group:string|object * @return dxValidationGroupResult * @static * @prevFileNamespace DevExpress.ui * @public */ static validateGroup(group: string | any): dxValidationGroupResult; /** * @docid validationEngineMethods.validateModel * @publicName validateModel(model) * @param1 model:object * @return object * @static * @prevFileNamespace DevExpress.integration * @public */ static validateModel(model: any): any; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface AsyncRule { /** * @docid AsyncRule.ignoreEmptyValue * @type boolean * @default false * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid AsyncRule.message * @type string * @default 'Value is invalid' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid AsyncRule.reevaluate * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ reevaluate?: boolean; /** * @docid AsyncRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; /** * @docid AsyncRule.validationCallback * @type function * @type_function_return Promise<any> * @type_function_param1 options:object * @type_function_param1_field1 value:string|number * @type_function_param1_field2 rule:object * @type_function_param1_field3 validator:object * @type_function_param1_field4 data:object * @type_function_param1_field5 column:object * @type_function_param1_field6 formItem:object * @prevFileNamespace DevExpress.ui * @public */ validationCallback?: ((options: { value?: string | number, rule?: any, validator?: any, data?: any, column?: any, formItem?: any }) => Promise<any> | JQueryPromise<any>); } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface CompareRule { /** * @docid CompareRule.comparisonTarget * @type function * @type_function_return object * @prevFileNamespace DevExpress.ui * @public */ comparisonTarget?: (() => any); /** * @docid CompareRule.comparisonType * @type Enums.ComparisonOperator * @default '==' * @prevFileNamespace DevExpress.ui * @public */ comparisonType?: '!=' | '!==' | '<' | '<=' | '==' | '===' | '>' | '>='; /** * @docid CompareRule.ignoreEmptyValue * @type boolean * @default false * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid CompareRule.message * @type string * @default 'Values do not match' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid CompareRule.reevaluate * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ reevaluate?: boolean; /** * @docid CompareRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface CustomRule { /** * @docid CustomRule.ignoreEmptyValue * @type boolean * @default false * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid CustomRule.message * @type string * @default 'Value is invalid' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid CustomRule.reevaluate * @type boolean * @default false * @prevFileNamespace DevExpress.ui * @public */ reevaluate?: boolean; /** * @docid CustomRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; /** * @docid CustomRule.validationCallback * @type function * @type_function_return boolean * @type_function_param1 options:object * @type_function_param1_field1 value:string|number * @type_function_param1_field2 rule:object * @type_function_param1_field3 validator:object * @type_function_param1_field4 data:object * @type_function_param1_field5 column:object * @type_function_param1_field6 formItem:object * @prevFileNamespace DevExpress.ui * @public */ validationCallback?: ((options: { value?: string | number, rule?: any, validator?: any, data?: any, column?: any, formItem?: any }) => boolean); } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface EmailRule { /** * @docid EmailRule.ignoreEmptyValue * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid EmailRule.message * @type string * @default 'Email is invalid' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid EmailRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface NumericRule { /** * @docid NumericRule.ignoreEmptyValue * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid NumericRule.message * @type string * @default 'Value should be a number' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid NumericRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface PatternRule { /** * @docid PatternRule.ignoreEmptyValue * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid PatternRule.message * @type string * @default 'Value does not match pattern' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid PatternRule.pattern * @type regexp|string * @prevFileNamespace DevExpress.ui * @public */ pattern?: RegExp | string; /** * @docid PatternRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface RangeRule { /** * @docid RangeRule.ignoreEmptyValue * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid RangeRule.max * @type datetime|number * @prevFileNamespace DevExpress.ui * @public */ max?: Date | number; /** * @docid RangeRule.message * @type string * @default 'Value is out of range' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid RangeRule.min * @type datetime|number * @prevFileNamespace DevExpress.ui * @public */ min?: Date | number; /** * @docid RangeRule.reevaluate * @type boolean * @default false * @prevFileNamespace DevExpress.ui * @public */ reevaluate?: boolean; /** * @docid RangeRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface RequiredRule { /** * @docid RequiredRule.message * @type string * @default 'Required' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid RequiredRule.trim * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ trim?: boolean; /** * @docid RequiredRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; } /** Warning! This type is used for internal purposes. Do not import it directly. */ export interface StringLengthRule { /** * @docid StringLengthRule.ignoreEmptyValue * @type boolean * @default false * @prevFileNamespace DevExpress.ui * @public */ ignoreEmptyValue?: boolean; /** * @docid StringLengthRule.max * @type number * @prevFileNamespace DevExpress.ui * @public */ max?: number; /** * @docid StringLengthRule.message * @type string * @default 'The length of the value is not correct' * @prevFileNamespace DevExpress.ui * @public */ message?: string; /** * @docid StringLengthRule.min * @type number * @prevFileNamespace DevExpress.ui * @public */ min?: number; /** * @docid StringLengthRule.trim * @type boolean * @default true * @prevFileNamespace DevExpress.ui * @public */ trim?: boolean; /** * @docid StringLengthRule.type * @type Enums.ValidationRuleType * @prevFileNamespace DevExpress.ui * @public */ type?: 'required' | 'numeric' | 'range' | 'stringLength' | 'custom' | 'compare' | 'pattern' | 'email' | 'async'; }