Skip to content

Commit

Permalink
Merge pull request #339 from surveyjs/bug/338-input-mask-multipletext
Browse files Browse the repository at this point in the history
Multiple Textboxes - The specified inputMask property is reset fix #338
  • Loading branch information
andrewtelnov authored Jan 3, 2024
2 parents ab1633a + f5af848 commit d00674b
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions src/inputmask.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import Inputmask from "inputmask";

function init(Survey) {
const updateColumnPropInfo = function (propJSON, name) {
const updateTextItemPropInfo = function (propJSON) {
const name = propJSON.name;
propJSON.onGetValue = (obj) => {
return obj.editor[name];
};
propJSON.onSetValue = (obj, val) => {
obj.editor[name] = val;
}
}
const updateColumnPropInfo = function (propJSON) {
const name = propJSON.name;
propJSON.visibleIf = (obj) => {
return obj.cellType === "text";
};
Expand Down Expand Up @@ -39,19 +49,22 @@ function init(Survey) {
if (Survey.Serializer.findProperty("text", "inputMask")) return;
var properties = [
{
name: "autoUnmask:boolean",
name: "autoUnmask",
type: "boolean",
category: "general",
showMode: "form",
default: true,
},
{
name: "clearIncomplete:boolean",
name: "clearIncomplete",
type: "boolean",
category: "general",
showMode: "form",
default: true,
},
{
name: "showMaskOnHover:boolean",
name: "showMaskOnHover",
type: "boolean",
category: "general",
showMode: "form",
default: true,
Expand Down Expand Up @@ -102,16 +115,18 @@ function init(Survey) {
},
];
Survey.Serializer.addProperties("text", properties);
properties.forEach(prop => {
if(prop.visible !== false) {
updateTextItemPropInfo(prop);
}
});
Survey.Serializer.addProperties("multipletextitem", properties);
updateColumnPropInfo(properties[0], "autoUnmask");
updateColumnPropInfo(properties[1], "clearIncomplete");
updateColumnPropInfo(properties[2], "showMaskOnHover");
updateColumnPropInfo(properties[3], "inputFormat");
updateColumnPropInfo(properties[4], "inputMask");
Survey.Serializer.addProperties(
"matrixdropdowncolumn",
properties
);
properties.forEach(prop => {
if(prop.visible !== false) {
updateColumnPropInfo(prop);
}
});
Survey.Serializer.addProperties("matrixdropdowncolumn", properties);
},
applyInputMask: function (surveyElement, el) {
var rootWidget = this;
Expand Down

0 comments on commit d00674b

Please sign in to comment.