Skip to content

Commit 1d9ce5c

Browse files
authored
Merge pull request #235 from rappasoft/develop
v1.3.0
2 parents 6735b92 + 64ced2a commit 1d9ce5c

File tree

20 files changed

+552
-50
lines changed

20 files changed

+552
-50
lines changed

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7+
## [1.3.0] - 2021-04-25
8+
9+
### Added
10+
11+
- Added searchable() to columns (https://github.com/rappasoft/laravel-livewire-tables/pull/233)
12+
13+
### Changed
14+
15+
- Fixed offline indicators to display block.
16+
- Tailwind cool-gray to just gray since it is included by default.
17+
718
## [1.2.2] - 2021-04-23
819

920
### Changed
@@ -237,8 +248,11 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
237248

238249
- Initial release
239250

240-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.2.0...development
241-
[1.2.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.0.4...v1.2.0
251+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.3.0...development
252+
[1.3.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.2.2...v1.3.0
253+
[1.2.2]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.2.1...v1.2.2
254+
[1.2.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.2.0...v1.2.1
255+
[1.2.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.1.0...v1.2.0
242256
[1.1.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.0.4...v1.1.0
243257
[1.0.4]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.0.3...v1.0.4
244258
[1.0.3]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.0.2...v1.0.3

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ class Table extends DataTableComponent
6666
{
6767
return [
6868
Column::make('Type')
69-
->sortable(),
69+
->sortable()
70+
->searchable(),
7071
Column::make('Name')
71-
->sortable(),
72+
->sortable()
73+
->searchable(),
7274
Column::make('Permissions'),
7375
Column::blank(),
7476
];
@@ -170,7 +172,7 @@ public function getTableRowUrl($row): string
170172
To create cells, you should use the `<x-livewire-tables::table.cell>` table cell component, which will be rendered to:
171173

172174
```html
173-
<td {{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-4 whitespace-no-wrap text-sm leading-5 text-cool-gray-900']) }}>
175+
<td {{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-4 whitespace-no-wrap text-sm leading-5 text-gray-900']) }}>
174176
{{ $slot }}
175177
</td>
176178
```
@@ -345,7 +347,23 @@ public array $filterNames = [
345347

346348
### Adding Search
347349

348-
The search is a special built-in filter that is managed by the component, but you need to define the search query, you can do so the same as any other filter:
350+
The search is a special built-in filter that is managed by the component, but you need to define the behavior. For a simple default search behavior, add searchable() to columns:
351+
352+
```php
353+
Column::make('Type')
354+
->searchable(),
355+
```
356+
357+
You can also pass a callback for more control:
358+
359+
```php
360+
Column::make('Type')
361+
->searchable(function (Builder $query, $searchTerm) {
362+
$query->orWhere(...);
363+
}),
364+
```
365+
366+
Sometimes the default search behavior may not meet your requirements. If this is the case, skip using the searchable() method on columns and define your own behavior directly on the query.
349367

350368
```php
351369
public function query(): Builder

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@if ($offlineIndicator)
2-
<div wire:offline>
2+
<div wire:offline.class.remove="d-none" class="d-none">
33
<div class="alert alert-danger d-flex align-items-center">
44
<svg xmlns="http://www.w3.org/2000/svg" style="width:1.3em;height:1.3em;" fill="none" viewBox="0 0 24 24" stroke="currentColor">
55
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />

resources/views/bootstrap-5/includes/offline.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@if ($offlineIndicator)
2-
<div wire:offline>
2+
<div wire:offline.class.remove="d-none" class="d-none">
33
<div class="alert alert-danger d-flex align-items-center">
44
<svg xmlns="http://www.w3.org/2000/svg" style="width:1.3em;height:1.3em;" fill="none" viewBox="0 0 24 24" stroke="currentColor">
55
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<td {{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-4 whitespace-no-wrap text-sm leading-5 text-cool-gray-900']) }}>
1+
<td {{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-4 whitespace-no-wrap text-sm leading-5 text-gray-900']) }}>
22
{{ $slot }}
33
</td>

resources/views/tailwind/components/table/heading.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
])
77

88
<th
9-
{{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-3 bg-cool-gray-50'])->only('class') }}
9+
{{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-3 bg-gray-50'])->only('class') }}
1010
>
1111
@unless ($sortable)
12-
<span class="block text-left text-xs leading-4 font-medium text-cool-gray-500 uppercase tracking-wider">
12+
<span class="block text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
1313
{{ $text ?? $slot }}
1414
</span>
1515
@else
1616
<button
1717
wire:click="sortBy('{{ $column }}', '{{ $text ?? $column }}')"
1818
{{ $attributes->except('class') }}
19-
class="flex items-center space-x-1 text-left text-xs leading-4 font-medium text-cool-gray-500 uppercase tracking-wider group focus:outline-none focus:underline"
19+
class="flex items-center space-x-1 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider group focus:outline-none focus:underline"
2020
>
2121
<span>{{ $text ?? $slot }}</span>
2222

resources/views/tailwind/components/table/table.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div class="align-middle min-w-full overflow-x-auto shadow overflow-hidden rounded-none md:rounded-lg">
2-
<table class="min-w-full divide-y divide-cool-gray-200">
2+
<table class="min-w-full divide-y divide-gray-200">
33
<thead>
44
<tr>
55
{{ $head }}
66
</tr>
77
</thead>
88

9-
<tbody class="bg-white divide-y divide-cool-gray-200">
9+
<tbody class="bg-white divide-y divide-gray-200">
1010
{{ $body }}
1111
</tbody>
1212
</table>

resources/views/tailwind/includes/offline.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@if ($offlineIndicator)
2-
<div wire:offline>
2+
<div wire:offline.class.remove="hidden" class="hidden">
33
<div class="rounded-md bg-red-50 p-4 mb-4">
44
<div class="flex">
55
<div class="flex-shrink-0">

resources/views/tailwind/includes/search.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
wire:model{{ $this->searchFilterOptions }}="filters.search"
55
placeholder="{{ __('Search') }}"
66
type="text"
7-
class="flex-1 shadow-sm border-cool-gray-300 block w-full transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:border-indigo-300 focus:shadow-outline-indigo @if (isset($filters['search']) && strlen($filters['search'])) rounded-none rounded-l-md @else rounded-md @endif"
7+
class="flex-1 shadow-sm border-gray-300 block w-full transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:border-indigo-300 focus:shadow-outline-indigo @if (isset($filters['search']) && strlen($filters['search'])) rounded-none rounded-l-md @else rounded-md @endif"
88
/>
99

1010
@if (isset($filters['search']) && strlen($filters['search']))

resources/views/tailwind/includes/table.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<input
77
wire:model="selectPage"
88
type="checkbox"
9-
class="rounded-md shadow-sm border-cool-gray-300 block transition duration-150 ease-in-out sm:text-sm sm:leading-5"
9+
class="rounded-md shadow-sm border-gray-300 block transition duration-150 ease-in-out sm:text-sm sm:leading-5"
1010
/>
1111
</div>
1212
</x-livewire-tables::table.heading>
@@ -38,7 +38,7 @@ class="rounded-md shadow-sm border-cool-gray-300 block transition duration-150 e
3838
<button
3939
wire:click="selectAll"
4040
type="button"
41-
class="ml-1 text-blue-600 underline text-cool-gray-700 text-sm leading-5 font-medium focus:outline-none focus:text-cool-gray-800 focus:underline transition duration-150 ease-in-out"
41+
class="ml-1 text-blue-600 underline text-gray-700 text-sm leading-5 font-medium focus:outline-none focus:text-gray-800 focus:underline transition duration-150 ease-in-out"
4242
>
4343
@lang('Select All')
4444
</button>
@@ -50,7 +50,7 @@ class="ml-1 text-blue-600 underline text-cool-gray-700 text-sm leading-5 font-me
5050
<button
5151
wire:click="resetBulk"
5252
type="button"
53-
class="ml-1 text-blue-600 underline text-cool-gray-700 text-sm leading-5 font-medium focus:outline-none focus:text-cool-gray-800 focus:underline transition duration-150 ease-in-out"
53+
class="ml-1 text-blue-600 underline text-gray-700 text-sm leading-5 font-medium focus:outline-none focus:text-gray-800 focus:underline transition duration-150 ease-in-out"
5454
>
5555
@lang('Unselect All')
5656
</button>
@@ -75,7 +75,7 @@ class="ml-1 text-blue-600 underline text-cool-gray-700 text-sm leading-5 font-me
7575
value="{{ $row->getKey() }}"
7676
onclick="event.stopPropagation();return true;"
7777
type="checkbox"
78-
class="rounded-md shadow-sm border-cool-gray-300 block transition duration-150 ease-in-out sm:text-sm sm:leading-5"
78+
class="rounded-md shadow-sm border-gray-300 block transition duration-150 ease-in-out sm:text-sm sm:leading-5"
7979
/>
8080
</div>
8181
</x-livewire-tables::table.cell>
@@ -87,11 +87,11 @@ class="rounded-md shadow-sm border-cool-gray-300 block transition duration-150 e
8787
<x-livewire-tables::table.row>
8888
<x-livewire-tables::table.cell :colspan="count($bulkActions) ? count($columns) + 1 : count($columns)">
8989
<div class="flex justify-center items-center space-x-2">
90-
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-cool-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
90+
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
9191
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" />
9292
</svg>
9393

94-
<span class="font-medium py-8 text-cool-gray-400 text-xl">@lang('No items found. Try narrowing your search.')</span>
94+
<span class="font-medium py-8 text-gray-400 text-xl">@lang('No items found. Try narrowing your search.')</span>
9595
</div>
9696
</x-livewire-tables::table.cell>
9797
</x-livewire-tables::table.row>

0 commit comments

Comments
 (0)