定制 codicastudio/mega-filter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

codicastudio/mega-filter

Composer 安装命令:

composer require codicastudio/mega-filter

包简介

A random Codica Studio package.

README 文档

README

This package allows you to control the columns and filters shown on your nova resources.

Installation

You can install the package via composer:

composer require digital-creative/nova-mega-filter

Basic Usage

Basic demo showing the power of this field:

use DigitalCreative\MegaFilter\MegaFilter;
use DigitalCreative\MegaFilter\HasMegaFilterTrait;
use DigitalCreative\MegaFilter\Column;

class ExampleNovaResource extends Resource {

    use HasMegaFilterTrait; // Important!!

    public function cards(Request $request)
    {
        return [
            MegaFilter::make([
                'filters' => [
                    new DateOfBirthFilter(),
                    new UserTypeFilter()
                ],
                'columns' => [
                    Column::make('Customer Name', 'name')->addFilter(new ActiveFilter()),
                    Column::make('Assets'),
                    Column::make('Payments')
                ]
            ])
        ];
    }

}

Columns

Columns reflects every column that is normally shown on your table resource, however you are free to give your user the ability to toggle it on/off:

Columns in Action

use DigitalCreative\MegaFilter\Column;
use DigitalCreative\MegaFilter\HasMegaFilterTrait;
use DigitalCreative\MegaFilter\MegaFilter;

MegaFilter::make([
    'columns' => [
        Column::make($label),
        Column::make($label, $attribute),
        Column::make($label, $attribute, $filters),
        new Column($label, $attribute, $filters),
    ],
])

You can add additional filters that only appears when the desired column is enabled:

MegaFilter::make([
    'columns' => [
        Column::make('Gender')->addFilter(new GenderFilter())
    ],
])

Columns in Action

If you want to have filters that are always shown, use the 'filters' option bellow

You can also define columns that can not be toggled by the user and will be always present on the table resource:

MegaFilter::make([
    'columns' => [
        Column::make('Name')->permanent()
    ],
])

When using ->permanent() every filter that the column may define will be also present

Other column methods include the ability to have a column default checked

MegaFilter::make([
    'columns' => [
        Column::make('Name')->checked() // Checked by default
    ],
])

Filters

The filters key accepts an array of any instance of the default Nova filter class or third party.

MegaFilter::make([
    'filters' => [
       new BirthdayFilter(),
       new UserTypeFilter(),
       new GenderFilter(),
    ],
])

Actions

Actions will use the same Nova action mechanism

MegaFilter::make([
    'actions' => [
       new ExportClientAsExcell(),
    ],
])

Columns in Action

If you have multiple actions defined, a dropdown will be shown:

Columns in Action

The columns selected will also be given to your action, you can access them directly from the request:

public function handle(ActionFields $fields, Collection $models)
{

    $columns = json_decode(request()->input('columns'));

    dd($columns);

}

Settings

The settings key is optional as it comes with some good defaults, but feel free to override it to suit your needs.

MegaFilter::make([
    'settings' => [

        /**
         * Tailwind width classes: w-full w-1/2 w-1/3 w-1/4 etc.
         */
        'columnsWidth' => 'w-1/4',
        'filtersWidth' => 'w-1/2',
        
        /**
         * The default state of the main toggle buttons
         */
        'columnsActive' => false,
        'filtersActive' => true,
        'actionsActive' => true,
        
        /**
         * Labels
         */
        'headerLabel' => 'Menu',
        'columnsLabel' => 'Columns',
        'filtersLabel' => 'Filters',
        'actionsLabel' => 'Actions',
        'columnsSectionTitle' => 'Additional Columns',
        'filtersSectionTitle' => 'Filters',
        'actionsSectionTitle' => 'Actions',
        'columnsResetLinkTitle' => 'Reset Columns',
        'filtersResetLinkTitle' => 'Reset Filters',

    ],
])

License

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

codicastudio/mega-filter 适用场景与选型建议

codicastudio/mega-filter 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 codicastudio/mega-filter 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-25