Skip to content

Commit

Permalink
compatiable with livewire V#
Browse files Browse the repository at this point in the history
  • Loading branch information
ken lin committed Aug 4, 2023
1 parent fa650fb commit cb0377d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion resources/stubs/component.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Livewire;
namespace App\Livewire;

use App\Models\DummyModel;
use Illuminate\Database\Eloquent\Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
])

<div
x-data="{ showModal: @entangle($attributes->wire('model')).defer }"
x-cloak
x-data="{ showModal: @entangle($attributes->wire('model')) }"
>
<div
class="fixed inset-0 z-30 flex items-center justify-center overflow-auto bg-gray-500 bg-opacity-75"
Expand All @@ -14,7 +15,6 @@ class="fixed inset-0 z-30 flex items-center justify-center overflow-auto bg-gray
x-transition:leave="transform duration-200"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-100"
x-cloak
>
{{-- Modal inner --}}
<div
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tailwind/datatable.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ class="relative"
</div>
</div>

<x-livewire-tables::modals.delete-button-modal wire:model.defer="confirmDelete" :itemKey="$itemKey"/>
<x-livewire-tables::modals.delete-button-modal wire:model="confirmDelete" :itemKey="$itemKey"/>
</div>
2 changes: 1 addition & 1 deletion resources/views/tailwind/includes/column-select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class="inline-flex items-center px-2 py-1 disabled:opacity-50 disabled:cursor-wa
>
<input
class="text-indigo-600 rounded border-gray-300 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-900 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600 dark:focus:bg-gray-600 disabled:opacity-50 disabled:cursor-wait"
wire:model="columnSelectEnabled"
wire:model.live="columnSelectEnabled"
wire:target="columnSelectEnabled"
wire:loading.attr="disabled"
type="checkbox"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tailwind/includes/per-page.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="w-full shadow-sm md:w-auto ml-0 md:ml-2">
<select
wire:model="perPage"
wire:model.live="perPage"
id="perPage"
class="block w-full border-gray-300 rounded shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-700 dark:text-white dark:border-gray-600"
>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tailwind/includes/search.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</svg>
</div>
<input
wire:model.debounce.{{$searchDebounce}}ms="search"
wire:model.live.debounce.{{$searchDebounce}}ms="search"
placeholder="@lang('livewire-tables::strings.search')"
type="text"
class="block px-10 w-full border-gray-300 rounded shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 dark:bg-gray-700 dark:text-white dark:border-gray-600 @if (isset($search) && strlen($search)) rounded-l-md rounded-r-none focus:ring-0 focus:border-gray-300 @else focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded @endif"
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/LivewireTablesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function handle()
$stub = File::get(__DIR__ . '/../../resources/stubs/component.stub');
$stub = str_replace('DummyTable', $this->argument('name'), $stub);
$stub = str_replace('DummyModel', $this->option('model'), $stub);
$path = app_path('Http/Livewire/' . $this->argument('name') . '.php');
$path = app_path('Http/' . $this->argument('name') . '.php');

File::ensureDirectoryExists(app_path('Http/Livewire'));
File::ensureDirectoryExists(app_path('Livewire'));

if (! File::exists($path) || $this->confirm($this->argument('name') . ' already exists. Overwrite it?')) {
File::put($path, $stub);
Expand Down
2 changes: 1 addition & 1 deletion src/Components/DeleteModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public function render(): View|Factory
*/
public function delete(?string $id = null): void
{
$this->emit('delete', $id);
$this->dispatch('delete', $id);
}
}
2 changes: 1 addition & 1 deletion src/LivewireTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ abstract class LivewireTables extends Component
*
* @var array
*/
protected $queryString = [
protected array $queryString = [
'search' => ['except' => ''],
'sorts' => ['except' => ''],
'filters' => ['except' => ''],
Expand Down
10 changes: 5 additions & 5 deletions src/Traits/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait Pagination
/**
* Theme of pagination.
*/
public string $paginationTheme;
public ?string $paginationTheme;

/**
* Amount of items to show per page.
Expand Down Expand Up @@ -47,7 +47,7 @@ trait Pagination
/**
* Initialize
*/
protected function initializePagination(): void
public function initializePagination(): void
{
$this->paginationTheme = $this->paginationTheme ?? config('livewire-tables.tailwind', 'tailwind');

Expand All @@ -61,7 +61,7 @@ protected function initializePagination(): void
*
* @return string
*/
protected function pageName(): string
public function pageName(): string
{
return 'page';
}
Expand All @@ -70,7 +70,7 @@ protected function pageName(): string
* https://laravel-livewire.com/docs/pagination
* Resetting Pagination After Filtering Data.
*/
protected function updatingSearch(): void
public function updatingSearch(): void
{
$this->resetPage();
}
Expand All @@ -79,7 +79,7 @@ protected function updatingSearch(): void
* https://laravel-livewire.com/docs/pagination
* Resetting Pagination After Changing the perPage.
*/
protected function updatingPerPage(): void
public function updatingPerPage(): void
{
$this->resetPage();
}
Expand Down

0 comments on commit cb0377d

Please sign in to comment.