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

add imask.js masking options to input field #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

simonbuehler
Copy link
Contributor

@simonbuehler simonbuehler commented Feb 19, 2022

hi,

first shot at the integration of imask.js ( https://imask.js.org/ ) into the input field, works for me

Input::make('datemasked')->maskOptions(
                "{mask: Date, lazy: false}"
            )

Input::make('Masktest', 'masktest')->rules('required')->maskOptions(
                    "{mask: '(00)00-00-00',  lazy: false,  placeholderChar: 'x' }"
                ),

possible enhancements:

  • Get either the masked or unmasked value back from the imask object and not the input value
  • make including js configurabe
  • add docs ;)

@tanthammar
Copy link
Owner

This is a nice idea but I would not want to add this to the Input but make it as a new field.

@simonbuehler
Copy link
Contributor Author

i see the point, first implementation was its own MaskedInput but then there was all the icon, suffix etc handling in the blade file and component misisng so i switched to the input fields as it seems to avoid duplication.

@tanthammar
Copy link
Owner

I understand but I don't want to require an external Js for a simple input.

should fix the unneeded  js load
@tanthammar
Copy link
Owner

tanthammar commented Feb 26, 2022

@simonbuehler
I think I read on Discord that there is an issue with json_encoding things like:

mask.updateOptions({
  mask: Number,
  min: 0,
  max: 100
});

Is it fixed?

I can't see where you are json_encoding/decoding the options.

@simonbuehler
Copy link
Contributor Author

@tanthammar its using a plain string to pass the maskoptions so no need for json en/decoding

@tanthammar
Copy link
Owner

I only have one comment.
With this change it is impossible to manually add x-data to the input.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants