diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml deleted file mode 100644 index 0c2baaa4b..000000000 --- a/.github/workflows/php-cs-fixer.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Check & fix styling - -on: - push: - branches-ignore: - - master - - main - - master2 - -jobs: - php-cs-fixer: - runs-on: ubuntu-latest - steps: - - name: Setup cache directory - uses: actions/cache@v3 - with: - path: .php-cs-fixer.cache - key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.sha }} - restore-keys: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer- - - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} - - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php-cs-fixer.php --allow-risky=yes - - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Fix styling diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml new file mode 100644 index 000000000..097689b83 --- /dev/null +++ b/.github/workflows/pint.yml @@ -0,0 +1,27 @@ +name: Fix PHP code style issues + +on: + push: + paths: + - '**.php' + +permissions: + contents: write + +jobs: + php-code-styling: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.2.0 + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Fix styling diff --git a/.gitignore b/.gitignore index 05c756b00..043be3f9a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ output.txt phpunit.xml.dist.bak phpunit.xml.dist.dev .github/workflows/code-cov.yml +.history/* diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php deleted file mode 100644 index 6161560ac..000000000 --- a/.php-cs-fixer.php +++ /dev/null @@ -1,43 +0,0 @@ -notPath('bootstrap/*') - ->notPath('storage/*') - ->notPath('resources/view/mail/*') - ->in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -$config = new PhpCsFixer\Config(); -return $config->setRules([ - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => false, -]) -->setFinder($finder); diff --git a/CHANGELOG.md b/CHANGELOG.md index db871814a..946966a2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,33 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ## [Unreleased] +## [2.14.0] - 2023-05-18 + +### Changed +- Fixes + - Bulk Actions (AlpineJS) + - Moving Table Head Checkbox to AlpineJS + - Using AlpineJS for calculating if all items have been selected + - Correcting missing x-cloak + - Added indeterminateCheckbox for TH for bulk actions + - Cleaned up ALpineJS functionality for Bulk Actions + - Repair of tests that were looking for wire:model that no longer existed + +- Enhancements + - Several new public variables for accessing pagination data cleanly, to avoid calling functions repeatedly across various blades. + - paginationTotalItemCount (Total number of items in the results across all page) + - paginationCurrentItems (Primary keys of items in the current page) + - paginationCurrentCount (Number of results on the current page) + +- Blades + - Several blades have had the classic Tables approach ($theme == 'tailwind', $theme == 'bootstrap) replaced with conditional classes using the @class([]) approach. This is to reduce the complexity of the blade files. + +## [2.13.1] - 2023-05-18 + +### Changed + +- Fixes for AlpineJS + ## [2.13.0] - 2023-05-17 ### Changed @@ -800,7 +827,9 @@ Ground Up Rebuild - Initial release -[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.13.0...development +[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.14.0...development +[2.14.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.14.0...v2.13.1 +[2.13.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.13.0...v2.13.1 [2.13.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.12.0...v2.13.0 [2.12.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.11.0...v2.12.0 [2.11.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.10.0...v2.11.0 diff --git a/composer.json b/composer.json index b2786566d..8a67b9aaa 100644 --- a/composer.json +++ b/composer.json @@ -19,9 +19,9 @@ ], "require": { "php": "^7.4|^8.0|^8.1|^8.2", + "illuminate/contracts": "^8.0|^9.0|^10.0", "livewire/livewire": "^2.6", - "spatie/laravel-package-tools": "^1.4.3", - "illuminate/contracts": "^8.0|^9.0|^10.0" + "spatie/laravel-package-tools": "^1.4.3" }, "require-dev": { "ext-sqlite3": "*", @@ -43,7 +43,8 @@ "scripts": { "psalm": "vendor/bin/psalm", "test": "vendor/bin/phpunit --colors=always", - "test-coverage": "vendor/bin/phpunit --coverage-html coverage" + "test-coverage": "vendor/bin/phpunit --coverage-html coverage", + "format": "vendor/bin/pint" }, "config": { "sort-packages": true diff --git a/resources/views/components/pagination.blade.php b/resources/views/components/pagination.blade.php index 51c932320..5ba6992cf 100644 --- a/resources/views/components/pagination.blade.php +++ b/resources/views/components/pagination.blade.php @@ -12,7 +12,7 @@ @endif @if ($theme === 'tailwind') -
+
@if ($component->paginationVisibilityIsEnabled())
@@ -23,7 +23,7 @@ @lang('to') {{ $rows->lastItem() }} @lang('of') - {{ $rows->total() }} + @lang('results')

@elseif ($component->paginationIsEnabled() && $component->isPaginationMethod('simple')) @@ -49,7 +49,7 @@ @endif
@elseif ($theme === 'bootstrap-4') -
+
@if ($component->paginationVisibilityIsEnabled()) @if ($component->paginationIsEnabled() && $component->isPaginationMethod('standard') && $rows->lastPage() > 1)
@@ -63,7 +63,7 @@ @lang('to') {{ $rows->count() ? $rows->lastItem() : 0 }} @lang('of') - {{ $rows->total() }} + @lang('results')
@@ -92,7 +92,7 @@ @endif
@elseif ($theme === 'bootstrap-5') -
+
@if ($component->paginationVisibilityIsEnabled()) @if ($component->paginationIsEnabled() && $component->isPaginationMethod('standard') && $rows->lastPage() > 1)
@@ -106,7 +106,7 @@ @lang('to') {{ $rows->count() ? $rows->lastItem() : 0 }} @lang('of') - {{ $rows->total() }} + @lang('results')
diff --git a/resources/views/components/table/td/bulk-actions.blade.php b/resources/views/components/table/td/bulk-actions.blade.php index 34b7a6c73..d5b7af025 100644 --- a/resources/views/components/table/td/bulk-actions.blade.php +++ b/resources/views/components/table/td/bulk-actions.blade.php @@ -6,38 +6,22 @@ $theme = $component->getTheme(); @endphp - @if ($theme === 'tailwind') - -
- -
-
- @elseif ($theme === 'bootstrap-4') - + +
$theme === "tailwind", + "form-check" => $theme === "bootstrap-5", + ]) + > $theme === "tailwind", + "form-check-input" => $theme === "bootstrap-5", + ]) /> - - @elseif ($theme === 'bootstrap-5') - -
- -
-
- @endif +
+
@endif diff --git a/resources/views/components/table/th/bulk-actions.blade.php b/resources/views/components/table/th/bulk-actions.blade.php index 3e61f8a92..e0fdead7b 100644 --- a/resources/views/components/table/th/bulk-actions.blade.php +++ b/resources/views/components/table/th/bulk-actions.blade.php @@ -5,32 +5,27 @@ $theme = $component->getTheme(); @endphp - @if ($theme === 'tailwind') - -
- -
-
- @elseif ($theme === 'bootstrap-4') - - +
$theme === 'tailwind', + 'form-check' => $theme === 'bootstrap-5', + ]) + > + $theme === 'tailwind', + 'form-check-input' => $theme === 'bootstrap-5', + ]) /> - - @elseif ($theme === 'bootstrap-5') - -
- -
-
- @endif +
+
@endif diff --git a/resources/views/components/table/tr/bulk-actions.blade.php b/resources/views/components/table/tr/bulk-actions.blade.php index 7871e4214..1107a6216 100644 --- a/resources/views/components/table/tr/bulk-actions.blade.php +++ b/resources/views/components/table/tr/bulk-actions.blade.php @@ -6,7 +6,6 @@ $table = $component->getTableName(); $theme = $component->getTheme(); $colspan = $component->getColspanCount(); - $selected = $component->getSelectedCount(); $selectAll = $component->selectAllIsEnabled(); $simplePagination = $component->paginationMethod == 'simple' ? true : false; @endphp @@ -15,14 +14,15 @@ -