@maskito/kit
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1329,2 +1329,25 @@ import { MASKITO_DEFAULT_OPTIONS, maskitoTransform } from '@maskito/core'; | ||
/** | ||
* It rejects new typed decimal separator if it already exists in text field. | ||
* Behaviour is similar to native <input type="number"> (Chrome). | ||
* @example 1|23,45 => Press comma (decimal separator) => 1|23,45 (do nothing). | ||
*/ | ||
function createRepeatedDecimalSeparatorPreprocessor(decimalSeparator) { | ||
return ({ | ||
elementState, | ||
data | ||
}) => { | ||
const { | ||
value, | ||
selection | ||
} = elementState; | ||
const [from, to] = selection; | ||
return { | ||
elementState, | ||
data: !value.includes(decimalSeparator) || value.slice(from, to + 1).includes(decimalSeparator) ? data : data.replace(new RegExp(escapeRegExp(decimalSeparator), 'gi'), '') | ||
}; | ||
}; | ||
} | ||
/** | ||
* It adds symbol for separating thousands. | ||
@@ -1456,3 +1479,3 @@ * @example 1000000 => (thousandSeparator is equal to space) => 1 000 000. | ||
thousandSeparator | ||
}), createZeroPrecisionPreprocessor(precision, decimalSeparator)], | ||
}), createZeroPrecisionPreprocessor(precision, decimalSeparator), createRepeatedDecimalSeparatorPreprocessor(decimalSeparator)], | ||
postprocessors: [createLeadingZeroesValidationPostprocessor(decimalSeparator, thousandSeparator), createMinMaxPostprocessor({ | ||
@@ -1459,0 +1482,0 @@ decimalSeparator, |
@@ -7,4 +7,5 @@ export * from './decimal-zero-padding-postprocessor'; | ||
export * from './preudo-character-preprocessor'; | ||
export * from './repeated-decimal-separator-preprocessor'; | ||
export * from './thousand-separator-postprocessor'; | ||
export * from './zero-precision-preprocessor'; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@maskito/kit", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "The optional framework-agnostic Maskito's package with ready-to-use masks", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@maskito/core": "^1.1.0" | ||
"@maskito/core": "^1.1.1" | ||
}, | ||
@@ -36,0 +36,0 @@ "main": "./index.umd.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
172564
180
3378