Skip to content

Commit d658a60

Browse files
committed
Fixes
1 parent 59f071b commit d658a60

File tree

5 files changed

+46
-27
lines changed

5 files changed

+46
-27
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
@aware(['tableName','showBulkActionsSections', 'coreTableAttributes', 'currentlyReorderingStatus', 'showCollapsingColumnSections', 'selectedVisibleColumns'])
22
@props(['row','rowIndex','rowPk','customAttributes'])
3+
@php
4+
if ($this->hasTableRowUrl())
5+
{
6+
$rowUrl = $this->getTableRowUrl($row);
7+
$rowTarget = $this->getTableRowUrlTarget($row);
8+
}
9+
else
10+
{
11+
$rowUrl = '';
12+
$rowTarget = '';
13+
}
14+
@endphp
315

416
<tbody {{ $attributes->merge($coreTableAttributes['tbody'])
517
->class([
@@ -9,7 +21,7 @@
921
->except(['default','default-styling','default-colors'])
1022
}} x-data
1123
>
12-
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $rowPk }}" >
24+
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $rowPk }}" :$rowUrl :$rowTarget >
1325

1426
@if($currentlyReorderingStatus)
1527
<x-livewire-tables::table.td.reorder x-cloak x-show="currentlyReorderingStatus" />
@@ -22,7 +34,7 @@
2234
@endif
2335

2436
@tableloop($selectedVisibleColumns as $colIndex => $column)
25-
<x-livewire-tables::table.td wire:key="{{ $tableName . '-' . $rowPk . '-datatable-td-' . $column->getSlug() }}" :$column :$colIndex >
37+
<x-livewire-tables::table.td wire:key="{{ $tableName . '-' . $rowPk . '-datatable-td-' . $column->getSlug() }}" :$column :$colIndex >
2638
@if($column->isHtml())
2739
{!! $column->setIndexes($rowIndex, $colIndex)->renderContents($row) !!}
2840
@else

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
@aware([ 'row', 'rowIndex', 'tableName', 'primaryKey','isTailwind','isBootstrap'])
1+
@aware([ 'row', 'rowIndex', 'tableName', 'primaryKey', 'rowPk', 'isTailwind','isBootstrap','rowUrl', 'rowTarget'])
22
@props(['column', 'colIndex'])
33

44
@php
5-
$customAttributes = $this->getTdAttributes($column, $row, $colIndex, $rowIndex)
5+
$customAttributes = $this->getTdAttributes($column, $row, $colIndex, $rowIndex);
66
@endphp
77

8-
<td wire:key="{{ $tableName . '-table-td-'.$row->{$primaryKey}.'-'.$column->getSlug() }}" x-ref="{{ $tableName . "_" . $rowIndex."_".$colIndex}}"
8+
<td wire:key="{{ $tableName . '-table-td-'.$rowPk.'-'.$column->getSlug() }}" x-ref="{{ $tableName . "_" . $rowIndex."_".$colIndex}}"
99
@if ($column->isClickable())
10-
@if($this->getTableRowUrlTarget($row) === 'navigate') wire:navigate href="{{ $this->getTableRowUrl($row) }}"
11-
@else onclick="window.open('{{ $this->getTableRowUrl($row) }}', '{{ $this->getTableRowUrlTarget($row) ?? '_self' }}')"
10+
@if($rowTarget === 'navigate') wire:navigate href="{{ $rowUrl }}"
11+
@else onclick="window.open('{{ $rowUrl }}', '{{ $rowTarget ?? '_self' }}')"
1212
@endif
1313
@endif
1414
{{

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
@aware([ 'tableName','primaryKey','isTailwind','isBootstrap','row', 'rowPk', 'rowIndex', 'customAttributes'])
1+
@aware([ 'tableName','primaryKey','isTailwind','isBootstrap','row', 'rowPk', 'rowIndex', 'customAttributes', 'hasTableRowUrl', 'hasDisplayLoadingPlaceholder'])
2+
@props(['rowUrl' => '', 'rowTarget' => ''])
23

34
<tr
45
rowpk='{{ $rowPk }}'
56
x-on:dragstart.self="currentlyReorderingStatus && dragStart(event)"
67
x-on:drop.prevent="currentlyReorderingStatus && dropEvent(event)"
78
x-on:dragover.prevent.throttle.500ms="currentlyReorderingStatus && dragOverEvent(event)"
89
x-on:dragleave.prevent.throttle.500ms="currentlyReorderingStatus && dragLeaveEvent(event)"
9-
@if($this->hasDisplayLoadingPlaceholder())
10+
@if($hasDisplayLoadingPlaceholder)
1011
wire:loading.class.add="hidden d-none"
1112
@else
1213
wire:loading.class.delay="opacity-50 dark:bg-gray-900 dark:opacity-60"
@@ -20,7 +21,7 @@
2021
->class($isTailwind ? [
2122
'bg-white dark:bg-gray-700 dark:text-white rappasoft-striped-row' => (($customAttributes['default'] ?? true) && $rowIndex % 2 === 0),
2223
'bg-gray-50 dark:bg-gray-800 dark:text-white rappasoft-striped-row' => (($customAttributes['default'] ?? true) && $rowIndex % 2 !== 0),
23-
'cursor-pointer' => ($this->hasTableRowUrl() && ($customAttributes['default'] ?? true)),
24+
'cursor-pointer' => ($hasTableRowUrl && ($customAttributes['default'] ?? true)),
2425
] :
2526
[
2627
'bg-light rappasoft-striped-row' => ($rowIndex % 2 === 0 && ($customAttributes['default'] ?? true)),

resources/views/datatable.blade.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
@php($tableName = $this->getTableName)
2-
@php($tableId = $this->getTableId)
3-
@php($primaryKey = $this->getPrimaryKey)
4-
@php($isTailwind = $this->isTailwind)
5-
@php($isBootstrap = $this->isBootstrap)
6-
@php($isBootstrap4 = $this->isBootstrap4)
7-
@php($isBootstrap5 = $this->isBootstrap5)
8-
@php($localisationPath = $this->getLocalisationPath)
9-
@php($getCurrentlyReorderingStatus = $this->getCurrentlyReorderingStatus)
10-
@php($currentlyReorderingStatus = $this->getCurrentlyReorderingStatus)
11-
@php($showBulkActionsSections = $this->showBulkActionsSections)
12-
@php($showCollapsingColumnSections = $this->showCollapsingColumnSections)
13-
@php($selectedVisibleColumns = $this->selectedVisibleColumns)
1+
@php($tableName = $this->getTableName())
2+
@php($tableId = $this->getTableId())
3+
@php($primaryKey = $this->getPrimaryKey())
4+
@php($isTailwind = $this->isTailwind())
5+
@php($isBootstrap = $this->isBootstrap())
6+
@php($isBootstrap4 = $this->isBootstrap4())
7+
@php($isBootstrap5 = $this->isBootstrap5())
8+
@php($localisationPath = $this->getLocalisationPath())
9+
@php($getCurrentlyReorderingStatus = $this->getCurrentlyReorderingStatus())
10+
@php($currentlyReorderingStatus = $this->getCurrentlyReorderingStatus())
11+
@php($showBulkActionsSections = $this->showBulkActionsSections())
12+
@php($showCollapsingColumnSections = $this->showCollapsingColumnSections())
13+
@php($selectedVisibleColumns = $this->selectedVisibleColumns())
1414
@php($collapsingColumnDetails = $this->getCollapsedColumnsForContentNew())
1515
@php($tdAttributes = $this->getBulkActionsTdAttributes())
1616
@php($tdCheckboxAttributes = $this->getBulkActionsTdCheckboxAttributes())
@@ -21,6 +21,9 @@
2121
@php($shouldCollapseOnTablet = $this->shouldCollapseOnTablet())
2222
@php($shouldCollapseOnMobile = $this->shouldCollapseOnMobile())
2323
@php($coreTableAttributes = $this->getCoreTableAttributes())
24+
@php($hasDisplayLoadingPlaceholder = $this->hasDisplayLoadingPlaceholder())
25+
@php($hasTableRowUrl = $this->hasTableRowUrl())
26+
2427

2528
<div>
2629
<div x-data="{ currentlyReorderingStatus: false }">
@@ -32,7 +35,7 @@
3235
$this->getParametersForConfigurableArea('before-wrapper')
3336
)
3437

35-
<x-livewire-tables::wrapper :$tableName :$primaryKey :$isTailwind :$isBootstrap :$isBootstrap4 :$isBootstrap5 :$localisationPath :$collapsingColumnDetails :$tdAttributes :$tdCheckboxAttributes :$collapsingColumnButtonExpandAttributes :$collapsingColumnButtonCollapseAttributes :$hasCollapsingColumns :$shouldCollapseAlways :$shouldCollapseOnTablet :$shouldCollapseOnMobile :$currentlyReorderingStatus :$showBulkActionsSections :$coreTableAttributes :$showCollapsingColumnSections :$selectedVisibleColumns>
38+
<x-livewire-tables::wrapper :$tableName :$primaryKey :$isTailwind :$isBootstrap :$isBootstrap4 :$isBootstrap5 :$localisationPath :$collapsingColumnDetails :$tdAttributes :$tdCheckboxAttributes :$collapsingColumnButtonExpandAttributes :$collapsingColumnButtonCollapseAttributes :$hasCollapsingColumns :$shouldCollapseAlways :$shouldCollapseOnTablet :$shouldCollapseOnMobile :$currentlyReorderingStatus :$showBulkActionsSections :$coreTableAttributes :$showCollapsingColumnSections :$selectedVisibleColumns :$hasDisplayLoadingPlaceholder :$hasTableRowUrl>
3639
@if($this->hasActions() && !$this->showActionsInToolbar())
3740
<x-livewire-tables::includes.actions/>
3841
@endif
@@ -84,11 +87,11 @@
8487
$this->getParametersForConfigurableArea('after-tools')
8588
)
8689

87-
<x-livewire-tables::table :bulkActionsTdAttributes="$this->getBulkActionsTdAttributes" :bulkActionsTdCheckboxAttributes="$this->getBulkActionsTdCheckboxAttributes">
90+
<x-livewire-tables::table :bulkActionsTdAttributes="$this->getBulkActionsTdAttributes()" :bulkActionsTdCheckboxAttributes="$this->getBulkActionsTdCheckboxAttributes()">
8891

8992
<x-livewire-tables::table.thead />
9093

91-
@if($this->shouldShowSecondaryHeader)
94+
@if($this->shouldShowSecondaryHeader())
9295
<x-livewire-tables::table.tr.secondary-header />
9396
@endif
9497

@@ -111,7 +114,7 @@
111114
@endif
112115

113116

114-
@if ($this->shouldShowFooter)
117+
@if ($this->shouldShowFooter())
115118
<x-livewire-tables::table.tfoot />
116119
@endif
117120
</x-livewire-tables::table>

src/Traits/Helpers/LoadingPlaceholderHelpers.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
namespace Rappasoft\LaravelLivewireTables\Traits\Helpers;
44

5+
use Livewire\Attributes\Computed;
6+
57
trait LoadingPlaceholderHelpers
68
{
9+
#[Computed]
710
public function hasDisplayLoadingPlaceholder(): bool
811
{
912
return $this->getDisplayLoadingPlaceholder();

0 commit comments

Comments
 (0)