Skip to content

Commit cf8273c

Browse files
lrljoeda-maskG4Zz0L1daniel-skopekCarlosChub27
authored
v3.7.2 (rappasoft#2257)
* Link column fix (rappasoft#2223) * Add handling for From field for "LinkColumn" * Fix styling * Update ChangeLog * docs: add reminder of requirement to use toggle method (rappasoft#2208) Co-authored-by: Joe <[email protected]> * Update IsNumericFilter.php (rappasoft#2230) * Link column fix (rappasoft#2223) (rappasoft#2224) * Link column fix (rappasoft#2223) * Add handling for From field for "LinkColumn" * Update ChangeLog * Update IsNumericFilter.php Fixes issues 2229 --------- Co-authored-by: Joe <[email protected]> * Fix styling * Boolean filter for bootstrap (rappasoft#2244) * Add BooleanFilter option for Bootstrap * Add BS4 Support * Update docs * Fixes for livewire component column (rappasoft#2245) * Initial Commit * Fix styling * Initial Commit * Fix styling * Adjust test * Fix styling * Use test-livewire-column-component * Additional Tests for LivewireComponentColumn * Fix styling * Add getContents Test * TypeHint/PHPDoc Tidying (rappasoft#2246) * Fix broken typehints * Minor tweaks to Footer/SecondaryHeader to ensure presence of callback prior to executing * Fix styling * PHPDoc additions * Fix styling * Update ChangeLog for TypeHintFixes * Fix styling * FilterPillData and StandardFilterPillData phpdocs * Fix styling * Add Wrapper Options to ArrayColumn (rappasoft#2255) * Add Wrapper Options to FlexCol * Fix styling * Moving getContents Back * Fix styling * Add Docs * Add Wrapper Manual Tests * Fix styling * Update to test separator * Fix styling * Improved pagination UX (rappasoft#2251) * Link column fix (rappasoft#2223) (rappasoft#2224) * Link column fix (rappasoft#2223) * Add handling for From field for "LinkColumn" * Update ChangeLog * Improved pagination UX --------- Co-authored-by: Joe <[email protected]> * Fixed collapsed function bug with tailwind CSS on mobile version (rappasoft#2228) * v3.7.2 updates (rappasoft#2256) --------- Co-authored-by: da-mask <[email protected]> Co-authored-by: G4Zz0L1 <[email protected]> Co-authored-by: Daniel Škopek <[email protected]> Co-authored-by: CarlosChub27 <[email protected]>
1 parent a863732 commit cf8273c

31 files changed

+752
-110
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,23 @@
22

33
All notable changes to `laravel-livewire-tables` will be documented in this file
44

5+
## [v3.7.2] - 2025-05-03
6+
### Bug Fixes
7+
- Improved Pagination UX for Bootstrap 4 by @daniel-skopek in https://github.com/rappasoft/laravel-livewire-tables/pull/2251
8+
- Fixes for livewire component column by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2245
9+
- Boolean filter for bootstrap by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2244
10+
- Update IsNumericFilter.php by @G4Zz0L1 in https://github.com/rappasoft/laravel-livewire-tables/pull/2230
11+
- Fixed collapsed function bug with tailwind CSS on mobile version by CarlosChub27 in https://github.com/rappasoft/laravel-livewire-tables/pull/2228
12+
13+
### New Features
14+
- Add Wrapper Options to ArrayColumn by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2255
15+
16+
### Tweaks
17+
- Tidying PHPDocs by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2246
18+
519
## [v3.7.1] - 2025-02-28
620
### Bug Fixes
7-
- Ensure that LinkColumn is included in query if "from" is defined
21+
- Ensure that LinkColumn is included in query if "from" is defined by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2224
822

923
## [v3.7.0] - 2025-02-27
1024

docs/column-types/array_column.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,64 @@ ArrayColumn::make('notes', 'name')
1313
->sortable(),
1414
```
1515

16-
### Empty Value
16+
## Empty Value
1717
You may define the default/empty value using the "emptyValue" method
1818

1919
```php
2020
ArrayColumn::make('notes', 'name')
2121
->emptyValue('Unknown'),
2222
```
2323

24+
## Wrapping the Output
25+
26+
As the ArrayColumn is designed to handle multiple related records, you can choose to wrap these for improved UX.
27+
28+
It is recommended that you utilise the built-in flexCol or flexRow approaches, which will also disable the separator
29+
30+
### flexCol
31+
This adds either:
32+
- Tailwind: 'flex flex-col'
33+
- Bootstrap: 'd-flex d-flex-col'
34+
35+
And merges any attributes specified in the sole parameter (as an array)
36+
```php
37+
ArrayColumn::make('notes', 'name')
38+
->data(fn($value, $row) => ($row->notes))
39+
->outputFormat(fn($index, $value) => "<a href='".$value->id."'>".$value->name."</a>")
40+
->flexCol(['class' => 'bg-red-500'])
41+
->sortable(),
42+
```
43+
44+
### flexRow
45+
46+
This adds either:
47+
- Tailwind: 'flex flex-row'
48+
- Bootstrap: 'd-flex d-flex-row'
49+
50+
And merges any attributes specified in the sole parameter (as an array)
51+
```php
52+
ArrayColumn::make('notes', 'name')
53+
->data(fn($value, $row) => ($row->notes))
54+
->outputFormat(fn($index, $value) => "<a href='".$value->id."'>".$value->name."</a>")
55+
->flexRow(['class' => 'bg-red-500'])
56+
->sortable(),
57+
```
58+
59+
### Manually
60+
61+
You can also specify a wrapperStart and wrapperEnd, for example, for an unordered list:
62+
63+
```php
64+
ArrayColumn::make('notes', 'name')
65+
->data(fn($value, $row) => ($row->notes))
66+
->outputFormat(fn($index, $value) => "<li><a href='".$value->id."'>".$value->name."</a></li>")
67+
->wrapperStart("<ul class='bg-blue'>")
68+
->wrapperEnd("</ul>")
69+
->sortable(),
70+
```
71+
72+
## See Also
73+
2474
Please also see the following for other available methods:
2575
<ul>
2676
<li>

docs/column-types/boolean_columns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ BooleanColumn::make('Active', 'status')
8989
->toggleable('changeStatus'),
9090
```
9191

92-
Then your "changeStatus" method may look like
92+
Then your "changeStatus" method may look like (make sure you are selecting the `id` in the query)
9393
```php
9494
public function changeStatus(int $id)
9595
{
@@ -108,7 +108,7 @@ BooleanColumn::make('Active', 'status')
108108
->toggleable('changeStatus'),
109109
```
110110

111-
Then your "changeStatus" method may look like
111+
Then your "changeStatus" method may look like (make sure you are selecting the `id` in the query)
112112
```php
113113
public function changeStatus(int $id)
114114
{

docs/filter-types/filters-boolean.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ weight: 2
44
---
55

66
## Beta
7-
This is currently in beta, and will only work with Tailwind.
7+
This is currently in beta, but should work with Tailwind, Bootstrap 4 and Bootstrap 5 as of latest version
88

99
## Details
1010

phpstan.neon

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ parameters:
2727
- src/Traits/Helpers/QueryHelpers.php
2828
- src/Views/Columns/Traits/HasSlot.php
2929
- src/Views/Columns/Traits/Helpers/ArrayColumnHelpers.php
30-
- identifier: instanceof.alwaysTrue
31-
paths:
32-
- src/Views/Columns/Traits/HasFooter.php
33-
- src/Views/Columns/Traits/HasSecondaryHeader.php
3430
- identifier: function.alreadyNarrowedType
3531
paths:
3632
- src/Views/Columns/Traits/Helpers/ArrayColumnHelpers.php
@@ -41,3 +37,6 @@ parameters:
4137
- src/Views/Filters/Traits/HasOptions.php
4238
- src/Views/Traits/Core/HasTheme.php
4339
- src/Views/Traits/Core/HasView.php
40+
- identifier: unset.possiblyHookedProperty
41+
paths:
42+
- src/Traits/Configuration/CollapsingColumnConfiguration.php

resources/views/components/table/collapsed-columns.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
@foreach($this->getCollapsedColumnsForContent as $colIndex => $column)
2929

3030
<p wire:key="{{ $tableName }}-row-{{ $row->{$primaryKey} }}-collapsed-contents-{{ $colIndex }}" @class([
31-
'block mb-2 hidden' => $isTailwind,
31+
'block mb-2' => $isTailwind,
3232
'sm:block' => $isTailwind && $column->shouldCollapseAlways(),
3333
'sm:block md:hidden' => $isTailwind && !$column->shouldCollapseAlways() && !$column->shouldCollapseOnTablet() && $column->shouldCollapseOnMobile(),
3434
'sm:block lg:hidden' => $isTailwind && !$column->shouldCollapseAlways() && ($column->shouldCollapseOnTablet() || $column->shouldCollapseOnMobile()),
Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
@php
22
$defaultValue = ($filter->hasFilterDefaultValue() ? (bool) $filter->getFilterDefaultValue() : false)
33
@endphp
4-
<div class="flex flex-cols"
5-
x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')"
6-
>
7-
<x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap />
8-
<input id="thisId" type="checkbox" name="switch" class="hidden" :checked="value" />
4+
@if($isTailwind)
5+
<div class="flex flex-cols" x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')">
6+
<x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap />
7+
<input id="thisId" type="checkbox" name="switch" class="hidden" :checked="value" />
98

10-
<button x-cloak {{ $filterInputAttributes->merge([
11-
":class" => "(value == 1 || value == true) ? '".$filterInputAttributes['activeColor']."' : '".$filterInputAttributes['inactiveColor']."'",
12-
])
13-
->class([
14-
'relative inline-flex h-6 py-0.5 ml-4 focus:outline-none rounded-full w-10' => ($filterInputAttributes['default-styling'] ?? true)
15-
])
16-
->except(['default-styling','default-colors','activeColor','inactiveColor','blobColor'])
17-
}}>
18-
<span :class="(value == 1 || value == true) ? 'translate-x-[18px]' : 'translate-x-0.5'" class="w-5 h-5 duration-200 ease-in-out rounded-full shadow-md {{ $filterInputAttributes['blobColor'] }}"></span>
19-
</button>
20-
<template x-if="(value == 1 || value == true)">
21-
<button @click="toggleStatusWithReset" type="button"
22-
class="flex-shrink-0 ml-1 h-6 w-6 rounded-full inline-flex items-center justify-center text-indigo-400 hover:bg-indigo-200 hover:text-indigo-500 focus:outline-none focus:bg-indigo-500 focus:text-white"
23-
>
24-
25-
<span class="sr-only">{{ __($localisationPath.'Remove filter option') }}</span>
26-
<x-heroicon-m-x-mark class="h-6 w-6" />
9+
<button x-cloak {{ $filterInputAttributes->merge([
10+
":class" => "(value == 1 || value == true) ? '".$filterInputAttributes['activeColor']."' : '".$filterInputAttributes['inactiveColor']."'",
11+
])
12+
->class([
13+
'relative inline-flex h-6 py-0.5 ml-4 focus:outline-none rounded-full w-10' => ($filterInputAttributes['default-styling'] ?? true)
14+
])
15+
->except(['default-styling','default-colors','activeColor','inactiveColor','blobColor'])
16+
}}>
17+
<span :class="(value == 1 || value == true) ? 'translate-x-[18px]' : 'translate-x-0.5'" class="w-5 h-5 duration-200 ease-in-out rounded-full shadow-md {{ $filterInputAttributes['blobColor'] }}"></span>
2718
</button>
28-
</template>
29-
</div>
19+
<template x-if="(value == 1 || value == true)">
20+
<button @click="toggleStatusWithReset" type="button"
21+
class="flex-shrink-0 ml-1 h-6 w-6 rounded-full inline-flex items-center justify-center text-indigo-400 hover:bg-indigo-200 hover:text-indigo-500 focus:outline-none focus:bg-indigo-500 focus:text-white"
22+
>
23+
24+
<span class="sr-only">{{ __($localisationPath.'Remove filter option') }}</span>
25+
<x-heroicon-m-x-mark class="h-6 w-6" />
26+
</button>
27+
</template>
28+
</div>
29+
@elseif($isBootstrap4)
30+
<div class="custom-control custom-switch" x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')">
31+
<input type="checkbox" class="custom-control-input" id="customSwitch1" :checked="value" @click="toggleStatusWithUpdate" x-ref="switchButton">
32+
<x-livewire-tables::tools.filter-label class="custom-control-label" for="customSwitch1" :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap />
33+
</div>
34+
@else
35+
<div class="form-check form-switch" x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')">
36+
<x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap />
37+
<input id="thisId" type="checkbox" name="switch" class="form-check-input" role="switch" :checked="value" @click="toggleStatusWithUpdate" x-ref="switchButton"/>
38+
</div>
39+
@endif

resources/views/specific/bootstrap-4/pagination.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@php(isset($this->numberOfPaginatorsRendered[$paginator->getPageName()]) ? $this->numberOfPaginatorsRendered[$paginator->getPageName()]++ : $this->numberOfPaginatorsRendered[$paginator->getPageName()] = 1)
44

55
<nav>
6-
<ul class="pagination">
6+
<ul class="pagination d-flex flex-wrap justify-content-start">
77
{{-- Previous Page Link --}}
88
@if ($paginator->onFirstPage())
99
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')">

src/DataTransferObjects/DebuggableData.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
class DebuggableData
88
{
9-
public DataTableComponent $component;
10-
11-
public function __construct(DataTableComponent $component)
12-
{
13-
$this->component = $component;
14-
}
9+
public function __construct(public DataTableComponent $component) {}
1510

11+
/**
12+
* Returns data to an array
13+
*
14+
* @return array<mixed>
15+
*/
1616
public function toArray(): array
1717
{
1818
return [

src/DataTransferObjects/FilterGenericData.php

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,13 @@
44

55
class FilterGenericData
66
{
7-
public string $tableName;
8-
9-
public string $filterLayout;
10-
11-
public bool $isTailwind = false;
12-
13-
public bool $isBootstrap4 = false;
14-
15-
public bool $isBootstrap5 = false;
16-
17-
public function __construct(string $tableName, string $filterLayout, bool $isTailwind = false, bool $isBootstrap4 = false, bool $isBootstrap5 = false)
18-
{
19-
$this->tableName = $tableName;
20-
$this->filterLayout = $filterLayout;
21-
$this->isTailwind = $isTailwind;
22-
$this->isBootstrap4 = $isBootstrap4;
23-
$this->isBootstrap5 = $isBootstrap5;
24-
}
7+
public function __construct(public string $tableName, public string $filterLayout, public bool $isTailwind = false, public bool $isBootstrap4 = false, public bool $isBootstrap5 = false) {}
258

9+
/**
10+
* Convert To Array
11+
*
12+
* @return array<mixed>
13+
*/
2614
public function toArray(): array
2715
{
2816
return [

0 commit comments

Comments
 (0)