承接 rodrigofs/filament-maskinput 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rodrigofs/filament-maskinput

Composer 安装命令:

composer require rodrigofs/filament-maskinput

包简介

Alternative the alpine mask.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status PHPStan GitHub Code Style Action Status Total Downloads

Motivation for Creating the Filament Mask Input Package

The Problem:

While working with data input masks in web applications, I encountered a specific challenge related to the Firefox browser. The issue was that the implemented masks did not function as expected in this browser, leading to inconsistencies and problems in the user experience.

Furthermore, when considering the use of Alpine.js's native x-mask as an alternative solution, I encountered another hurdle. There seemed to be an issue in the interaction between Alpine.js and Livewire, particularly in how the state was updated. This behavior resulted in the unexpected removal of input masks, affecting the usability and functionality of the application.

The Solution:

Faced with these challenges, I decided to create the filament-maskinput package. It is designed to implement input masks efficiently, overcoming the issues found with Firefox and the Alpine.js-Livewire interaction. This package ensures browser compatibility and maintains input masks reliably during Livewire's lifecycle.

Filament Mask Input Package

Overview

The filament-maskinput package enhances FilamentPHP applications by adding masked input functionalities. It allows for the creation of inputs with various masking patterns, including monetary, dynamic, and fixed patterns.

Installation

Install the package via composer:

composer require rodrigofs/filament-maskinput

Configuration

You can configure the filament-maskinput package through the config/filament-maskinput.php file, setting default values for parameters like allowNegative, decimalPrecision, thousandsSeparator and decimalSeparator.

Optionally, you can publish the config using

php artisan vendor:publish --tag="config"

Usage

MaskInput Component

MaskInput is an extension of TextInput in FilamentPHP, designed to create input fields with custom masking patterns.

Methods

  • money

    • Description: Configures the input field for monetary values.
    • Parameters:
      • $decimalPrecision (int|null): Decimal precision.
      • $decimalSeparator (string|null): Decimal separator.
      • $thousandsSeparator (string|null): Thousands delimiter.
      • $allowNegative (bool|null): Allow negative.
  • mask

    • Description: Sets the mask pattern for the input.
    • Parameters:
      • $mask (string | Closure | RawJs | null): The mask pattern or function.
  • maxLength

    • Description: For dynamic masks, maxLength acts as a trigger to switch between mask patterns. It's essential when using dynamic masks.
    • Parameters:
      • $length (int | Closure): Maximum length for the input.

Examples

Money Input

MaskInput::make('money')
->money();

MaskInput::make('money')
->money(decimalPrecision: 3, allowNegative: true);

output: "-1.234,560"

Dynamic Input

MaskInput::make('dynamic')
->mask(RawJs::make("['999.999.999-99', '99.999.999/9999-99']"))
->stripCharacters(['.','-', '/'])
->maxLength(14) // Acts as a trigger for mask switching

output: "123.456.789-01" or "12.345.678/9012-34"

Pattern Input

MaskInput::make('pattern')
->mask('99999-999')
->stripCharacters(['-'])

output: "12345-678"
MaskInput::make('pattern')
->mask('SS.SS.SSSSS.S.S.SSSSSS')
->stripCharacters(['.'])

output: "9B.GR.D08X0.4.G.117974"
MaskInput::make('pattern')
->mask('AAA-9999')
->stripCharacters(['-'])

output: "ABC-1234"

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

rodrigofs/filament-maskinput 适用场景与选型建议

rodrigofs/filament-maskinput 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 8.09k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2024 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rodrigofs/filament-maskinput 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rodrigofs/filament-maskinput 我们能提供哪些服务?
定制开发 / 二次开发

基于 rodrigofs/filament-maskinput 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-02