Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: delete 'values' option and extend 'value' type in declaration #25494

Merged
merged 7 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
31 changes: 5 additions & 26 deletions packages/devextreme-angular/src/ui/calendar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,27 +478,14 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr

*/
@Input()
get value(): Date | number | string {
get value(): Date | number | string | Array<Date | number | string> {
return this._getOption('value');
}
set value(value: Date | number | string) {
set value(value: Date | number | string | Array<Date | number | string>) {
this._setOption('value', value);
}


/**
* [descr:dxCalendarOptions.values]

*/
@Input()
get values(): Array<Date | number | string> {
return this._getOption('values');
}
set values(value: Array<Date | number | string>) {
this._setOption('values', value);
}


/**
* [descr:WidgetOptions.visible]

Expand Down Expand Up @@ -804,14 +791,7 @@ export class DxCalendarComponent 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<Date | number | string>;

/**

* This member supports the internal infrastructure and is not intended to be used directly from your code.

*/
@Output() valuesChange: EventEmitter<Array<Date | number | string>>;
@Output() valueChange: EventEmitter<Date | number | string | Array<Date | number | string>>;

/**

Expand Down Expand Up @@ -903,7 +883,6 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr
{ emit: 'validationMessagePositionChange' },
{ emit: 'validationStatusChange' },
{ emit: 'valueChange' },
{ emit: 'valuesChange' },
{ emit: 'visibleChange' },
{ emit: 'weekNumberRuleChange' },
{ emit: 'widthChange' },
Expand Down Expand Up @@ -949,7 +928,7 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr
super.ngOnChanges(changes);
this.setupChanges('disabledDates', changes);
this.setupChanges('validationErrors', changes);
this.setupChanges('values', changes);
this.setupChanges('value', changes);
}

setupChanges(prop: string, changes: SimpleChanges) {
Expand All @@ -961,7 +940,7 @@ export class DxCalendarComponent extends DxComponent implements OnDestroy, Contr
ngDoCheck() {
this._idh.doCheck('disabledDates');
this._idh.doCheck('validationErrors');
this._idh.doCheck('values');
this._idh.doCheck('value');
this._watcherHelper.checkWatchers();
super.ngDoCheck();
super.clearChangedOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,20 +256,13 @@ export abstract class DxoCalendarOptions extends NestedOption {
this._setOption('validationStatus', value);
}

get value(): Date | number | string {
get value(): Date | number | string | Array<Date | number | string> {
return this._getOption('value');
}
set value(value: Date | number | string) {
set value(value: Date | number | string | Array<Date | number | string>) {
this._setOption('value', value);
}

get values(): Array<Date | number | string> {
return this._getOption('values');
}
set values(value: Array<Date | number | string>) {
this._setOption('values', value);
}

get visible(): boolean {
return this._getOption('visible');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import { DxoCalendarOptions } from './base/calendar-options';
'validationMessagePosition',
'validationStatus',
'value',
'values',
'visible',
'weekNumberRule',
'width',
Expand All @@ -79,7 +78,7 @@ export class DxoCalendarOptionsComponent extends DxoCalendarOptions implements O
* This member supports the internal infrastructure and is not intended to be used directly from your code.

*/
@Output() valueChange: EventEmitter<Date | number | string>;
@Output() valueChange: EventEmitter<Date | number | string | Array<Date | number | string>>;

/**

Expand Down
5 changes: 2 additions & 3 deletions packages/devextreme-react/src/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type ICalendarOptions = React.PropsWithChildren<ReplaceFieldTypes<Properties, IC
cellRender?: (...params: any) => React.ReactNode;
cellComponent?: React.ComponentType<any>;
cellKeyFn?: (data: any) => string;
defaultValue?: any | number | string;
defaultValue?: any | Array<any | number | string> | number | string;
defaultZoomLevel?: "century" | "decade" | "month" | "year";
onValueChange?: (value: any | number | string) => void;
onValueChange?: (value: any | Array<any | number | string> | number | string) => void;
onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void;
}>

Expand Down Expand Up @@ -138,7 +138,6 @@ class Calendar extends BaseComponent<React.PropsWithChildren<ICalendarOptions>>
"invalid",
"pending"])
]),
values: PropTypes.array,
visible: PropTypes.bool,
weekNumberRule: PropTypes.oneOfType([
PropTypes.string,
Expand Down
7 changes: 3 additions & 4 deletions packages/devextreme-react/src/date-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,13 @@ type ICalendarOptionsProps = React.PropsWithChildren<{
validationMessageMode?: "always" | "auto";
validationMessagePosition?: "bottom" | "left" | "right" | "top";
validationStatus?: "valid" | "invalid" | "pending";
value?: any | number | string;
values?: Array<any | number | string>;
value?: any | Array<any | number | string> | number | string;
visible?: boolean;
weekNumberRule?: "auto" | "firstDay" | "fullWeek" | "firstFourDays";
width?: (() => number | string) | number | string;
zoomLevel?: "century" | "decade" | "month" | "year";
defaultValue?: any | number | string;
onValueChange?: (value: any | number | string) => void;
defaultValue?: any | Array<any | number | string> | number | string;
onValueChange?: (value: any | Array<any | number | string> | number | string) => void;
defaultZoomLevel?: "century" | "decade" | "month" | "year";
onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void;
cellRender?: (...params: any) => React.ReactNode;
Expand Down
7 changes: 3 additions & 4 deletions packages/devextreme-react/src/date-range-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,13 @@ type ICalendarOptionsProps = React.PropsWithChildren<{
validationMessageMode?: "always" | "auto";
validationMessagePosition?: "bottom" | "left" | "right" | "top";
validationStatus?: "valid" | "invalid" | "pending";
value?: any | number | string;
values?: Array<any | number | string>;
value?: any | Array<any | number | string> | number | string;
visible?: boolean;
weekNumberRule?: "auto" | "firstDay" | "fullWeek" | "firstFourDays";
width?: (() => number | string) | number | string;
zoomLevel?: "century" | "decade" | "month" | "year";
defaultValue?: any | number | string;
onValueChange?: (value: any | number | string) => void;
defaultValue?: any | Array<any | number | string> | number | string;
onValueChange?: (value: any | Array<any | number | string> | number | string) => void;
defaultZoomLevel?: "century" | "decade" | "month" | "year";
onZoomLevelChange?: (value: "century" | "decade" | "month" | "year") => void;
cellRender?: (...params: any) => React.ReactNode;
Expand Down
3 changes: 0 additions & 3 deletions packages/devextreme-vue/src/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type AccessibleOptions = Pick<Properties,
"validationMessagePosition" |
"validationStatus" |
"value" |
"values" |
"visible" |
"weekNumberRule" |
"width" |
Expand Down Expand Up @@ -97,7 +96,6 @@ const DxCalendar = createComponent({
validationMessagePosition: String,
validationStatus: String,
value: {},
values: Array,
visible: Boolean,
weekNumberRule: String,
width: [Function, Number, String],
Expand Down Expand Up @@ -142,7 +140,6 @@ const DxCalendar = createComponent({
"update:validationMessagePosition": null,
"update:validationStatus": null,
"update:value": null,
"update:values": null,
"update:visible": null,
"update:weekNumberRule": null,
"update:width": null,
Expand Down
2 changes: 0 additions & 2 deletions packages/devextreme-vue/src/date-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ const DxCalendarOptions = createConfigurationComponent({
"update:validationMessagePosition": null,
"update:validationStatus": null,
"update:value": null,
"update:values": null,
"update:visible": null,
"update:weekNumberRule": null,
"update:width": null,
Expand Down Expand Up @@ -416,7 +415,6 @@ const DxCalendarOptions = createConfigurationComponent({
validationMessagePosition: String,
validationStatus: String,
value: {},
values: Array,
visible: Boolean,
weekNumberRule: String,
width: [Function, Number, String],
Expand Down
2 changes: 0 additions & 2 deletions packages/devextreme-vue/src/date-range-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ const DxCalendarOptions = createConfigurationComponent({
"update:validationMessagePosition": null,
"update:validationStatus": null,
"update:value": null,
"update:values": null,
"update:visible": null,
"update:weekNumberRule": null,
"update:width": null,
Expand Down Expand Up @@ -428,7 +427,6 @@ const DxCalendarOptions = createConfigurationComponent({
validationMessagePosition: String,
validationStatus: String,
value: {},
values: Array,
visible: Boolean,
weekNumberRule: String,
width: [Function, Number, String],
Expand Down
10 changes: 3 additions & 7 deletions packages/devextreme/js/ui/calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,11 @@ export interface dxCalendarOptions extends EditorOptions<dxCalendar> {
/**
* @docid
* @default null
* @default [] &for(multiple selection mode)
* @default [null,null] &for(range selection mode)
* @public
*/
value?: Date | number | string;
/**
* @docid
* @default []
* @public
*/
values?: Array<Date | number | string>;
value?: Date | number | string | Array<Date | number | string>;
/**
* @docid
* @default 'month'
Expand Down
6 changes: 1 addition & 5 deletions packages/devextreme/ts/dx.all.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9079,11 +9079,7 @@ declare module DevExpress.ui {
/**
* [descr:dxCalendarOptions.value]
*/
value?: Date | number | string;
/**
* [descr:dxCalendarOptions.values]
*/
values?: Array<Date | number | string>;
value?: Date | number | string | Array<Date | number | string>;
/**
* [descr:dxCalendarOptions.zoomLevel]
*/
Expand Down
Loading