Skip to content

Commit

Permalink
fix inappropriate skipInvalid warning for dynamic mask
Browse files Browse the repository at this point in the history
  • Loading branch information
uNmAnNeR committed Apr 17, 2023
1 parent f8175da commit 6e51aa2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/imask/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1>IMask Core Demo</h1>
<script src="dist/imask.js"></script>
<!-- <script src="https://unpkg.com/imask"></script> -->
<script type="text/javascript">
const mask = {
const mask = [{
mask: 'XXX-XX-0000',
definitions: {
X: {
Expand All @@ -22,11 +22,11 @@ <h1>IMask Core Demo</h1>
},
lazy: false,
overwrite: 'shift',
};
}];

var result = document.getElementById('value');
var unmasked = document.getElementById('unmasked');
var imask = IMask(document.getElementById('input'), mask).on('accept', () => {
var imask = IMask(document.getElementById('input'), {mask}).on('accept', () => {
console.log(imask.value, imask.unmaskedValue, imask.typedValue);
result.innerHTML = imask.value;
unmasked.innerHTML = imask.unmaskedValue;
Expand Down
6 changes: 4 additions & 2 deletions packages/imask/src/masked/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,10 @@ class MaskedDynamic extends Masked<DynamicMaskType> {
super.skipInvalid;
}

set skipInvalid (skipInvalid: *) {
console.warn('"skipInvalid" option is not available in dynamic mask, use this option in siblings');
set skipInvalid (skipInvalid: boolean) {
if (this.isInitialized || skipInvalid !== Masked.DEFAULTS.skipInvalid) {
console.warn('"skipInvalid" option is not available in dynamic mask, use this option in siblings');
}
}

/**
Expand Down

0 comments on commit 6e51aa2

Please sign in to comment.