Skip to content

Commit 1aa39c1

Browse files
committed
Add the showMaskOnHover option
1 parent 334fc2d commit 1aa39c1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/inputmask.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function init(Survey) {
1111
numericPlaceholder: "0",
1212
autoUnmask: true,
1313
clearIncomplete: true,
14+
showMaskOnHover: true,
1415
widgetIsLoaded: function () {
1516
return typeof Inputmask != "undefined";
1617
},
@@ -35,6 +36,11 @@ function init(Survey) {
3536
category: "general",
3637
default: true,
3738
},
39+
{
40+
name: "showMaskOnHover:boolean",
41+
category: "general",
42+
default: true,
43+
},
3844
{ name: "inputFormat", category: "general" },
3945
{
4046
name: "inputMask",
@@ -96,6 +102,9 @@ function init(Survey) {
96102
options.clearIncomplete = typeof surveyElement.clearIncomplete !== "undefined"
97103
? surveyElement.clearIncomplete
98104
: rootWidget.clearIncomplete;
105+
options.showMaskOnHover = typeof surveyElement.showMaskOnHover !== "undefined"
106+
? surveyElement.showMaskOnHover
107+
: rootWidget.showMaskOnHover;
99108
if (surveyElement.inputMask !== "none") {
100109
options.inputFormat = surveyElement.inputFormat;
101110
}
@@ -112,15 +121,14 @@ function init(Survey) {
112121
options.digitsOptional = rootWidget.numericDigitsOptional;
113122
options.prefix = surveyElement.prefix || "";
114123
options.suffix = surveyElement.suffix || "";
115-
options.placeholder = rootWidget.numericPlaceholder;
124+
options.placeholder = rootWidget.numericPlaceholder;
116125
}
117126
// if (surveyElement.inputMask == "datetime") {
118127
// mask = surveyElement.inputFormat;
119128
// }
120129
if (surveyElement.inputMask === "phone" && !!surveyElement.inputFormat) {
121130
mask = surveyElement.inputFormat;
122131
}
123-
124132
Inputmask(mask, options).mask(el);
125133

126134
el.onblur = function () {
@@ -138,7 +146,7 @@ function init(Survey) {
138146
customWidgetData.isNeedRender = true;
139147
};
140148

141-
var pushValueHandler = function () {
149+
var pushValueHandler = function () {
142150
if (!el.inputmask) return;
143151
if (el.inputmask.isComplete()) {
144152
surveyElement.value = options.autoUnmask
@@ -159,7 +167,7 @@ function init(Survey) {
159167
surveyElement.valueChangedCallback = updateHandler;
160168
updateHandler();
161169
},
162-
afterRender: function (question, el) {
170+
afterRender: function (question, el) {
163171
if (question.getType() != "multipletext") {
164172
var input = el.querySelector("input") || el;
165173
this.applyInputMask(question, input);

0 commit comments

Comments
 (0)