intelicoreact 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -98,8 +98,8 @@ function InputMask2() {
|
|
|
98
98
|
_ref$returnMaskedValu = _ref.returnMaskedValue,
|
|
99
99
|
returnMaskedValue = _ref$returnMaskedValu === void 0 ? false : _ref$returnMaskedValu,
|
|
100
100
|
name = _ref.name,
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
disabled = _ref.disabled,
|
|
102
|
+
testId = _ref.testId;
|
|
103
103
|
|
|
104
104
|
var errors = _objectSpread(_objectSpread({}, _config.DEFAULT_ERRORS), customErrors);
|
|
105
105
|
|
|
@@ -416,7 +416,7 @@ function InputMask2() {
|
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
var onKeyDown = function onKeyDown(e) {
|
|
419
|
-
var _getCharByIndex2,
|
|
419
|
+
var _getCharByIndex2, _getCharByIndex4;
|
|
420
420
|
|
|
421
421
|
onKeyDownProp === null || onKeyDownProp === void 0 ? void 0 : onKeyDownProp(e);
|
|
422
422
|
var keyCode = e.keyCode;
|
|
@@ -427,19 +427,14 @@ function InputMask2() {
|
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
if (keyCode
|
|
431
|
-
setCursor(cursor);
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if (keyCode !== 8 && keyCode !== 37 && (_getCharByIndex3 = getCharByIndex(cursor)) !== null && _getCharByIndex3 !== void 0 && _getCharByIndex3.isSpecialSymbol) {
|
|
430
|
+
if (keyCode !== 8 && keyCode !== 37 && (_getCharByIndex2 = getCharByIndex(cursor)) !== null && _getCharByIndex2 !== void 0 && _getCharByIndex2.isSpecialSymbol) {
|
|
436
431
|
if (keyCode === 46) {
|
|
437
432
|
e.preventDefault();
|
|
438
433
|
e.stopPropagation();
|
|
439
434
|
}
|
|
440
435
|
|
|
441
|
-
while ((
|
|
442
|
-
var
|
|
436
|
+
while ((_getCharByIndex3 = getCharByIndex(cursor)) !== null && _getCharByIndex3 !== void 0 && _getCharByIndex3.isSpecialSymbol && cursor <= maxEditableIndex) {
|
|
437
|
+
var _getCharByIndex3;
|
|
443
438
|
|
|
444
439
|
++cursor;
|
|
445
440
|
}
|
|
@@ -448,12 +443,12 @@ function InputMask2() {
|
|
|
448
443
|
return;
|
|
449
444
|
}
|
|
450
445
|
|
|
451
|
-
if (keyCode === 8 && (
|
|
446
|
+
if (keyCode === 8 && (_getCharByIndex4 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex4 !== void 0 && _getCharByIndex4.isSpecialSymbol) {
|
|
452
447
|
e.preventDefault();
|
|
453
448
|
e.stopPropagation();
|
|
454
449
|
|
|
455
|
-
while ((
|
|
456
|
-
var
|
|
450
|
+
while ((_getCharByIndex5 = getCharByIndex(cursor - 1)) !== null && _getCharByIndex5 !== void 0 && _getCharByIndex5.isSpecialSymbol && cursor > 0) {
|
|
451
|
+
var _getCharByIndex5;
|
|
457
452
|
|
|
458
453
|
--cursor;
|
|
459
454
|
}
|
|
@@ -486,8 +481,6 @@ function InputMask2() {
|
|
|
486
481
|
};
|
|
487
482
|
|
|
488
483
|
var _onFocus = function onFocus(e) {
|
|
489
|
-
var cursor = e.target.selectionStart;
|
|
490
|
-
setCursorPos(cursor);
|
|
491
484
|
setFocused(true);
|
|
492
485
|
onFocusProp();
|
|
493
486
|
};
|
|
@@ -500,10 +493,6 @@ function InputMask2() {
|
|
|
500
493
|
var onClick = function onClick(e) {
|
|
501
494
|
var cursor = e.target.selectionStart;
|
|
502
495
|
if (cursor >= maxEditableIndex) setCursor(maxEditableIndex);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
var handleChange = function handleChange(e) {
|
|
506
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
507
496
|
}; // GENERAL EVENT HANDLERS | END //
|
|
508
497
|
/// --- OBSERVERS ---///
|
|
509
498
|
// Render Mask
|
|
@@ -529,7 +518,7 @@ function InputMask2() {
|
|
|
529
518
|
setMaskRendered(true);
|
|
530
519
|
}, [maskPattern]);
|
|
531
520
|
(0, _react.useEffect)(function () {
|
|
532
|
-
if (
|
|
521
|
+
if (isMaskRendered && !isInitValue || value === '' && value !== getInputValue()) {
|
|
533
522
|
setValue(value);
|
|
534
523
|
setIsInitValue(true);
|
|
535
524
|
}
|
|
@@ -632,7 +621,7 @@ function InputMask2() {
|
|
|
632
621
|
className: "input-mask_input ".concat(className),
|
|
633
622
|
ref: inputRef,
|
|
634
623
|
value: inputValue,
|
|
635
|
-
onChange:
|
|
624
|
+
onChange: onChange,
|
|
636
625
|
onKeyDown: onKeyDown,
|
|
637
626
|
onKeyUp: onKeyUp,
|
|
638
627
|
onBlur: onBlur,
|