Skip to content

Commit

Permalink
fix: Number mask ignores radix mapping, when value been set directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Redal Aktanov committed May 29, 2023
1 parent f8ab81e commit 5ffbb0b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8775,7 +8775,7 @@ <h3 class='fl m0' id='masked'>
<div class="clearfix small pointer toggle-sibling">
<div class="py1 contain">
<a class='icon pin-right py1 dark-link caret-right'></a>
<span class='code strong strong truncate'>resolve(value)</span>
<span class='code strong strong truncate'>resolve(value, flags)</span>
</div>
</div>
<div class="clearfix display-none toggle-target">
Expand All @@ -8785,7 +8785,7 @@ <h3 class='fl m0' id='masked'>

<p>Resolve new value</p>

<div class='pre p1 fill-light mt0'>resolve(value: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></div>
<div class='pre p1 fill-light mt0'>resolve(value: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>, flags: <a href="#appendflags">AppendFlags</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></div>



Expand All @@ -8808,6 +8808,15 @@ <h3 class='fl m0' id='masked'>

</div>

<div class='space-bottom0'>
<div>
<span class='code bold'>flags</span> <code class='quiet'>(<a href="#appendflags">AppendFlags</a>
= <code>{input:true}</code>)</code>

</div>

</div>

</div>


Expand Down
2 changes: 1 addition & 1 deletion packages/imask/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ declare namespace IMask {
constructor(opts: BaseMaskedOptions<MaskType>);
updateOptions(opts: Partial<BaseMaskedOptions<MaskType>>): void;
reset(): void;
resolve(value: string): string;
resolve(value: string, flags?: AppendFlags): string;
nearestInputPos(cursorPos: number, direction?: Direction): number;
extractTail(fromPos?: number, toPos?: number): TailDetails;
appendTail(tail: string | TailDetails): ChangeDetails;
Expand Down
4 changes: 2 additions & 2 deletions packages/imask/src/masked/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class Masked<MaskType> {
}

/** Resolve new value */
resolve (value: string): string {
resolve (value: string, flags: AppendFlags = {input: true}): string {
this.reset();
this.append(value, {input: true}, '');
this.append(value, flags, '');
this.doCommit();
return this.value;
}
Expand Down

0 comments on commit 5ffbb0b

Please sign in to comment.