Skip to content

Commit 5eccc56

Browse files
authored
Merge pull request #272 from rappasoft/develop
v1.6.0
2 parents e2a62ec + 0206002 commit 5eccc56

24 files changed

+498
-315
lines changed

.gitattributes

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
33

44
# Ignore all test and documentation with "export-ignore".
5-
/.github export-ignore
6-
/.gitattributes export-ignore
7-
/.gitignore export-ignore
8-
/phpunit.xml.dist export-ignore
9-
/tests export-ignore
10-
/.editorconfig export-ignore
11-
/.php_cs.dist export-ignore
12-
/psalm.xml export-ignore
13-
/psalm.xml.dist export-ignore
14-
/testbench.yaml export-ignore
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/tests export-ignore
10+
/.editorconfig export-ignore
11+
/.php-cs-fixer.php export-ignore
12+
/psalm.xml export-ignore
13+
/psalm.xml.dist export-ignore
14+
/testbench.yaml export-ignore

.github/workflows/php-cs-fixer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Run PHP CS Fixer
1616
uses: docker://oskarstark/php-cs-fixer-ga
1717
with:
18-
args: --config=.php_cs.dist --allow-risky=yes
18+
args: --config=.php-cs-fixer.php --allow-risky=yes
1919

2020
- name: Commit changes
2121
uses: stefanzweifel/git-auto-commit-action@v4

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.idea
2-
.php_cs
3-
.php_cs.cache
2+
.php-cs-fixer.php
3+
.php-cs-fixer.cache
44
.phpunit.result.cache
55
build
66
composer.lock

.php-cs-fixer.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->notPath('bootstrap/*')
5+
->notPath('storage/*')
6+
->notPath('resources/view/mail/*')
7+
->in([
8+
__DIR__ . '/src',
9+
__DIR__ . '/tests',
10+
])
11+
->name('*.php')
12+
->notName('*.blade.php')
13+
->ignoreDotFiles(true)
14+
->ignoreVCS(true);
15+
16+
$config = new PhpCsFixer\Config();
17+
return $config->setRules([
18+
'@PSR2' => true,
19+
'array_syntax' => ['syntax' => 'short'],
20+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
21+
'no_unused_imports' => true,
22+
'not_operator_with_successor_space' => true,
23+
'trailing_comma_in_multiline' => true,
24+
'phpdoc_scalar' => true,
25+
'unary_operator_spaces' => true,
26+
'binary_operator_spaces' => true,
27+
'blank_line_before_statement' => [
28+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
29+
],
30+
'phpdoc_single_line_var_spacing' => true,
31+
'phpdoc_var_without_name' => true,
32+
'class_attributes_separation' => [
33+
'elements' => [
34+
'method' => 'one',
35+
],
36+
],
37+
'method_argument_space' => [
38+
'on_multiline' => 'ensure_fully_multiline',
39+
'keep_multiple_spaces_after_comma' => true,
40+
],
41+
'single_trait_insert_per_statement' => false,
42+
])
43+
->setFinder($finder);

.php_cs.dist

Lines changed: 0 additions & 43 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7+
## [1.6.0] - 2021-05-04
8+
9+
### Added
10+
11+
- Added Unselect All button on bulk row when selecting page.
12+
- Added disabled delay on select checkboxes.
13+
- Added disabled on bulk row button clicks.
14+
- Added missing showPagination conditional to views.
15+
- Added getFilters and getFiltersWithoutSearch methods and refactor views.
16+
- Added checkFilters method and refactor mountWithFilters
17+
- Added hasIntegerKeys method
18+
19+
### Changed
20+
21+
- When selecting a page, if there are the same selected as total rows, just show the amount of selected instead of showing "Selecting 1 row. Do you want to select all 1 rows.".
22+
- Move bulk select row to its own partial for all templates.
23+
- Moved updatedFilters from WithSearch to WithFilters
24+
- Refactor hasFilter to support numeric keys
25+
- Refactor getFilter to support numeric keys
26+
- Refactor getFilterOptions to support numeric keys
27+
28+
### Removed
29+
30+
- Removed updatingFilters from WithFilters
31+
732
## [1.5.1] - 2021-05-02
833

934
### Added
@@ -14,6 +39,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
1439

1540
- Changed resetAll method to include search and page and moved to parent component.
1641
- Refactored search method to use new resetSearch.
42+
- [Use custom per page on first load](https://github.com/rappasoft/laravel-livewire-tables/pull/270)
1743

1844
## [1.5.0] - 2021-05-02
1945

@@ -297,7 +323,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
297323

298324
- Initial release
299325

300-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.5.1...development
326+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.6.0...development
327+
[1.6.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.4.0...v1.6.0
301328
[1.5.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.4.0...v1.5.1
302329
[1.5.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.4.0...v1.5.0
303330
[1.4.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.3.1...v1.4.0
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
@if (count($bulkActions) && (($selectPage && $rows->total() > $rows->count()) || count($selected)))
2+
<x-livewire-tables::bs4.table.row wire:key="row-message">
3+
<x-livewire-tables::bs4.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
4+
@if (count($selected) && !$selectAll && !$selectPage)
5+
<div>
6+
<span>
7+
@lang('You have selected')
8+
<strong>{{ count($selected) }}</strong>
9+
@lang(':rows', ['rows' => count($selected) === 1 ? 'row' : 'rows']).
10+
</span>
11+
12+
<button
13+
wire:click="resetBulk"
14+
wire:loading.attr="disabled"
15+
type="button"
16+
class="btn btn-primary btn-sm"
17+
>
18+
@lang('Unselect All')
19+
</button>
20+
</div>
21+
@elseif ($selectAll)
22+
<div>
23+
<span>
24+
@lang('You are currently selecting all')
25+
<strong>{{ number_format($rows->total()) }}</strong>
26+
@lang('rows').
27+
</span>
28+
29+
<button
30+
wire:click="resetBulk"
31+
wire:loading.attr="disabled"
32+
type="button"
33+
class="btn btn-primary btn-sm"
34+
>
35+
@lang('Unselect All')
36+
</button>
37+
</div>
38+
@else
39+
@if ($rows->total() === count($selected))
40+
<div>
41+
<span>
42+
@lang('You have selected')
43+
<strong>{{ count($selected) }}</strong>
44+
@lang(':rows', ['rows' => count($selected) === 1 ? 'row' : 'rows']).
45+
</span>
46+
47+
<button
48+
wire:click="resetBulk"
49+
wire:loading.attr="disabled"
50+
type="button"
51+
class="btn btn-primary btn-sm"
52+
>
53+
@lang('Unselect All')
54+
</button>
55+
</div>
56+
@else
57+
<div>
58+
<span>
59+
@lang('You have selected')
60+
<strong>{{ $rows->count() }}</strong>
61+
@lang('rows, do you want to select all')
62+
<strong>{{ number_format($rows->total()) }}</strong>?
63+
</span>
64+
65+
<button
66+
wire:click="selectAll"
67+
wire:loading.attr="disabled"
68+
type="button"
69+
class="btn btn-primary btn-sm"
70+
>
71+
@lang('Select All')
72+
</button>
73+
74+
<button
75+
wire:click="resetBulk"
76+
wire:loading.attr="disabled"
77+
type="button"
78+
class="btn btn-primary btn-sm"
79+
>
80+
@lang('Unselect All')
81+
</button>
82+
</div>
83+
@endif
84+
@endif
85+
</x-livewire-tables::bs4.table.cell>
86+
</x-livewire-tables::bs4.table.row>
87+
@endif

resources/views/bootstrap-4/includes/filter-pills.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@if ($showFilters && count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
1+
@if ($showFilters && count($this->getFiltersWithoutSearch()))
22
<div class="mb-3">
33
<small>@lang('Applied Filters'):</small>
44

resources/views/bootstrap-4/includes/filters.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<button type="button" class="btn dropdown-toggle d-block w-100 d-md-inline" data-toggle="dropdown">
44
@lang('Filters')
55

6-
@if (count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
6+
@if (count($this->getFiltersWithoutSearch()))
77
<span class="badge badge-info">
8-
{{ isset($filters['search']) ? count(array_filter($filters)) - 1 : count(array_filter($filters)) }}
8+
{{ count($this->getFiltersWithoutSearch()) }}
99
</span>
1010
@endif
1111

@@ -38,7 +38,7 @@ class="form-control"
3838
@endforeach
3939
@endif
4040

41-
@if (count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
41+
@if (count($this->getFiltersWithoutSearch()))
4242
<div class="dropdown-divider"></div>
4343

4444
<a
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
@if ($paginationEnabled && $showPerPage && $rows->lastPage() > 1)
2-
<div class="row">
3-
<div class="col-12 col-md-6">
4-
{{ $rows->links() }}
5-
</div>
1+
@if ($showPagination)
2+
@if ($paginationEnabled && $showPerPage && $rows->lastPage() > 1)
3+
<div class="row">
4+
<div class="col-12 col-md-6">
5+
{{ $rows->links() }}
6+
</div>
67

7-
<div class="col-12 col-md-6 text-center text-md-right text-muted">
8-
@lang('Showing')
9-
<strong>{{ $rows->count() ? $rows->firstItem() : 0 }}</strong>
10-
@lang('to')
11-
<strong>{{ $rows->count() ? $rows->lastItem() : 0 }}</strong>
12-
@lang('of')
13-
<strong>{{ $rows->total() }}</strong>
14-
@lang('results')
8+
<div class="col-12 col-md-6 text-center text-md-right text-muted">
9+
@lang('Showing')
10+
<strong>{{ $rows->count() ? $rows->firstItem() : 0 }}</strong>
11+
@lang('to')
12+
<strong>{{ $rows->count() ? $rows->lastItem() : 0 }}</strong>
13+
@lang('of')
14+
<strong>{{ $rows->total() }}</strong>
15+
@lang('results')
16+
</div>
1517
</div>
16-
</div>
17-
@else
18-
<div class="row">
19-
<div class="col-12 text-muted">
20-
@lang('Showing')
21-
<strong>{{ $rows->count() }}</strong>
22-
@lang('results')
18+
@else
19+
<div class="row">
20+
<div class="col-12 text-muted">
21+
@lang('Showing')
22+
<strong>{{ $rows->count() }}</strong>
23+
@lang('results')
24+
</div>
2325
</div>
24-
</div>
26+
@endif
2527
@endif

0 commit comments

Comments
 (0)