rodrigofs / filament-maskinput

Filament input mask
MIT License
5 stars 3 forks source link

Dynamic Issue During Insert Data #4

Open Fik21-i opened 6 days ago

Fik21-i commented 6 days ago

Hi rodrigofs,

currently im using your plugin for my project . i just found out that for dynamic function has some bug to manage the number during switching format. i have attach the video and image of my code for your reference. Thanks

https://github.com/user-attachments/assets/d514da64-bd59-431e-98b1-f097ad82a409

Screenshot 2024-10-27 at 3 21 22 PM
rodrigofs commented 3 days ago

Hello @Fik21-i,

how are you? Well, I'm analyzing the reported issue, and it seems like you want to dynamically format these numbers using the following formats, depending on the number of characters. However, I noticed that you are not following the pattern for masks:

Try doing the following to resolve this, if I understood correctly:

MaskInput::make('dynamic')
      ->mask(RawJs::make("['99.9999','999.9999']"))
      ->stripCharacters(['.'])
      ->maxLength(7),