Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fee8b61
TextEditorMask: Refactor and improve typing
Feb 13, 2026
d14c5a7
refactor(minor)
Feb 13, 2026
d4bb91d
fix
Feb 13, 2026
b13c81b
fix
Feb 13, 2026
cf4dd29
revert(all)
Feb 19, 2026
d38d407
feat(m_text_editor.mask.rule.ts): Improve typing
Feb 19, 2026
52fda5b
refactor(minors)
Feb 19, 2026
c9da3ed
fix(m_text_editor.mask.rule.ts): handle && first
Feb 19, 2026
d393746
feat(m_text_editor.mask.strategy.ts): Improve typing
Feb 19, 2026
955c46d
fix(te-masks): Revert some code pars
Feb 19, 2026
9422a16
refactor(m_text_editor.mask.rule.ts): small
Feb 19, 2026
bc51150
feat(m_text_editor.mask.ts): Improve typing
Feb 19, 2026
b971d25
refactor && fix()
Feb 20, 2026
fb538c9
Revert "refactor && fix()"
Feb 20, 2026
7b0dc37
Revert "feat(m_text_editor.mask.ts): Improve typing"
Feb 20, 2026
4d613d1
refactor(caretUtils)
Feb 20, 2026
deed400
refactor(buildInMaskRules)
Feb 20, 2026
3f6c64b
refactor(): Add type CaretDirection
Feb 20, 2026
2c731de
refactor(m_text_editor.mask.ts): Refactor without serios changes
Feb 20, 2026
47fc9fb
fix(date_box && drop_down_box): Add expect error
Feb 20, 2026
1639edc
refactor(supportedKeys)
Feb 20, 2026
9902b24
refactor(_getMaskRule)
Feb 20, 2026
fdaf150
fix(): Remove this.option() typo
Feb 20, 2026
84a66bb
refactor(_changeHandler): Add DxEvent type
Feb 20, 2026
71d5165
refactor(m_text_editor.mask.ts): Refactor without changes
Feb 20, 2026
aedc1be
refactor(): Import DxMouseWheelEvent
Feb 20, 2026
7942f0e
refactro(): Minors && Move back isDefine and use in _parseMaskRule
Feb 20, 2026
afe2401
refactro(): Finish _parseMaskRule
Feb 20, 2026
3325f56
refactor(): Update _valueChangeEventHandler
Feb 20, 2026
0fc73ae
refactor(_isControlKeyFired)
Feb 20, 2026
51bf464
refactor(_maskKeyHandler): keyHandler with Promis<string> and related
Feb 20, 2026
6daf5cb
refactor(): _changedValue, _textValue, _value
Feb 20, 2026
6b2bd56
fix(_valueChangeEventHandler): Params
Feb 20, 2026
6661179
refactor(_maskRulesChain): Improve type && Handle undefined
Feb 20, 2026
b382eef
refactor(_displayMask): Add finalCaret
Feb 20, 2026
c4dd045
refactor(_normalizeChainArguments): Use spread
Feb 20, 2026
b8cb5c8
refactor(_convertToValue): Use return
Feb 20, 2026
8ec870f
refactor(_caret)
Feb 20, 2026
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
11 changes: 9 additions & 2 deletions packages/devextreme/js/__internal/ui/date_box/date_box.mask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ class DateBoxMask extends DateBoxBase {
const caret = this._caret();
const { text = '' } = this.option();

return caret.end - caret.start === text.length;
const caretStart = caret?.start ?? 0;
const caretEnd = caret?.end ?? 0;

return caretEnd - caretStart === text.length;
}

_getFormatPattern(): string {
Expand Down Expand Up @@ -661,7 +664,10 @@ class DateBoxMask extends DateBoxBase {
this._loadMaskValue(this._maskValue);
const { text } = this.option();
if (text) {
this._activePartIndex = getDatePartIndexByPosition(this._dateParts, this._caret().start);
this._activePartIndex = getDatePartIndexByPosition(
this._dateParts,
this._caret()?.start ?? 0,
);

if (!this._isAllSelected()) {
this._clearSearchValue();
Expand All @@ -686,6 +692,7 @@ class DateBoxMask extends DateBoxBase {

_maskPasteHandler(e: DxEvent): void {
const { text } = this.option();
// @ts-expect-error text
Comment thread
marker-dao marked this conversation as resolved.
const newText = this._replaceSelectedText(text, this._caret(), clipboardText(e));
Comment thread
marker-dao marked this conversation as resolved.
const date = dateLocalization.parse(newText, this._getFormatPattern());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
this._caretTimeout = undefined;
const caret = this._caret();

if (caret.start === caret.end && this._useMaskBehavior()) {
if (caret?.start === caret?.end && this._useMaskBehavior()) {
const text = this._getInputVal();
const decimalSeparatorIndex = this._getTextSeparatorIndex(text);

Expand Down Expand Up @@ -254,8 +254,8 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
_removeHandler(e) {
const caret = this._caret();
const text = this._getInputVal();
let { start } = caret;
let { end } = caret;

let { start = 0, end = 0 } = caret ?? {};

this._lastKey = getChar(e);
this._lastKeyName = normalizeKeyName(e);
Expand All @@ -265,7 +265,11 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {

if (start === end) {
const caretPosition = start;
const canDelete = isBackspaceKey && caretPosition > 0 || isDeleteKey && caretPosition < text.length;

const canDelete = isBackspaceKey
&& caretPosition > 0
|| isDeleteKey
&& caretPosition < text.length;

if (canDelete) {
isDeleteKey && end++;
Expand Down Expand Up @@ -520,7 +524,7 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
const caret = this._caret();
const point = number.getDecimalSeparator();
const pointIndex = this._getTextSeparatorIndex(text);
const isCaretOnFloat = pointIndex >= 0 && pointIndex < caret.start;
const isCaretOnFloat = pointIndex >= 0 && pointIndex < (caret?.start ?? 0);
const textParts = this._removeStubs(text, true).split(point);

if (!isCaretOnFloat || textParts.length !== 2) {
Expand Down Expand Up @@ -702,7 +706,8 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
}

const caret = this._caret();
if (caret.start !== caret.end) {

if (caret?.start !== caret?.end) {
if (normalizeKeyName(e) === MINUS_KEY) {
this._applyRevertedSign(e, caret, true);
return;
Expand Down
Loading
Loading