Skip to content

Commit 6e30f7c

Browse files
authored
Merge pull request #739 from rappasoft/develop
v2.2.0
2 parents 2788f4a + 4d23d85 commit 6e30f7c

File tree

19 files changed

+231
-9
lines changed

19 files changed

+231
-9
lines changed

CHANGELOG.md

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

55
## [Unreleased]
66

7+
## [2.2.0] - 2022-04-25
8+
9+
### Added
10+
11+
- Added space to include custom markup at the end of the component.
12+
- Added events documentation
13+
- Added ability to set columns as deselected by default - https://github.com/rappasoft/laravel-livewire-tables/pull/731
14+
- Added NumberFilter - https://github.com/rappasoft/laravel-livewire-tables/pull/729
15+
### Changed
16+
17+
- Fixed issue with Postgres and quotes - https://github.com/rappasoft/laravel-livewire-tables/pull/734
18+
719
## [2.1.0] - 2022-04-12
820

921
### Added
@@ -593,7 +605,8 @@ Ground Up Rebuild
593605

594606
- Initial release
595607

596-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.1.0...development
608+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.2.0...development
609+
[2.2.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.1.0...v2.2.0
597610
[2.1.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v2.0.0...v2.1.0
598611
[2.0.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.20.1...v2.0.0
599612
[1.21.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.20.1...v1.21.0

docs/columns/column-selection.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ Column::make('Address', 'address.address')
1414
->excludeFromColumnSelect(),
1515
```
1616

17+
## Deselected by default
18+
19+
If you would like a column to be included in the column select but deselected by default, you can specify:
20+
21+
```php
22+
Column::make('Address', 'address.address')
23+
->deselected(),
24+
```
25+
1726
## Available Methods
1827

1928
### setColumnSelectStatus

docs/datatable/events.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Events
3+
weight: 2
4+
---
5+
6+
These are the available events on the datatable component that you can fire from your application:
7+
8+
### refreshDatatable
9+
10+
```php
11+
$this->emit('refreshDatatable');
12+
```
13+
14+
Calls `$refresh` on the component. Good for updating from external sources or as an alternative to polling.

docs/examples/advanced-example.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,67 @@ class UsersTable extends DataTableComponent
222222
}
223223
}
224224
}
225+
```
226+
227+
**input-search.blade.php**
228+
229+
```html
230+
@if (config('livewire-tables.theme') === 'tailwind')
231+
<div class="flex rounded-md shadow-sm">
232+
<input
233+
wire:model.debounce="columnSearch.{{ $field }}"
234+
placeholder="Search {{ ucfirst($field) }}"
235+
type="text"
236+
class="block w-full border-gray-300 rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 dark:bg-gray-800 dark:text-white dark:border-gray-600 @if (isset($columnSearch[$field]) && strlen($columnSearch[$field])) rounded-none rounded-l-md focus:ring-0 focus:border-gray-300 @else focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md @endif"
237+
/>
238+
239+
@if (isset($columnSearch[$field]) && strlen($columnSearch[$field]))
240+
<span wire:click="$set('columnSearch.{{ $field }}', null)" class="inline-flex items-center px-3 text-gray-500 border border-l-0 border-gray-300 cursor-pointer bg-gray-50 rounded-r-md sm:text-sm dark:bg-gray-700 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600">
241+
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
242+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
243+
</svg>
244+
</span>
245+
@endif
246+
</div>
247+
@endif
248+
249+
@if (config('livewire-tables.theme') === 'bootstrap-4')
250+
<div class="mb-3 mb-md-0 input-group">
251+
<input
252+
wire:model.debounce="columnSearch.{{ $field }}"
253+
placeholder="Search {{ ucfirst($field) }}"
254+
type="text"
255+
class="form-control"
256+
>
257+
258+
@if (isset($columnSearch[$field]) && strlen($columnSearch[$field]))
259+
<div class="input-group-append">
260+
<button wire:click="$set('columnSearch.{{ $field }}', null)" class="btn btn-outline-secondary" type="button">
261+
<svg style="width:.75em;height:.75em" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
262+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
263+
</svg>
264+
</button>
265+
</div>
266+
@endif
267+
</div>
268+
@endif
269+
270+
@if (config('livewire-tables.theme') === 'bootstrap-5')
271+
<div class="mb-3 mb-md-0 input-group">
272+
<input
273+
wire:model.debounce="columnSearch.{{ $field }}"
274+
placeholder="Search {{ ucfirst($field) }}"
275+
type="text"
276+
class="form-control"
277+
>
278+
279+
@if (isset($columnSearch[$field]) && strlen($columnSearch[$field]))
280+
<button wire:click="$set('columnSearch.{{ $field }}', null)" class="btn btn-outline-secondary" type="button">
281+
<svg style="width:.75em;height:.75em" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
282+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
283+
</svg>
284+
</button>
285+
@endif
286+
</div>
287+
@endif
225288
```

docs/misc/custom-markup.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Adding Custom Markup
3+
weight: 3
4+
---
5+
6+
If you would like to append any custom markup right before the end of the component, you may use the `customView` method and return a view.
7+
8+
This is good for loading extra content such as modals.
9+
10+
```php
11+
public function customView(): string
12+
{
13+
return 'includes.custom';
14+
}
15+
```

docs/misc/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Debugging
3-
weight: 3
3+
weight: 4
44
---
55

66
## Configuration

docs/upgrade-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ New:
5555
```php
5656
$this->getAppliedFilterWithValue('active');
5757
```
58+
59+
## Modals
60+
61+
`modalsView()` was changed to `customView()`

docs/usage/creating-components.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ class UsersTable extends DataTableComponent
2222

2323
public function configure(): void
2424
{
25-
$this->setPrimaryKey('id')
25+
$this->setPrimaryKey('id');
2626
}
2727

2828
public function columns(): array
2929
{
30-
Column::make('ID', 'id')
31-
->sortable(),
32-
Column::make('Name')
33-
->sortable(),
30+
return [
31+
Column::make('ID', 'id')
32+
->sortable(),
33+
Column::make('Name')
34+
->sortable(),
35+
];
3436
}
3537
}
3638
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@php
2+
$theme = $component->getTheme();
3+
@endphp
4+
5+
@if ($theme === 'tailwind')
6+
<div class="rounded-md shadow-sm">
7+
<input
8+
wire:model.stop="{{ $component->getTableName() }}.filters.{{ $filter->getKey() }}"
9+
wire:key="{{ $component->getTableName() }}-filter-{{ $filter->getKey() }}"
10+
id="{{ $component->getTableName() }}-filter-{{ $filter->getKey() }}"
11+
type="number"
12+
@if($filter->hasConfig('min')) min="{{ $filter->getConfig('min') }}" @endif
13+
@if($filter->hasConfig('max')) max="{{ $filter->getConfig('max') }}" @endif
14+
class="block w-full border-gray-300 rounded-md shadow-sm transition duration-150 ease-in-out focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-800 dark:text-white dark:border-gray-600"
15+
/>
16+
</div>
17+
@elseif ($theme === 'bootstrap-4' || $theme === 'bootstrap-5')
18+
<div class="mb-3 mb-md-0 input-group">
19+
<input
20+
wire:model.stop="{{ $component->getTableName() }}.filters.{{ $filter->getKey() }}"
21+
wire:key="{{ $component->getTableName() }}-filter-{{ $filter->getKey() }}"
22+
id="{{ $component->getTableName() }}-filter-{{ $filter->getKey() }}"
23+
type="number"
24+
@if($filter->hasConfig('min')) min="{{ $filter->getConfig('min') }}" @endif
25+
@if($filter->hasConfig('max')) max="{{ $filter->getConfig('max') }}" @endif
26+
class="form-control"
27+
/>
28+
</div>
29+
@endif

resources/views/datatable.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@
6060
</x-livewire-tables::table>
6161

6262
<x-livewire-tables::pagination :rows="$rows" />
63+
64+
@isset($customView)
65+
@include($customView)
66+
@endisset
6367
</x-livewire-tables::wrapper>

0 commit comments

Comments
 (0)