Skip to content

add imask.js masking options to input field#111

Open
simonbuehler wants to merge 4 commits into
tanthammar:masterfrom
simonbuehler:master
Open

add imask.js masking options to input field#111
simonbuehler wants to merge 4 commits into
tanthammar:masterfrom
simonbuehler:master

Conversation

@simonbuehler
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@tanthammar
Copy link
Copy Markdown
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.

2 participants