-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(livewire-table) atualiza as views que serão publicadas
- Loading branch information
1 parent
ea90e07
commit 7a0f81f
Showing
21 changed files
with
895 additions
and
413 deletions.
There are no files selected for viewing
158 changes: 123 additions & 35 deletions
158
resources/views/livewire-tables/vendor/components/pagination.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,130 @@ | ||
@aware(['component']) | ||
@props(['rows']) | ||
@aware(['component','isTailwind','isBootstrap','isBootstrap4','isBootstrap5']) | ||
|
||
@php | ||
$theme = $component->getTheme(); | ||
@endphp | ||
|
||
@if ($component->hasConfigurableAreaFor('before-pagination')) | ||
@include( | ||
$component->getConfigurableAreaFor('before-pagination'), | ||
$component->getParametersForConfigurableArea('before-pagination')) | ||
@if ($this->hasConfigurableAreaFor('before-pagination')) | ||
@include($this->getConfigurableAreaFor('before-pagination'), $this->getParametersForConfigurableArea('before-pagination')) | ||
@endif | ||
|
||
<div class="card-footer d-flex align-items-center"> | ||
@if ($component->paginationVisibilityIsEnabled()) | ||
@if ($component->paginationIsEnabled() && ($component->isPaginationMethod('simple') || ($component->isPaginationMethod('standard') && $rows->lastPage() > 1))) | ||
<p class="m-0 text-secondary"> | ||
@lang('Showing') | ||
<span>{{ $rows->count() ? $rows->firstItem() : 0 }}</span> | ||
@lang('to') | ||
<span>{{ $rows->count() ? $rows->lastItem() : 0 }}</span> | ||
@lang('of') | ||
<span><span x-text="paginationTotalItemCount"></span></span> | ||
@lang('results') | ||
</p> | ||
@if ($this->isTailwind) | ||
<div> | ||
@if ($this->paginationVisibilityIsEnabled()) | ||
<div class="mt-4 px-4 md:p-0 sm:flex justify-between items-center space-y-4 sm:space-y-0"> | ||
<div> | ||
@if ($this->paginationIsEnabled() && $this->isPaginationMethod('standard') && $this->getRows->lastPage() > 1) | ||
<p class="paged-pagination-results text-sm text-gray-700 leading-5 dark:text-white"> | ||
@if($this->showPaginationDetails()) | ||
<span>@lang('Showing')</span> | ||
<span class="font-medium">{{ $this->getRows->firstItem() }}</span> | ||
<span>@lang('to')</span> | ||
<span class="font-medium">{{ $this->getRows->lastItem() }}</span> | ||
<span>@lang('of')</span> | ||
<span class="font-medium"><span x-text="paginationTotalItemCount"></span></span> | ||
<span>@lang('results')</span> | ||
@endif | ||
</p> | ||
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('simple')) | ||
<p class="paged-pagination-results text-sm text-gray-700 leading-5 dark:text-white"> | ||
@if($this->showPaginationDetails()) | ||
<span>@lang('Showing')</span> | ||
<span class="font-medium">{{ $this->getRows->firstItem() }}</span> | ||
<span>@lang('to')</span> | ||
<span class="font-medium">{{ $this->getRows->lastItem() }}</span> | ||
@endif | ||
</p> | ||
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('cursor')) | ||
@else | ||
<p class="total-pagination-results text-sm text-gray-700 leading-5 dark:text-white"> | ||
@lang('Showing') | ||
<span class="font-medium">{{ $this->getRows->count() }}</span> | ||
@lang('results') | ||
</p> | ||
@endif | ||
</div> | ||
|
||
@if ($this->paginationIsEnabled()) | ||
{{ $this->getRows->links('livewire-tables::specific.tailwind.'.(!$this->isPaginationMethod('standard') ? 'simple-' : '').'pagination') }} | ||
@endif | ||
</div> | ||
@endif | ||
</div> | ||
@elseif ($this->isBootstrap4) | ||
<div > | ||
@if ($this->paginationVisibilityIsEnabled()) | ||
@if ($this->paginationIsEnabled() && $this->isPaginationMethod('standard') && $this->getRows->lastPage() > 1) | ||
<div class="row mt-3"> | ||
<div class="col-12 col-md-6 overflow-auto"> | ||
{{ $this->getRows->links('livewire-tables::specific.bootstrap-4.pagination') }} | ||
</div> | ||
|
||
<div class="col-12 col-md-6 text-center text-md-right text-muted"> | ||
@if($this->showPaginationDetails()) | ||
<span>@lang('Showing')</span> | ||
<strong>{{ $this->getRows->count() ? $this->getRows->firstItem() : 0 }}</strong> | ||
<span>@lang('to')</span> | ||
<strong>{{ $this->getRows->count() ? $this->getRows->lastItem() : 0 }}</strong> | ||
<span>@lang('of')</span> | ||
<strong><span x-text="paginationTotalItemCount"></span></strong> | ||
<span>@lang('results')</span> | ||
@endif | ||
</div> | ||
</div> | ||
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('simple')) | ||
<div class="row mt-3"> | ||
<div class="col-12 col-md-6 overflow-auto"> | ||
{{ $this->getRows->links('livewire-tables::specific.bootstrap-4.simple-pagination') }} | ||
</div> | ||
|
||
{{ $rows->links('admix-ui::livewire-tables.includes.pagination-items') }} | ||
@else | ||
<p class="m-0 text-secondary"> | ||
@lang('Showing') | ||
<span>{{ $rows->count() }}</span> | ||
@lang('results') | ||
</p> | ||
<div class="col-12 col-md-6 text-center text-md-right text-muted"> | ||
@if($this->showPaginationDetails()) | ||
<span>@lang('Showing')</span> | ||
<strong>{{ $this->getRows->count() ? $this->getRows->firstItem() : 0 }}</strong> | ||
<span>@lang('to')</span> | ||
<strong>{{ $this->getRows->count() ? $this->getRows->lastItem() : 0 }}</strong> | ||
@endif | ||
</div> | ||
</div> | ||
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('cursor')) | ||
<div class="row mt-3"> | ||
<div class="col-12 col-md-6 overflow-auto"> | ||
{{ $this->getRows->links('livewire-tables::specific.bootstrap-4.simple-pagination') }} | ||
</div> | ||
</div> | ||
@else | ||
<div class="row mt-3"> | ||
<div class="col-12 text-muted"> | ||
@lang('Showing') | ||
<strong>{{ $this->getRows->count() }}</strong> | ||
@lang('results') | ||
</div> | ||
</div> | ||
@endif | ||
@endif | ||
@endif | ||
</div> | ||
</div> | ||
@elseif ($this->isBootstrap5) | ||
<div class="card-footer d-flex align-items-center"> | ||
@if ($this->paginationVisibilityIsEnabled()) | ||
@if ($this->paginationIsEnabled() && ($this->isPaginationMethod('simple') || ($this->isPaginationMethod('standard') && $this->getRows->lastPage() > 1))) | ||
<p class="m-0 text-secondary"> | ||
@lang('Showing') | ||
<span>{{ $this->getRows->count() ? $this->getRows->firstItem() : 0 }}</span> | ||
@lang('to') | ||
<span>{{ $this->getRows->count() ? $this->getRows->lastItem() : 0 }}</span> | ||
@lang('of') | ||
<span><span x-text="paginationTotalItemCount"></span></span> | ||
@lang('results') | ||
</p> | ||
|
||
@if ($component->hasConfigurableAreaFor('after-pagination')) | ||
@include( | ||
$component->getConfigurableAreaFor('after-pagination'), | ||
$component->getParametersForConfigurableArea('after-pagination')) | ||
{{ $this->getRows->links('admix-ui::livewire-tables.includes.pagination-items') }} | ||
@else | ||
<p class="m-0 text-secondary"> | ||
@lang('Showing') | ||
<span>{{ $this->getRows->count() }}</span> | ||
@lang('results') | ||
</p> | ||
@endif | ||
@endif | ||
</div> | ||
@endif | ||
|
||
@if ($this->hasConfigurableAreaFor('after-pagination')) | ||
@include($this->getConfigurableAreaFor('after-pagination'), $this->getParametersForConfigurableArea('after-pagination')) | ||
@endif |
26 changes: 26 additions & 0 deletions
26
resources/views/livewire-tables/vendor/components/table/td/plain.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@aware(['component', 'rowIndex', 'rowID', 'isTailwind', 'isBootstrap']) | ||
@props(['column' => null, 'customAttributes' => [], 'displayMinimisedOnReorder' => false, 'hideUntilReorder' => false]) | ||
|
||
@if ($isTailwind) | ||
<td x-cloak {{ $attributes | ||
->merge($customAttributes) | ||
->class(['px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $customAttributes['default'] ?? true]) | ||
->class(['hidden' => $column && $column->shouldCollapseAlways()]) | ||
->class(['hidden md:table-cell' => $column && $column->shouldCollapseOnMobile()]) | ||
->class(['hidden lg:table-cell' => $column && $column->shouldCollapseOnTablet()]) | ||
->except('default') | ||
}} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif > | ||
{{ $slot }} | ||
</td> | ||
@elseif ($isBootstrap) | ||
<td {{ $attributes | ||
->merge($customAttributes) | ||
->class(['w-1 -pe-0' => $customAttributes['default'] ?? true]) | ||
->class(['d-none' => $column && $column->shouldCollapseAlways()]) | ||
->class(['d-none d-md-table-cell' => $column && $column->shouldCollapseOnMobile()]) | ||
->class(['d-none d-lg-table-cell' => $column && $column->shouldCollapseOnTablet()]) | ||
->except('default') | ||
}}> | ||
{{ $slot }} | ||
</td> | ||
@endif |
15 changes: 13 additions & 2 deletions
15
resources/views/livewire-tables/vendor/components/table/th/plain.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
@aware(['component']) | ||
@aware(['component', 'isTailwind', 'isBootstrap']) | ||
@props(['displayMinimisedOnReorder' => false, 'hideUntilReorder' => false, 'customAttributes' => ['default' => true]]) | ||
|
||
<th scope="col" class="w-1">{{ $slot }}</th> | ||
<th x-cloak {{ $attributes }} scope="col" | ||
{{ | ||
$attributes->merge($customAttributes)->class([ | ||
'table-cell px-3 py-2 md:px-6 md:py-3 text-center md:text-left bg-gray-50 dark:bg-gray-800 laravel-livewire-tables-reorderingMinimised' => ($isTailwind) && ($customAttributes['default'] ?? true), | ||
'laravel-livewire-tables-reorderingMinimised w-1 pe-0' => ($isBootstrap) && ($customAttributes['default'] ?? true), | ||
]) | ||
}} | ||
@if($hideUntilReorder) :class="!reorderDisplayColumn && 'w-0 p-0 hidden'" @endif | ||
> | ||
{{ $slot }} | ||
</th> |
35 changes: 35 additions & 0 deletions
35
resources/views/livewire-tables/vendor/components/table/tr.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@aware(['component', 'tableName', 'primaryKey', 'isTailwind', 'isBootstrap']) | ||
@props(['row', 'rowIndex']) | ||
|
||
@php | ||
$customAttributes = $this->getTrAttributes($row, $rowIndex); | ||
@endphp | ||
|
||
<tr | ||
rowpk='{{ $row->{$primaryKey} }}' | ||
x-on:dragstart.self="currentlyReorderingStatus && dragStart(event)" | ||
x-on:drop.prevent="currentlyReorderingStatus && dropEvent(event)" | ||
x-on:dragover.prevent.throttle.500ms="currentlyReorderingStatus && dragOverEvent(event)" | ||
x-on:dragleave.prevent.throttle.500ms="currentlyReorderingStatus && dragLeaveEvent(event)" | ||
@if($this->hasDisplayLoadingPlaceholder()) | ||
wire:loading.remove | ||
@else | ||
wire:loading.class.delay="opacity-50 dark:bg-gray-900 dark:opacity-60" | ||
@endif | ||
id="{{ $tableName }}-row-{{ $row->{$primaryKey} }}" | ||
:draggable="currentlyReorderingStatus" | ||
wire:key="{{ $tableName }}-tablerow-tr-{{ $row->{$primaryKey} }}" | ||
loopType="{{ ($rowIndex % 2 === 0) ? 'even' : 'odd' }}" | ||
{{ | ||
$attributes->merge($customAttributes) | ||
->class(['bg-white dark:bg-gray-700 dark:text-white rappasoft-striped-row' => ($isTailwind && ($customAttributes['default'] ?? true) && $rowIndex % 2 === 0)]) | ||
->class(['bg-gray-50 dark:bg-gray-800 dark:text-white rappasoft-striped-row' => ($isTailwind && ($customAttributes['default'] ?? true) && $rowIndex % 2 !== 0)]) | ||
->class(['cursor-pointer' => ($isTailwind && $this->hasTableRowUrl() && ($customAttributes['default'] ?? true))]) | ||
->class(['-bg-light rappasoft-striped-row' => ($isBootstrap && $rowIndex % 2 === 0 && ($customAttributes['default'] ?? true))]) | ||
->class(['-bg-white rappasoft-striped-row' => ($isBootstrap && $rowIndex % 2 !== 0 && ($customAttributes['default'] ?? true))]) | ||
->except(['default']) | ||
}} | ||
|
||
> | ||
{{ $slot }} | ||
</tr> |
Oops, something went wrong.