Skip to content

Commit a238d50

Browse files
author
marker dao ®
committed
TextEditorBase: Improve typing && Refactor
1 parent 5b32aa7 commit a238d50

5 files changed

Lines changed: 182 additions & 119 deletions

File tree

packages/devextreme/js/__internal/ui/chat/message_box/chat_text_area.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ class ChatTextArea extends TextArea<Properties> {
427427
return maxHeight;
428428
}
429429

430-
_keyPressHandler(e: InputEvent): void {
430+
_keyPressHandler(e: { originalEvent: InputEvent & KeyboardEvent }): void {
431431
super._keyPressHandler(e);
432432

433433
this._toggleButtonDisableState();

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable class-methods-use-this */
21
import dateLocalization from '@js/common/core/localization/date';
32
import messageLocalization from '@js/common/core/localization/message';
43
import config from '@js/core/config';
@@ -13,7 +12,6 @@ import { extend } from '@js/core/utils/extend';
1312
import { inputType } from '@js/core/utils/support';
1413
import { isDate as isDateType, isNumeric, isString } from '@js/core/utils/type';
1514
import { getWindow, hasWindow } from '@js/core/utils/window';
16-
import type { DxEvent } from '@js/events';
1715
import type {
1816
DateLike,
1917
DatePickerType,
@@ -23,8 +21,8 @@ import type {
2321
import type { ToolbarItem } from '@js/ui/popup';
2422
import type { OptionChanged } from '@ts/core/widget/types';
2523
import DropDownEditor from '@ts/ui/drop_down_editor/m_drop_down_editor';
24+
import type { ValueChangedEvent } from '@ts/ui/editor/editor';
2625

27-
import type { ValueChangedEvent } from '../editor/editor';
2826
import type { PopupProperties } from '../popup/m_popup';
2927
import uiDateUtils from './date_utils';
3028
import Calendar from './m_date_box.strategy.calendar';
@@ -208,7 +206,7 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
208206
const strategyName = this._getStrategyName(this._getFormatType());
209207
const strategy = STRATEGY_CLASSES[strategyName];
210208

211-
if (!(this._strategy && this._strategy.NAME === strategyName)) {
209+
if (!(this._strategy?.NAME === strategyName)) {
212210
// eslint-disable-next-line new-cap
213211
this._strategy = new strategy(this);
214212
}
@@ -465,7 +463,7 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
465463
}
466464
}
467465

468-
_clearValueHandler(e: DxEvent): void {
466+
_clearValueHandler(e: ValueChangedEvent & { stopPropagation: () => void }): void {
469467
this.option('text', '');
470468
super._clearValueHandler(e);
471469
}
@@ -549,7 +547,7 @@ class DateBox extends DropDownEditor<DateBoxBaseProperties> {
549547
if (this._applyInternalValidation(date).isValid) {
550548
const displayedText = this._getDisplayedText(newValue);
551549

552-
if (value && newValue && value.getTime() === newValue.getTime() && displayedText !== text) {
550+
if (value && value.getTime() === newValue?.getTime() && displayedText !== text) {
553551
this._renderValue();
554552
} else {
555553
this.dateValue(newValue, e);

0 commit comments

Comments
 (0)