Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/devextreme-angular/src/ui/autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,10 @@ export class DxAutocompleteComponent extends DxComponent implements OnDestroy, C

*/
@Input()
get value(): string {
get value(): null | string {
return this._getOption('value');
}
set value(value: string) {
set value(value: null | string) {
this._setOption('value', value);
}

Expand Down Expand Up @@ -1311,7 +1311,7 @@ export class DxAutocompleteComponent extends DxComponent implements OnDestroy, C
* This member supports the internal infrastructure and is not intended to be used directly from your code.

*/
@Output() valueChange: EventEmitter<string>;
@Output() valueChange: EventEmitter<null | string>;

/**

Expand Down
6 changes: 3 additions & 3 deletions packages/devextreme-angular/src/ui/color-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,10 @@ export class DxColorBoxComponent extends DxComponent implements OnDestroy, Contr

*/
@Input()
get value(): string {
get value(): null | string {
return this._getOption('value');
}
set value(value: string) {
set value(value: null | string) {
this._setOption('value', value);
}

Expand Down Expand Up @@ -1080,7 +1080,7 @@ export class DxColorBoxComponent extends DxComponent implements OnDestroy, Contr
* This member supports the internal infrastructure and is not intended to be used directly from your code.

*/
@Output() valueChange: EventEmitter<string>;
@Output() valueChange: EventEmitter<null | string>;

/**

Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-react/src/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ type IAutocompleteOptions = React.PropsWithChildren<ReplaceFieldTypes<Properties
itemRender?: (...params: any) => React.ReactNode;
itemComponent?: React.ComponentType<any>;
defaultOpened?: boolean;
defaultValue?: string;
defaultValue?: null | string;
onOpenedChange?: (value: boolean) => void;
onValueChange?: (value: string) => void;
onValueChange?: (value: null | string) => void;
}>

interface AutocompleteRef {
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-react/src/color-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ type IColorBoxOptions = React.PropsWithChildren<ReplaceFieldTypes<Properties, IC
fieldRender?: (...params: any) => React.ReactNode;
fieldComponent?: React.ComponentType<any>;
defaultOpened?: boolean;
defaultValue?: string;
defaultValue?: null | string;
onOpenedChange?: (value: boolean) => void;
onValueChange?: (value: string) => void;
onValueChange?: (value: null | string) => void;
}>

interface ColorBoxRef {
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-vue/src/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const componentConfig = {
validationMessageMode: String as PropType<ValidationMessageMode>,
validationMessagePosition: String as PropType<Mode | Position>,
validationStatus: String as PropType<ValidationStatus>,
value: String,
value: String as PropType<null | string>,
valueChangeEvent: String,
valueExpr: [Function, String] as PropType<(((item: any) => string | number | boolean)) | string>,
visible: Boolean,
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-vue/src/color-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const componentConfig = {
validationMessageMode: String as PropType<ValidationMessageMode>,
validationMessagePosition: String as PropType<Mode | Position>,
validationStatus: String as PropType<ValidationStatus>,
value: String,
value: String as PropType<null | string>,
visible: Boolean,
width: [Number, String]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class ColorBox extends DropDownEditor<ColorBoxProperties> {
const color = new Color(newValue);

if (color.colorIsInvalid) {
this._input().val(oldValue);
this._input().val(oldValue === null ? undefined : oldValue);
return;
}
// @ts-expect-error ts-error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const BLACK_COLOR = '#000000';
export interface ColorViewProperties extends EditorProperties {
keyStep?: number;

matchValue?: string;
matchValue?: string | null;

editAlphaChannel?: boolean;

Expand Down Expand Up @@ -299,7 +299,6 @@ class ColorView extends Editor<ColorViewProperties> {
return {
...super._getDefaultOptions(),
value: null,
// @ts-expect-error ts-error
matchValue: null,
onEnterKeyPressed: undefined,
editAlphaChannel: false,
Expand Down
6 changes: 3 additions & 3 deletions packages/devextreme/js/ui/autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ export interface dxAutocompleteOptions extends dxDropDownListOptions<dxAutocompl
* @default null
* @public
*/
value?: string;

value?: string | null;
/**
* @docid
* @type dxPopupOptions
Expand All @@ -230,8 +229,9 @@ export default class dxAutocomplete extends dxDropDownList<dxAutocompleteOptions
* @docid
* @publicName reset(value)
* @public
* @param1 value:string | null
*/
reset(value?: string | null): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme/js/ui/calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ export default class dxCalendar extends Editor<dxCalendarOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:Date|number|string|Array<Date|number|string|null>|null
* @param1 value:Date | number | string | Array<Date | number | string | null> | null
*/
reset(value?: DateLike | Array<Date | number | string | null>): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme/js/ui/check_box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ export default class dxCheckBox extends Editor<dxCheckBoxOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:boolean | null
*/
reset(value?: boolean | null | undefined): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
5 changes: 3 additions & 2 deletions packages/devextreme/js/ui/color_box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export interface dxColorBoxOptions extends dxDropDownEditorOptions<dxColorBox> {
* @docid
* @public
*/
value?: string;
value?: string | null;
/**
* @docid
* @type dxPopupOptions
Expand All @@ -228,8 +228,9 @@ export default class dxColorBox extends dxDropDownEditor<dxColorBoxOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:string | null
*/
reset(value?: string | null): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme/js/ui/date_box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import dxDropDownEditor, {

import {
ValueChangedInfo,
EditorValuableObject,
} from './editor/editor';

import {
Expand Down Expand Up @@ -366,7 +367,9 @@ export interface DateBoxBaseOptions<TComponent> extends dxDropDownEditorOptions<
* @hidden
* @options DateBoxBaseOptions
*/
export class DateBoxBase<TProperties = Properties> extends dxDropDownEditor<TProperties> {
export class DateBoxBase<
TProperties extends EditorValuableObject = Properties,
> extends dxDropDownEditor<TProperties> {
/**
* @docid
* @publicName close()
Expand All @@ -393,9 +396,9 @@ export default class dxDateBox extends DateBoxBase<Properties> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:Date|number|string|null
* @param1 value:Date | number | string | null
*/
reset(value?: DateLike): void;
reset(value?: Properties['value']): void;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/devextreme/js/ui/date_range_box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export type Properties = Omit<DateBoxBaseOptions<dxDateRangeBox>, 'inputAttr' |
startDateText?: string;
/**
* @docid dxDateRangeBoxOptions.value
* @type Array<Date|number|string|null>
* @type Array<Date | number | string | null>
* @default [null,null]
* @public
*/
Expand Down Expand Up @@ -335,8 +335,9 @@ export default class dxDateRangeBox extends DateRangeBoxBase {
* @docid
* @publicName reset(value)
* @public
* @param1 value:Array<Date | number | string | null>
*/
reset(value?: Array<Date | number | string | null>): void;
reset(value?: Properties['value']): void;
}

/// #DEBUG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
EventInfo,
} from '../../common/core/events';

import { EditorValuableObject } from '../editor/editor';

/** @public */
export type DropDownPredefinedButton = 'clear' | 'dropDown';

Expand Down Expand Up @@ -140,7 +142,9 @@ export interface dxDropDownEditorOptions<TComponent> extends Omit<dxTextBoxOptio
* @namespace DevExpress.ui
* @options dxDropDownEditorOptions
*/
export default class dxDropDownEditor<TProperties> extends dxTextBox<TProperties> {
export default class dxDropDownEditor<
TProperties extends EditorValuableObject = Properties,
> extends dxTextBox<TProperties> {
/**
* @docid
* @publicName close()
Expand All @@ -165,6 +169,13 @@ export default class dxDropDownEditor<TProperties> extends dxTextBox<TProperties
* @public
*/
open(): void;
/**
* @docid
* @publicName reset(value)
* @public
* @param1 value:any
*/
reset(value?: TProperties['value']): void;
}

interface DropDownEditorInstance extends dxDropDownEditor<Properties> { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {

import {
ValueChangedInfo,
EditorValuableObject,
} from '../editor/editor';

import {
Expand Down Expand Up @@ -186,6 +187,8 @@ export interface dxDropDownListOptions<TComponent> extends DataExpressionMixinOp
* @namespace DevExpress.ui
* @options dxDropDownListOptions
*/
export default class dxDropDownList<TProperties> extends dxDropDownEditor<TProperties> {
export default class dxDropDownList<
TProperties extends EditorValuableObject,
> extends dxDropDownEditor<TProperties> {
getDataSource(): DataSource;
}
16 changes: 13 additions & 3 deletions packages/devextreme/js/ui/editor/editor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,24 @@ export interface EditorOptions<TComponent> extends WidgetOptions<TComponent> {
*/
readonly isDirty?: boolean;
}

/**
* @docid
* @hidden
*/
export interface EditorValuableObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand this name. Why is this object valuable?

Copy link
Contributor Author

@marker-dao marker-dao Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it contains value. This utility interface with @hidden doctag ensures that all types that extend EditorValuableObject will contain a value field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I may not understand this to full extent, but believe me when I say that the current name is not it, even if it will be hidden.

I have a little pile of names for you to choose from. If you think one of them is okay, go on and rename. If not, I will come up with something else:
EditorHasValueObject
EditorWithValueObject
EditorValueHolderObject

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EditorOptionsWithValue

value?: unknown;
}

/**
* @docid
* @inherits Widget
* @hidden
* @namespace DevExpress.ui
*/
export default class Editor<TProperties = Properties> extends Widget<TProperties> {
export default class Editor<
TProperties extends EditorValuableObject = Properties,
> extends Widget<TProperties> {
/**
* @docid
* @publicName clear()
Expand All @@ -128,11 +139,10 @@ export default class Editor<TProperties = Properties> extends Widget<TProperties

/**
* @docid
* @type_function_param1 value:any
* @publicName reset(value)
* @public
*/
reset(value?: any): void;
reset(value?: TProperties['value']): void;
}

interface EditorInstance extends Editor<Properties> { }
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme/js/ui/file_uploader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,9 @@ export default class dxFileUploader extends Editor<dxFileUploaderOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:Array<File>
*/
reset(value?: Array<File>): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme/js/ui/number_box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@ export default class dxNumberBox extends dxTextEditor<dxNumberBoxOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:number
*/
reset(value?: number): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme/js/ui/progress_bar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ export default class dxProgressBar extends dxTrackBar<dxProgressBarOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:number | false
*/
reset(value?: Number | false): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme/js/ui/range_slider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ export default class dxRangeSlider extends dxTrackBar<dxRangeSliderOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:Array<number>
*/
reset(value?: Array<number>): void;
reset(value?: Properties['value']): void;
}

/** @public */
Expand Down
6 changes: 4 additions & 2 deletions packages/devextreme/js/ui/select_box.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import dxDropDownList, {

import {
ValueChangedInfo,
EditorValuableObject,
} from './editor/editor';

import {
Expand Down Expand Up @@ -271,7 +272,6 @@ export interface dxSelectBoxOptions<TComponent> extends dxDropDownListOptions<TC
* @public
*/
customItemCreateEvent?: string;

/**
* @docid
* @type dxPopupOptions
Expand All @@ -285,7 +285,9 @@ export interface dxSelectBoxOptions<TComponent> extends dxDropDownListOptions<TC
* @namespace DevExpress.ui
* @public
*/
export default class dxSelectBox<TProperties = Properties> extends dxDropDownList<TProperties> { }
export default class dxSelectBox<
TProperties extends EditorValuableObject = Properties,
> extends dxDropDownList<TProperties> { }

interface SelectBoxInstance extends dxSelectBox<Properties> { }

Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme/js/ui/slider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ export default class dxSlider extends dxTrackBar<dxSliderOptions> {
* @docid
* @publicName reset(value)
* @public
* @param1 value:number
*/
reset(value?: number): void;
reset(value?: Properties['value']): void;
}

/**
Expand Down
Loading
Loading