Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic mask dispatch does not work correctly with fixed characters #1044

Closed
uNmAnNeR opened this issue Jun 3, 2024 · 1 comment
Closed
Labels

Comments

@uNmAnNeR
Copy link
Owner

uNmAnNeR commented Jun 3, 2024

Using your example works with UI. But if you use IMask.createMask, without UI, it will not work.

I try too using the following:

const masked = IMask.createMask({
  mask: [
    {
      mask: '000.000.000-00',
    },
    {
      mask: '00.000.000/0000-00',
    },
  ]
});

masked.resolve('123.456.789-012');

console.log(masked.value); //123.456.789-01
console.log(masked.unmaskedValue); //12345678901

https://codesandbox.io/p/sandbox/componentes-mask-nnzvfl?file=%2Fsrc%2Fcomponents%2FMask.tsx%3A36%2C34

Originally posted by @renerlemes in #844 (reply in thread)

@uNmAnNeR
Copy link
Owner Author

uNmAnNeR commented Jun 3, 2024

solutions could be (or both):

  1. for pattern mask: _isRawInput = raw flag, not raw | input
  2. for dynamic mask:
    a. add new rawUnmaskedInputValue = raw & unmasked to calculate weights
    b. or use unmaskedValue instead of rawInputValue

@uNmAnNeR uNmAnNeR added the bug label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant