Skip to content

Commit efdb875

Browse files
committed
fix #1044
1 parent d1fe83e commit efdb875

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

packages/imask/example.html

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,14 @@ <h1>IMask Core Demo</h1>
1212
<!-- <script src="https://unpkg.com/imask"></script> -->
1313
<script type="text/javascript">
1414
const opts = {
15-
mask: 'VLv\\alue MM',
16-
lazy: false, // make placeholder always visible
17-
18-
blocks: {
19-
YY: {
20-
mask: '00',
21-
},
22-
23-
VL: {
24-
mask: IMask.MaskedEnum,
25-
enum: ['TV', 'HD', 'VR'],
15+
mask: [
16+
{
17+
mask: '000.000.000-00',
2618
},
27-
28-
MM: {
29-
mask: IMask.MaskedRange,
30-
from: 1,
31-
to: 12,
19+
{
20+
mask: '00.000.000/0000-00',
3221
},
33-
},
22+
],
3423
};
3524

3625
const input = document.getElementById('input');

packages/imask/src/masked/pattern/fixed-definition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class PatternFixedDefinition implements PatternBlock {
102102
rawInserted: isResolved ? this.char: '',
103103
})
104104
this._value = this.char;
105-
this._isRawInput = isResolved && (flags.raw || flags.input);
105+
this._isRawInput = isResolved && flags.raw;
106106

107107
return details;
108108
}

packages/imask/test/masked/dynamic.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ describe('MaskedDynamic', function () {
161161
assert.equal(masked.value, '12__5_');
162162
});
163163

164+
it('should consider only raw input', function () {
165+
masked.updateOptions({
166+
mask: [
167+
{ mask: '000.000.000-00' },
168+
{ mask: '00.000.000/0000-00' },
169+
],
170+
});
171+
172+
masked.resolve('123.456.789-012');
173+
assert.equal(masked.value, '12.345.678/9012');
174+
});
175+
164176
describe('expose', function () {
165177
it('should expose number', function () {
166178
const mask = new MaskedDynamic<number>({

0 commit comments

Comments
 (0)