@maskito/kit
Advanced tools
Comparing version 0.8.1 to 0.9.0
@@ -6,3 +6,4 @@ export { maskitoDateOptionsGenerator } from './lib/masks/date'; | ||
export { maskitoTimeOptionsGenerator } from './lib/masks/time'; | ||
export { maskitoPrefixPostprocessorGenerator } from './lib/processors'; | ||
export { MaskitoDateMode, MaskitoDateSegments, MaskitoTimeMode, MaskitoTimeSegments, } from './lib/types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -311,2 +311,27 @@ import { maskitoPipe } from '@maskito/core'; | ||
function maskitoPrefixPostprocessorGenerator(prefix) { | ||
return ({ | ||
value, | ||
selection | ||
}, initialElementState) => { | ||
const minCaretIndex = prefix.length; | ||
if (value.length < minCaretIndex && initialElementState.value) { | ||
return { | ||
selection: [minCaretIndex, minCaretIndex], | ||
value: prefix | ||
}; | ||
} | ||
const [from, to] = selection; | ||
return value.length && !value.startsWith(prefix) ? { | ||
selection: [from + prefix.length, to + prefix.length], | ||
value: prefix + value | ||
} : { | ||
selection, | ||
value | ||
}; | ||
}; | ||
} | ||
function createValidDatePreprocessor({ | ||
@@ -1217,2 +1242,2 @@ dateModeTemplate, | ||
export { maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator, maskitoDateTimeOptionsGenerator, maskitoNumberOptionsGenerator, maskitoParseNumber, maskitoTimeOptionsGenerator }; | ||
export { maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator, maskitoDateTimeOptionsGenerator, maskitoNumberOptionsGenerator, maskitoParseNumber, maskitoPrefixPostprocessorGenerator, maskitoTimeOptionsGenerator }; |
@@ -375,2 +375,27 @@ (function (global, factory) { | ||
function maskitoPrefixPostprocessorGenerator(prefix) { | ||
return function (_a, initialElementState) { | ||
var value = _a.value, | ||
selection = _a.selection; | ||
var minCaretIndex = prefix.length; | ||
if (value.length < minCaretIndex && initialElementState.value) { | ||
return { | ||
selection: [minCaretIndex, minCaretIndex], | ||
value: prefix | ||
}; | ||
} | ||
var from = selection[0], | ||
to = selection[1]; | ||
return value.length && !value.startsWith(prefix) ? { | ||
selection: [from + prefix.length, to + prefix.length], | ||
value: prefix + value | ||
} : { | ||
selection: selection, | ||
value: value | ||
}; | ||
}; | ||
} | ||
function createValidDatePreprocessor(_a) { | ||
@@ -1359,2 +1384,3 @@ var dateModeTemplate = _a.dateModeTemplate, | ||
exports.maskitoParseNumber = maskitoParseNumber; | ||
exports.maskitoPrefixPostprocessorGenerator = maskitoPrefixPostprocessorGenerator; | ||
exports.maskitoTimeOptionsGenerator = maskitoTimeOptionsGenerator; | ||
@@ -1361,0 +1387,0 @@ |
export { createMinMaxDatePostprocessor } from './min-max-date-postprocessor'; | ||
export { maskitoPrefixPostprocessorGenerator } from './prefix-postprocessor'; | ||
export { createValidDatePreprocessor } from './valid-date-preprocessor'; | ||
export { createZeroPlaceholdersPreprocessor } from './zero-placeholders-preprocessor'; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@maskito/kit", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "The optional framework-agnostic Maskito's package with ready-to-use masks", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@maskito/core": "^0.8.1" | ||
"@maskito/core": "^0.9.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "main": "./index.umd.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
139400
152
2664
0