Coder Social home page Coder Social logo

topknoxbitch / filament-adjacency-list Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saade/filament-adjacency-list

0.0 0.0 0.0 3.93 MB

A Filament package to manage adjacency lists (aka trees).

Home Page: https://filamentphp.com/plugins/saade-adjacency-list

License: MIT License

JavaScript 7.51% PHP 75.42% CSS 0.05% Blade 17.01%

filament-adjacency-list's Introduction

Filament Adjacency List

Latest Version on Packagist Total Downloads

A Filament package to manage adjacency lists (aka trees).

Banner

Installation

You can install the package via composer:

composer require saade/filament-adjacency-list

Usage

use Saade\FilamentAdjacencyList\Forms\Components\AdjacencyList;

AdjacencyList::make('subjects')
    ->form([
        Forms\Components\TextInput::make('label')
            ->required(),
    ])

Configuration

Customizing the label and children keys.

AdjacencyList::make('subjects')
    ->labelKey('name')          // defaults to 'label'
    ->childrenKey('subitems')   // defaults to 'children'

Customizing the MaxDepth of the tree.

AdjacencyList::make('subjects')
    ->maxDepth(2)               // defaults to -1 (unlimited depth)

Creating items without a modal.

AdjacencyList::make('subjects')
    ->modal(false)      // defaults to true

Disabling creation, edition, deletion, and reordering.

AdjacencyList::make('subjects')
    ->addable(false)
    ->editable(false)
    ->deletable(false)
    ->reorderable(false)

Customizing actions

use Filament\Forms\Actions\Action;

AdjacencyList::make('subjects')
    ->addAction(fn (Action $action): Action => $action->icon('heroicon-o-plus')->color('primary'))
    ->addChildAction(fn (Action $action): Action => $action->button())
    ->editAction(fn (Action $action): Action => $action->icon('heroicon-o-pencil'))
    ->deleteAction(fn (Action $action): Action => $action->requiresConfirmation())
    ->reorderAction(fn (Action $action): Action => $action->icon('heroicon-o-arrow-path-rounded-square'))

Important

Reorder Action

If you want to add ->extraAttributes() to the action, you need to add the ['data-sortable-handle' => 'true'] attribute to the array.

if you want to trigger a livewire action on click, you need to chain ->livewireClickHandlerEnabled() on the action.

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.

Sponsor Saade

filament-adjacency-list's People

Contributors

saade avatar vanhooff avatar dependabot[bot] avatar atmonshi avatar ribesalexandre avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.