Download the PHP package kapital-online/filament-form-components without Composer

On this page you can find all versions of the php package kapital-online/filament-form-components. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-form-components

Kapital Filament Form Components

🇬🇧 English


Türkçe

Filament form componentleri için geliştirilmiş özellikler: çoklu seçim, devre dışı seçenekler ve daha fazlası.

Sorun

Filament v2'de disableOptionWhen() metodu tekli seçim (dropdown) için mükemmel çalışır, ancak multiple() aktif edildiğinde çalışmaz. Bunun nedeni:

  1. Tekli seçim native HTML <select> elementi kullanır ve disabled attribute doğal olarak çalışır
  2. Çoklu seçim daha iyi UX için Choices.js kütüphanesi kullanır
  3. Filament'in transformOptionsForJs() metodu Choices.js'e sadece label ve value gönderir, disabled durumunu göndermez

Bu paket bu sorunu çözer ve ek özellikler ekler.

Çözüm

Bu paket Filament'in Select componentini extend eder ve transformOptionsForJs() metodunu override ederek disabled özelliğini ekler. Choices.js zaten disabled seçenekleri desteklediği için ek JavaScript gerekmez.

Kurulum

1. composer.json'a Ekleyin

Bu yerel bir paket olduğu için root composer.json dosyasına ekleyin:

2. Composer'ı Güncelleyin

Paket Laravel'in package discovery mekanizması ile otomatik olarak yüklenecektir.

Kullanım

Temel Kullanım (Drop-in Replacement)

Filament'in Select componentini Kapital'in Select'i ile değiştirin:

Artık disableOptionWhen() çoklu seçim ile mükemmel çalışıyor!

Özellikler

1. Düzeltilmiş disableOptionWhen() Çoklu Seçim İle

Ana özellik - devre dışı seçenekler artık çoklu seçimde düzgün çalışıyor:

Devre dışı seçenekler soluk görünür ve seçilemez.

2. Maksimum Seçilebilir Öğe (maxSelectable)

Seçilebilecek öğe sayısını sınırlayın:

Özellikler:

3. Minimum Seçilebilir Öğe (minSelectable)

Minimum sayıda seçim zorunluluğu:

Özellikler:

4. Tümünü Seç Seçeneği (selectAllOption)

"Tümünü Seç" butonu ekler. Tıklandığında disabled olmayan tüm seçenekleri otomatik seçer:

Özellikler:

5. Tümünü Temizle Seçeneği (deselectAllOption)

"Tümünü Temizle" butonu ekler. Tıklandığında tüm seçimleri kaldırır:

Özellikler:

6. Master-Detail Table (Filament v3)

Bu paket Filament v3 resource tabloları için master-detail altyapısı da içerir.

Öne çıkanlar:

Gerekli Importlar
Resource Kullanımı
List Page Kullanımı

İlgili resource list page sınıfında trait eklenmelidir:

API Özeti

Not: Filament v3 Resource::table() method imzası Filament\Tables\Table beklediği için method parametresi Filament tipiyle kalmalıdır. Paketin master-detail özellikleri runtime’da instanceof MasterDetailResourceTable ile etkinleştirilir.

Bilinen Kısıt / Öneri

Nested modal içinde tekrar modal açan table action akışları Alpine/Livewire tarafında sorun çıkarabilir. Bu tip senaryolarda detail içeriğini aynı sayfada inline açmak veya action akışını modal dışına taşımak daha stabil sonuç verir.

Gerçek Dünya Örneği

Tüm Özellikler Karşılaştırması

Özellik Filament v2 Select Kapital Enhanced Select
Tekli seçim + disableOptionWhen() ✅ Çalışıyor ✅ Çalışıyor
Çoklu seçim + disableOptionWhen() ❌ Bozuk ✅ Düzeltildi
maxSelectable() ❌ Yok ✅ Var
minSelectable() ❌ Yok ✅ Var
selectAllOption() ❌ Yok ✅ Var
deselectAllOption() ❌ Yok ✅ Var
Diğer tüm Filament özellikleri ✅ Tam uyumlu

Teknik Detaylar

Nasıl Çalışır

Düzeltme oldukça basit. Paket tek bir metodu override eder:

Choices.js (Filament'in çoklu seçim için kullandığı kütüphane) disabled özelliğini doğal olarak destekler. Bunu options array'ine ekleyerek, devre dışı seçenekler otomatik olarak çalışır.

Validasyon

Tüm validasyon güvenlik için backend'de gerçekleşir:

Frontend özellikleri (Choices.js maxItemCount gibi) kullanıcı dostu geri bildirim sağlar ancak güvenlik için bunlara güvenilmez.

Uyumluluk

Sorun Giderme

Devre dışı seçenekler hala seçilebiliyor

Doğru Select componentini import ettiğinizden emin olun:

Composer paketi bulamıyor

Paketin doğru konumda olduğundan emin olun:

Max/min validasyon çalışmıyor

Validasyon kuralları otomatik olarak eklenir. Kontrol edin:

  1. ->multiple() kullanıyorsunuz
  2. Form validate ediliyor
  3. Validasyon hataları için Laravel loglarını kontrol edin

English

Enhanced Filament form components with extended functionality for multiple select, disabled options, and more.

The Problem

In Filament v2, the disableOptionWhen() method works perfectly for single select dropdowns, but fails to work when multiple() is enabled. This is because:

  1. Single select uses native HTML <select> elements where disabled attributes work natively
  2. Multiple select uses Choices.js library for better UX
  3. Filament's transformOptionsForJs() method only passes label and value to Choices.js, omitting the disabled state

This package fixes this issue and adds additional features for enhanced select components.

The Solution

This package extends Filament's Select component and overrides the transformOptionsForJs() method to include the disabled property. Choices.js already supports disabled options natively, so no additional JavaScript is required.

Installation

1. Add to composer.json

Since this is a local package, add it to your root composer.json:

2. Update Composer

The package will be auto-discovered via Laravel's package discovery mechanism.

Usage

Basic Usage (Drop-in Replacement)

Simply replace Filament's Select component with Kapital's Select:

Now disableOptionWhen() works perfectly with multiple() enabled!

Features

1. Fixed disableOptionWhen() with Multiple Select

The primary feature - disabled options now work correctly with multiple select:

Disabled options will appear grayed out and cannot be selected.

2. Maximum Selectable Items (maxSelectable)

Limit the number of items that can be selected:

Features:

3. Minimum Selectable Items (minSelectable)

Require a minimum number of selections:

Features:

4. Select All Option (selectAllOption)

Adds a "Select All" button. When clicked, automatically selects all non-disabled options:

Features:

5. Deselect All Option (deselectAllOption)

Adds a "Deselect All" button. When clicked, clears all selections:

Features:

6. Master-Detail Table (Filament v3)

This package also includes a master-detail infrastructure for Filament v3 resource tables.

Highlights:

Required Imports
Resource Usage
List Page Usage

Add the trait to your resource list page class:

API Summary

Note: Filament v3 Resource::table() signature must keep Filament\Tables\Table as the method argument. Package master-detail features are enabled at runtime via instanceof MasterDetailResourceTable.

Known Limitation / Recommendation

Nested table actions that open another modal inside an existing modal may cause Alpine/Livewire issues. In such cases, prefer inline detail rendering on the same page or move the action flow outside nested modals.

Real-World Example

All Features Comparison

Feature Filament v2 Select Kapital Enhanced Select
Single select with disableOptionWhen() ✅ Works ✅ Works
Multiple select with disableOptionWhen() ❌ Broken ✅ Fixed
maxSelectable() ❌ Not available ✅ Available
minSelectable() ❌ Not available ✅ Available
selectAllOption() ❌ Not available ✅ Available
deselectAllOption() ❌ Not available ✅ Available
All other Filament features ✅ Fully compatible

Technical Details

How It Works

The fix is remarkably simple. The package overrides a single method:

Choices.js (the library Filament uses for multiple selects) natively supports the disabled property. By including it in the options array, disabled options automatically work.

Validation

All validation happens on the backend for security:

Frontend features (like Choices.js maxItemCount) provide user-friendly feedback but aren't relied upon for security.

Compatibility

Troubleshooting

Disabled options still selectable

Make sure you're importing the correct Select component:

Composer can't find the package

Ensure the package is in the correct location:

Max/min validation not working

The validation rules are automatically added. Check:

  1. You're using ->multiple()
  2. The form is being validated
  3. Check Laravel logs for validation errors

License

MIT

Credits

Created by Kapital Online for internal use and open-sourced for the community.

Contributing

This is an internal package, but suggestions and bug reports are welcome.


All versions of filament-form-components with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
filament/forms Version ^3.0
filament/tables Version ^3.0
illuminate/support Version ^9.0|^10.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kapital-online/filament-form-components contains the following files

Loading the files please wait ...