Download the PHP package beholdr/filament-trilist without Composer
On this page you can find all versions of the php package beholdr/filament-trilist. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download beholdr/filament-trilist
More information about beholdr/filament-trilist
Files in beholdr/filament-trilist
Package filament-trilist
Short Description Filament plugin that adds components for working with tree data: treeselect and treeview
License MIT
Homepage https://github.com/beholdr/filament-trilist
Informations about the package filament-trilist
Filament Trilist ☘️
Filament plugin for working with tree data: treeselect input and treeview page. Based on Trilist package.
Support
Do you like Filament Trilist? Please support me via Boosty.
Features
- Treeselect input and treeview page
- Tree items can have multiple parents
- Works with relationship or custom hierarchical data
Installation
You can install the package via composer:
Optionally, you can publish the views using
Tree data
You can use hierarchical data from any source when it follows format:
For example, you can use special library like staudenmeir/laravel-adjacency-list to get tree data:
Or use custom relationship schema and methods, even with ManyToMany
(multiple parents) relationship.
Example for self-referencing entity
#### Migrations #### Model With given model you can generate tree data like this:Treeselect input
Import TrilistSelect
class and use it on your Filament form:
Full options list:
Custom labels
If you want to customize labels you can use labelHook
method. It should return a string that will be processed as JS (pay attention to escaping quotes and special characters):
Usage in filters
You can use treeselect in custom filter:
Treeview page
Create custom page class inside Pages
directory of your resource directory. Note that page class extends Beholdr\FilamentTrilist\Components\TrilistPage
:
Register created page in the static getPages()
method of your resource:
Add link for a newly created page to your panel navigation:
Treeview options
You can set some tree options by overriding static methods in the custom page class:
getFieldId()
: tree item id field namegetFieldLabel()
: tree item label field namegetFieldChildren()
: tree item children field nameisAnimated()
: animate expand/collapse, default: trueisSearchable()
: enable filtering of items, default: falsegetSearchPrompt()
: search input placeholder
Custom labels
If you want to customize labels of the tree items, you can override getLabelHook()
method of the TrilistPage
.
Example
Say, model for your tree items has a `description` field that you want to output below the item name. All additional properties of your model are under `item.data` property, so description will be at `item.data.description`:License
The MIT License (MIT). Please see License File for more information.
All versions of filament-trilist with dependencies
filament/filament Version ^3.0
spatie/laravel-package-tools Version ^1.15.0
illuminate/contracts Version ^10.0 || ^11.0