diff --git a/apps/demos/Demos/CardView/DataValidation/Angular/app/app.component.ts b/apps/demos/Demos/CardView/DataValidation/Angular/app/app.component.ts index 676f6d0a582c..b5313c5650cc 100644 --- a/apps/demos/Demos/CardView/DataValidation/Angular/app/app.component.ts +++ b/apps/demos/Demos/CardView/DataValidation/Angular/app/app.component.ts @@ -2,6 +2,7 @@ import { bootstrapApplication } from '@angular/platform-browser'; import { HttpClient, provideHttpClient, withFetch } from '@angular/common/http'; import { Component, enableProdMode, provideZoneChangeDetection } from '@angular/core'; import { DxCardViewModule, DxTextAreaModule } from 'devextreme-angular'; +import type { ValidationCallbackData } from 'devextreme-angular/common'; import { lastValueFrom } from 'rxjs'; import { Employee, Service } from './app.service'; @@ -65,7 +66,7 @@ export class AppComponent { return result; }; - hireDateValidationCallback = (params) => new Date(params.value) > new Date(params.data.birthDate); + hireDateValidationCallback = (params: ValidationCallbackData) => new Date(params.value) > new Date(params.data.birthDate); } bootstrapApplication(AppComponent, { diff --git a/apps/demos/Demos/CardView/DataValidation/Vue/App.vue b/apps/demos/Demos/CardView/DataValidation/Vue/App.vue index c8c6134b2b14..c6a87351ded3 100644 --- a/apps/demos/Demos/CardView/DataValidation/Vue/App.vue +++ b/apps/demos/Demos/CardView/DataValidation/Vue/App.vue @@ -173,8 +173,8 @@ import { DxItem, DxSearchPanel, DxRequiredRule, DxEmailRule, DxAsyncRule, DxCustomRule, } from 'devextreme-vue/card-view'; -import { type ValidationCallbackData } from 'devextreme-vue/common'; import 'devextreme-vue/text-area'; +import type { ValidationCallbackData } from 'devextreme-vue/common'; import { employees, type Employee } from './data.ts'; function altExpr({ fullName }: Employee): string { diff --git a/apps/demos/Demos/Form/Validation/Angular/app/app.component.ts b/apps/demos/Demos/Form/Validation/Angular/app/app.component.ts index 851b65a6f4ec..4c4454202208 100644 --- a/apps/demos/Demos/Form/Validation/Angular/app/app.component.ts +++ b/apps/demos/Demos/Form/Validation/Angular/app/app.component.ts @@ -13,12 +13,12 @@ import { } from 'devextreme-angular'; import notify from 'devextreme/ui/notify'; import Validator from 'devextreme/ui/validator'; -import { AsyncRule } from 'devextreme-angular/common'; import { DxFormModule, DxFormComponent, DxFormTypes } from 'devextreme-angular/ui/form'; import { DxTextBoxTypes } from 'devextreme-angular/ui/text-box'; import { DxDateBoxTypes } from 'devextreme-angular/ui/date-box'; import { DxDateRangeBoxTypes } from 'devextreme-angular/ui/date-range-box'; import { DxButtonModule, DxButtonTypes } from 'devextreme-angular/ui/button'; +import type { ValidationCallbackData } from 'devextreme-angular/common'; import { Customer, Service } from './app.service'; type EditorOptions = DxTextBoxTypes.Properties; @@ -190,8 +190,8 @@ export class AppComponent { ); }; - validateVacationDatesRange({ value }) { - const [startDate, endDate] = value; + validateVacationDatesRange(params: ValidationCallbackData) { + const [startDate, endDate] = params.value; if (startDate === null || endDate === null) { return true; @@ -203,8 +203,8 @@ export class AppComponent { return daysDifference < 25; } - validateVacationDatesPresence({ value }) { - const [startDate, endDate] = value; + validateVacationDatesPresence(params: ValidationCallbackData) { + const [startDate, endDate] = params.value; if (startDate === null && endDate === null) { return true; @@ -213,7 +213,7 @@ export class AppComponent { return startDate !== null && endDate !== null; } - asyncValidation: AsyncRule['validationCallback'] = ({ value }) => sendRequest(value); + asyncValidation = (params: ValidationCallbackData) => sendRequest(params.value); onFormSubmit = (e: SubmitEvent) => { notify({ diff --git a/apps/demos/Demos/Form/Validation/React/App.tsx b/apps/demos/Demos/Form/Validation/React/App.tsx index d0189150f22a..1725709a4473 100644 --- a/apps/demos/Demos/Form/Validation/React/App.tsx +++ b/apps/demos/Demos/Form/Validation/React/App.tsx @@ -14,12 +14,12 @@ import Form, { CustomRule, } from 'devextreme-react/form'; import type { FormRef, FormTypes } from 'devextreme-react/form'; -import type { ButtonType } from 'devextreme-react/common'; import type { IAutocompleteOptions } from 'devextreme-react/autocomplete'; import type { ISelectBoxOptions } from 'devextreme-react/select-box'; import type { ITextBoxOptions } from 'devextreme-react/text-box'; import type { IDateBoxOptions } from 'devextreme-react/date-box'; import type { IDateRangeBoxOptions } from 'devextreme-react/date-range-box'; +import type { ButtonType, ValidationCallbackData } from 'devextreme-react/common'; import notify from 'devextreme/ui/notify'; import Validator from 'devextreme/ui/validator'; import 'devextreme-react/autocomplete'; @@ -100,10 +100,10 @@ const passwordComparison = (): string => customer.Password; const checkComparison = (): boolean => true; -const asyncValidation = ({ value }: { value: any; }): Promise => sendRequest(value); +const asyncValidation = (params: ValidationCallbackData): Promise => sendRequest(params.value); -const validateVacationDatesRange = ({ value }: { value: any; }): boolean => { - const [startDate, endDate] = value; +const validateVacationDatesRange = (params: ValidationCallbackData): boolean => { + const [startDate, endDate] = params.value; if (startDate === null || endDate === null) { return true; @@ -115,8 +115,8 @@ const validateVacationDatesRange = ({ value }: { value: any; }): boolean => { return daysDifference < 25; }; -const validateVacationDatesPresence = ({ value }: { value: any }): boolean => { - const [startDate, endDate] = value; +const validateVacationDatesPresence = (params: ValidationCallbackData): boolean => { + const [startDate, endDate] = params.value; if (startDate === null && endDate === null) { return true; diff --git a/apps/demos/Demos/Form/Validation/ReactJs/App.js b/apps/demos/Demos/Form/Validation/ReactJs/App.js index 5db3ada32c5c..446c254d4347 100644 --- a/apps/demos/Demos/Form/Validation/ReactJs/App.js +++ b/apps/demos/Demos/Form/Validation/ReactJs/App.js @@ -78,9 +78,9 @@ function sendRequest(value) { } const passwordComparison = () => customer.Password; const checkComparison = () => true; -const asyncValidation = ({ value }) => sendRequest(value); -const validateVacationDatesRange = ({ value }) => { - const [startDate, endDate] = value; +const asyncValidation = (params) => sendRequest(params.value); +const validateVacationDatesRange = (params) => { + const [startDate, endDate] = params.value; if (startDate === null || endDate === null) { return true; } @@ -88,8 +88,8 @@ const validateVacationDatesRange = ({ value }) => { const daysDifference = Math.abs((endDate - startDate) / millisecondsPerDay); return daysDifference < 25; }; -const validateVacationDatesPresence = ({ value }) => { - const [startDate, endDate] = value; +const validateVacationDatesPresence = (params) => { + const [startDate, endDate] = params.value; if (startDate === null && endDate === null) { return true; } diff --git a/apps/demos/Demos/Form/Validation/Vue/App.vue b/apps/demos/Demos/Form/Validation/Vue/App.vue index 12c3b1d2e8f9..6ed92ca13569 100644 --- a/apps/demos/Demos/Form/Validation/Vue/App.vue +++ b/apps/demos/Demos/Form/Validation/Vue/App.vue @@ -181,6 +181,7 @@ import DxForm, { } from 'devextreme-vue/form'; import DxAutocomplete from 'devextreme-vue/autocomplete'; // for editor-type=dxAutocomplete import 'devextreme-vue/date-range-box'; +import type { ValidationCallbackData } from 'devextreme-vue/common'; import notify from 'devextreme/ui/notify'; import Validator from 'devextreme/ui/validator'; import service from './data.ts'; @@ -312,11 +313,11 @@ function passwordComparison() { function checkComparison() { return true; } -function asyncValidation(params: Record) { +function asyncValidation(params: ValidationCallbackData) { return sendRequest(params.value); } -function validateVacationDatesRange({ value }: Record) { - const [startDate, endDate] = value; +function validateVacationDatesRange(params: ValidationCallbackData) { + const [startDate, endDate] = params.value; if (startDate === null || endDate === null) { return true; @@ -327,8 +328,8 @@ function validateVacationDatesRange({ value }: Record) { return daysDifference < 25; } -function validateVacationDatesPresence({ value }: Record) { - const [startDate, endDate] = value; +function validateVacationDatesPresence(params: ValidationCallbackData) { + const [startDate, endDate] = params.value; if (startDate === null && endDate === null) { return true; diff --git a/apps/demos/Demos/Form/Validation/jQuery/index.js b/apps/demos/Demos/Form/Validation/jQuery/index.js index 9cd5955375d2..420da9c053b4 100644 --- a/apps/demos/Demos/Form/Validation/jQuery/index.js +++ b/apps/demos/Demos/Form/Validation/jQuery/index.js @@ -145,8 +145,8 @@ $(() => { }, validationRules: [{ type: 'custom', - validationCallback: ({ value }) => { - const [startDate, endDate] = value; + validationCallback: (params) => { + const [startDate, endDate] = params.value; if (startDate === null || endDate === null) { return true; @@ -160,8 +160,8 @@ $(() => { message: 'The vacation period must not exceed 25 days', }, { type: 'custom', - validationCallback: ({ value }) => { - const [startDate, endDate] = value; + validationCallback: (params) => { + const [startDate, endDate] = params.value; if (startDate === null && endDate === null) { return true; diff --git a/packages/devextreme-angular/src/ui/card-view/nested/async-rule-dxi.ts b/packages/devextreme-angular/src/ui/card-view/nested/async-rule-dxi.ts index c15e0ba8e463..da94ffabdf9b 100644 --- a/packages/devextreme-angular/src/ui/card-view/nested/async-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/card-view/nested/async-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiCardViewAsyncRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any) { + get validationCallback(): ((options: ValidationCallbackData) => any) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)) { + set validationCallback(value: ((options: ValidationCallbackData) => any)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/card-view/nested/custom-rule-dxi.ts b/packages/devextreme-angular/src/ui/card-view/nested/custom-rule-dxi.ts index bed686bdfc37..c6610f839c20 100644 --- a/packages/devextreme-angular/src/ui/card-view/nested/custom-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/card-view/nested/custom-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiCardViewCustomRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/card-view/nested/validation-rule-dxi.ts b/packages/devextreme-angular/src/ui/card-view/nested/validation-rule-dxi.ts index 91f01749ad95..7642cf0f1439 100644 --- a/packages/devextreme-angular/src/ui/card-view/nested/validation-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/card-view/nested/validation-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType, ComparisonOperator } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from 'devextreme/common'; import { DxIntegrationModule, @@ -94,10 +94,10 @@ export class DxiCardViewValidationRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/data-grid/nested/async-rule-dxi.ts b/packages/devextreme-angular/src/ui/data-grid/nested/async-rule-dxi.ts index ce447b3506b4..fc60806a0c9f 100644 --- a/packages/devextreme-angular/src/ui/data-grid/nested/async-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/data-grid/nested/async-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiDataGridAsyncRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any) { + get validationCallback(): ((options: ValidationCallbackData) => any) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)) { + set validationCallback(value: ((options: ValidationCallbackData) => any)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/data-grid/nested/custom-rule-dxi.ts b/packages/devextreme-angular/src/ui/data-grid/nested/custom-rule-dxi.ts index 457ea1072946..ffa38eaa37c7 100644 --- a/packages/devextreme-angular/src/ui/data-grid/nested/custom-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/data-grid/nested/custom-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiDataGridCustomRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/data-grid/nested/validation-rule-dxi.ts b/packages/devextreme-angular/src/ui/data-grid/nested/validation-rule-dxi.ts index d3cbad699b3d..4d60d705ed94 100644 --- a/packages/devextreme-angular/src/ui/data-grid/nested/validation-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/data-grid/nested/validation-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType, ComparisonOperator } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from 'devextreme/common'; import { DxIntegrationModule, @@ -94,10 +94,10 @@ export class DxiDataGridValidationRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/form/nested/async-rule-dxi.ts b/packages/devextreme-angular/src/ui/form/nested/async-rule-dxi.ts index 3074a9622ea3..e07e8a4f8a02 100644 --- a/packages/devextreme-angular/src/ui/form/nested/async-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/form/nested/async-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiFormAsyncRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any) { + get validationCallback(): ((options: ValidationCallbackData) => any) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)) { + set validationCallback(value: ((options: ValidationCallbackData) => any)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/form/nested/custom-rule-dxi.ts b/packages/devextreme-angular/src/ui/form/nested/custom-rule-dxi.ts index 654f712ca079..e49d3eb53e6d 100644 --- a/packages/devextreme-angular/src/ui/form/nested/custom-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/form/nested/custom-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiFormCustomRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/form/nested/validation-rule-dxi.ts b/packages/devextreme-angular/src/ui/form/nested/validation-rule-dxi.ts index 9aca7dd04c21..8c5d3902ecaa 100644 --- a/packages/devextreme-angular/src/ui/form/nested/validation-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/form/nested/validation-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType, ComparisonOperator } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from 'devextreme/common'; import { DxIntegrationModule, @@ -94,10 +94,10 @@ export class DxiFormValidationRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/scheduler/nested/async-rule-dxi.ts b/packages/devextreme-angular/src/ui/scheduler/nested/async-rule-dxi.ts index 439c7bd5ddc3..8d10c206e148 100644 --- a/packages/devextreme-angular/src/ui/scheduler/nested/async-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/scheduler/nested/async-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiSchedulerAsyncRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any) { + get validationCallback(): ((options: ValidationCallbackData) => any) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)) { + set validationCallback(value: ((options: ValidationCallbackData) => any)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/scheduler/nested/custom-rule-dxi.ts b/packages/devextreme-angular/src/ui/scheduler/nested/custom-rule-dxi.ts index 0f96c4b432ab..d3604ba16a1a 100644 --- a/packages/devextreme-angular/src/ui/scheduler/nested/custom-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/scheduler/nested/custom-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiSchedulerCustomRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/scheduler/nested/validation-rule-dxi.ts b/packages/devextreme-angular/src/ui/scheduler/nested/validation-rule-dxi.ts index 30e70a0a0ec1..d30e7f9d10a0 100644 --- a/packages/devextreme-angular/src/ui/scheduler/nested/validation-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/scheduler/nested/validation-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType, ComparisonOperator } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from 'devextreme/common'; import { DxIntegrationModule, @@ -94,10 +94,10 @@ export class DxiSchedulerValidationRuleComponent extends CollectionNestedOption } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/tree-list/nested/async-rule-dxi.ts b/packages/devextreme-angular/src/ui/tree-list/nested/async-rule-dxi.ts index 52d59842ddfd..965b912ebb30 100644 --- a/packages/devextreme-angular/src/ui/tree-list/nested/async-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/tree-list/nested/async-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiTreeListAsyncRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any) { + get validationCallback(): ((options: ValidationCallbackData) => any) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)) { + set validationCallback(value: ((options: ValidationCallbackData) => any)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/tree-list/nested/custom-rule-dxi.ts b/packages/devextreme-angular/src/ui/tree-list/nested/custom-rule-dxi.ts index f227aca19255..5c4c0f0ee4e9 100644 --- a/packages/devextreme-angular/src/ui/tree-list/nested/custom-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/tree-list/nested/custom-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiTreeListCustomRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/tree-list/nested/validation-rule-dxi.ts b/packages/devextreme-angular/src/ui/tree-list/nested/validation-rule-dxi.ts index 5119c0ab22c6..82641586669a 100644 --- a/packages/devextreme-angular/src/ui/tree-list/nested/validation-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/tree-list/nested/validation-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType, ComparisonOperator } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from 'devextreme/common'; import { DxIntegrationModule, @@ -94,10 +94,10 @@ export class DxiTreeListValidationRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/validator/nested/async-rule-dxi.ts b/packages/devextreme-angular/src/ui/validator/nested/async-rule-dxi.ts index 559ac16e3eb1..1c97dde7c212 100644 --- a/packages/devextreme-angular/src/ui/validator/nested/async-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/validator/nested/async-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiValidatorAsyncRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any) { + get validationCallback(): ((options: ValidationCallbackData) => any) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)) { + set validationCallback(value: ((options: ValidationCallbackData) => any)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/validator/nested/custom-rule-dxi.ts b/packages/devextreme-angular/src/ui/validator/nested/custom-rule-dxi.ts index 45a1337f86ef..bf2607706c14 100644 --- a/packages/devextreme-angular/src/ui/validator/nested/custom-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/validator/nested/custom-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData } from 'devextreme/common'; import { DxIntegrationModule, @@ -70,10 +70,10 @@ export class DxiValidatorCustomRuleComponent extends CollectionNestedOption { } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-angular/src/ui/validator/nested/validation-rule-dxi.ts b/packages/devextreme-angular/src/ui/validator/nested/validation-rule-dxi.ts index e1e6524d03cb..eaa4d924b601 100644 --- a/packages/devextreme-angular/src/ui/validator/nested/validation-rule-dxi.ts +++ b/packages/devextreme-angular/src/ui/validator/nested/validation-rule-dxi.ts @@ -12,7 +12,7 @@ import { -import { ValidationRuleType, ComparisonOperator } from 'devextreme/common'; +import { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from 'devextreme/common'; import { DxIntegrationModule, @@ -94,10 +94,10 @@ export class DxiValidatorValidationRuleComponent extends CollectionNestedOption } @Input() - get validationCallback(): ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean) { + get validationCallback(): ((options: ValidationCallbackData) => boolean) { return this._getOption('validationCallback'); } - set validationCallback(value: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)) { + set validationCallback(value: ((options: ValidationCallbackData) => boolean)) { this._setOption('validationCallback', value); } diff --git a/packages/devextreme-react/src/card-view.ts b/packages/devextreme-react/src/card-view.ts index 3f34ceb24fca..6c778c27d5d1 100644 --- a/packages/devextreme-react/src/card-view.ts +++ b/packages/devextreme-react/src/card-view.ts @@ -11,7 +11,7 @@ import NestedOption from "./core/nested-option"; import type { CardClickEvent, CardDblClickEvent, CardInsertedEvent, CardInsertingEvent, CardPreparedEvent, CardRemovedEvent, CardRemovingEvent, CardUpdatedEvent, CardUpdatingEvent, ContextMenuPreparingEvent, EditCanceledEvent, EditCancelingEvent, EditingStartEvent, FieldCaptionClickEvent, FieldCaptionDblClickEvent, FieldCaptionPreparedEvent, FieldValueClickEvent, FieldValueDblClickEvent, FieldValuePreparedEvent, InitNewCardEvent, SavedEvent, SavingEvent, CardTemplateData, CardHeaderItem as CardViewCardHeaderItem, CardHeaderPredefinedItem, FieldTemplateData, ColumnTemplateData, EditingTexts as CardViewEditingTexts, PredefinedToolbarItem, dxCardViewToolbarItem } from "devextreme/ui/card_view"; import type { AnimationConfig, CollisionResolution, PositionConfig, AnimationState, AnimationType, CollisionResolutionCombination } from "devextreme/common/core/animation"; -import type { ValidationRuleType, HorizontalAlignment, VerticalAlignment, ButtonStyle, template, ButtonType, ToolbarItemLocation, ToolbarItemComponent, SearchMode, SingleMultipleOrNone, SelectAllMode, DataType, Format as CommonFormat, SortOrder, ComparisonOperator, DragHighlight, Mode, Direction, PositionAlignment, DisplayMode, ScrollbarMode, TabsIconPosition, TabsStyle, Position as CommonPosition } from "devextreme/common"; +import type { ValidationRuleType, ValidationCallbackData, HorizontalAlignment, VerticalAlignment, ButtonStyle, template, ButtonType, ToolbarItemLocation, ToolbarItemComponent, SearchMode, SingleMultipleOrNone, SelectAllMode, DataType, Format as CommonFormat, SortOrder, ComparisonOperator, DragHighlight, Mode, Direction, PositionAlignment, DisplayMode, ScrollbarMode, TabsIconPosition, TabsStyle, Position as CommonPosition } from "devextreme/common"; import type { dxButtonOptions, ClickEvent, ContentReadyEvent, DisposingEvent, InitializedEvent, OptionChangedEvent } from "devextreme/ui/button"; import type { FormItemType, FormPredefinedButtonItem, ContentReadyEvent as FormContentReadyEvent, DisposingEvent as FormDisposingEvent, InitializedEvent as FormInitializedEvent, OptionChangedEvent as FormOptionChangedEvent, dxFormSimpleItem, dxFormOptions, dxFormGroupItem, dxFormTabbedItem, dxFormEmptyItem, dxFormButtonItem, LabelLocation, FormLabelMode, EditorEnterKeyEvent, FieldDataChangedEvent, SmartPastedEvent, SmartPastingEvent, FormItemComponent } from "devextreme/ui/form"; import type { ContentReadyEvent as FilterBuilderContentReadyEvent, DisposingEvent as FilterBuilderDisposingEvent, InitializedEvent as FilterBuilderInitializedEvent, OptionChangedEvent as FilterBuilderOptionChangedEvent, dxFilterBuilderField, FieldInfo, FilterBuilderOperation, dxFilterBuilderCustomOperation, GroupOperation, EditorPreparedEvent, EditorPreparingEvent, ValueChangedEvent } from "devextreme/ui/filter_builder"; @@ -217,7 +217,7 @@ type IAsyncRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any); + validationCallback?: ((options: ValidationCallbackData) => any); }> const _componentAsyncRule = (props: IAsyncRuleProps) => { return React.createElement(NestedOption, { @@ -933,7 +933,7 @@ type ICustomRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); }> const _componentCustomRule = (props: ICustomRuleProps) => { return React.createElement(NestedOption, { @@ -2818,7 +2818,7 @@ type IValidationRuleProps = React.PropsWithChildren<{ max?: Date | number | string; min?: Date | number | string; reevaluate?: boolean; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); comparisonTarget?: (() => any); comparisonType?: ComparisonOperator; pattern?: RegExp | string; diff --git a/packages/devextreme-react/src/data-grid.ts b/packages/devextreme-react/src/data-grid.ts index c6236a7c60c3..e19e749437d8 100644 --- a/packages/devextreme-react/src/data-grid.ts +++ b/packages/devextreme-react/src/data-grid.ts @@ -11,7 +11,7 @@ import NestedOption from "./core/nested-option"; import type { dxDataGridColumn, AdaptiveDetailRowPreparingEvent, AIColumnRequestCreatingEvent, CellClickEvent, CellDblClickEvent, CellPreparedEvent, ContentReadyEvent, ContextMenuPreparingEvent, DataErrorOccurredEvent, DisposingEvent, EditCanceledEvent, EditCancelingEvent, EditingStartEvent, EditorPreparedEvent, EditorPreparingEvent, ExportingEvent, FocusedCellChangingEvent, FocusedRowChangingEvent, InitializedEvent, InitNewRowEvent, KeyDownEvent, RowClickEvent, RowCollapsedEvent, RowCollapsingEvent, RowDblClickEvent, RowExpandedEvent, RowExpandingEvent, RowInsertedEvent, RowInsertingEvent, RowPreparedEvent, RowRemovedEvent, RowRemovingEvent, RowUpdatedEvent, RowUpdatingEvent, RowValidatingEvent, SavedEvent, SavingEvent, ToolbarPreparingEvent, dxDataGridRowObject, DataGridPredefinedColumnButton, ColumnButtonClickEvent, dxDataGridColumnButton, DataGridCommandColumnType, SelectionSensitivity, DataGridExportFormat, DataGridPredefinedToolbarItem, DataGridScrollMode, dxDataGridToolbarItem } from "devextreme/ui/data_grid"; import type { DataChange, AIColumnMode, DataChangeType, ColumnAIOptions, FilterOperation, FilterType, FixedPosition, ColumnHeaderFilter as GridsColumnHeaderFilter, SelectedFilterOperation, ColumnChooserMode, ColumnChooserSearchConfig, ColumnChooserSelectionConfig, HeaderFilterGroupInterval, ColumnHeaderFilterSearchConfig, HeaderFilterSearchConfig, HeaderFilterTexts, SelectionColumnDisplayMode, GridsEditMode, NewRowPosition, GridsEditRefreshMode, StartEditAction, FilterPanel as GridsFilterPanel, FilterPanelTexts as GridsFilterPanelTexts, ApplyFilterMode, GroupExpandMode, SummaryType, EnterKeyAction, EnterKeyDirection, PagerPageSize, GridBase, DataRenderMode, StateStoreType } from "devextreme/common/grids"; -import type { Mode, ValidationRuleType, HorizontalAlignment, VerticalAlignment, template, TextEditorButtonLocation, DataType, Format as CommonFormat, SortOrder, SearchMode, ComparisonOperator, SingleMultipleOrNone, SelectAllMode, TextBoxPredefinedButton, TextEditorButton, LabelMode, MaskMode, EditorStyle, ValidationMessageMode, Position as CommonPosition, ValidationStatus, PositionAlignment, Direction, ToolbarItemLocation, ToolbarItemComponent, ButtonStyle, ButtonType, DisplayMode, DragDirection, DragHighlight, ScrollbarMode } from "devextreme/common"; +import type { Mode, ValidationRuleType, ValidationCallbackData, HorizontalAlignment, VerticalAlignment, template, TextEditorButtonLocation, DataType, Format as CommonFormat, SortOrder, SearchMode, ComparisonOperator, SingleMultipleOrNone, SelectAllMode, TextBoxPredefinedButton, TextEditorButton, LabelMode, MaskMode, EditorStyle, ValidationMessageMode, Position as CommonPosition, ValidationStatus, PositionAlignment, Direction, ToolbarItemLocation, ToolbarItemComponent, ButtonStyle, ButtonType, DisplayMode, DragDirection, DragHighlight, ScrollbarMode } from "devextreme/common"; import type { ContentReadyEvent as TextBoxContentReadyEvent, DisposingEvent as TextBoxDisposingEvent, InitializedEvent as TextBoxInitializedEvent, KeyDownEvent as TextBoxKeyDownEvent, dxTextBoxOptions, TextBoxType, ChangeEvent, CopyEvent, CutEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InputEvent, KeyUpEvent, OptionChangedEvent, PasteEvent, ValueChangedEvent } from "devextreme/ui/text_box"; import type { ContentReadyEvent as FilterBuilderContentReadyEvent, DisposingEvent as FilterBuilderDisposingEvent, EditorPreparedEvent as FilterBuilderEditorPreparedEvent, EditorPreparingEvent as FilterBuilderEditorPreparingEvent, InitializedEvent as FilterBuilderInitializedEvent, dxFilterBuilderField, FieldInfo, OptionChangedEvent as FilterBuilderOptionChangedEvent, ValueChangedEvent as FilterBuilderValueChangedEvent, FilterBuilderOperation, dxFilterBuilderCustomOperation, GroupOperation } from "devextreme/ui/filter_builder"; import type { ContentReadyEvent as FormContentReadyEvent, DisposingEvent as FormDisposingEvent, InitializedEvent as FormInitializedEvent, dxFormSimpleItem, dxFormOptions, OptionChangedEvent as FormOptionChangedEvent, dxFormGroupItem, dxFormTabbedItem, dxFormEmptyItem, dxFormButtonItem, LabelLocation, FormLabelMode, EditorEnterKeyEvent, FieldDataChangedEvent, SmartPastedEvent, SmartPastingEvent, FormItemComponent, FormItemType } from "devextreme/ui/form"; @@ -286,7 +286,7 @@ type IAsyncRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any); + validationCallback?: ((options: ValidationCallbackData) => any); }> const _componentAsyncRule = (props: IAsyncRuleProps) => { return React.createElement(NestedOption, { @@ -936,7 +936,7 @@ type ICustomRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); }> const _componentCustomRule = (props: ICustomRuleProps) => { return React.createElement(NestedOption, { @@ -3296,7 +3296,7 @@ type IValidationRuleProps = React.PropsWithChildren<{ max?: Date | number | string; min?: Date | number | string; reevaluate?: boolean; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); comparisonTarget?: (() => any); comparisonType?: ComparisonOperator; pattern?: RegExp | string; diff --git a/packages/devextreme-react/src/form.ts b/packages/devextreme-react/src/form.ts index 2630c3e67fce..afcfa38ade31 100644 --- a/packages/devextreme-react/src/form.ts +++ b/packages/devextreme-react/src/form.ts @@ -11,7 +11,7 @@ import NestedOption from "./core/nested-option"; import type { ContentReadyEvent, DisposingEvent, EditorEnterKeyEvent, InitializedEvent, SmartPastedEvent, SmartPastingEvent, FormItemType, FormPredefinedButtonItem, dxFormButtonItem, dxFormEmptyItem, dxFormGroupItem, dxFormSimpleItem, dxFormTabbedItem, FormItemComponent, LabelLocation } from "devextreme/ui/form"; import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, ClickEvent, OptionChangedEvent } from "devextreme/ui/button"; import type { ContentReadyEvent as TabPanelContentReadyEvent, DisposingEvent as TabPanelDisposingEvent, InitializedEvent as TabPanelInitializedEvent, OptionChangedEvent as TabPanelOptionChangedEvent, dxTabPanelOptions, dxTabPanelItem, ItemClickEvent, ItemContextMenuEvent, ItemHoldEvent, ItemRenderedEvent, SelectionChangedEvent, SelectionChangingEvent, TitleClickEvent, TitleHoldEvent, TitleRenderedEvent } from "devextreme/ui/tab_panel"; -import type { ValidationRuleType, HorizontalAlignment, VerticalAlignment, ButtonStyle, template, ButtonType, ComparisonOperator, TabsIconPosition, TabsStyle, Position } from "devextreme/common"; +import type { ValidationRuleType, ValidationCallbackData, HorizontalAlignment, VerticalAlignment, ButtonStyle, template, ButtonType, ComparisonOperator, TabsIconPosition, TabsStyle, Position } from "devextreme/common"; import type { CollectionWidgetItem } from "devextreme/ui/collection/ui.collection_widget.base"; import type { DataSourceOptions } from "devextreme/data/data_source"; import type { Store } from "devextreme/data/store"; @@ -114,7 +114,7 @@ type IAsyncRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any); + validationCallback?: ((options: ValidationCallbackData) => any); }> const _componentAsyncRule = (props: IAsyncRuleProps) => { return React.createElement(NestedOption, { @@ -270,7 +270,7 @@ type ICustomRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); }> const _componentCustomRule = (props: ICustomRuleProps) => { return React.createElement(NestedOption, { @@ -977,7 +977,7 @@ type IValidationRuleProps = React.PropsWithChildren<{ max?: Date | number | string; min?: Date | number | string; reevaluate?: boolean; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); comparisonTarget?: (() => any); comparisonType?: ComparisonOperator; pattern?: RegExp | string; diff --git a/packages/devextreme-react/src/scheduler.ts b/packages/devextreme-react/src/scheduler.ts index 79710070a0d1..ae4ef7c942c5 100644 --- a/packages/devextreme-react/src/scheduler.ts +++ b/packages/devextreme-react/src/scheduler.ts @@ -14,7 +14,7 @@ import type { ContentReadyEvent as FormContentReadyEvent, DisposingEvent as Form import type { ContentReadyEvent as ButtonGroupContentReadyEvent, DisposingEvent as ButtonGroupDisposingEvent, InitializedEvent as ButtonGroupInitializedEvent, OptionChangedEvent as ButtonGroupOptionChangedEvent, dxButtonGroupItem, ItemClickEvent, SelectionChangedEvent } from "devextreme/ui/button_group"; import type { ContentReadyEvent as TabPanelContentReadyEvent, DisposingEvent as TabPanelDisposingEvent, InitializedEvent as TabPanelInitializedEvent, OptionChangedEvent as TabPanelOptionChangedEvent, dxTabPanelOptions, ItemClickEvent as TabPanelItemClickEvent, SelectionChangedEvent as TabPanelSelectionChangedEvent, dxTabPanelItem, ItemContextMenuEvent, ItemHoldEvent, ItemRenderedEvent, SelectionChangingEvent, TitleClickEvent, TitleHoldEvent, TitleRenderedEvent } from "devextreme/ui/tab_panel"; import type { event } from "devextreme/events/events.types"; -import type { ValidationRuleType, HorizontalAlignment, VerticalAlignment, ButtonStyle, template, ButtonType, ComparisonOperator, Mode, ToolbarItemLocation, ToolbarItemComponent, SingleMultipleOrNone, ScrollMode, TabsIconPosition, TabsStyle, Position, FirstDayOfWeek, Orientation } from "devextreme/common"; +import type { ValidationRuleType, ValidationCallbackData, HorizontalAlignment, VerticalAlignment, ButtonStyle, template, ButtonType, ComparisonOperator, Mode, ToolbarItemLocation, ToolbarItemComponent, SingleMultipleOrNone, ScrollMode, TabsIconPosition, TabsStyle, Position, FirstDayOfWeek, Orientation } from "devextreme/common"; import type { AIIntegration } from "devextreme/common/ai-integration"; import type { CollectionWidgetItem } from "devextreme/ui/collection/ui.collection_widget.base"; import type { LocateInMenuMode, ShowTextMode } from "devextreme/ui/toolbar"; @@ -215,7 +215,7 @@ type IAsyncRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any); + validationCallback?: ((options: ValidationCallbackData) => any); }> const _componentAsyncRule = (props: IAsyncRuleProps) => { return React.createElement(NestedOption, { @@ -371,7 +371,7 @@ type ICustomRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); }> const _componentCustomRule = (props: ICustomRuleProps) => { return React.createElement(NestedOption, { @@ -1416,7 +1416,7 @@ type IValidationRuleProps = React.PropsWithChildren<{ max?: Date | number | string; min?: Date | number | string; reevaluate?: boolean; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); comparisonTarget?: (() => any); comparisonType?: ComparisonOperator; pattern?: RegExp | string; diff --git a/packages/devextreme-react/src/tree-list.ts b/packages/devextreme-react/src/tree-list.ts index d5e46bfc933e..484059d69ee9 100644 --- a/packages/devextreme-react/src/tree-list.ts +++ b/packages/devextreme-react/src/tree-list.ts @@ -17,7 +17,7 @@ import type { ContentReadyEvent as FormContentReadyEvent, DisposingEvent as Form import type { ContentReadyEvent as ButtonContentReadyEvent, DisposingEvent as ButtonDisposingEvent, InitializedEvent as ButtonInitializedEvent, dxButtonOptions, OptionChangedEvent as ButtonOptionChangedEvent, ClickEvent } from "devextreme/ui/button"; import type { AIIntegration } from "devextreme/common/ai-integration"; import type { AnimationConfig, CollisionResolution, PositionConfig, AnimationState, AnimationType, CollisionResolutionCombination } from "devextreme/common/core/animation"; -import type { ValidationRuleType, HorizontalAlignment, VerticalAlignment, template, TextEditorButtonLocation, DataType, Format as CommonFormat, SortOrder, SearchMode, ComparisonOperator, TextBoxPredefinedButton, TextEditorButton, LabelMode, MaskMode, EditorStyle, ValidationMessageMode, Position as CommonPosition, ValidationStatus, PositionAlignment, Mode, Direction, ToolbarItemLocation, ToolbarItemComponent, ButtonStyle, ButtonType, DisplayMode, DragDirection, DragHighlight, ScrollMode, ScrollbarMode, SingleMultipleOrNone } from "devextreme/common"; +import type { ValidationRuleType, ValidationCallbackData, HorizontalAlignment, VerticalAlignment, template, TextEditorButtonLocation, DataType, Format as CommonFormat, SortOrder, SearchMode, ComparisonOperator, TextBoxPredefinedButton, TextEditorButton, LabelMode, MaskMode, EditorStyle, ValidationMessageMode, Position as CommonPosition, ValidationStatus, PositionAlignment, Mode, Direction, ToolbarItemLocation, ToolbarItemComponent, ButtonStyle, ButtonType, DisplayMode, DragDirection, DragHighlight, ScrollMode, ScrollbarMode, SingleMultipleOrNone } from "devextreme/common"; import type { event } from "devextreme/events/events.types"; import type { Format as LocalizationFormat } from "devextreme/common/core/localization"; import type { DataSourceOptions } from "devextreme/data/data_source"; @@ -258,7 +258,7 @@ type IAsyncRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any); + validationCallback?: ((options: ValidationCallbackData) => any); }> const _componentAsyncRule = (props: IAsyncRuleProps) => { return React.createElement(NestedOption, { @@ -892,7 +892,7 @@ type ICustomRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); }> const _componentCustomRule = (props: ICustomRuleProps) => { return React.createElement(NestedOption, { @@ -2899,7 +2899,7 @@ type IValidationRuleProps = React.PropsWithChildren<{ max?: Date | number | string; min?: Date | number | string; reevaluate?: boolean; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); comparisonTarget?: (() => any); comparisonType?: ComparisonOperator; pattern?: RegExp | string; diff --git a/packages/devextreme-react/src/validator.ts b/packages/devextreme-react/src/validator.ts index 62d5991273d1..730f5cc387b0 100644 --- a/packages/devextreme-react/src/validator.ts +++ b/packages/devextreme-react/src/validator.ts @@ -10,7 +10,7 @@ import { IHtmlOptions, ComponentRef, NestedComponentMeta } from "./core/componen import NestedOption from "./core/nested-option"; import type { DisposingEvent, InitializedEvent, ValidatedEvent } from "devextreme/ui/validator"; -import type { ValidationRuleType, ComparisonOperator } from "devextreme/common"; +import type { ValidationRuleType, ValidationCallbackData, ComparisonOperator } from "devextreme/common"; type ReplaceFieldTypes = { [P in keyof TSource]: P extends keyof TReplacement ? TReplacement[P] : TSource[P]; @@ -105,7 +105,7 @@ type IAsyncRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any); + validationCallback?: ((options: ValidationCallbackData) => any); }> const _componentAsyncRule = (props: IAsyncRuleProps) => { return React.createElement(NestedOption, { @@ -157,7 +157,7 @@ type ICustomRuleProps = React.PropsWithChildren<{ message?: string; reevaluate?: boolean; type?: ValidationRuleType; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); }> const _componentCustomRule = (props: ICustomRuleProps) => { return React.createElement(NestedOption, { @@ -337,7 +337,7 @@ type IValidationRuleProps = React.PropsWithChildren<{ max?: Date | number | string; min?: Date | number | string; reevaluate?: boolean; - validationCallback?: ((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean); + validationCallback?: ((options: ValidationCallbackData) => boolean); comparisonTarget?: (() => any); comparisonType?: ComparisonOperator; pattern?: RegExp | string; diff --git a/packages/devextreme-vue/src/card-view.ts b/packages/devextreme-vue/src/card-view.ts index 83373a58575b..31dbd402f1e7 100644 --- a/packages/devextreme-vue/src/card-view.ts +++ b/packages/devextreme-vue/src/card-view.ts @@ -49,6 +49,7 @@ import { import { Mode, ValidationRuleType, + ValidationCallbackData, HorizontalAlignment, VerticalAlignment, ButtonStyle, @@ -548,7 +549,7 @@ const DxAsyncRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => any)> } }; @@ -1301,7 +1302,7 @@ const DxCustomRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; @@ -3259,7 +3260,7 @@ const DxValidationRuleConfig = { reevaluate: Boolean, trim: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; diff --git a/packages/devextreme-vue/src/data-grid.ts b/packages/devextreme-vue/src/data-grid.ts index 45465a450f76..50394590a457 100644 --- a/packages/devextreme-vue/src/data-grid.ts +++ b/packages/devextreme-vue/src/data-grid.ts @@ -112,6 +112,7 @@ import { import { Mode, ValidationRuleType, + ValidationCallbackData, HorizontalAlignment, VerticalAlignment, TextEditorButtonLocation, @@ -756,7 +757,7 @@ const DxAsyncRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => any)> } }; @@ -1435,7 +1436,7 @@ const DxCustomRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; @@ -4043,7 +4044,7 @@ const DxValidationRuleConfig = { reevaluate: Boolean, trim: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; diff --git a/packages/devextreme-vue/src/form.ts b/packages/devextreme-vue/src/form.ts index ae0b8dd12c24..4e2aa4394227 100644 --- a/packages/devextreme-vue/src/form.ts +++ b/packages/devextreme-vue/src/form.ts @@ -9,6 +9,7 @@ import { import { Mode, ValidationRuleType, + ValidationCallbackData, HorizontalAlignment, VerticalAlignment, ButtonStyle, @@ -274,7 +275,7 @@ const DxAsyncRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => any)> } }; @@ -458,7 +459,7 @@ const DxCustomRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; @@ -1153,7 +1154,7 @@ const DxValidationRuleConfig = { reevaluate: Boolean, trim: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; diff --git a/packages/devextreme-vue/src/scheduler.ts b/packages/devextreme-vue/src/scheduler.ts index 9118bd8c3e81..659009c89201 100644 --- a/packages/devextreme-vue/src/scheduler.ts +++ b/packages/devextreme-vue/src/scheduler.ts @@ -47,6 +47,7 @@ import { import { FirstDayOfWeek, ValidationRuleType, + ValidationCallbackData, HorizontalAlignment, VerticalAlignment, ButtonStyle, @@ -471,7 +472,7 @@ const DxAsyncRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => any)> } }; @@ -655,7 +656,7 @@ const DxCustomRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; @@ -1739,7 +1740,7 @@ const DxValidationRuleConfig = { reevaluate: Boolean, trim: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; diff --git a/packages/devextreme-vue/src/tree-list.ts b/packages/devextreme-vue/src/tree-list.ts index 1f7456478143..f450e9f87866 100644 --- a/packages/devextreme-vue/src/tree-list.ts +++ b/packages/devextreme-vue/src/tree-list.ts @@ -106,6 +106,7 @@ import { Mode, DataStructure, ValidationRuleType, + ValidationCallbackData, HorizontalAlignment, VerticalAlignment, TextEditorButtonLocation, @@ -744,7 +745,7 @@ const DxAsyncRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => any)> } }; @@ -1409,7 +1410,7 @@ const DxCustomRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; @@ -3655,7 +3656,7 @@ const DxValidationRuleConfig = { reevaluate: Boolean, trim: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; diff --git a/packages/devextreme-vue/src/validator.ts b/packages/devextreme-vue/src/validator.ts index 035a24eddc37..03ddd7ff7e7b 100644 --- a/packages/devextreme-vue/src/validator.ts +++ b/packages/devextreme-vue/src/validator.ts @@ -10,6 +10,7 @@ import { } from "devextreme/ui/validator"; import { ValidationRuleType, + ValidationCallbackData, ComparisonOperator, } from "devextreme/common"; import * as CommonTypes from "devextreme/common"; @@ -133,7 +134,7 @@ const DxAsyncRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => any)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => any)> } }; @@ -191,7 +192,7 @@ const DxCustomRuleConfig = { message: String, reevaluate: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; @@ -396,7 +397,7 @@ const DxValidationRuleConfig = { reevaluate: Boolean, trim: Boolean, type: String as PropType, - validationCallback: Function as PropType<((options: { column: Record, data: Record, formItem: Record, rule: Record, validator: Record, value: any }) => boolean)> + validationCallback: Function as PropType<((options: ValidationCallbackData) => boolean)> } }; diff --git a/packages/devextreme/js/common.d.ts b/packages/devextreme/js/common.d.ts index 2ac75ae9b8a8..701d3ff2fa01 100644 --- a/packages/devextreme/js/common.d.ts +++ b/packages/devextreme/js/common.d.ts @@ -57,13 +57,6 @@ export type AsyncRule = { /** * @docid * @type_function_return Promise - * @type_function_param1 options:object - * @type_function_param1_field value:any - * @type_function_param1_field rule:object - * @type_function_param1_field validator:object - * @type_function_param1_field data:object - * @type_function_param1_field column:object - * @type_function_param1_field formItem:object * @public */ validationCallback?: ((options: ValidationCallbackData) => PromiseLike); @@ -159,13 +152,6 @@ export type CustomRule = { type: 'custom'; /** * @docid - * @type_function_param1 options:object - * @type_function_param1_field value:any - * @type_function_param1_field rule:object - * @type_function_param1_field validator:object - * @type_function_param1_field data:object - * @type_function_param1_field column:object - * @type_function_param1_field formItem:object * @public */ validationCallback?: ((options: ValidationCallbackData) => boolean); @@ -812,15 +798,37 @@ export type ToolbarItemLocation = 'after' | 'before' | 'center'; export type TooltipShowMode = 'always' | 'onHover'; /** + * @docid * @public * @namespace DevExpress.common */ export type ValidationCallbackData = { + /** @docid */ value?: any; + /** + * @docid + * @type object + */ rule: any; + /** + * @docid + * @type object + */ validator: any; + /** + * @docid + * @type object + */ data?: any; + /** + * @docid + * @type object + */ column?: any; + /** + * @docid + * @type object + */ formItem?: any; }; diff --git a/packages/devextreme/ts/dx.all.d.ts b/packages/devextreme/ts/dx.all.d.ts index 4a7bc64f3a1c..5291c4c7318e 100644 --- a/packages/devextreme/ts/dx.all.d.ts +++ b/packages/devextreme/ts/dx.all.d.ts @@ -1724,12 +1724,33 @@ declare module DevExpress.common { | 'dxTextBox'; export type ToolbarItemLocation = 'after' | 'before' | 'center'; export type TooltipShowMode = 'always' | 'onHover'; + /** + * [descr:ValidationCallbackData] + */ export type ValidationCallbackData = { + /** + * [descr:ValidationCallbackData.value] + */ value?: any; + /** + * [descr:ValidationCallbackData.rule] + */ rule: any; + /** + * [descr:ValidationCallbackData.validator] + */ validator: any; + /** + * [descr:ValidationCallbackData.data] + */ data?: any; + /** + * [descr:ValidationCallbackData.column] + */ column?: any; + /** + * [descr:ValidationCallbackData.formItem] + */ formItem?: any; }; export type ValidationMessageMode = 'always' | 'auto';