diff --git a/packages/devextreme-angular/src/ui/validator/index.ts b/packages/devextreme-angular/src/ui/validator/index.ts index e2a7c2a6f7db..1c5539dbdb3d 100644 --- a/packages/devextreme-angular/src/ui/validator/index.ts +++ b/packages/devextreme-angular/src/ui/validator/index.ts @@ -26,7 +26,7 @@ import { import * as CommonTypes from 'devextreme/common'; -import { EventInfo } from 'devextreme/common/core/events'; +import { DisposingEvent, InitializedEvent, OptionChangedEvent } from 'devextreme/ui/validator'; import DxValidator from 'devextreme/ui/validator'; @@ -179,27 +179,27 @@ export class DxValidatorComponent extends DxComponentExtension implements OnDest /** - * [descr:DOMComponentOptions.onDisposing] + * [descr:dxValidatorOptions.onDisposing] */ - @Output() onDisposing: EventEmitter>; + @Output() onDisposing: EventEmitter; /** - * [descr:ComponentOptions.onInitialized] + * [descr:dxValidatorOptions.onInitialized] */ - @Output() onInitialized: EventEmitter; + @Output() onInitialized: EventEmitter; /** - * [descr:DOMComponentOptions.onOptionChanged] + * [descr:dxValidatorOptions.onOptionChanged] */ - @Output() onOptionChanged: EventEmitter; + @Output() onOptionChanged: EventEmitter; /** diff --git a/packages/devextreme-react/src/validator.ts b/packages/devextreme-react/src/validator.ts index 89da2743ea1f..dd1b41117078 100644 --- a/packages/devextreme-react/src/validator.ts +++ b/packages/devextreme-react/src/validator.ts @@ -9,9 +9,19 @@ import { ExtensionComponent as BaseComponent } from "./core/extension-component" import { IHtmlOptions, ComponentRef, NestedComponentMeta } from "./core/component"; import NestedOption from "./core/nested-option"; +import type { DisposingEvent, InitializedEvent } from "devextreme/ui/validator"; import type { ValidationRuleType, ComparisonOperator } from "devextreme/common"; -type IValidatorOptions = React.PropsWithChildren +type ReplaceFieldTypes = { + [P in keyof TSource]: P extends keyof TReplacement ? TReplacement[P] : TSource[P]; +} + +type IValidatorOptionsNarrowedEvents = { + onDisposing?: ((e: DisposingEvent) => void); + onInitialized?: ((e: InitializedEvent) => void); +} + +type IValidatorOptions = React.PropsWithChildren & IHtmlOptions> interface ValidatorRef { instance: () => dxValidator; diff --git a/packages/devextreme-vue/src/validator.ts b/packages/devextreme-vue/src/validator.ts index 5b5dc4c0686b..4c64f0e720b7 100644 --- a/packages/devextreme-vue/src/validator.ts +++ b/packages/devextreme-vue/src/validator.ts @@ -2,13 +2,11 @@ import { PropType } from "vue"; import { defineComponent } from "vue"; import { prepareExtensionComponentConfig } from "./core/index"; import Validator, { Properties } from "devextreme/ui/validator"; -import DOMComponent from "devextreme/core/dom_component"; import { - EventInfo, -} from "devextreme/common/core/events"; -import { - Component, -} from "devextreme/core/component"; + DisposingEvent, + InitializedEvent, + OptionChangedEvent, +} from "devextreme/ui/validator"; import { ValidationStatus, ValidationRuleType, @@ -41,9 +39,9 @@ const componentConfig = { elementAttr: Object as PropType>, height: [Function, Number, String] as PropType<((() => number | string)) | number | string>, name: String, - onDisposing: Function as PropType<((e: EventInfo) => void)>, - onInitialized: Function as PropType<((e: { component: Component, element: any }) => void)>, - onOptionChanged: Function as PropType<((e: { component: DOMComponent, element: any, fullName: string, model: any, name: string, previousValue: any, value: any }) => void)>, + onDisposing: Function as PropType<((e: DisposingEvent) => void)>, + onInitialized: Function as PropType<((e: InitializedEvent) => void)>, + onOptionChanged: Function as PropType<((e: OptionChangedEvent) => void)>, onValidated: Function as PropType<((validatedInfo: { brokenRule: CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule | CommonTypes.ValidationRule, brokenRules: Array, isValid: boolean, name: string, status: ValidationStatus, validationRules: Array, value: Record }) => void)>, validationGroup: String, validationRules: Array as PropType>,