Skip to content

Commit

Permalink
Rearrange wire:keys
Browse files Browse the repository at this point in the history
  • Loading branch information
rappasoft committed Apr 19, 2021
1 parent 8f8fc73 commit 392e7d5
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
- `$searchFilterDebounce`, `$searchFilterDefer`, `$searchFilterLazy`, for defining the search input data binding property. https://github.com/rappasoft/laravel-livewire-tables/pull/211
- Remove ability to need to define filters if not defining defaults. https://github.com/rappasoft/laravel-livewire-tables/pull/213

### Changed

- Rearrange wire:keys

## [1.0.3] - 2021-04-18

### Added
Expand Down
9 changes: 8 additions & 1 deletion resources/views/bootstrap-4/includes/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

<div class="dropdown-menu dropdown-menu-right w-100" aria-labelledby="bulkActions">
@foreach($bulkActions as $action => $title)
<a href="#" wire:click.prevent="{{ $action }}" class="dropdown-item">{{ $title }}</a>
<a
href="#"
wire:click.prevent="{{ $action }}"
wire:key="bulk-action-{{ $action }}"
class="dropdown-item"
>
{{ $title }}
</a>
@endforeach
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/bootstrap-4/includes/filter-pills.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@if ($showFilters && count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
<div wire:key="filter-badges" class="mb-3">
<div class="mb-3">
<small class="text-secondary">@lang('Applied Filters'):</small>

@foreach($filters as $key => $value)
@if ($key !== 'search' && strlen($value))
<span
wire:key="filter-{{ $key }}"
wire:key="filter-pill-{{ $key }}"
class="badge badge-pill badge-info d-inline-flex align-items-center"
>
{{ $filterNames[$key] ?? ucwords(strtr($key, ['_' => ' ', '-' => ' '])) }}: {{ ucwords(strtr($value, ['_' => ' ', '-' => ' '])) }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/bootstrap-4/includes/filters.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@include($filtersView)
@elseif (count($customFilters))
@foreach ($customFilters as $key => $filter)
<div class="p-2">
<div wire:key="filter-{{ $key }}" class="p-2">
@if ($filter->isSelect())
<label for="filter-{{ $key }}" class="mb-2">
{{ $filter->name() }}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/bootstrap-4/includes/sorting-pills.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@if ($showSorting && count($sorts))
<div wire:key="sort-badges" class="mb-3">
<div class="mb-3">
<small class="text-secondary">@lang('Applied Sorting'):</small>

@foreach($sorts as $col => $dir)
<span
wire:key="sort-{{ $col }}"
wire:key="sorting-pill-{{ $key }}"
class="badge badge-pill badge-info d-inline-flex align-items-center"
>
<span>{{ $sortNames[$col] ?? ucwords(strtr($col, ['_' => ' ', '-' => ' '])) }}: {{ $dir === 'asc' ? 'A-Z' : 'Z-A' }}</span>
Expand Down
9 changes: 8 additions & 1 deletion resources/views/bootstrap-5/includes/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

<div class="dropdown-menu dropdown-menu-end w-100" aria-labelledby="bulkActions">
@foreach($bulkActions as $action => $title)
<a href="#" wire:click.prevent="{{ $action }}" class="dropdown-item">{{ $title }}</a>
<a
href="#"
wire:click.prevent="{{ $action }}"
wire:key="bulk-action-{{ $action }}"
class="dropdown-item"
>
{{ $title }}
</a>
@endforeach
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/bootstrap-5/includes/filter-pills.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@if ($showFilters && count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
<div wire:key="filter-badges" class="mb-3">
<div class="mb-3">
<small class="text-secondary">@lang('Applied Filters'):</small>

@foreach($filters as $key => $value)
@if ($key !== 'search' && strlen($value))
<span
wire:key="filter-{{ $key }}"
wire:key="filter-pill-{{ $key }}"
class="badge rounded-pill bg-info d-inline-flex align-items-center"
>
{{ $filterNames[$key] ?? ucwords(strtr($key, ['_' => ' ', '-' => ' '])) }}: {{ ucwords(strtr($value, ['_' => ' ', '-' => ' '])) }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/bootstrap-5/includes/filters.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@include($filtersView)
@elseif (count($customFilters))
@foreach ($customFilters as $key => $filter)
<div class="p-2">
<div wire:key="filter-{{ $key }}" class="p-2">
@if ($filter->isSelect())
<label for="filter-{{ $key }}" class="mb-2">
{{ $filter->name() }}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/bootstrap-5/includes/sorting-pills.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@if ($showSorting && count($sorts))
<div wire:key="sort-badges" class="mb-3">
<div class="mb-3">
<small class="text-secondary">@lang('Applied Sorting'):</small>

@foreach($sorts as $col => $dir)
<span
wire:key="sort-{{ $col }}"
wire:key="sorting-pill-{{ $key }}"
class="badge rounded-pill bg-info d-inline-flex align-items-center"
>
<span>{{ $sortNames[$col] ?? ucwords(strtr($col, ['_' => ' ', '-' => ' '])) }}: {{ $dir === 'asc' ? 'A-Z' : 'Z-A' }}</span>
Expand Down
8 changes: 7 additions & 1 deletion resources/views/tailwind/includes/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50"
<div class="rounded-md bg-white shadow-xs">
<div class="py-1" role="menu" aria-orientation="vertical" aria-labelledby="options-menu">
@foreach($bulkActions as $action => $title)
<button wire:click="{{ $action }}" type="button" class="block w-full px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 flex items-center space-x-2" role="menuitem">
<button
wire:click="{{ $action }}"
wire:key="bulk-action-{{ $action }}"
type="button"
class="block w-full px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 flex items-center space-x-2"
role="menuitem"
>
<span>{{ $title }}</span>
</button>
@endforeach
Expand Down
4 changes: 2 additions & 2 deletions resources/views/tailwind/includes/filter-pills.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@if ($showFilters && count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
<div wire:key="filter-badges" class="p-6 md:p-0">
<div class="p-6 md:p-0">
<small class="text-gray-700">@lang('Applied Filters'):</small>

@foreach($filters as $key => $value)
@if ($key !== 'search' && strlen($value))
<span
wire:key="filter-{{ $key }}"
wire:key="filter-pill-{{ $key }}"
class="inline-flex items-center py-0.5 pl-2 pr-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-700"
>
{{ $filterNames[$key] ?? ucwords(strtr($key, ['_' => ' ', '-' => ' '])) }}: {{ ucwords(strtr($value, ['_' => ' ', '-' => ' '])) }}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/tailwind/includes/sorting-pills.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@if ($showSorting && count($sorts))
<div wire:key="sort-badges" class="p-6 md:p-0">
<div class="p-6 md:p-0">
<small class="text-gray-700">@lang('Applied Sorting'):</small>

@foreach($sorts as $col => $dir)
<span
wire:key="sort-{{ $col }}"
wire:key="sorting-pill-{{ $key }}"
class="inline-flex items-center py-0.5 pl-2 pr-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-700"
>
{{ $sortNames[$col] ?? ucwords(strtr($col, ['_' => ' ', '-' => ' '])) }}: {{ $dir === 'asc' ? 'A-Z' : 'Z-A' }}
Expand Down

0 comments on commit 392e7d5

Please sign in to comment.