From 9bdce6dd57981bb24d25bfb0d78fc00498f0eaf9 Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Wed, 7 Feb 2024 15:52:50 +0300 Subject: [PATCH] work for #4842 --- src/mask/mask_manager.ts | 2 +- src/mask/mask_number.ts | 2 +- src/mask/mask_pattern.ts | 13 +++++++------ src/mask/mask_settings.ts | 7 ++++++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/mask/mask_manager.ts b/src/mask/mask_manager.ts index 134e24a3f4..42a2b7a599 100644 --- a/src/mask/mask_manager.ts +++ b/src/mask/mask_manager.ts @@ -37,7 +37,7 @@ export class MaskManagerType { return new InputMaskBase(maskOption); } public getAllTypes(): Array { - var result = new Array(); + var result = ["none"]; for (var key in this.creatorHash) { result.push(key); } diff --git a/src/mask/mask_number.ts b/src/mask/mask_number.ts index c777f1debf..f231a3aae4 100644 --- a/src/mask/mask_number.ts +++ b/src/mask/mask_number.ts @@ -212,7 +212,7 @@ export class InputMaskNumber extends InputMaskBase { } public getNumberMaskedValue(src: string | number, matchWholeMask: boolean = false): string { - const input = src.toString(); + const input = (src === undefined || src === null) ? "" : src.toString(); const parsedNumber = this.parseNumber(input); const displayText = this.displayNumber(parsedNumber, true, matchWholeMask); return displayText; diff --git a/src/mask/mask_pattern.ts b/src/mask/mask_pattern.ts index fef3ee4d7b..37c9f4b194 100644 --- a/src/mask/mask_pattern.ts +++ b/src/mask/mask_pattern.ts @@ -39,7 +39,8 @@ function getFirstMatch(str: string, strIndex: number, literal: IMaskLiteral): nu return strIndex; } -export function getMaskedValueByPattern(str: string, pattern: string | Array, matchWholeMask:boolean): string { +export function getMaskedValueByPattern(src: string, pattern: string | Array, matchWholeMask:boolean): string { + const input = (src === undefined || src === null) ? "" : src; let result = ""; let strIndex = 0; const literals: Array = (typeof pattern === "string") ? getLiterals(pattern) : pattern; @@ -48,11 +49,11 @@ export function getMaskedValueByPattern(str: string, pattern: string | Array