Skip to content

Commit b45b9e1

Browse files
authored
Merge branch '26_1' into implement_appt_hotkeys_26_1
2 parents 54409f5 + 87bc94e commit b45b9e1

File tree

57 files changed

+1322
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1322
-1196
lines changed

e2e/testcafe-devextreme/tests/dataGrid/common/filterRow/visual.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test.meta({
3232
showBorders: true,
3333
}));
3434

35-
test('FilterRow range overlay screenshot', async (t) => {
35+
test.meta({ unstable: true })('FilterRow range overlay screenshot', async (t) => {
3636
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
3737
const dataGrid = new DataGrid('#container');
3838
const filterEditor = dataGrid.getFilterEditor(1, FilterTextBox);

packages/devextreme/js/__internal/ui/calendar/calendar.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import type {
4747
} from './calendar.views';
4848
import Views from './calendar.views';
4949

50+
// STYLE calendar
51+
5052
const CALENDAR_CLASS = 'dx-calendar';
5153
const CALENDAR_BODY_CLASS = 'dx-calendar-body';
5254
const CALENDAR_CELL_CLASS = 'dx-calendar-cell';
@@ -561,7 +563,7 @@ class Calendar<
561563
const strategyName = this._getSelectionStrategyName();
562564
const strategy = SELECTION_STRATEGIES[strategyName];
563565

564-
if (!this._selectionStrategy || this._selectionStrategy.NAME !== strategyName) {
566+
if (this._selectionStrategy?.NAME !== strategyName) {
565567
// eslint-disable-next-line new-cap
566568
this._selectionStrategy = new strategy(this);
567569
}

packages/devextreme/js/__internal/ui/date_box/date_box.base.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { extend } from '@js/core/utils/extend';
1212
import { inputType } from '@js/core/utils/support';
1313
import { isDate as isDateType, isNumeric, isString } from '@js/core/utils/type';
1414
import { getWindow, hasWindow } from '@js/core/utils/window';
15-
import type { DxEvent } from '@js/events';
15+
import type { DxEvent, InteractionEvent } from '@js/events';
1616
import type {
1717
DateLike,
1818
DatePickerType,
@@ -23,7 +23,6 @@ import type { ToolbarItem } from '@js/ui/popup';
2323
import type { OptionChanged } from '@ts/core/widget/types';
2424
import DropDownEditor from '@ts/ui/drop_down_editor/m_drop_down_editor';
2525

26-
import type { ValueChangedEvent } from '../editor/editor';
2726
import type { PopupProperties } from '../popup/m_popup';
2827
import uiDateUtils from './date_utils';
2928
import Calendar from './m_date_box.strategy.calendar';
@@ -71,6 +70,7 @@ const STRATEGY_CLASSES = {
7170
};
7271

7372
export interface DateBoxBaseProperties extends Omit<Properties, 'onClosed' | 'onOpened'> {
73+
buttonsLocation?: string;
7474
emptyDateValue?: Date;
7575
_showValidationIcon?: boolean;
7676
}
@@ -84,7 +84,8 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
8484

8585
_userOptions?: DateBoxBaseProperties;
8686

87-
_supportedKeys(): Record<string, (e: KeyboardEvent) => void> {
87+
_supportedKeys(): Record<string, (e: KeyboardEvent) => boolean | undefined> {
88+
// @ts-expect-error ts-error
8889
return {
8990
...super._supportedKeys(),
9091
...this._strategy.supportedKeys(),
@@ -120,12 +121,13 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
120121
}
121122

122123
_defaultOptionsRules(): DefaultOptionsRule<DateBoxBaseProperties>[] {
123-
// @ts-expect-error ts-error
124124
return super._defaultOptionsRules().concat([
125125
{
126126
device: { platform: 'ios' },
127127
options: {
128-
'dropDownOptions.showTitle': true,
128+
dropDownOptions: {
129+
showTitle: true,
130+
},
129131
},
130132
},
131133
{
@@ -531,7 +533,9 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
531533
: uiDateUtils.FORMATS_MAP[mode] as string | null;
532534
}
533535

534-
_valueChangeEventHandler(e: ValueChangedEvent): void {
536+
_valueChangeEventHandler(
537+
e: InteractionEvent,
538+
): void {
535539
const { text, type = 'date', validationError } = this.option();
536540
const currentValue = this.getDateOption('value');
537541

@@ -548,7 +552,7 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
548552
if (this._applyInternalValidation(date).isValid) {
549553
const displayedText = this._getDisplayedText(newValue);
550554

551-
if (value && newValue && value.getTime() === newValue.getTime() && displayedText !== text) {
555+
if (value && value.getTime() === newValue?.getTime() && displayedText !== text) {
552556
this._renderValue();
553557
} else {
554558
this.dateValue(newValue, e);
@@ -577,7 +581,7 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
577581
_getParsedDate(text?: string): Date | undefined {
578582
const { displayFormat } = this.option();
579583
const strategyDisplayFormat = this._strategy.getDisplayFormat(displayFormat);
580-
const parsedText = this._strategy.getParsedText(text, strategyDisplayFormat);
584+
const parsedText = this._strategy.getParsedText(text, strategyDisplayFormat as string);
581585

582586
return parsedText ?? undefined;
583587
}
@@ -631,7 +635,9 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
631635
_isValueChanged(newValue: Date | null): boolean {
632636
const oldValue = this.getDateOption('value');
633637

638+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
634639
const oldTime = oldValue && oldValue.getTime();
640+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
635641
const newTime = newValue && newValue.getTime();
636642

637643
return oldTime !== newTime;
@@ -686,7 +692,7 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
686692
this._refresh();
687693
}
688694

689-
_applyButtonHandler(e: { event: ValueChangedEvent }): void {
695+
_applyButtonHandler(e: { event: InteractionEvent }): void {
690696
const value = this._strategy.getValue();
691697
this.dateValue(value, e.event);
692698

@@ -794,18 +800,22 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
794800
return undefined;
795801
}
796802

797-
return dateSerialization.getDateSerializationFormat(value) as string | undefined;
803+
return dateSerialization.getDateSerializationFormat(value) as string;
798804
}
799805

800806
_updateValue(value?: Date | null): void {
801807
super._updateValue();
802808
this._applyInternalValidation(value ?? this.getDateOption('value'));
803809
}
804810

805-
dateValue(value: Date | null, dxEvent?: ValueChangedEvent): void {
811+
dateValue(
812+
value: Date | null,
813+
dxEvent?: InteractionEvent | Event,
814+
): void {
806815
const isValueChanged = this._isValueChanged(value);
807816

808817
if (isValueChanged && dxEvent) {
818+
// @ts-expect-error editor's ValueChangedEvent should be extended
809819
this._saveValueChangeEvent(dxEvent);
810820
}
811821

packages/devextreme/js/__internal/ui/date_box/date_box.mask.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ import { fitIntoRange, inRange, sign } from '@js/core/utils/math';
1111
import {
1212
isDate, isDefined, isFunction, isString,
1313
} from '@js/core/utils/type';
14-
import type { DxEvent } from '@js/events';
14+
import type { DxEvent, InteractionEvent } from '@js/events';
1515
import type { DateLike, Properties } from '@js/ui/date_box';
1616
import dateLocalization from '@ts/core/localization/date';
1717
import type { OptionChanged } from '@ts/core/widget/types';
1818
import type { KeyboardKeyDownEvent } from '@ts/events/core/m_keyboard_processor';
1919

20-
import type { ValueChangedEvent } from '../editor/editor';
2120
import type { DxMouseWheelEvent } from '../scroll_view/types';
2221
import type { DateBoxBaseProperties } from './date_box.base';
2322
import DateBoxBase from './date_box.base';
@@ -47,14 +46,17 @@ class DateBoxMask extends DateBoxBase {
4746

4847
_formatPattern?: string | null;
4948

50-
_supportedKeys(): Record<string, (e: KeyboardEvent) => unknown> {
49+
_supportedKeys(): Record<string, (e: KeyboardEvent) => boolean | undefined> {
5150
const originalHandlers = super._supportedKeys();
52-
const callOriginalHandler = (e: KeyboardEvent): unknown => {
51+
const callOriginalHandler = (e: KeyboardEvent): boolean | undefined => {
5352
const normalizedKeyName = normalizeKeyName(e);
5453
const originalHandler = normalizedKeyName ? originalHandlers[normalizedKeyName] : undefined;
5554
return originalHandler?.apply(this, [e]);
5655
};
57-
const applyHandler = (e: KeyboardEvent, maskHandler: (e: KeyboardEvent) => void): unknown => {
56+
const applyHandler = (
57+
e: KeyboardEvent,
58+
maskHandler: (e: KeyboardEvent) => boolean | undefined,
59+
): boolean | undefined => {
5860
if (this._shouldUseOriginalHandler(e)) {
5961
return callOriginalHandler.apply(this, [e]);
6062
}
@@ -68,42 +70,52 @@ class DateBoxMask extends DateBoxBase {
6870
if (!this._isAllSelected()) {
6971
event.preventDefault();
7072
}
73+
return undefined;
7174
}),
7275
backspace: (e) => applyHandler(e, (event) => {
7376
this._revertPart(BACKWARD);
7477
if (!this._isAllSelected()) {
7578
event.preventDefault();
7679
}
80+
return undefined;
7781
}),
78-
home: (e) => applyHandler(e, (event): void => {
82+
home: (e) => applyHandler(e, (event) => {
7983
this._selectFirstPart();
8084
event.preventDefault();
85+
return undefined;
8186
}),
82-
end: (e) => applyHandler(e, (event): void => {
87+
end: (e) => applyHandler(e, (event) => {
8388
this._selectLastPart();
8489
event.preventDefault();
90+
return undefined;
8591
}),
8692
escape: (e) => applyHandler(e, () => {
8793
this._revertChanges();
94+
return undefined;
8895
}),
8996
enter: (e) => applyHandler(e, () => {
9097
this._enterHandler();
98+
return undefined;
9199
}),
92100
leftArrow: (e) => applyHandler(e, (event) => {
93101
this._selectNextPart(BACKWARD);
94102
event.preventDefault();
103+
return undefined;
95104
}),
96105
rightArrow: (e) => applyHandler(e, (event) => {
97106
this._selectNextPart(FORWARD);
98107
event.preventDefault();
108+
return undefined;
99109
}),
100110
upArrow: (e) => applyHandler(e, (event) => {
101111
this._upDownArrowHandler(FORWARD);
102112
event.preventDefault();
113+
return undefined;
103114
}),
104115
downArrow: (e) => applyHandler(e, (event) => {
105116
this._upDownArrowHandler(BACKWARD);
106117
event.preventDefault();
118+
return undefined;
107119
}),
108120
};
109121
}
@@ -726,10 +738,11 @@ class DateBoxMask extends DateBoxBase {
726738
}
727739
}
728740

729-
_valueChangeEventHandler(e: ValueChangedEvent): void {
741+
_valueChangeEventHandler(e: InteractionEvent): void {
730742
const { text } = this.option();
731743

732744
if (this._useMaskBehavior()) {
745+
// @ts-expect-error editor's ValueChangedEvent should be extended
733746
this._saveValueChangeEvent(e);
734747
if (!text) {
735748
this._maskValue = null;

packages/devextreme/js/__internal/ui/date_box/date_utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import dateLocalization from '@js/common/core/localization/date';
22
import $ from '@js/core/renderer';
33
import dateSerialization from '@js/core/utils/date_serialization';
44
import { isDate } from '@js/core/utils/type';
5+
import type { Format } from '@js/localization';
56
import type { DateLike, DateType } from '@js/ui/date_box';
67

78
const DATE_COMPONENTS = ['year', 'day', 'month', 'day'];
@@ -20,14 +21,14 @@ interface FormatInfo {
2021
components: DateComponentKey[];
2122
}
2223

23-
const getStringFormat = (format: string | { type: string }): string | null => {
24+
const getStringFormat = (format: Format): string | null | undefined => {
2425
const formatType = typeof format;
2526

2627
if (formatType === 'string') {
2728
return 'format';
2829
}
2930

30-
if (typeof format === 'object' && format.type !== undefined) {
31+
if (typeof format === 'object' && 'type' in format) {
3132
return format.type;
3233
}
3334

@@ -165,7 +166,7 @@ const dateUtils = {
165166
return dateLocalization.formatUsesDayName(format);
166167
},
167168

168-
getLongestDate(format: string, monthNames: string[], dayNames: string[]): Date {
169+
getLongestDate(format: Format, monthNames: string[], dayNames: string[]): Date {
169170
const stringFormat = getStringFormat(format);
170171
let month = 9;
171172

packages/devextreme/js/__internal/ui/date_box/date_view.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ class DateView extends Editor<DateViewProperties> {
106106
super._render();
107107
this.$element().addClass(DATEVIEW_CLASS);
108108

109-
const { type } = this.option();
109+
const { type = 'date' } = this.option();
110110

111-
this._toggleFormatClasses(type as string);
111+
this._toggleFormatClasses(type);
112112
this._toggleCompactClass();
113113
}
114114

0 commit comments

Comments
 (0)