|
|
@@ -7,13 +7,13 @@ import {
|
|
|
seekPrevious,
|
|
|
translatePosition
|
|
|
} from "./positioning";
|
|
|
-import {keyCode, keys} from "./keycode.js";
|
|
|
-import {iemobile, iphone} from "./environment";
|
|
|
-import {handleRemove, isComplete, isSelection, isValid} from "./validation";
|
|
|
-import {applyInputValue, checkVal, clearOptionalTail, HandleNativePlaceholder, writeBuffer} from "./inputHandling";
|
|
|
-import {getPlaceholder, getTest} from "./validation-tests";
|
|
|
+import { keyCode, keys } from "./keycode.js";
|
|
|
+import { iemobile, iphone } from "./environment";
|
|
|
+import { handleRemove, isComplete, isSelection, isValid } from "./validation";
|
|
|
+import { applyInputValue, checkVal, clearOptionalTail, HandleNativePlaceholder, writeBuffer } from "./inputHandling";
|
|
|
+import { getPlaceholder, getTest } from "./validation-tests";
|
|
|
|
|
|
-export {EventHandlers};
|
|
|
+export { EventHandlers };
|
|
|
|
|
|
var EventHandlers = {
|
|
|
keyEvent: function (e, checkval, writeOut, strict, ndx) {
|
|
|
@@ -116,9 +116,9 @@ var EventHandlers = {
|
|
|
//special treat the decimal separator
|
|
|
// if ((k === 44 || k === 46) && e.location === 3 && opts.radixPoint !== "") k = opts.radixPoint.charCodeAt(0);
|
|
|
var pos = checkval ? {
|
|
|
- begin: ndx,
|
|
|
- end: ndx
|
|
|
- } : caret.call(inputmask, input),
|
|
|
+ begin: ndx,
|
|
|
+ end: ndx
|
|
|
+ } : caret.call(inputmask, input),
|
|
|
forwardPosition;
|
|
|
|
|
|
//allow for character substitution
|
|
|
@@ -151,14 +151,6 @@ var EventHandlers = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- keyupEvent: function (e) {
|
|
|
- const inputmask = this.inputmask;
|
|
|
-
|
|
|
- if (inputmask.isComposing) {
|
|
|
- if (e.keyCode === keyCode.KEY_229 || e.key === keys.Enter)
|
|
|
- inputmask.$el.trigger("input");
|
|
|
- }
|
|
|
- },
|
|
|
pasteEvent: function (e) {
|
|
|
const inputmask = this.inputmask, opts = inputmask.opts;
|
|
|
|
|
|
@@ -312,8 +304,11 @@ var EventHandlers = {
|
|
|
|
|
|
if (buffer !== inputValue) {
|
|
|
inputValue = ieMobileHandler(input, inputValue, caretPos);
|
|
|
-
|
|
|
- var changes = analyseChanges(inputValue, buffer, caretPos);
|
|
|
+ var changes = e.inputType ? {
|
|
|
+ action: "",
|
|
|
+ data: inputValue.split(""),
|
|
|
+ caret: caretPos
|
|
|
+ } : analyseChanges(inputValue, buffer, caretPos);
|
|
|
|
|
|
// console.log(JSON.stringify(changes));
|
|
|
if ((input.inputmask.shadowRoot || input.ownerDocument).activeElement !== input) {
|
|
|
@@ -341,18 +336,13 @@ var EventHandlers = {
|
|
|
break;
|
|
|
default:
|
|
|
applyInputValue(input, inputValue);
|
|
|
+ caret.call(inputmask, input, caretPos.begin, caretPos.end, true);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
e.preventDefault();
|
|
|
}
|
|
|
},
|
|
|
- compositionendEvent: function (e) {
|
|
|
- const inputmask = this.inputmask;
|
|
|
-
|
|
|
- inputmask.isComposing = false;
|
|
|
- inputmask.$el.trigger("input");
|
|
|
- },
|
|
|
setValueEvent: function (e) {
|
|
|
const inputmask = this.inputmask;
|
|
|
var input = this,
|
|
|
@@ -428,7 +418,7 @@ var EventHandlers = {
|
|
|
},
|
|
|
blurEvent: function (e) {
|
|
|
const inputmask = this.inputmask, opts = inputmask.opts, $ = inputmask.dependencyLib;
|
|
|
- inputmask.clicked=0;
|
|
|
+ inputmask.clicked = 0;
|
|
|
|
|
|
var $input = $(this),
|
|
|
input = this;
|