@maskito/kit
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -1001,2 +1001,19 @@ import { MASKITO_DEFAULT_OPTIONS, maskitoPipe } from '@maskito/core'; | ||
/** | ||
* It pads EMPTY integer part with zero if decimal parts exists. | ||
* It works on blur event only! | ||
* @example 1|,23 => Backspace => Blur => 0,23 | ||
*/ | ||
function createNotEmptyIntegerPlugin(decimalSeparator) { | ||
return maskitoEventHandler('blur', element => { | ||
const newValue = element.value.replace(new RegExp(`^(\\D+)?${escapeRegExp(decimalSeparator)}`), `$10${decimalSeparator}`); | ||
if (newValue !== element.value) { | ||
element.value = newValue; | ||
element.dispatchEvent(new Event('input')); | ||
} | ||
}); | ||
} | ||
/** | ||
* If `decimalZeroPadding` is `true`, it pads decimal part with zeroes | ||
@@ -1378,2 +1395,3 @@ * (until number of digits after decimalSeparator is equal to the `precision`). | ||
})), | ||
plugins: [createNotEmptyIntegerPlugin(decimalSeparator)], | ||
overwriteMode: decimalZeroPadding ? ({ | ||
@@ -1380,0 +1398,0 @@ value, |
@@ -1135,2 +1135,19 @@ (function (global, factory) { | ||
/** | ||
* It pads EMPTY integer part with zero if decimal parts exists. | ||
* It works on blur event only! | ||
* @example 1|,23 => Backspace => Blur => 0,23 | ||
*/ | ||
function createNotEmptyIntegerPlugin(decimalSeparator) { | ||
return maskitoEventHandler('blur', function (element) { | ||
var newValue = element.value.replace(new RegExp("^(\\D+)?" + escapeRegExp(decimalSeparator)), "$10" + decimalSeparator); | ||
if (newValue !== element.value) { | ||
element.value = newValue; | ||
element.dispatchEvent(new Event('input')); | ||
} | ||
}); | ||
} | ||
/** | ||
* If `decimalZeroPadding` is `true`, it pads decimal part with zeroes | ||
@@ -1540,2 +1557,3 @@ * (until number of digits after decimalSeparator is equal to the `precision`). | ||
})), | ||
plugins: [createNotEmptyIntegerPlugin(decimalSeparator)], | ||
overwriteMode: decimalZeroPadding ? function (_a) { | ||
@@ -1542,0 +1560,0 @@ var value = _a.value, |
{ | ||
"name": "@maskito/kit", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "The optional framework-agnostic Maskito's package with ready-to-use masks", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@maskito/core": "^0.13.0" | ||
"@maskito/core": "^0.14.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "main": "./index.umd.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162304
172
3170