diff --git a/.github/workflows/run-phpstan-pull.yml b/.github/workflows/run-phpstan-pull.yml index 7426e4a7a..bacc60816 100644 --- a/.github/workflows/run-phpstan-pull.yml +++ b/.github/workflows/run-phpstan-pull.yml @@ -12,9 +12,9 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-24.04] - php: [8.3] - laravel: [11] + os: [ubuntu-latest] + php: [8.4] + laravel: [12] stability: [prefer-dist] name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -77,10 +77,10 @@ jobs: - name: Update dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer update --${{ matrix.stability }} --no-interaction + run: composer update --${{ matrix.stability }} --no-interaction -W - name: Install PHPStan - run: composer require larastan/larastan:^2.0 --no-interaction + run: composer require larastan/larastan:^3.0 --no-interaction -W - uses: actions/cache@v4 with: diff --git a/.github/workflows/run-phpstan.yml b/.github/workflows/run-phpstan.yml index 5132a9479..e3069324c 100644 --- a/.github/workflows/run-phpstan.yml +++ b/.github/workflows/run-phpstan.yml @@ -15,9 +15,9 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-24.04] - php: [8.3] - laravel: [11] + os: [ubuntu-latest] + php: [8.4] + laravel: [12] stability: [prefer-dist] name: PHPStan - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -80,10 +80,10 @@ jobs: - name: Update dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer update --${{ matrix.stability }} --no-interaction + run: composer update --${{ matrix.stability }} --no-interaction -W - name: Install PHPStan - run: composer require larastan/larastan:^2.0 --dev --no-interaction + run: composer require larastan/larastan:^3.0 --dev --no-interaction -W - uses: actions/cache@v4 with: diff --git a/.github/workflows/run-tests-pull.yml b/.github/workflows/run-tests-pull.yml index 1ea6334be..257e1d43d 100644 --- a/.github/workflows/run-tests-pull.yml +++ b/.github/workflows/run-tests-pull.yml @@ -14,7 +14,7 @@ jobs: max-parallel: 2 matrix: os: [ubuntu-latest] - php: [8.2, 8.3, 8.4] + php: [8.2, 8.3] laravel: [10.*] stability: [prefer-dist] @@ -172,3 +172,86 @@ jobs: - name: Run Visuals Tests run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage + + test-laravel12: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 2 + matrix: + os: [ubuntu-latest] + php: [8.2, 8.3, 8.4] + laravel: [12.*] + stability: [prefer-dist] + + name: PULL PHP-${{ matrix.php }} - Laravel-12 + env: + extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }} + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo, :psr + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + key: ${{ env.extensionKey }} + + - name: Cache extensions + uses: actions/cache@v4 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + tools: phpunit:latest + ini-values: memory_limit=512M + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Get composer cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer- + + - name: Add token + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer config github-oauth.github.com $GITHUB_TOKEN + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update + + - name: Update dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --${{ matrix.stability }} --no-interaction + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run Unit Tests + run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage + + - name: Run Visuals Tests + run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 21161009c..70fb43bd8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -16,7 +16,7 @@ jobs: max-parallel: 2 matrix: os: [ubuntu-24.04] - php: [8.2, 8.3, 8.4] + php: [8.2, 8.3] laravel: [10.*] stability: [prefer-dist] @@ -174,3 +174,86 @@ jobs: - name: Run Visuals Tests run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage + + test-laravel12: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 2 + matrix: + os: [ubuntu-24.04] + php: [8.2, 8.3, 8.4] + laravel: [12.*] + stability: [prefer-dist] + + name: PHP-${{ matrix.php }} - Laravel-12 + env: + extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo, :psr + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + key: ${{ env.extensionKey }} + + - name: Cache extensions + uses: actions/cache@v4 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + restore-keys: ${{ matrix.os }}-${{ steps.extcache.outputs.key }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ${{ env.extensions }} + tools: phpunit:latest + ini-values: memory_limit=512M + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Get composer cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer- + + - name: Add token + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer config github-oauth.github.com $GITHUB_TOKEN + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update + + - name: Update dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --${{ matrix.stability }} --no-interaction + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run Unit Tests + run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage + + - name: Run Visuals Tests + run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index deb5a8ab2..dc56fe69d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,30 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## [v3.7.0] - 2025-02-27 -## [v3.6.0] - UNRELEASED +### Bug Fixes +- Filters urgent fixes - correct Filter Default QueryString by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2188 +- Fix Search Field in bootstrap by @yparitcher in https://github.com/rappasoft/laravel-livewire-tables/pull/2183 +- Add "after-tools" configurable area by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2180 + +### New Features +- Add setFilterPillTitleAsHtml by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2204 +- Enable setting styles for sorting pills as a configuration by @HussamAlhennawi in https://github.com/rappasoft/laravel-livewire-tables/pull/2179 +- Enable setting styles for filter pills as a configuration by @HussamAlhennawi in https://github.com/rappasoft/laravel-livewire-tables/pull/2178 +- Enable setting styles for column select as a configuration by @HussamAlhennawi in https://github.com/rappasoft/laravel-livewire-tables/pull/2175 +- BulkActionTweaks - Adding default checkbox, customising attribute behaviours by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2203 +- Laravel v12 Support by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2217 + +### Tweaks +- Tweak for text pill title by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2206 +- Tweak Return Types by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2205 +- Migrate Column/Filter Traits by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2202 +- Filter Rationalisation & Livewire Array Filter improvements by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2191 +- Move Filter View Traits by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2189 +- Filter Trait - Reorganization by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2181 + +## [v3.6.0] - 2025-01-16 ### Bug Fixes - Ensure Default Sorting Is Shown in Pills by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2138 diff --git a/composer.json b/composer.json index bda267c29..bd58755ef 100644 --- a/composer.json +++ b/composer.json @@ -23,21 +23,21 @@ } ], "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.1|^8.2|^8.3|^8.4", "blade-ui-kit/blade-heroicons": "^2.1", - "illuminate/contracts": "^10.0|^11.0", - "illuminate/support": "^10.0|^11.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", + "illuminate/support": "^10.0|^11.0|^12.0", "livewire/livewire": "^3.0|dev-main" }, "require-dev": { "ext-sqlite3": "*", - "brianium/paratest": "^5.0|^6.0|^7.0|^8.0", + "brianium/paratest": "^5.0|^6.0|^7.0|^8.0|^9.0", + "larastan/larastan": "^2.6|^3.0", "laravel/pint": "^1.10", "monolog/monolog": "*", - "nunomaduro/collision": "^6.0|^7.0|^8.0", - "larastan/larastan": "^2.6", - "orchestra/testbench": "^7.0|^8.0|^9.0", - "phpunit/phpunit": "^9.0|^10.0|^11.0" + "nunomaduro/collision": "^6.0|^7.0|^8.0|^9.0", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "phpunit/phpunit": "^9.0|^10.0|^11.0|^12.0" }, "autoload": { "psr-4": { diff --git a/docs/column-types/array_column.md b/docs/column-types/array_column.md index 7802e78aa..3d612248d 100644 --- a/docs/column-types/array_column.md +++ b/docs/column-types/array_column.md @@ -5,7 +5,7 @@ weight: 2 Array columns provide an easy way to work with and display an array of data from a field. -``` +```php ArrayColumn::make('notes', 'name') ->data(fn($value, $row) => ($row->notes)) ->outputFormat(fn($index, $value) => "".$value->name."") @@ -16,7 +16,7 @@ ArrayColumn::make('notes', 'name') ### Empty Value You may define the default/empty value using the "emptyValue" method -``` +```php ArrayColumn::make('notes', 'name') ->emptyValue('Unknown'), ``` diff --git a/docs/column-types/avg_column.md b/docs/column-types/avg_column.md index d5e4b32fb..f0f7680ac 100644 --- a/docs/column-types/avg_column.md +++ b/docs/column-types/avg_column.md @@ -5,7 +5,7 @@ weight: 3 Avg columns provide an easy way to display the "Average" of a field on a relation. -``` +```php AvgColumn::make('Average Related User Age') ->setDataSource('users','age') ->sortable(), diff --git a/docs/column-types/count_column.md b/docs/column-types/count_column.md index 4b1fe6c3a..beb7d3437 100644 --- a/docs/column-types/count_column.md +++ b/docs/column-types/count_column.md @@ -5,7 +5,7 @@ weight: 8 Count columns provide an easy way to display the "Count" of a relation. -``` +```php CountColumn::make('Related Users') ->setDataSource('users') ->sortable(), diff --git a/docs/column-types/livewire_component_column.md b/docs/column-types/livewire_component_column.md index ebeb72724..f48859641 100644 --- a/docs/column-types/livewire_component_column.md +++ b/docs/column-types/livewire_component_column.md @@ -8,7 +8,7 @@ Livewire Component Columns allow for the use of a Livewire Component as a Column This is **not recommended** as due to the nature of Livewire, it becomes inefficient at scale. ## component -``` +```php LivewireComponentColumn::make('Action') ->component('PathToLivewireComponent'), diff --git a/docs/columns/column-selection.md b/docs/columns/column-selection.md index fae9eb906..0d5872fbb 100644 --- a/docs/columns/column-selection.md +++ b/docs/columns/column-selection.md @@ -222,4 +222,68 @@ class DataTableColumnsSelectedListener } } -``` \ No newline at end of file +``` + +## Styling + +### setColumnSelectButtonAttributes +Allows for customisation of the appearance of the "Column Select" button + +Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods. + +#### default-colors +Setting to false will disable the default colors for the Column Select button, the default colors are: + +Bootstrap: None + +Tailwind: `text-gray-700 bg-white border-gray-300 hover:bg-gray-50 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-700 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600` + +#### default-styling +Setting to false will disable the default styling for the Column Select button, the default styling is: + +Bootstrap: `btn dropdown-toggle d-block w-100 d-md-inline` + +Tailwind: `inline-flex justify-center px-4 py-2 w-full text-sm font-medium rounded-md border shadow-sm focus:ring focus:ring-opacity-50` + +```php +public function configure(): void +{ + $this->setColumnSelectButtonAttributes([ + 'class' => 'focus:border-rose-300 focus:ring-1 focus:ring-rose-300 focus-visible:outline-rose-300', // Add these classes to the column select button + 'default-colors' => false, // Do not output the default colors + 'default-styling' => true // Output the default styling + ]); +} +``` + +### setColumnSelectMenuOptionCheckboxAttributes +Allows for customisation of the appearance of the "Column Select" menu option checkbox + +Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods. + +#### default-colors +Setting to false will disable the default colors for the Column Select menu option checkbox, the default colors are: + +Bootstrap: None + +Tailwind: `text-indigo-600 border-gray-300 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-900 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600 dark:focus:bg-gray-600` +#### default-styling + +Setting to false will disable the default styling for the Column Select menu option checkbox, the default styling is: + +Bootstrap 4: None + +Bootstrap 5: `form-check-input` + +Tailwind: `transition duration-150 ease-in-out rounded shadow-sm focus:ring focus:ring-opacity-50 disabled:opacity-50 disabled:cursor-wait` + +```php +public function configure(): void +{ + $this->setColumnSelectMenuOptionCheckboxAttributes([ + 'class' => 'text-rose-300 focus:border-rose-300 focus:ring-rose-300', // Add these classes to the column select menu option checkbox + 'default-colors' => false, // Do not output the default colors + 'default-styling' => true // Output the default styling + ]); +} +``` diff --git a/docs/datatable/configurable-areas.md b/docs/datatable/configurable-areas.md index 4661be63b..489a42cd6 100644 --- a/docs/datatable/configurable-areas.md +++ b/docs/datatable/configurable-areas.md @@ -34,6 +34,7 @@ public function configure(): void 'toolbar-right-end' => 'path.to.my.view', 'before-toolbar' => 'path.to.my.view', 'after-toolbar' => 'path.to.my.view', + 'after-tools' => 'path.to.my.view', 'before-pagination' => 'path.to.my.view', 'after-pagination' => 'path.to.my.view', 'after-wrapper' => 'path.to.my.view', diff --git a/docs/filter-types/filters-livewire-component-array.md b/docs/filter-types/filters-livewire-component-array.md new file mode 100644 index 000000000..86b2491dc --- /dev/null +++ b/docs/filter-types/filters-livewire-component-array.md @@ -0,0 +1,51 @@ +--- +title: Livewire Custom Array Filter (Beta) +weight: 13 +--- + +**IN BETA** +This feature is currently in beta, and use in production is not recommended. + +### Usage +This allows you to use a child/nested Livewire Component in place of the existing Filters, giving you more control over the look/feel/behaviour of a filter. This version supports use of returning an array of values for use in filtering. + +To use a LivewireComponentArrayFilter, you must include it in your namespace: +```php +use Rappasoft\LaravelLivewireTables\Views\Filters\LivewireComponentArrayFilter; +``` + +When creating a filter: +- Specify a unique name +- Set the path to a valid Livewire Component +- Define a filter() callback to define how the returned value will be used. + +```php + public function filters(): array + { + return [ + LivewireComponentArrayFilter::make('My External Filter') + ->setLivewireComponent('my-test-external-filter') + ->filter(function (Builder $builder, array $values) { + $builder->whereIn('foreign_id', $values); + }), + ]; + } +``` + +### setPillsSeparator +As this is an array, you can define the separator to use between pills values, by default this is set to ", " + +```php + public function filters(): array + { + return [ + LivewireComponentArrayFilter::make('My External Filter') + ->setLivewireComponent('my-test-external-filter') + ->setPillsSeparator(' OR ') + ->filter(function (Builder $builder, array $values) { + $builder->whereIn('foreign_id', $values); + }), + ]; + } +``` + diff --git a/docs/filters/available-component-methods.md b/docs/filters/available-component-methods.md index 9a463edbf..ffa02f29c 100644 --- a/docs/filters/available-component-methods.md +++ b/docs/filters/available-component-methods.md @@ -85,41 +85,9 @@ public function configure(): void --- -## setFilterPillsStatus +## Pills -**Enabled by default**, show/hide the filter pills. - -```php -public function configure(): void -{ - $this->setFilterPillsStatus(true); - $this->setFilterPillsStatus(false); -} -``` - -## setFilterPillsEnabled - -Show the filter pills for the component. - -```php -public function configure(): void -{ - // Shorthand for $this->setFilterPillsStatus(true) - $this->setFilterPillsEnabled(); -} -``` - -## setFilterPillsDisabled - -Hide the filter pills for the component. - -```php -public function configure(): void -{ - // Shorthand for $this->setFilterPillsStatus(false) - $this->setFilterPillsDisabled(); -} -``` +See the [Filter Pills](./filter-pills) documentation for help with configuring the pills --- diff --git a/docs/filters/available-filter-methods.md b/docs/filters/available-filter-methods.md index 9597372d4..249273109 100644 --- a/docs/filters/available-filter-methods.md +++ b/docs/filters/available-filter-methods.md @@ -5,36 +5,10 @@ weight: 6 The following methods are available on the filter object. These are "filter-specific" methods. ----- +Ensure you check out: +- [Available Component Methods](./available-component-methods) documentation for Table Wide configuration +- [Filter Pills](./filter-pills) documentation for help with configuring the pills for a filter -## setFilterPillTitle - -By default, the filter pill title is the filter name, but you can make it whatever you want: - -```php -SelectFilter::make('Active') - ->setFilterPillTitle('User Status') -``` - -## setFilterPillValues - -If you have numeric, or generated keys as your filter option values, they probably don't look too nice in the filter pill. You can set the values to be displayed in the filter pill: - -```php -SelectFilter::make('Active') - ->setFilterPillTitle('User Status') - ->setFilterPillValues([ - '1' => 'Active', - '0' => 'Inactive', - ]) - ->options([ - '' => 'All', - '1' => 'Yes', - '0' => 'No', - ]) -``` - -Now instead of `Active: Yes` it will say `User Status: Active` ## hiddenFromMenus @@ -80,8 +54,96 @@ By default the `clear` button will reset all filters to their defaults. You can SelectFilter::make('Active') ->notResetByClearButton() ``` - -## setFilterSlidedownRow + +## setCustomView +Use a fully custom view for a filter. This will utilise solely your view when rendering this filter. Note that the following methods will no longer apply to a filter using this: +- setCustomFilterLabel +- setFilterLabelAttributes + +```php +TextFilter::make('Name') + ->setCustomView('text-custom-view'), +``` + +## Config + +If the filter takes any config options, you can set them with the `config` method: + +```php + DateFilter::make('Date') + ->config([ + 'min' => '2020-01-01', + 'max' => '2021-12-31', + ]) +``` + +## Customising Wireable Behaviour + +For the following Filters, you may customise how the input is wire:model into the Table Component: + +- DateFilter (Defaults to Live) +- DateTimeFilter (Defaults to Live) +- MultiSelectDropdownFilter (Defaults to live.debounce.250ms) +- MultiSelectFilter (Defaults to live.debounce.250ms) +- NumberFilter (Defaults to Blur) +- SelectFilter (Defaults to Live) +- TextFilter (Defaults to Blur) + +You may override this using the following methods, on any of the above Filter types: + +### setWireBlur() +Forces the filter to use a wire:model.blur approach +```php + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireBlur() +``` + +### setWireDefer() +Forces the filter to use a wire:model approach +```php + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireDefer() +``` + +### setWireLive() +Forces the fitler to use a wire:model.live approach +```php + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireLive() +``` + +### setWireDebounce(int $debounceDelay) +Allows you to pass a string to use a wire:model.live.debounce.Xms approach +```php + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireDebounce(50) +``` + +--- + +## Styling + +These methods allow you to over-ride default styling for individual Filters + +--- + +### setFilterSlidedownRow This method applies only when using the Slide Down approach to filter display. By default the filters will be displayed in the order that they are listed in the filters() method. This method allows you to specify the row that the filter will be listed. When multiple filters are placed on the same row, and a mobile device is used, then the first filter listed will "win" that row. @@ -92,7 +154,7 @@ SelectFilter::make('Active') ->setFilterSlidedownRow(1) ``` -## setFilterSlidedownColspan +### setFilterSlidedownColspan This method applies only when using the Slide Down approach to filter display. By default each filter will take up one column, with the number of columns determined by the size of the screen, this ranges from 1 on a mobile device, to a maximum of 5 on a large display. This method allows you to specify the number of columns that the filter should span. It will span the number of columns specified, up to the number of columns available (depending on screen size). @@ -107,37 +169,9 @@ DateFilter::make('Date') ->setFilterSlidedownColspan('2') ``` -## setFilterPillBlade - -Set a blade file for use in displaying the filter values in the pills area. You can use this in conjunction with setFilterPillValues() to prettify your applied filter values display. You will receive two properties ($filter) containing the filter instance, and ($value) containing the filter value. - -```php -SelectFilter::make('Active') - ->setFilterPillBlade('path.to.blade') -``` - -Example blade: -```php -@aware(['component']) -@props(['filter']) - - - {{ $filter->getFilterPillTitle() }} - ({{ $filter->getFilterPillValue($value) }}) - - - -``` +--- -## setCustomFilterLabel +### setCustomFilterLabel Set a custom blade file for the filter's label. This will be used in both the Pop-Over and SlideDown filter displays, you should therefore ensure that you cater for the different filter layouts. @@ -158,27 +192,27 @@ You will receive several properties to your blade, explained here: Example label blade: ```php -@props(['filter', 'filterLayout' => 'popover', 'tableName' => 'table', 'isTailwind' => false, 'isBootstrap' => false, 'isBootstrap4' => false, 'isBootstrap5' => false, 'customLabelAttributes' => []]) - - -