From b7c4896d9ea99f129576d10c2982e0f5726b56df Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:27:51 +0100 Subject: [PATCH 01/14] upgrade php 8.5 livewire 3 --- composer.json | 32 ++++++++++++++++---------------- src/Elements/Column.php | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 685f03f..c948d9e 100644 --- a/composer.json +++ b/composer.json @@ -16,26 +16,26 @@ } ], "require": { - "php": "^8.3|8.4", - "spatie/laravel-package-tools": "^1.9.2", - "illuminate/contracts": "^9.0|^10.0", - "illuminate/database": "^9.0|^10.0", - "livewire/livewire": "^2.5" + "php": "^8.2", + "spatie/laravel-package-tools": "^1.19.0", + "illuminate/contracts": "^11.0|^12.0", + "illuminate/database": "^11.0|^12.0", + "livewire/livewire": "^3.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^v3.1", - "nunomaduro/collision": "^6.0|^7.0", - "nunomaduro/larastan": "^2.0.1", - "orchestra/testbench": "^6.22|^v7.1|^8.0", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", + "nunomaduro/collision": "^8.8.3", + "nunomaduro/larastan": "^2.0 | ^3.0", + "orchestra/testbench": "^9.0 | ^10.0", + "pestphp/pest": "^3.0 | ^4.0", + "pestphp/pest-plugin-laravel": "^3.0 | ^4.0", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan-deprecation-rules": "^2.0.3", + "phpstan/phpstan-phpunit": "^2.0.11", "phpunit/phpunit": "^9.5|^10.0", - "spatie/invade": "^1.1", - "spatie/laravel-ray": "^1.26", - "spatie/pest-plugin-snapshots": "^1.1", + "spatie/invade": "^2.1", + "spatie/laravel-ray": "^1.43", + "spatie/pest-plugin-snapshots": "^2.2.1", "spatie/x-ray": "dev-main" }, "autoload": { diff --git a/src/Elements/Column.php b/src/Elements/Column.php index f76cc83..7fabd57 100644 --- a/src/Elements/Column.php +++ b/src/Elements/Column.php @@ -36,7 +36,7 @@ public function __construct(WiredTable $table, string $name, string|null $dbColu $this->set(Config::name, $name) ->set(Config::db_column, $dbColumn) - ->set(Config::id, md5($this->name().$this->dbColumn().$table->id)); + ->set(Config::id, md5($this->name().$this->dbColumn().$table->getId())); } protected function initDefaults(): void From ea09139a782c550b11955ac2cc97fd8bc36919b2 Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:30:05 +0100 Subject: [PATCH 02/14] upgrade php 8.5 livewire 3 --- .github/workflows/phpstan.yml | 2 +- .github/workflows/run-tests.yml | 11 ++++++++++- .github/workflows/x-ray.yml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 856c1c7..ff7d0e3 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: [8.3, 8.4] + php-version: [8.2, 8.3, 8.4] coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 03d8632..9f44ab8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,8 +14,17 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] php: [8.3, 8.4] - laravel: [9.*] + laravel: [11.*, 12.*] stability: [prefer-lowest, prefer-stable] + exclude: + - laravel: 11.* + stability: prefer-lowest + - laravel: 12.* + stability: prefer-lowest + - laravel: 11.* + php: 8.5 + - php: 8.2 + stability: prefer-lowest name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/.github/workflows/x-ray.yml b/.github/workflows/x-ray.yml index b6f029f..a8963f9 100644 --- a/.github/workflows/x-ray.yml +++ b/.github/workflows/x-ray.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: [8.3, 8.4] + php-version: [8.2, 8.3, 8.4] coverage: none - name: Install composer dependencies From 60ffe4ffc2b6435486010af4dd17e15044f1c1d7 Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:33:39 +0100 Subject: [PATCH 03/14] upgrade php 8.5 livewire 3 --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index c948d9e..4720166 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,6 @@ "phpstan/extension-installer": "^1.4.3", "phpstan/phpstan-deprecation-rules": "^2.0.3", "phpstan/phpstan-phpunit": "^2.0.11", - "phpunit/phpunit": "^9.5|^10.0", "spatie/invade": "^2.1", "spatie/laravel-ray": "^1.43", "spatie/pest-plugin-snapshots": "^2.2.1", From 4a5fd79ccd3d3924fcf440eb7d3d6861f85aa2e2 Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:37:22 +0100 Subject: [PATCH 04/14] upgrade php 8.5 livewire 3 --- .github/workflows/run-tests.yml | 2 +- phpunit.xml.dist | 30 +++++++----------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9f44ab8..8021d07 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -50,5 +50,5 @@ jobs: composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests - run: vendor/bin/pest --ci + run: vendor/bin/pest --no-coverage -vv --c diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ba25c05..353bca3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,32 +1,11 @@ - + - tests + tests - - ./src - @@ -36,4 +15,9 @@ + + + ./src + + From 4e178a9a8e3ac9cc44e0d183bd803ef7fe3fdd81 Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:38:20 +0100 Subject: [PATCH 05/14] upgrade php 8.5 livewire 3 --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8021d07..a983844 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -50,5 +50,5 @@ jobs: composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests - run: vendor/bin/pest --no-coverage -vv --c + run: vendor/bin/pest --no-coverage -vv --ci From 2306a764566bfe71001b1afb7dd55b87454a3177 Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:41:58 +0100 Subject: [PATCH 06/14] upgrade php 8.5 livewire 3 --- phpunit.xml.dist | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 353bca3..aea341a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,10 +2,13 @@ - tests + tests + + ./src + @@ -15,9 +18,4 @@ - - - ./src - - From d5c132ad3105cc49964d3070d85d25f1449075fb Mon Sep 17 00:00:00 2001 From: mario Date: Thu, 29 Jan 2026 16:44:39 +0100 Subject: [PATCH 07/14] upgrade php 8.5 livewire 3 --- phpunit.xml.dist | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aea341a..ba25c05 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,23 @@ - + tests From 4bb8e9a943006903cce2609128f7452ee4999a89 Mon Sep 17 00:00:00 2001 From: mario Date: Fri, 30 Jan 2026 11:40:38 +0100 Subject: [PATCH 08/14] upgrade php 8.5 livewire 3 --- README.md | 48 ------ composer.json | 2 +- .../components/actions.blade.php | 58 ------- .../components/body/content.blade.php | 14 -- .../components/body/index.blade.php | 13 -- .../components/body/rows-selector.blade.php | 25 --- .../components/body/td.blade.php | 68 -------- .../components/body/tr.blade.php | 24 --- .../components/debug.blade.php | 154 ------------------ .../components/elements/checkbox.blade.php | 13 -- .../elements/filters/checkbox.blade.php | 32 ---- .../elements/filters/date.blade.php | 31 ---- .../elements/filters/select.blade.php | 35 ---- .../elements/filters/text.blade.php | 32 ---- .../components/filters.blade.php | 64 -------- .../components/footer/index.blade.php | 16 -- .../components/footer/td.blade.php | 30 ---- .../components/header/filters.blade.php | 29 ---- .../components/header/index.blade.php | 16 -- .../components/header/rows-selector.blade.php | 31 ---- .../components/header/th.blade.php | 78 --------- .../components/page-size-selector.blade.php | 18 -- .../components/pagination.blade.php | 22 --- .../components/search.blade.php | 33 ---- .../components/table.blade.php | 17 -- .../components/top.blade.php | 63 ------- .../components/wrapper.blade.php | 7 - .../views/tailwind_3_prefixed/dummy.blade.php | 28 ---- .../livewire-pagination.blade.php | 116 ------------- .../views/tailwind_3_prefixed/main.blade.php | 91 ----------- .../values/boolean.blade.php | 17 -- src/Concerns/HasFilters.php | 2 +- src/Concerns/HasTextConfiguration.php | 1 - tests/Pest.php | 2 +- tests/Unit/Concerns/HasConfiguration.php | 5 +- tests/Unit/Concerns/HasFilters.php | 76 +++++---- tests/Unit/Concerns/HasPagination.php | 12 +- tests/Unit/Concerns/HasQueryStrings.php | 6 +- tests/Unit/Concerns/HasSearch.php | 2 +- .../Configurations/TableConfiguration.php | 35 ++-- tests/Unit/Elements/Action.php | 52 +++--- tests/Unit/Elements/Column.php | 4 +- tests/Unit/Styles/TailwindPrefixed.php | 60 ------- 43 files changed, 106 insertions(+), 1376 deletions(-) delete mode 100644 resources/views/tailwind_3_prefixed/components/actions.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/body/content.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/body/index.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/body/td.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/body/tr.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/debug.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/filters.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/footer/index.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/footer/td.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/header/filters.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/header/index.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/header/th.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/pagination.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/search.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/table.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/top.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/components/wrapper.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/dummy.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/livewire-pagination.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/main.blade.php delete mode 100644 resources/views/tailwind_3_prefixed/values/boolean.blade.php delete mode 100644 tests/Unit/Styles/TailwindPrefixed.php diff --git a/README.md b/README.md index 0e120e7..c69fbde 100644 --- a/README.md +++ b/README.md @@ -45,54 +45,6 @@ Optionally, you can publish the views using php artisan vendor:publish --tag="wired-tables-views" ``` - -## Tailwind configuration - -In order to keep wired tables tailwind classes, add this to your `tailwind.config.js`: - -```js -module.exports = { - content: [ - //... - './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', - './vendor/wire-elements/modal/resources/views/*.blade.php', - //... - ], - theme: { - extend: {}, - }, - plugins: [], - prefix: 'tw-', - corePlugins: { - preflight: false, - } -} -``` - -### Using tailwind along with other frameworks (i.e. bootstrap) - -set `style = tailwind_3_prefixed` config in `configs/wired-tables.php` (see above for info on how to publish config file) - -and add these to your `tailwind.config.js`: - -```js -module.exports = { - content: [ - //... - './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', - './vendor/wire-elements/modal/resources/views/*.blade.php', - ], - - //... - - prefix: 'tw-', - corePlugins: { - //... - preflight: false, - } -} -``` - ## Usage ```php diff --git a/composer.json b/composer.json index 4720166..9c4eb9b 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "lint": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix -v", "test:lint": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix -v --dry-run", "test:types": "vendor/bin/phpstan analyse --ansi", - "test:unit": "vendor/bin/pest --colors=always --exclude-group=sandbox", + "test:unit": "vendor/bin/pest --no-coverage --colors=always --exclude-group=sandbox", "test": [ "@test:lint", "@test:types", diff --git a/resources/views/tailwind_3_prefixed/components/actions.blade.php b/resources/views/tailwind_3_prefixed/components/actions.blade.php deleted file mode 100644 index 38aa15c..0000000 --- a/resources/views/tailwind_3_prefixed/components/actions.blade.php +++ /dev/null @@ -1,58 +0,0 @@ - - -@if($this->shouldShowActionsSelector()) - @php($visibleActions = collect($this->actions)->filter(fn(DefStudio\WiredTables\Elements\Action $action) => $action->isVisible())) - @if($this->config(\DefStudio\WiredTables\Enums\Config::group_actions)) - -
class('tw-relative')}} wire:key="wt-{{$this->id}}-actions-wrapper" x-data="{show_actions: false}"> - -
- @foreach($visibleActions->chunk($this->config(\DefStudio\WiredTables\Enums\Config::actions_columns, $visibleActions->count() > 3 ? 3 : 1)) as $action_group) -
- @foreach($action_group as $index => $action) - -
- -
- @endforeach -
- @endforeach -
-
- - @else -
class('tw-flex')}} wire:key="wt-{{$this->id}}-actions-wrapper"> - @foreach($visibleActions as $index => $action) - -
- -
- @endforeach -
- @endif -@endif diff --git a/resources/views/tailwind_3_prefixed/components/body/content.blade.php b/resources/views/tailwind_3_prefixed/components/body/content.blade.php deleted file mode 100644 index a076ee5..0000000 --- a/resources/views/tailwind_3_prefixed/components/body/content.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@props(['column']) - -@if($column->get(\DefStudio\WiredTables\Enums\Config::clamp)) -
-
- {{$slot}} -
-
- {{$slot}} -
-
-@else - {{$slot}} -@endif diff --git a/resources/views/tailwind_3_prefixed/components/body/index.blade.php b/resources/views/tailwind_3_prefixed/components/body/index.blade.php deleted file mode 100644 index 9d5a357..0000000 --- a/resources/views/tailwind_3_prefixed/components/body/index.blade.php +++ /dev/null @@ -1,13 +0,0 @@ - - -class(['tw-divide-y tw-divide-gray-200' => $this->config(\DefStudio\WiredTables\Enums\Config::enable_row_dividers)])}}> -{{$slot}} - diff --git a/resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php b/resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php deleted file mode 100644 index d93d29f..0000000 --- a/resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php +++ /dev/null @@ -1,25 +0,0 @@ - - -@props(['model']) - -@if($this->shouldShowRowsSelector()) - class(['tw-pl-6 tw-py-3 tw-text-left'])}} - > - - -@endif diff --git a/resources/views/tailwind_3_prefixed/components/body/td.blade.php b/resources/views/tailwind_3_prefixed/components/body/td.blade.php deleted file mode 100644 index bdea00a..0000000 --- a/resources/views/tailwind_3_prefixed/components/body/td.blade.php +++ /dev/null @@ -1,68 +0,0 @@ -render(); - -$attributes = $attributes->merge([ - 'wire:key' => "wt-$this->id-row-{$this->getRowId($model)}-cell", - 'style' => ($width = $column->get(\DefStudio\WiredTables\Enums\Config::limit)) ? "max-width: {$width}px;" : '', -])->class([ - "tw-px-4 tw-py-2" => $this->config(\DefStudio\WiredTables\Enums\Config::compact_table), - "tw-px-6 tw-py-3" => !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table), - "tw-whitespace-nowrap" => !$column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table) && !$column->get(\DefStudio\WiredTables\Enums\Config::limit), - "tw-truncate" => $this->config(\DefStudio\WiredTables\Enums\Config::limit), - "tw-font-medium", - "tw-min-w-[15rem]" => $column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && \Illuminate\Support\Str::of($content->toHtml())->trim()->isNotEmpty(), - $column->getTextClasses(), -]) ; - -if ($emit = $column->getEmit()) { - $emit = \Illuminate\Support\Arr::wrap($emit); - - $params = collect($emit) - ->map(fn ($value) => is_array($value) ? json_encode($value) : "'$value'") - ->join(','); - - $attributes = $attributes->merge([ - 'wire:click' => "\$emit($params)", - 'class' => 'cursor-pointer', - ]); -} - -$clamp_width = $column->get(\DefStudio\WiredTables\Enums\Config::clamp); - -?> -@props(['column', 'model']) - - - @if($url = $column->getUrl()) - get(\DefStudio\WiredTables\Enums\Config::url_target)) ? "target='$url_target'": ''}}> - {{$content}} - - @elseif($column->get(\DefStudio\WiredTables\Enums\Config::limit) && str($content->toHtml())->toString()) -
-
- {{$content}} -
-
- {{$content}} -
-
- - - -
-
- @else - {{$content}} - @endif - diff --git a/resources/views/tailwind_3_prefixed/components/body/tr.blade.php b/resources/views/tailwind_3_prefixed/components/body/tr.blade.php deleted file mode 100644 index ddc0e38..0000000 --- a/resources/views/tailwind_3_prefixed/components/body/tr.blade.php +++ /dev/null @@ -1,24 +0,0 @@ - - -@props(['model']) - -class([ - 'tw-bg-white' => !$this->config(\DefStudio\WiredTables\Enums\Config::striped), - 'odd:tw-bg-white even:tw-bg-gray-50' => $this->config(\DefStudio\WiredTables\Enums\Config::striped), - 'hover:tw-bg-gray-200' => $this->config(\DefStudio\WiredTables\Enums\Config::hover), - ])}} ->{{$slot}} - diff --git a/resources/views/tailwind_3_prefixed/components/debug.blade.php b/resources/views/tailwind_3_prefixed/components/debug.blade.php deleted file mode 100644 index 6a0ed8f..0000000 --- a/resources/views/tailwind_3_prefixed/components/debug.blade.php +++ /dev/null @@ -1,154 +0,0 @@ - - -@if($this->config(\DefStudio\WiredTables\Enums\Config::debug)) -
class("tw-my-3 tw-border tw-rounded-md tw-overflow-hidden")}} x-cloak> -
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
-
@php($this->configuration()->dump())
-
@php($this->configuration()->header->dump())
-
@dump($this->sorting)
-
- @if($this->paginationEnabled()) - @dump(['page' => $this->page, 'page size' => $this->pageSize]) - @else - @dump("Pagination disabled") - @endif -
-
- @if($this->shouldShowRowsSelector()) - @dump(['selected' => collect($this->selection)->keys()->toArray()]) - @else - @dump("Row selection not needed") - @endif -
-
-
    - @foreach($this->columns as $index => $column) -
  • - -
  • - @endforeach -
-
- @foreach($this->columns as $index => $column) -
- {{$column->dump()}} -
- @endforeach -
-
-
-
    - @foreach($this->actions as $index => $action) -
  • - -
  • - @endforeach -
-
- @foreach($this->actions as $index => $action) -
- {{$action->dump()}} -
- @endforeach -
-
-
-
    - @foreach($this->filters as $index => $filter) -
  • - -
  • - @endforeach -
-
- @foreach($this->filters as $index => $filter) -
- {{$filter->dump()}} -
- @endforeach -
-
-
- {{ $this->debugQuery()}} -
-
-
    - @foreach($this->dumpLabels() as $label) -
  • - -
  • - @endforeach -
-
- @foreach($this->dumpLabels() as $label) -
- @foreach($this->dumps()->where(fn(DefStudio\WiredTables\Elements\Dump $dump) => $dump->getLabel() === $label) as $dump) - {{$dump->print()}} - @endforeach -
- @endforeach -
-
-
-
-
- -@endif diff --git a/resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php b/resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php deleted file mode 100644 index ed61784..0000000 --- a/resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php +++ /dev/null @@ -1,13 +0,0 @@ -class([ - "tw-rounded", - "tw-border-gray-300", - "tw-text-indigo-600", - "tw-shadow-sm", - "focus:tw-border-indigo-300", - "focus:tw-ring focus:tw-ring-indigo-200", - "focus:tw-ring-opacity-50", - "tw-cursor-pointer", - ])}} -/> diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php deleted file mode 100644 index 5d9226b..0000000 --- a/resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php +++ /dev/null @@ -1,32 +0,0 @@ - - -@props(['filter', 'label' => true]) - -
- @if($label) - - @endif - - -
- diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php deleted file mode 100644 index 981ffd6..0000000 --- a/resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php +++ /dev/null @@ -1,31 +0,0 @@ - - -@props(['filter', 'label' => true]) - -
- @if($label) - - @endif - -
- diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php deleted file mode 100644 index 68f599c..0000000 --- a/resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php +++ /dev/null @@ -1,35 +0,0 @@ - - -@props(['filter', 'label' => true]) - -
- @if($label) - - @endif - - -
- diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php deleted file mode 100644 index 13ff136..0000000 --- a/resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php +++ /dev/null @@ -1,32 +0,0 @@ - - -@props(['filter', 'label' => true]) - -
- @if($label) - - @endif - -
- diff --git a/resources/views/tailwind_3_prefixed/components/filters.blade.php b/resources/views/tailwind_3_prefixed/components/filters.blade.php deleted file mode 100644 index 6bc00de..0000000 --- a/resources/views/tailwind_3_prefixed/components/filters.blade.php +++ /dev/null @@ -1,64 +0,0 @@ - - -@if($this->shouldShowFiltersSelector()) - @php($visibleFilters = $this->globalFilters()->filter(fn($filter) => $filter->isVisible())) - - @if($this->config(\DefStudio\WiredTables\Enums\Config::group_filters)) -
class('tw-relative')}} wire:key="wt-{{$this->id}}-filters-wrapper" x-data="{show: false}"> - -
- - @foreach($visibleFilters->chunk($this->config(\DefStudio\WiredTables\Enums\Config::filters_columns, $visibleFilters->count() > 2 ? 2 : 1)) as $filter_group) -
- @foreach($filter_group as $filter) - -
- -
- @endforeach -
- @endforeach -
-
- @else -
class('tw-flex')}} wire:key="wt-{{$this->id}}-filters-wrapper"> - @foreach($visibleFilters as $filter) - - @endforeach -
- @endif -@endif diff --git a/resources/views/tailwind_3_prefixed/components/footer/index.blade.php b/resources/views/tailwind_3_prefixed/components/footer/index.blade.php deleted file mode 100644 index 3b13f7f..0000000 --- a/resources/views/tailwind_3_prefixed/components/footer/index.blade.php +++ /dev/null @@ -1,16 +0,0 @@ - - - -class([ - "tw-bg-gray-50" => !$this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode), - "tw-bg-gray-700" => $this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode), -])}}> - {{$slot}} - diff --git a/resources/views/tailwind_3_prefixed/components/footer/td.blade.php b/resources/views/tailwind_3_prefixed/components/footer/td.blade.php deleted file mode 100644 index 6089b36..0000000 --- a/resources/views/tailwind_3_prefixed/components/footer/td.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -class([ - "tw-px-4 tw-py-2" => $this->config(\DefStudio\WiredTables\Enums\Config::compact_table), - "tw-px-6 tw-py-3" => !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table), - "tw-whitespace-nowrap" => !$column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table) && !$column->get(\DefStudio\WiredTables\Enums\Config::limit), - "tw-font-medium", - "tw-min-w-[15rem]" => $column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && \Illuminate\Support\Str::of($content->toHtml())->trim()->isNotEmpty(), - $column->getTextClasses(), -]); - -?> - -@props(['column', 'model']) - - - {{$this->getColumnSum($column->name())}} - - diff --git a/resources/views/tailwind_3_prefixed/components/header/filters.blade.php b/resources/views/tailwind_3_prefixed/components/header/filters.blade.php deleted file mode 100644 index 2423d32..0000000 --- a/resources/views/tailwind_3_prefixed/components/header/filters.blade.php +++ /dev/null @@ -1,29 +0,0 @@ - -@if($this->shouldShowColumnFilters()) - - @if($this->shouldShowRowsSelector()) - - @endif - @foreach($this->columns as $column) - - @php($columnFilter = $this->getFilterByName($column->name())) - @if($columnFilter && $columnFilter->isColumnFilter()) - - @endif - - @endforeach - -@endif diff --git a/resources/views/tailwind_3_prefixed/components/header/index.blade.php b/resources/views/tailwind_3_prefixed/components/header/index.blade.php deleted file mode 100644 index fd6a092..0000000 --- a/resources/views/tailwind_3_prefixed/components/header/index.blade.php +++ /dev/null @@ -1,16 +0,0 @@ - - - -class([ - "tw-bg-gray-50" => !$this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode), - "tw-bg-gray-700" => $this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode), -])}}> - {{$slot}} - diff --git a/resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php b/resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php deleted file mode 100644 index e5da9d4..0000000 --- a/resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php +++ /dev/null @@ -1,31 +0,0 @@ - - -@if($this->shouldShowRowsSelector()) - class([ - "tw-px-6 tw-text-left tw-align-middle", - "tw-py-3" => !$this->shouldShowColumnFilters(), - "tw-pt-3" => $this->shouldShowColumnFilters(), - ])}} - > - selectedIds()) || collect($this->getVisibleRowsIds())->reject(fn (int $id) => collect($this->selectedIds())->contains($id))->isNotEmpty()) { - $this->allSelected = false; - } else { - $this->allSelected = true; - } - ?> - - -@endif diff --git a/resources/views/tailwind_3_prefixed/components/header/th.blade.php b/resources/views/tailwind_3_prefixed/components/header/th.blade.php deleted file mode 100644 index c6e6f2c..0000000 --- a/resources/views/tailwind_3_prefixed/components/header/th.blade.php +++ /dev/null @@ -1,78 +0,0 @@ -getTextClasses()}"; -?> - -@props(['column']) - - -class([ - "tw-px-6 tw-relative", - "tw-py-3" => !$this->shouldShowColumnFilters(), - "tw-pt-3" => $this->shouldShowColumnFilters(), - ])}}> - @if($column->isSortable()) - - @else -
- {{$column->name()}} -
- @endif - - diff --git a/resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php b/resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php deleted file mode 100644 index 2522cf7..0000000 --- a/resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php +++ /dev/null @@ -1,18 +0,0 @@ -config(\DefStudio\WiredTables\Enums\Config::available_page_sizes); - -?> - -@if($availablePageSize && count($availablePageSize)>1) - -@endif - diff --git a/resources/views/tailwind_3_prefixed/components/pagination.blade.php b/resources/views/tailwind_3_prefixed/components/pagination.blade.php deleted file mode 100644 index ba5eaba..0000000 --- a/resources/views/tailwind_3_prefixed/components/pagination.blade.php +++ /dev/null @@ -1,22 +0,0 @@ - - -@if($this->paginationEnabled()) -
class("sm:tw-flex tw-items-center tw-p-3 tw-pt-0")}}> - - @if($this->pageSize !== 'all') -
- {{$this->rows->links('wired-tables::livewire-pagination')}} -
- @endif - -
- -
- -
-@endif diff --git a/resources/views/tailwind_3_prefixed/components/search.blade.php b/resources/views/tailwind_3_prefixed/components/search.blade.php deleted file mode 100644 index 2f059dd..0000000 --- a/resources/views/tailwind_3_prefixed/components/search.blade.php +++ /dev/null @@ -1,33 +0,0 @@ - - - -@if($this->isSearchable()) -
-
-
- - - -
- - - -
- - - -
-
-
-@endif diff --git a/resources/views/tailwind_3_prefixed/components/table.blade.php b/resources/views/tailwind_3_prefixed/components/table.blade.php deleted file mode 100644 index 691a906..0000000 --- a/resources/views/tailwind_3_prefixed/components/table.blade.php +++ /dev/null @@ -1,17 +0,0 @@ - - -class([ - "tw-min-w-full", - 'tw-divide-y tw-divide-gray-200' => $this->config(\DefStudio\WiredTables\Enums\Config::enable_row_dividers) -])}}> - {{$header}} - - {{$slot}} -
diff --git a/resources/views/tailwind_3_prefixed/components/top.blade.php b/resources/views/tailwind_3_prefixed/components/top.blade.php deleted file mode 100644 index 4f5b3d9..0000000 --- a/resources/views/tailwind_3_prefixed/components/top.blade.php +++ /dev/null @@ -1,63 +0,0 @@ - - -
- - - -
- @if($this->activeFilters()->isNotEmpty()) -
-
Filters:
- @foreach($this->activeFilters() as $filter) -
- {{$filter->name()}}: {{$filter->formattedValue()}} - - - - -
- @endforeach -
- @endif - - @if(!empty($this->sorting)) -
-
Sort:
- @foreach($this->sorting as $columnName => $dir) -
- {{$columnName}}: {{$dir}} - - - - -
- @endforeach -
- @endif -
- -
- @if($this->config(\DefStudio\WiredTables\Enums\Config::is_searchable, true)) - - @endif - - - -
- - -
-
-
- diff --git a/resources/views/tailwind_3_prefixed/components/wrapper.blade.php b/resources/views/tailwind_3_prefixed/components/wrapper.blade.php deleted file mode 100644 index 76e49dd..0000000 --- a/resources/views/tailwind_3_prefixed/components/wrapper.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -
class([ - "tw-min-h-[300px]", - "tw-flex tw-flex-col sm:tw-rounded-lg", - "tw-shadow-[0_0_15px_-2px_rgba(0,0,0,0.1)]" => $this->config(\DefStudio\WiredTables\Enums\Config::wrapper_shadow) -])}}> - {{$slot}} -
diff --git a/resources/views/tailwind_3_prefixed/dummy.blade.php b/resources/views/tailwind_3_prefixed/dummy.blade.php deleted file mode 100644 index b6056fe..0000000 --- a/resources/views/tailwind_3_prefixed/dummy.blade.php +++ /dev/null @@ -1,28 +0,0 @@ -
diff --git a/resources/views/tailwind_3_prefixed/livewire-pagination.blade.php b/resources/views/tailwind_3_prefixed/livewire-pagination.blade.php deleted file mode 100644 index d03550c..0000000 --- a/resources/views/tailwind_3_prefixed/livewire-pagination.blade.php +++ /dev/null @@ -1,116 +0,0 @@ -
- @if ($paginator->hasPages()) - @php(isset($this->numberOfPaginatorsRendered[$paginator->getPageName()]) ? $this->numberOfPaginatorsRendered[$paginator->getPageName()]++ : $this->numberOfPaginatorsRendered[$paginator->getPageName()] = 1) - - - @endif -
diff --git a/resources/views/tailwind_3_prefixed/main.blade.php b/resources/views/tailwind_3_prefixed/main.blade.php deleted file mode 100644 index 7eb96fd..0000000 --- a/resources/views/tailwind_3_prefixed/main.blade.php +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - @if(count($this->selectedIds())>0 && count($this->selectedIds()) < $this->totalRowsCount && $this->rows->hasPages()) -
- - {{count($this->selectedIds())}} rows selected so far, - - - select all {{$this->totalRowsCount}} rows - -
- - @endif - -
config(\DefStudio\WiredTables\Enums\Config::poll))wire:poll.{{$poll}}ms @endif - @class([ - 'tw-overflow-auto tw-mb-3', - 'tw-rounded-md' => $this->config(\DefStudio\WiredTables\Enums\Config::rounded), - 'tw-shadow-md' => $this->config(\DefStudio\WiredTables\Enums\Config::table_shadow), - ]) - > - - - - - - @foreach($this->columns as $column) - @continue(!$column->isVisible()) - @php($column->setParentConfiguration($this->configuration()->header)) - - @endforeach - - - - - - - - @forelse($this->rows as $model) - - - @foreach($this->columns as $column) - @continue(!$column->isVisible()) - @php($column->setParentConfiguration($this->configuration())) - @php($column->setModel($model)) - - @endforeach - - @empty - - - {{$this->config(\DefStudio\WiredTables\Enums\Config::empty_message, __('No data found'))}} - - - @endforelse - - - - @if(collect($this->columns)->some(fn(\DefStudio\WiredTables\Elements\Column $column) => !!$column->get(\DefStudio\WiredTables\Enums\Config::with_sum))) - - - @if($this->shouldShowRowsSelector()) - - @endif - - @foreach($this->columns as $column) - @continue(!$column->isVisible()) - - - @endforeach - - - @endif - - - - -
- - - -
- diff --git a/resources/views/tailwind_3_prefixed/values/boolean.blade.php b/resources/views/tailwind_3_prefixed/values/boolean.blade.php deleted file mode 100644 index 7ee8a56..0000000 --- a/resources/views/tailwind_3_prefixed/values/boolean.blade.php +++ /dev/null @@ -1,17 +0,0 @@ - - -@if($value) - - - -@else - - - -@endif diff --git a/src/Concerns/HasFilters.php b/src/Concerns/HasFilters.php index 1d4d430..cb8145f 100644 --- a/src/Concerns/HasFilters.php +++ b/src/Concerns/HasFilters.php @@ -87,7 +87,7 @@ public function getFilterByName(string $name): Filter|null return collect($this->_filters)->first(fn (Filter $filter) => $filter->name() === $name); } - public function updatedFilterValues($value, $key): void + public function updatedFilterValues(): void { if ($this->paginationEnabled()) { $this->setPage(1); diff --git a/src/Concerns/HasTextConfiguration.php b/src/Concerns/HasTextConfiguration.php index 172ff7e..7657ada 100644 --- a/src/Concerns/HasTextConfiguration.php +++ b/src/Concerns/HasTextConfiguration.php @@ -17,7 +17,6 @@ public function getTextClasses(): string Config::font_size_class, ])->map(fn (Config $config) => $this->get($config)) ->filter() - ->when(config("wired-tables.style") === 'tailwind_3_prefixed', fn (Collection $collection) => $collection->map(fn (string $class) => "tw-$class")) ->join(' '); } diff --git a/tests/Pest.php b/tests/Pest.php index 24fd985..d96d00f 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -67,7 +67,7 @@ protected function columns(): void $table->bootedHasPagination(); $table->bootedHasFilters(); - $table->forgetComputed('slug'); + unset($table->slug); return $table; } diff --git a/tests/Unit/Concerns/HasConfiguration.php b/tests/Unit/Concerns/HasConfiguration.php index 59f8f3b..d7e5ca9 100644 --- a/tests/Unit/Concerns/HasConfiguration.php +++ b/tests/Unit/Concerns/HasConfiguration.php @@ -30,7 +30,8 @@ 'preserve_state' => true, 'striped' => true, 'enable_row_dividers' => false, - 'drop_shadow' => false, + 'wrapper_shadow' => false, + 'table_shadow' => false, 'hover' => false, 'support_multiple_sorting' => false, 'group_filters' => true, @@ -38,6 +39,8 @@ 'filters_columns' => 1, 'actions_columns' => 1, 'always_show_actions' => false, + 'is_searchable' => true, + 'rounded' => false, ]); expect($table->configuration()->header->toArray())->toBe([ diff --git a/tests/Unit/Concerns/HasFilters.php b/tests/Unit/Concerns/HasFilters.php index f856f89..d8f52fd 100644 --- a/tests/Unit/Concerns/HasFilters.php +++ b/tests/Unit/Concerns/HasFilters.php @@ -18,7 +18,7 @@ use function Pest\Laravel\actingAs; -test('filters are booted', function () { +test('filters are booted', function() { $table = fakeTable(); expect($table->filters) @@ -26,7 +26,7 @@ ->not->toBeEmpty(); }); -test('filters are mounted', function () { +test('filters are mounted', function() { $table = fakeTable(); expect($table->filterValues) @@ -34,7 +34,7 @@ ->toHaveKey('brand'); }); -test('cached filters are mounted', function () { +test('cached filters are mounted', function() { actingAs(new User(['id' => 42])); Cache::put("httplocalhost-42-state-filters", [ 'brand' => 'foo', @@ -46,7 +46,7 @@ ]); }); -test('cached filters can be overridden by a query string', function () { +test('cached filters can be overridden by a query string', function() { actingAs(new User(['id' => 42])); Cache::put("httplocalhost-42-state-filters", [ 'brand' => 'foo', @@ -67,7 +67,7 @@ ]); }); -test('cached filters are cleared with filter values', function () { +test('cached filters are cleared with filter values', function() { actingAs(new User(['id' => 42])); Cache::put("httplocalhost-42-state-filters", [ 'brand' => 'foo', @@ -81,7 +81,7 @@ ]); }); -test('cached filters are updated when filter values change', function () { +test('cached filters are updated when filter values change', function() { actingAs(new User(['id' => 42])); $table = fakeTable(); $table->filterValues = [ @@ -95,7 +95,7 @@ ]); }); -test('existing filters are not cleared on mount', function () { +test('existing filters are not cleared on mount', function() { $table = fakeTable(); $table->filterValues['brand'] = 'foo'; @@ -107,7 +107,7 @@ ]); }); -test('filters must be defined only inside [->filters()] method', function () { +test('filters must be defined only inside [->filters()] method', function() { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -125,11 +125,11 @@ public function addFilter(): void } }); - expect(fn () => $table->addFilter()) + expect(fn() => $table->addFilter()) ->toThrow(FilterException::class); }); -test('filters must be unique', function () { +test('filters must be unique', function() { fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -149,7 +149,7 @@ protected function filters(): void }); })->throws(FilterException::class); -it('can retrieve a filter', function () { +it('can retrieve a filter', function() { $table = fakeTable(); expect($table->getFilter('brand')) @@ -157,7 +157,7 @@ protected function filters(): void ->name()->toBe('Brand'); }); -it('can retrieve a filter by name', function () { +it('can retrieve a filter by name', function() { $table = fakeTable(); expect($table->getFilterByName('Brand')) @@ -165,7 +165,7 @@ protected function filters(): void ->name()->toBe('Brand'); }); -it('cleans up checkbox filters when unckeched', function () { +it('cleans up checkbox filters when unckeched', function() { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -190,7 +190,7 @@ protected function filters(): void expect($table->filterValues['check'])->toBeNull(); }); -it('can tell if it has filters', function () { +it('can tell if it has filters', function() { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -208,11 +208,13 @@ protected function columns(): void expect(fakeTable()->hasFilters())->toBeTrue(); }); -it('can tell if filters selector should be shown', function (WiredTable $table, bool $visible) { +it('can tell if filters selector should be shown', function($table, bool $visible) { + $table = $table(); + expect($table->shouldShowFiltersSelector())->toBe($visible); })->with([ 'no filters' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -223,10 +225,10 @@ protected function columns(): void $this->column('Name'); } }), - 'visible' => false, + false, ], 'no global filters' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -242,10 +244,10 @@ protected function filters(): void $this->filter('Name')->displayOnColumn(); } }), - 'visible' => false, + false, ], 'hidden filter' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -261,19 +263,21 @@ protected function filters(): void $this->filter('Name')->hidden(); } }), - 'visible' => false, + false, ], 'visible filter' => [ - 'table' => fn () => fakeTable(), - 'visible' => true, + fn() => fakeTable(), + true, ], ]); -it('can tell if column filters should be shown', function (WiredTable $table, bool $visible) { +it('can tell if column filters should be shown', function( $table, bool $visible) { + $table = $table(); + expect($table->shouldShowColumnFilters())->toBe($visible); })->with([ 'no filters' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -284,10 +288,10 @@ protected function columns(): void $this->column('Name'); } }), - 'visible' => false, + false, ], 'no column filters' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -303,10 +307,10 @@ protected function filters(): void $this->filter('Name'); } }), - 'visible' => false, + false, ], 'hidden filter' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -322,10 +326,10 @@ protected function filters(): void $this->filter('Name')->displayOnColumn()->hidden(); } }), - 'visible' => false, + false, ], 'visible filter' => [ - 'table' => fn () => fakeTable(new class () extends WiredTable { + fn() => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -341,11 +345,11 @@ protected function filters(): void $this->filter('Name')->displayOnColumn(); } }), - 'visible' => true, + true, ], ]); -it('can extract active filters', function () { +it('can extract active filters', function() { $table = fakeTable(); expect($table->activeFilters())->toBeEmpty(); @@ -358,7 +362,7 @@ protected function filters(): void ->first()->name()->toBe('Brand'); }); -it('can extract global and column filters', function () { +it('can extract global and column filters', function() { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -388,7 +392,7 @@ protected function filters(): void ->first()->name()->toBe('Name'); }); -it('can clear filters', function () { +it('can clear filters', function() { $table = fakeTable(); $table->filterValues['brand'] = 'lamborghini'; @@ -397,7 +401,7 @@ protected function filters(): void expect($table->filterValues['brand'])->toBeNull(); }); -it('can apply filters', function () { +it('can apply filters', function() { enableDebug(); $table = fakeTable(); diff --git a/tests/Unit/Concerns/HasPagination.php b/tests/Unit/Concerns/HasPagination.php index 468cbf2..976a821 100644 --- a/tests/Unit/Concerns/HasPagination.php +++ b/tests/Unit/Concerns/HasPagination.php @@ -10,16 +10,16 @@ test('pagination is mounted', function () { $table = fakeTable(); - expect($table->pageSize)->toBe(10); + expect($table->pageSize)->toBe('10'); }); test('page is reset when page size changes', function () { $table = fakeTable(); - $table->page = 2; + $table->setPage(2); $table->updatedPageSize(); - expect($table->page)->toBe(1); + expect($table->paginators)->toBe(['page' => 1]); }); it('can change page size', function () { @@ -28,7 +28,7 @@ $table->setPageSize(20); ; - expect($table->pageSize)->toBe(20); + expect($table->pageSize)->toBe('20'); }); it('prevents invalid page sizes', function () { @@ -54,7 +54,7 @@ $table = fakeTable(); - expect($table->pageSize)->toBe(50); + expect($table->pageSize)->toBe('50'); }); test('cached page size is updated', function () { @@ -65,5 +65,5 @@ $table = fakeTable(); $table->setPageSize(20); - expect(Cache::get("httplocalhost-42-state-page-size"))->toBe(20); + expect(Cache::get("httplocalhost-42-state-page-size"))->toBe('20'); }); diff --git a/tests/Unit/Concerns/HasQueryStrings.php b/tests/Unit/Concerns/HasQueryStrings.php index 7b9b8c9..3569215 100644 --- a/tests/Unit/Concerns/HasQueryStrings.php +++ b/tests/Unit/Concerns/HasQueryStrings.php @@ -16,8 +16,8 @@ expect($table->queryString())->toBe([ - "search" => ['except' => '', 'as' => 'foo.search'], - "sorting" => ['except' => [], 'as' => 'foo.sort'], - "filterValues" => ['except' => '', 'as' => 'foo.filters'], + "search" => ['except' => '', 'as' => 'foo_search'], + "sorting" => ['except' => [], 'as' => 'foo_sort'], + "filterValues" => ['except' => '', 'as' => 'foo_filters'], ]); }); diff --git a/tests/Unit/Concerns/HasSearch.php b/tests/Unit/Concerns/HasSearch.php index c651678..530b9b3 100644 --- a/tests/Unit/Concerns/HasSearch.php +++ b/tests/Unit/Concerns/HasSearch.php @@ -135,7 +135,7 @@ protected function columns(): void $table->search = 'foo'; - expect($table)->rawQuery()->toBe('select * from "cars" where ("name" like \'%foo%\') limit 10 offset 0'); + expect($table)->rawQuery()->toBe('select * from "cars" where ("name" like \'%foo%\' or 0 >= 1) limit 10 offset 0'); }); diff --git a/tests/Unit/Configurations/TableConfiguration.php b/tests/Unit/Configurations/TableConfiguration.php index 1c44064..eec4507 100644 --- a/tests/Unit/Configurations/TableConfiguration.php +++ b/tests/Unit/Configurations/TableConfiguration.php @@ -2,7 +2,7 @@ use DefStudio\WiredTables\Configurations\TableConfiguration; -test('defaults', function () { +test('defaults', function() { $config = new TableConfiguration(); expect($config->toArray())->toBe([ @@ -21,7 +21,8 @@ 'preserve_state' => true, 'striped' => true, 'enable_row_dividers' => false, - 'drop_shadow' => false, + 'wrapper_shadow' => false, + 'table_shadow' => false, 'hover' => false, 'support_multiple_sorting' => false, 'group_filters' => true, @@ -29,10 +30,12 @@ 'filters_columns' => 1, 'actions_columns' => 1, 'always_show_actions' => false, + "is_searchable" => true, + "rounded" => false, ]); }); -it('can disable pagination', function () { +it('can disable pagination', function() { $config = new TableConfiguration(); $config->disablePagination(); @@ -43,7 +46,7 @@ ]); }); -it('can set compact table mode', function () { +it('can set compact table mode', function() { $config = new TableConfiguration(); $config->compactTable(); @@ -53,7 +56,7 @@ ]); }); -it('can set default page size', function () { +it('can set default page size', function() { $config = new TableConfiguration(); $config->pageSize(100); @@ -63,7 +66,7 @@ ]); }); -it('can set available pages', function () { +it('can set available pages', function() { $config = new TableConfiguration(); $config->pageSize(100, [1, 2, 100, 150]); @@ -74,7 +77,7 @@ ]); }); -it('can disable row stripes', function () { +it('can disable row stripes', function() { $config = new TableConfiguration(); $config->striped(false); @@ -84,7 +87,7 @@ ]); }); -it('can enable rows hover effect', function () { +it('can enable rows hover effect', function() { $config = new TableConfiguration(); $config->hover(); @@ -94,7 +97,7 @@ ]); }); -it('can set the number of filters columns', function () { +it('can set the number of filters columns', function() { $config = new TableConfiguration(); $config->filterSelectorColumns(42); @@ -104,7 +107,7 @@ ]); }); -it('can set the number of actions columns', function () { +it('can set the number of actions columns', function() { $config = new TableConfiguration(); $config->actionsSelectorColumns(42); @@ -114,7 +117,7 @@ ]); }); -it('can disable row dividers', function () { +it('can disable row dividers', function() { $config = new TableConfiguration(); $config->rowDividers(false); @@ -124,7 +127,7 @@ ]); }); -it('can enable multiple sorting', function () { +it('can enable multiple sorting', function() { $config = new TableConfiguration(); $config->multipleSorting(); @@ -134,7 +137,7 @@ ]); }); -it('can enable debug mode', function () { +it('can enable debug mode', function() { enableDebug(); $config = new TableConfiguration(); @@ -145,7 +148,7 @@ ]); }); -it("can't set debug mode if debug is disabled", function () { +it("can't set debug mode if debug is disabled", function() { $config = new TableConfiguration(); $config->debug(); @@ -153,7 +156,7 @@ expect($config->toArray())->not->toHaveKey('debug'); }); -it('can set row_id field', function () { +it('can set row_id field', function() { $config = new TableConfiguration(); $config->rowIdField('foo'); @@ -161,7 +164,7 @@ expect($config->toArray())->toMatchArray(['id_field' => 'foo']); }); -it('can set state preserving', function () { +it('can set state preserving', function() { $config = new TableConfiguration(); $config->preserveState(false); diff --git a/tests/Unit/Elements/Action.php b/tests/Unit/Elements/Action.php index b7d8bc2..d787fe0 100644 --- a/tests/Unit/Elements/Action.php +++ b/tests/Unit/Elements/Action.php @@ -71,11 +71,13 @@ ]); }); -it('can compute its method', function (Action $action, string $method) { +it('can compute its method', function ($action, string $method) { + $action = $action(); + expect($action->method())->toBe($method); })->with([ 'closure' => [ - 'action' => fn () => (new Action(new class () extends WiredTable { + fn () => (new Action(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -86,10 +88,10 @@ protected function columns(): void $this->column('test'); } }, 'my action'))->handle(fn () => null), - 'method' => 'handleAction', + 'handleAction', ], 'method given' => [ - 'action' => fn () => (new Action(new class () extends WiredTable { + fn () => (new Action(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -104,10 +106,10 @@ public function test(): void { } }, 'my action', 'test')), - 'method' => 'test', + 'test', ], 'camel' => [ - 'action' => fn () => (new Action(new class () extends WiredTable { + fn () => (new Action(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -122,10 +124,10 @@ public function myAction(): void { } }, 'my action')), - 'method' => 'myAction', + 'myAction', ], 'snake' => [ - 'action' => fn () => (new Action(new class () extends WiredTable { + fn () => (new Action(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -140,7 +142,7 @@ public function my_action(): void { } }, 'my action')), - 'method' => 'my_action', + 'my_action', ], ]); @@ -163,29 +165,31 @@ public function my_action(): void expect($processed)->toBeTrue(); }); -test("visibility", function (Action $action, bool $visible) { +test("visibility", function ( $action, bool $visible) { + $action = $action(); + expect($action->isVisible())->toBe($visible); })->with([ 'hidden by configuration' => [ - 'action' => fn () => (new Action(fakeTable(), 'my action'))->hidden(), - 'visible' => false, + fn () => (new Action(fakeTable(), 'my action'))->hidden(), + false, ], 'hidden by closure' => [ - 'action' => fn () => (new Action(fakeTable(), 'my action'))->hidden(fn () => true), - 'visible' => false, + fn () => (new Action(fakeTable(), 'my action'))->hidden(fn () => true), + false, ], 'visible by table configuration (row selection not needed)' => [ - 'action' => function () { + function () { $table = fakeTable(); $table->configuration()->alwaysShowActions(); $action = new Action($table, 'my action'); return $action; }, - 'visible' => true, + true, ], 'visible by table configuration (row selection required)' => [ - 'action' => function () { + function () { $table = fakeTable(); $table->configuration()->alwaysShowActions(); $action = new Action($table, 'my action'); @@ -193,14 +197,14 @@ public function my_action(): void return $action; }, - 'visible' => true, + true, ], 'visible if row selection is not needed' => [ - 'action' => fn () => new Action(fakeTable(), 'my action'), - 'visible' => true, + fn () => new Action(fakeTable(), 'my action'), + true, ], 'visible if rows are selected' => [ - 'action' => function () { + function () { $table = fakeTable(); $table->selectRows([1]); $action = new Action($table, 'my action'); @@ -208,10 +212,10 @@ public function my_action(): void return $action; }, - 'visible' => true, + true, ], 'hidden if no rows are selected and row selection is required' => [ - 'action' => fn () => (new Action(fakeTable(), 'my action'))->withRowSelection(), - 'visible' => false, + fn () => (new Action(fakeTable(), 'my action'))->withRowSelection(), + false, ], ]); diff --git a/tests/Unit/Elements/Column.php b/tests/Unit/Elements/Column.php index 631afd5..1277b48 100644 --- a/tests/Unit/Elements/Column.php +++ b/tests/Unit/Elements/Column.php @@ -15,7 +15,7 @@ test('defaults', function () { $table = fakeTable(); - $table->id = 1234; + $table->setId(1234); $column = new Column($table, "Test"); @@ -60,7 +60,7 @@ it('can return its id', function () { $table = fakeTable(); - $table->id = 1234; + $table->setId(1234); $column = new Column($table, "Test"); diff --git a/tests/Unit/Styles/TailwindPrefixed.php b/tests/Unit/Styles/TailwindPrefixed.php deleted file mode 100644 index be7568e..0000000 --- a/tests/Unit/Styles/TailwindPrefixed.php +++ /dev/null @@ -1,60 +0,0 @@ -replace("resources". DIRECTORY_SEPARATOR. "views". DIRECTORY_SEPARATOR. "tailwind_3", "resources". DIRECTORY_SEPARATOR. "views". DIRECTORY_SEPARATOR. "tailwind_3_prefixed")->toString(); - - expect($prefixed_file)->toBeFile(); - - $file_match = []; - preg_match_all($pattern, File::get($file), $file_match); - - $prefixed_match = []; - preg_match_all($pattern, File::get($prefixed_file), $prefixed_match); - - - if (isset($file_match[1])) { - foreach ($file_match[1] as $class_index => $class) { - $items = Str::of($class)->replace("\r\n", '')->replace("\n", '')->replace("\t", '')->explode(' ')->filter()->values(); - - $prefixed_items = Str::of($prefixed_match[1][$class_index])->replace("\r\n", '')->replace("\n", '')->replace("\t", '')->explode(' ')->filter()->values(); - - $items->each(function (string $item, $item_index) use ($file, $prefixed_items) { - $prefixed_item = $prefixed_items->get($item_index); - - if (Str::of($item)->contains("{{")) { - return; - } - - if (Str::of($item)->before('[')->contains(':')) { - $item = Str::of($item)->after(':')->toString(); - $prefixed_item = Str::of($prefixed_item)->after(':')->toString(); - } - - try { - if (Str::of($item)->startsWith('-')) { - expect($prefixed_item)->toBe("-tw$item"); - - return; - } - - expect($prefixed_item)->toBe("tw-$item"); - } catch (ExpectationFailedException $e) { - throw new ExpectationFailedException("Class was not prefixed in [$file]", $e->getComparisonFailure()); - } - }); - } - } - } - } -}); From 229c0e73519001a1d48296ba517646a636cf50d7 Mon Sep 17 00:00:00 2001 From: MarioGattolla <94918437+MarioGattolla@users.noreply.github.com> Date: Fri, 30 Jan 2026 10:40:55 +0000 Subject: [PATCH 09/14] Lint --- src/Concerns/HasTextConfiguration.php | 1 - tests/Unit/Concerns/HasFilters.php | 56 +++++++++---------- .../Configurations/TableConfiguration.php | 30 +++++----- tests/Unit/Elements/Action.php | 2 +- 4 files changed, 44 insertions(+), 45 deletions(-) diff --git a/src/Concerns/HasTextConfiguration.php b/src/Concerns/HasTextConfiguration.php index 7657ada..212d05a 100644 --- a/src/Concerns/HasTextConfiguration.php +++ b/src/Concerns/HasTextConfiguration.php @@ -5,7 +5,6 @@ namespace DefStudio\WiredTables\Concerns; use DefStudio\WiredTables\Enums\Config; -use Illuminate\Support\Collection; trait HasTextConfiguration { diff --git a/tests/Unit/Concerns/HasFilters.php b/tests/Unit/Concerns/HasFilters.php index d8f52fd..b572ff2 100644 --- a/tests/Unit/Concerns/HasFilters.php +++ b/tests/Unit/Concerns/HasFilters.php @@ -18,7 +18,7 @@ use function Pest\Laravel\actingAs; -test('filters are booted', function() { +test('filters are booted', function () { $table = fakeTable(); expect($table->filters) @@ -26,7 +26,7 @@ ->not->toBeEmpty(); }); -test('filters are mounted', function() { +test('filters are mounted', function () { $table = fakeTable(); expect($table->filterValues) @@ -34,7 +34,7 @@ ->toHaveKey('brand'); }); -test('cached filters are mounted', function() { +test('cached filters are mounted', function () { actingAs(new User(['id' => 42])); Cache::put("httplocalhost-42-state-filters", [ 'brand' => 'foo', @@ -46,7 +46,7 @@ ]); }); -test('cached filters can be overridden by a query string', function() { +test('cached filters can be overridden by a query string', function () { actingAs(new User(['id' => 42])); Cache::put("httplocalhost-42-state-filters", [ 'brand' => 'foo', @@ -67,7 +67,7 @@ ]); }); -test('cached filters are cleared with filter values', function() { +test('cached filters are cleared with filter values', function () { actingAs(new User(['id' => 42])); Cache::put("httplocalhost-42-state-filters", [ 'brand' => 'foo', @@ -81,7 +81,7 @@ ]); }); -test('cached filters are updated when filter values change', function() { +test('cached filters are updated when filter values change', function () { actingAs(new User(['id' => 42])); $table = fakeTable(); $table->filterValues = [ @@ -95,7 +95,7 @@ ]); }); -test('existing filters are not cleared on mount', function() { +test('existing filters are not cleared on mount', function () { $table = fakeTable(); $table->filterValues['brand'] = 'foo'; @@ -107,7 +107,7 @@ ]); }); -test('filters must be defined only inside [->filters()] method', function() { +test('filters must be defined only inside [->filters()] method', function () { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -125,11 +125,11 @@ public function addFilter(): void } }); - expect(fn() => $table->addFilter()) + expect(fn () => $table->addFilter()) ->toThrow(FilterException::class); }); -test('filters must be unique', function() { +test('filters must be unique', function () { fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -149,7 +149,7 @@ protected function filters(): void }); })->throws(FilterException::class); -it('can retrieve a filter', function() { +it('can retrieve a filter', function () { $table = fakeTable(); expect($table->getFilter('brand')) @@ -157,7 +157,7 @@ protected function filters(): void ->name()->toBe('Brand'); }); -it('can retrieve a filter by name', function() { +it('can retrieve a filter by name', function () { $table = fakeTable(); expect($table->getFilterByName('Brand')) @@ -165,7 +165,7 @@ protected function filters(): void ->name()->toBe('Brand'); }); -it('cleans up checkbox filters when unckeched', function() { +it('cleans up checkbox filters when unckeched', function () { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -190,7 +190,7 @@ protected function filters(): void expect($table->filterValues['check'])->toBeNull(); }); -it('can tell if it has filters', function() { +it('can tell if it has filters', function () { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -208,13 +208,13 @@ protected function columns(): void expect(fakeTable()->hasFilters())->toBeTrue(); }); -it('can tell if filters selector should be shown', function($table, bool $visible) { +it('can tell if filters selector should be shown', function ($table, bool $visible) { $table = $table(); expect($table->shouldShowFiltersSelector())->toBe($visible); })->with([ 'no filters' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -228,7 +228,7 @@ protected function columns(): void false, ], 'no global filters' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -247,7 +247,7 @@ protected function filters(): void false, ], 'hidden filter' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -266,18 +266,18 @@ protected function filters(): void false, ], 'visible filter' => [ - fn() => fakeTable(), + fn () => fakeTable(), true, ], ]); -it('can tell if column filters should be shown', function( $table, bool $visible) { +it('can tell if column filters should be shown', function ($table, bool $visible) { $table = $table(); expect($table->shouldShowColumnFilters())->toBe($visible); })->with([ 'no filters' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -291,7 +291,7 @@ protected function columns(): void false, ], 'no column filters' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -310,7 +310,7 @@ protected function filters(): void false, ], 'hidden filter' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -329,7 +329,7 @@ protected function filters(): void false, ], 'visible filter' => [ - fn() => fakeTable(new class () extends WiredTable { + fn () => fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { return Car::query(); @@ -349,7 +349,7 @@ protected function filters(): void ], ]); -it('can extract active filters', function() { +it('can extract active filters', function () { $table = fakeTable(); expect($table->activeFilters())->toBeEmpty(); @@ -362,7 +362,7 @@ protected function filters(): void ->first()->name()->toBe('Brand'); }); -it('can extract global and column filters', function() { +it('can extract global and column filters', function () { $table = fakeTable(new class () extends WiredTable { protected function query(): Builder|Relation { @@ -392,7 +392,7 @@ protected function filters(): void ->first()->name()->toBe('Name'); }); -it('can clear filters', function() { +it('can clear filters', function () { $table = fakeTable(); $table->filterValues['brand'] = 'lamborghini'; @@ -401,7 +401,7 @@ protected function filters(): void expect($table->filterValues['brand'])->toBeNull(); }); -it('can apply filters', function() { +it('can apply filters', function () { enableDebug(); $table = fakeTable(); diff --git a/tests/Unit/Configurations/TableConfiguration.php b/tests/Unit/Configurations/TableConfiguration.php index eec4507..5d90632 100644 --- a/tests/Unit/Configurations/TableConfiguration.php +++ b/tests/Unit/Configurations/TableConfiguration.php @@ -2,7 +2,7 @@ use DefStudio\WiredTables\Configurations\TableConfiguration; -test('defaults', function() { +test('defaults', function () { $config = new TableConfiguration(); expect($config->toArray())->toBe([ @@ -35,7 +35,7 @@ ]); }); -it('can disable pagination', function() { +it('can disable pagination', function () { $config = new TableConfiguration(); $config->disablePagination(); @@ -46,7 +46,7 @@ ]); }); -it('can set compact table mode', function() { +it('can set compact table mode', function () { $config = new TableConfiguration(); $config->compactTable(); @@ -56,7 +56,7 @@ ]); }); -it('can set default page size', function() { +it('can set default page size', function () { $config = new TableConfiguration(); $config->pageSize(100); @@ -66,7 +66,7 @@ ]); }); -it('can set available pages', function() { +it('can set available pages', function () { $config = new TableConfiguration(); $config->pageSize(100, [1, 2, 100, 150]); @@ -77,7 +77,7 @@ ]); }); -it('can disable row stripes', function() { +it('can disable row stripes', function () { $config = new TableConfiguration(); $config->striped(false); @@ -87,7 +87,7 @@ ]); }); -it('can enable rows hover effect', function() { +it('can enable rows hover effect', function () { $config = new TableConfiguration(); $config->hover(); @@ -97,7 +97,7 @@ ]); }); -it('can set the number of filters columns', function() { +it('can set the number of filters columns', function () { $config = new TableConfiguration(); $config->filterSelectorColumns(42); @@ -107,7 +107,7 @@ ]); }); -it('can set the number of actions columns', function() { +it('can set the number of actions columns', function () { $config = new TableConfiguration(); $config->actionsSelectorColumns(42); @@ -117,7 +117,7 @@ ]); }); -it('can disable row dividers', function() { +it('can disable row dividers', function () { $config = new TableConfiguration(); $config->rowDividers(false); @@ -127,7 +127,7 @@ ]); }); -it('can enable multiple sorting', function() { +it('can enable multiple sorting', function () { $config = new TableConfiguration(); $config->multipleSorting(); @@ -137,7 +137,7 @@ ]); }); -it('can enable debug mode', function() { +it('can enable debug mode', function () { enableDebug(); $config = new TableConfiguration(); @@ -148,7 +148,7 @@ ]); }); -it("can't set debug mode if debug is disabled", function() { +it("can't set debug mode if debug is disabled", function () { $config = new TableConfiguration(); $config->debug(); @@ -156,7 +156,7 @@ expect($config->toArray())->not->toHaveKey('debug'); }); -it('can set row_id field', function() { +it('can set row_id field', function () { $config = new TableConfiguration(); $config->rowIdField('foo'); @@ -164,7 +164,7 @@ expect($config->toArray())->toMatchArray(['id_field' => 'foo']); }); -it('can set state preserving', function() { +it('can set state preserving', function () { $config = new TableConfiguration(); $config->preserveState(false); diff --git a/tests/Unit/Elements/Action.php b/tests/Unit/Elements/Action.php index d787fe0..45d0d64 100644 --- a/tests/Unit/Elements/Action.php +++ b/tests/Unit/Elements/Action.php @@ -165,7 +165,7 @@ public function my_action(): void expect($processed)->toBeTrue(); }); -test("visibility", function ( $action, bool $visible) { +test("visibility", function ($action, bool $visible) { $action = $action(); expect($action->isVisible())->toBe($visible); From 7376a1060bc8c86d38e883f0d971557db0af29ae Mon Sep 17 00:00:00 2001 From: mario Date: Fri, 30 Jan 2026 16:18:39 +0100 Subject: [PATCH 10/14] upgrade php 8.5 livewire 3 --- .github/workflows/phpstan.yml | 2 +- .github/workflows/run-tests.yml | 2 +- .github/workflows/x-ray.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index ff7d0e3..9908ea3 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: [8.2, 8.3, 8.4] + php-version: [8.2, 8.3, 8.4, 8.5] coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a983844..9ee2e0a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, macos-latest, windows-latest] - php: [8.3, 8.4] + php: [8.3, 8.4, 8.5] laravel: [11.*, 12.*] stability: [prefer-lowest, prefer-stable] exclude: diff --git a/.github/workflows/x-ray.yml b/.github/workflows/x-ray.yml index a8963f9..b51a3ed 100644 --- a/.github/workflows/x-ray.yml +++ b/.github/workflows/x-ray.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: [8.2, 8.3, 8.4] + php-version: [8.2, 8.3, 8.4, 8.5] coverage: none - name: Install composer dependencies From 91aa2809b93cbb9e815bd84e38c899033063a8b8 Mon Sep 17 00:00:00 2001 From: mario Date: Tue, 3 Feb 2026 12:10:53 +0100 Subject: [PATCH 11/14] upgrade php 8.5 livewire 3 --- .github/workflows/run-tests.yml | 2 +- .../tailwind_3/components/actions.blade.php | 16 ++++++++-------- .../components/body/rows-selector.blade.php | 6 +++--- .../tailwind_3/components/body/td.blade.php | 4 ++-- .../tailwind_3/components/body/tr.blade.php | 2 +- .../elements/filters/checkbox.blade.php | 10 +++++----- .../components/elements/filters/date.blade.php | 10 +++++----- .../components/elements/filters/select.blade.php | 8 ++++---- .../components/elements/filters/text.blade.php | 10 +++++----- .../tailwind_3/components/filters.blade.php | 10 +++++----- .../tailwind_3/components/footer/td.blade.php | 2 +- .../components/header/rows-selector.blade.php | 4 ++-- .../components/page-size-selector.blade.php | 2 +- .../tailwind_3/components/pagination.blade.php | 2 +- .../views/tailwind_3/components/search.blade.php | 6 +++--- .../views/tailwind_3/components/top.blade.php | 10 +++++----- resources/views/tailwind_3/main.blade.php | 16 ++++++++-------- src/Elements/Column.php | 1 + 18 files changed, 61 insertions(+), 60 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9ee2e0a..58dae74 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, macos-latest, windows-latest] - php: [8.3, 8.4, 8.5] + php: [8.2, 8.3, 8.4, 8.5] laravel: [11.*, 12.*] stability: [prefer-lowest, prefer-stable] exclude: diff --git a/resources/views/tailwind_3/components/actions.blade.php b/resources/views/tailwind_3/components/actions.blade.php index 7c353d7..d66558e 100644 --- a/resources/views/tailwind_3/components/actions.blade.php +++ b/resources/views/tailwind_3/components/actions.blade.php @@ -9,9 +9,9 @@ @php($visibleActions = collect($this->actions)->filter(fn(DefStudio\WiredTables\Elements\Action $action) => $action->isVisible())) @if($this->config(\DefStudio\WiredTables\Enums\Config::group_actions)) -
class('relative')}} wire:key="wt-{{$this->id}}-actions-wrapper" x-data="{show_actions: false}"> +
class('relative')}} wire:key="wt-{{$this->getId()}}-actions-wrapper" x-data="{show_actions: false}"> -
@foreach($action_group as $index => $action) -
- @@ -44,11 +44,11 @@ class="bg-transparent border focus-visible:outline-0 border-solid p-2 whitespace
@else -
class('flex')}} wire:key="wt-{{$this->id}}-actions-wrapper"> +
class('flex')}} wire:key="wt-{{$this->getId()}}-actions-wrapper"> @foreach($visibleActions as $index => $action) -
- diff --git a/resources/views/tailwind_3/components/body/rows-selector.blade.php b/resources/views/tailwind_3/components/body/rows-selector.blade.php index 7499cb4..54f0bf6 100644 --- a/resources/views/tailwind_3/components/body/rows-selector.blade.php +++ b/resources/views/tailwind_3/components/body/rows-selector.blade.php @@ -15,11 +15,11 @@ @props(['model']) @if($this->shouldShowRowsSelector()) - class(['pl-6 py-3 text-left'])}} > - @endif diff --git a/resources/views/tailwind_3/components/body/td.blade.php b/resources/views/tailwind_3/components/body/td.blade.php index c8edf19..b544668 100644 --- a/resources/views/tailwind_3/components/body/td.blade.php +++ b/resources/views/tailwind_3/components/body/td.blade.php @@ -13,7 +13,7 @@ $content = $column->render(); $attributes = $attributes->merge([ - 'wire:key' => "wt-$this->id-row-{$this->getRowId($model)}-cell" + 'wire:key' => "wt-$this->getId()-row-{$this->getRowId($model)}-cell" ])->class([ "px-2 py-1" => $this->config(\DefStudio\WiredTables\Enums\Config::compact_table), "px-6 py-3" => !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table), @@ -42,7 +42,7 @@ @props(['column', 'model']) - + @if($url = $column->getUrl()) get(\DefStudio\WiredTables\Enums\Config::url_target)) ? "target='$url_target'": ''}}> diff --git a/resources/views/tailwind_3/components/body/tr.blade.php b/resources/views/tailwind_3/components/body/tr.blade.php index 90aa78b..ae56bed 100644 --- a/resources/views/tailwind_3/components/body/tr.blade.php +++ b/resources/views/tailwind_3/components/body/tr.blade.php @@ -14,7 +14,7 @@ @props(['model']) class([ 'bg-white' => !$this->config(\DefStudio\WiredTables\Enums\Config::striped), 'odd:bg-white even:bg-gray-50' => $this->config(\DefStudio\WiredTables\Enums\Config::striped), diff --git a/resources/views/tailwind_3/components/elements/filters/checkbox.blade.php b/resources/views/tailwind_3/components/elements/filters/checkbox.blade.php index eaa929a..b00ceef 100644 --- a/resources/views/tailwind_3/components/elements/filters/checkbox.blade.php +++ b/resources/views/tailwind_3/components/elements/filters/checkbox.blade.php @@ -9,19 +9,19 @@ @props(['filter', 'label' => true]) -
+
@if($label) - @endif - id}}-filter-{{$filter->key()}}-wrapper" {{$attributes}}> +
@if($label) - @endif - id}}-filter-{{$filter->key()}}-wrapper" {{$attributes}}> +
@if($label) - @endif - id}}-filters-wrapper" x-data="{show: false}"> +
class('relative')}} wire:key="wt-{{$this->getId()}}-filters-wrapper" x-data="{show: false}"> -
@foreach($filter_group as $filter) -
+
id}}-filters-wrapper"> +
class('flex')}} wire:key="wt-{{$this->getId()}}-filters-wrapper"> @foreach($visibleFilters as $filter) + {{$this->getColumnSum($column->name())}} diff --git a/resources/views/tailwind_3/components/header/rows-selector.blade.php b/resources/views/tailwind_3/components/header/rows-selector.blade.php index 8d69a64..8d41b14 100644 --- a/resources/views/tailwind_3/components/header/rows-selector.blade.php +++ b/resources/views/tailwind_3/components/header/rows-selector.blade.php @@ -12,7 +12,7 @@ @if($this->shouldShowRowsSelector()) class([ "px-6 text-left align-middle", "py-3" => !$this->shouldShowColumnFilters(), @@ -26,6 +26,6 @@ $this->allSelected = true; } ?> - + @endif diff --git a/resources/views/tailwind_3/components/page-size-selector.blade.php b/resources/views/tailwind_3/components/page-size-selector.blade.php index e2aeebf..19ff383 100644 --- a/resources/views/tailwind_3/components/page-size-selector.blade.php +++ b/resources/views/tailwind_3/components/page-size-selector.blade.php @@ -9,7 +9,7 @@ ?> @if($availablePageSize && count($availablePageSize)>1) - class("bg-transparent border focus-visible:outline-0 border-solid px-2 pr-7 py-2 border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm text-sm text-gray-700 cursor-pointer")}} wire:model.live="pageSize"> @foreach($availablePageSize as $availPagSize) @endforeach diff --git a/resources/views/tailwind_3/components/pagination.blade.php b/resources/views/tailwind_3/components/pagination.blade.php index d5b7232..6a22272 100644 --- a/resources/views/tailwind_3/components/pagination.blade.php +++ b/resources/views/tailwind_3/components/pagination.blade.php @@ -15,7 +15,7 @@ @endif
- +
diff --git a/resources/views/tailwind_3/components/search.blade.php b/resources/views/tailwind_3/components/search.blade.php index 4158626..b705768 100644 --- a/resources/views/tailwind_3/components/search.blade.php +++ b/resources/views/tailwind_3/components/search.blade.php @@ -15,12 +15,12 @@
-
diff --git a/resources/views/tailwind_3/components/top.blade.php b/resources/views/tailwind_3/components/top.blade.php index 1284a46..cd3299b 100644 --- a/resources/views/tailwind_3/components/top.blade.php +++ b/resources/views/tailwind_3/components/top.blade.php @@ -6,15 +6,15 @@ ?>
- + -
+
@if($this->activeFilters()->isNotEmpty())
Filters:
@foreach($this->activeFilters() as $filter) -
@@ -32,7 +32,7 @@ class="font-medium ml-1 px-1 py-0.5 text-xs text-indigo-600 bg-indigo-200 hover:
Sort:
@foreach($this->sorting as $columnName => $dir) -
@@ -56,7 +56,7 @@ class="font-medium ml-1 px-1 py-0.5 text-xs text-indigo-600 bg-indigo-200 hover:
- +
diff --git a/resources/views/tailwind_3/main.blade.php b/resources/views/tailwind_3/main.blade.php index 589df2b..29c835d 100644 --- a/resources/views/tailwind_3/main.blade.php +++ b/resources/views/tailwind_3/main.blade.php @@ -7,8 +7,8 @@ /** @var WiredTable $this */ ?> - - + + @if(count($this->selectedIds())>0 && count($this->selectedIds()) < $this->totalRowsCount && $this->rows->hasPages())
@@ -29,11 +29,11 @@ 'shadow-md' => $this->config(Config::table_shadow), ]) > - + - + - + @foreach($this->columns as $column) @continue(!$column->isVisible()) @php($column->setParentConfiguration($this->configuration()->header)) @@ -48,7 +48,7 @@ @forelse($this->rows as $model) - + @foreach($this->columns as $column) @continue(!$column->isVisible()) @php($column->setParentConfiguration($this->configuration())) @@ -67,7 +67,7 @@ @if(collect($this->columns)->some(fn(Column $column) => !!$column->get(Config::with_sum))) - + @if($this->shouldShowRowsSelector()) @@ -87,7 +87,7 @@
- +
diff --git a/src/Elements/Column.php b/src/Elements/Column.php index 7fabd57..6b948c4 100644 --- a/src/Elements/Column.php +++ b/src/Elements/Column.php @@ -149,6 +149,7 @@ public function emit(Closure $emitClosure, ?string $target = null): static return $this->set(Config::emit, $emitClosure); } + public function carbon(string $format): static { return $this->set(Config::type, ColumnType::carbon) From 029489520f7451b1ef0244c15333395962e6bee8 Mon Sep 17 00:00:00 2001 From: MarioGattolla <94918437+MarioGattolla@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:11:24 +0000 Subject: [PATCH 12/14] Lint --- src/Elements/Column.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Elements/Column.php b/src/Elements/Column.php index 6b948c4..7fabd57 100644 --- a/src/Elements/Column.php +++ b/src/Elements/Column.php @@ -149,7 +149,6 @@ public function emit(Closure $emitClosure, ?string $target = null): static return $this->set(Config::emit, $emitClosure); } - public function carbon(string $format): static { return $this->set(Config::type, ColumnType::carbon) From a7c247e37dbc6c523427294db09e7758dab6f538 Mon Sep 17 00:00:00 2001 From: mario Date: Tue, 3 Feb 2026 12:14:15 +0100 Subject: [PATCH 13/14] upgrade php 8.5 livewire 3 --- resources/views/tailwind_3/components/body/td.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/tailwind_3/components/body/td.blade.php b/resources/views/tailwind_3/components/body/td.blade.php index b544668..378c192 100644 --- a/resources/views/tailwind_3/components/body/td.blade.php +++ b/resources/views/tailwind_3/components/body/td.blade.php @@ -13,7 +13,7 @@ $content = $column->render(); $attributes = $attributes->merge([ - 'wire:key' => "wt-$this->getId()-row-{$this->getRowId($model)}-cell" + 'wire:key' => "wt-{$this->getId()}-row-{$this->getRowId($model)}-cell" ])->class([ "px-2 py-1" => $this->config(\DefStudio\WiredTables\Enums\Config::compact_table), "px-6 py-3" => !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table), From 7bbcfcb1aed3f85f34c4f43790886e6300a1349b Mon Sep 17 00:00:00 2001 From: mario Date: Tue, 3 Feb 2026 12:46:03 +0100 Subject: [PATCH 14/14] upgrade php 8.5 livewire 3 --- resources/views/tailwind_3/livewire-pagination.blade.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/views/tailwind_3/livewire-pagination.blade.php b/resources/views/tailwind_3/livewire-pagination.blade.php index b0af906..4d27051 100644 --- a/resources/views/tailwind_3/livewire-pagination.blade.php +++ b/resources/views/tailwind_3/livewire-pagination.blade.php @@ -1,7 +1,5 @@
@if ($paginator->hasPages()) - @php(isset($this->numberOfPaginatorsRendered[$paginator->getPageName()]) ? $this->numberOfPaginatorsRendered[$paginator->getPageName()]++ : $this->numberOfPaginatorsRendered[$paginator->getPageName()] = 1) -