Skip to content

Commit

Permalink
Input Mask for Text input questions #4842 - other library
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Novikov committed Oct 4, 2023
1 parent b55aa0a commit 3c0a137
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/question_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { QuestionTextBase } from "./question_textbase";
import { ExpressionRunner } from "./conditions";
import { SurveyModel } from "./survey";

import IMask from "imask";
import Inputmask from "inputmask";

/**
* A class that describes the Single-Line Input question type.
Expand Down Expand Up @@ -472,15 +472,10 @@ export class QuestionTextModel extends QuestionTextBase {

@property() mask: string;
private updateMaskInstance() {
if (!this.maskInstance) {
this.maskInstance = new IMask.InputMask(this.input, { mask: this.mask });
} else {
this.maskInstance.updateOptions({ mask: this.mask });
}
Inputmask(this.mask).mask(this.input);
}
private destroyMaskInstance() {
if (this.maskInstance) this.maskInstance.destroy();
this.maskInstance = null;
Inputmask.remove(this.input);
}
public afterRenderQuestionElement(el: HTMLElement) {
if (!!el) {
Expand Down

0 comments on commit 3c0a137

Please sign in to comment.