From 1aa39c193821f335ab9ecb6e9a753362806940a9 Mon Sep 17 00:00:00 2001 From: Jane Date: Mon, 14 Nov 2022 18:32:43 +0300 Subject: [PATCH] Add the showMaskOnHover option --- src/inputmask.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/inputmask.js b/src/inputmask.js index d6d4399c..7f516cce 100644 --- a/src/inputmask.js +++ b/src/inputmask.js @@ -11,6 +11,7 @@ function init(Survey) { numericPlaceholder: "0", autoUnmask: true, clearIncomplete: true, + showMaskOnHover: true, widgetIsLoaded: function () { return typeof Inputmask != "undefined"; }, @@ -35,6 +36,11 @@ function init(Survey) { category: "general", default: true, }, + { + name: "showMaskOnHover:boolean", + category: "general", + default: true, + }, { name: "inputFormat", category: "general" }, { name: "inputMask", @@ -96,6 +102,9 @@ function init(Survey) { options.clearIncomplete = typeof surveyElement.clearIncomplete !== "undefined" ? surveyElement.clearIncomplete : rootWidget.clearIncomplete; + options.showMaskOnHover = typeof surveyElement.showMaskOnHover !== "undefined" + ? surveyElement.showMaskOnHover + : rootWidget.showMaskOnHover; if (surveyElement.inputMask !== "none") { options.inputFormat = surveyElement.inputFormat; } @@ -112,7 +121,7 @@ function init(Survey) { options.digitsOptional = rootWidget.numericDigitsOptional; options.prefix = surveyElement.prefix || ""; options.suffix = surveyElement.suffix || ""; - options.placeholder = rootWidget.numericPlaceholder; + options.placeholder = rootWidget.numericPlaceholder; } // if (surveyElement.inputMask == "datetime") { // mask = surveyElement.inputFormat; @@ -120,7 +129,6 @@ function init(Survey) { if (surveyElement.inputMask === "phone" && !!surveyElement.inputFormat) { mask = surveyElement.inputFormat; } - Inputmask(mask, options).mask(el); el.onblur = function () { @@ -138,7 +146,7 @@ function init(Survey) { customWidgetData.isNeedRender = true; }; - var pushValueHandler = function () { + var pushValueHandler = function () { if (!el.inputmask) return; if (el.inputmask.isComplete()) { surveyElement.value = options.autoUnmask @@ -159,7 +167,7 @@ function init(Survey) { surveyElement.valueChangedCallback = updateHandler; updateHandler(); }, - afterRender: function (question, el) { + afterRender: function (question, el) { if (question.getType() != "multipletext") { var input = el.querySelector("input") || el; this.applyInputMask(question, input);