diff --git a/.gitignore b/.gitignore
index 848cfaa9b..39ce23330 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ phpunit.xml.bak
phpstan.txt
coverage.xml
./tmp/**
+tests.txt
diff --git a/resources/views/components/table/empty.blade.php b/resources/views/components/table/empty.blade.php
index 705f93d48..18994fa12 100644
--- a/resources/views/components/table/empty.blade.php
+++ b/resources/views/components/table/empty.blade.php
@@ -2,18 +2,15 @@
@php($attributes = $attributes->merge(['wire:key' => 'empty-message-'.$this->getId()]))
-@if ($isTailwind)
-
+
$theme === 'tailwind',
- 'form-check' => $theme === 'bootstrap-5',
+ 'inline-flex rounded-md shadow-sm' => $this->isTailwind,
+ 'form-check' => $this->isBootstrap,
])>
- merge($bulkActionsTdCheckboxAttributes)->class([
- 'rounded border-gray-300 text-indigo-600 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' => ($theme === 'tailwind') && ($bulkActionsTdCheckboxAttributes['default'] ?? true),
- 'form-check-input' => ($theme === 'bootstrap-5') && ($bulkActionsTdCheckboxAttributes['default'] ?? true),
+ 'rounded shadow-sm transition duration-150 ease-in-out focus:ring focus:ring-opacity-50' => $this->isTailwind && (($bulkActionsTdCheckboxAttributes['default'] ?? true) || ($bulkActionsTdCheckboxAttributes['default-styling'] ?? true)),
+ 'border-gray-300 text-indigo-600 focus:border-indigo-300 focus:ring-indigo-200 dark:bg-gray-900 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600 dark:focus:bg-gray-600' => $this->isTailwind && (($bulkActionsTdCheckboxAttributes['default'] ?? true) || ($bulkActionsTdCheckboxAttributes['default-colors'] ?? true)),
+ 'form-check-input' => $this->isBootstrap && ($bulkActionsTdCheckboxAttributes['default'] ?? true),
])->except(['default','default-styling','default-colors'])
- }}
- />
+ }} />
@endif
diff --git a/resources/views/components/table/td/collapsed-columns.blade.php b/resources/views/components/table/td/collapsed-columns.blade.php
index 3bf65e170..92654b1fc 100644
--- a/resources/views/components/table/td/collapsed-columns.blade.php
+++ b/resources/views/components/table/td/collapsed-columns.blade.php
@@ -2,81 +2,44 @@
@props(['rowIndex', 'hidden' => false])
@if ($this->collapsingColumnsAreEnabled() && $this->hasCollapsedColumns())
- @if ($isTailwind)
- merge(['class' => 'p-3 table-cell text-center '])
- ->class(['sm:hidden' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
- ->class(['md:hidden' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
- ->class(['lg:hidden' => !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
- }}
- :class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
- >
- @if (! $hidden)
-
- @endif
- |
- @elseif ($isBootstrap)
- class(['d-sm-none' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
- ->class(['d-md-none' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
- ->class(['d-lg-none' => !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
- }}
- :class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
- >
- @if (! $hidden)
-
- @endif
- |
- @endif
+ merge()
+ ->class(['p-3 table-cell text-center' => $this->isTailwind])
+ ->class(['sm:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
+ ->class(['md:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
+ ->class(['lg:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
+ ->class(['d-sm-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
+ ->class(['d-md-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
+ ->class(['d-lg-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
+
+ }}
+ :class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
+ >
+ @if (! $hidden)
+
+ @endif
+ |
@endif
diff --git a/resources/views/components/table/td/plain.blade.php b/resources/views/components/table/td/plain.blade.php
index 417f6c6b6..12af0e796 100644
--- a/resources/views/components/table/td/plain.blade.php
+++ b/resources/views/components/table/td/plain.blade.php
@@ -2,26 +2,16 @@
@props(['column' => null, 'customAttributes' => [], 'displayMinimisedOnReorder' => false, 'hideUntilReorder' => false])
-@if ($isTailwind)
- 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','default-styling','default-colors'])
- }} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif >
- {{ $slot }}
- |
-@elseif ($isBootstrap)
- merge($customAttributes)
- ->class(['' => $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','default-styling','default-colors'])
- }}>
- {{ $slot }}
- |
-@endif
+merge($customAttributes)
+ ->class(['px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $isTailwind && ($customAttributes['default'] ?? true)])
+ ->class(['hidden' => $isTailwind && $column && $column->shouldCollapseAlways()])
+ ->class(['hidden md:table-cell' => $isTailwind && $column && $column->shouldCollapseOnMobile()])
+ ->class(['hidden lg:table-cell' => $isTailwind && $column && $column->shouldCollapseOnTablet()])
+ ->class(['d-none' => $isBootstrap && $column && $column->shouldCollapseAlways()])
+ ->class(['d-none d-md-table-cell' => $isBootstrap && $column && $column->shouldCollapseOnMobile()])
+ ->class(['d-none d-lg-table-cell' => $isBootstrap && $column && $column->shouldCollapseOnTablet()])
+ ->except(['default','default-styling','default-colors'])
+}} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif >
+ {{ $slot }}
+ |
diff --git a/resources/views/components/table/th.blade.php b/resources/views/components/table/th.blade.php
index 525833fe7..3857d3fff 100644
--- a/resources/views/components/table/th.blade.php
+++ b/resources/views/components/table/th.blade.php
@@ -10,81 +10,50 @@
$customSortIconAttributes = $allThAttributes['sortIconAttributes'];
$customLabelAttributes = $allThAttributes['labelAttributes'];
- //$customThAttributes = $this->getThAttributes($column);
- //$customSortButtonAttributes = $this->getThSortButtonAttributes($column);
- //$customSortIconAttributes = $this->getThSortIconAttributes($column);
-
$direction = $column->hasField() ? $this->getSort($column->getColumnSelectName()) : $this->getSort($column->getSlug()) ?? null ;
@endphp
-@if ($isTailwind)
- merge($customThAttributes)
- ->class(['text-gray-500 dark:bg-gray-800 dark:text-gray-400' => (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true))])
- ->class(['px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true))])
- ->class(['hidden' => $column->shouldCollapseAlways()])
- ->class(['hidden md:table-cell' => $column->shouldCollapseOnMobile()])
- ->class(['hidden lg:table-cell' => $column->shouldCollapseOnTablet()])
- ->except(['default', 'default-colors', 'default-styling'])
- }}
- >
- @if($column->getColumnLabelStatus())
- @unless ($this->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback()))
- except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }}
- @else
- |
diff --git a/resources/views/components/table/th/collapsed-columns.blade.php b/resources/views/components/table/th/collapsed-columns.blade.php
index eebc53e70..6be3dfa6c 100644
--- a/resources/views/components/table/th/collapsed-columns.blade.php
+++ b/resources/views/components/table/th/collapsed-columns.blade.php
@@ -1,29 +1,18 @@
@aware([ 'tableName','isTailwind','isBootstrap'])
@if ($this->collapsingColumnsAreEnabled() && $this->hasCollapsedColumns())
- @if ($isTailwind)
- merge(['class' => 'table-cell dark:bg-gray-800 laravel-livewire-tables-reorderingMinimised'])
- ->class(['sm:hidden' => !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
- ->class(['md:hidden' => !$this->shouldCollapseOnMobile() && !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
- ->class(['lg:hidden' => !$this->shouldCollapseAlways()])
- }}
- :class="{ 'laravel-livewire-tables-reorderingMinimised': ! currentlyReorderingStatus }"
- > |
- @elseif ($isBootstrap)
- merge(['class' => 'd-table-cell laravel-livewire-tables-reorderingMinimised'])
- ->class(['d-sm-none' => !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
- ->class(['d-md-none' => !$this->shouldCollapseOnMobile() && !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
- ->class(['d-lg-none' => !$this->shouldCollapseAlways()])
- }}
- :class="{ 'laravel-livewire-tables-reorderingMinimised': ! currentlyReorderingStatus }"
- > |
- @endif
+ merge()
+ ->class(['table-cell dark:bg-gray-800 laravel-livewire-tables-reorderingMinimised' => $isTailwind])
+ ->class(['sm:hidden' => $isTailwind && !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
+ ->class(['md:hidden' => $isTailwind && !$this->shouldCollapseOnMobile() && !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
+ ->class(['lg:hidden' => $isTailwind && !$this->shouldCollapseAlways()])
+ ->class(['d-table-cell laravel-livewire-tables-reorderingMinimised' => $isBootstrap])
+ ->class(['d-sm-none' => $isBootstrap && !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
+ ->class(['d-md-none' => $isBootstrap && !$this->shouldCollapseOnMobile() && !$this->shouldCollapseOnTablet() && !$this->shouldCollapseAlways()])
+ ->class(['d-lg-none' => $isBootstrap && !$this->shouldCollapseAlways()])
+
+ }}
+ :class="{ 'laravel-livewire-tables-reorderingMinimised': ! currentlyReorderingStatus }"
+ > |
@endif
diff --git a/resources/views/components/table/th/plain.blade.php b/resources/views/components/table/th/plain.blade.php
index 0b9c8326e..ff5566cf1 100644
--- a/resources/views/components/table/th/plain.blade.php
+++ b/resources/views/components/table/th/plain.blade.php
@@ -1,14 +1,12 @@
@aware(['isTailwind','isBootstrap'])
@props(['displayMinimisedOnReorder' => false, 'hideUntilReorder' => false, 'customAttributes' => ['default' => true]])
-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-colors'] ?? true) || ($customAttributes['default'] ?? true)),
'laravel-livewire-tables-reorderingMinimised' => ($isBootstrap) && (($customAttributes['default-colors'] ?? true) || ($customAttributes['default'] ?? true)),
- ])
- }}
- @if($hideUntilReorder) :class="!reorderDisplayColumn && 'w-0 p-0 hidden'" @endif
+ ])->except(['default','default-styling','default-colors'])
+ }} @if($hideUntilReorder) :class="!reorderDisplayColumn && 'w-0 p-0 hidden'" @endif
>
{{ $slot }}
|
diff --git a/resources/views/components/table/th/reorder.blade.php b/resources/views/components/table/th/reorder.blade.php
index e4fe7cecb..903b7340b 100644
--- a/resources/views/components/table/th/reorder.blade.php
+++ b/resources/views/components/table/th/reorder.blade.php
@@ -9,6 +9,7 @@
->class(['text-gray-500 dark:bg-gray-800 dark:text-gray-400' => (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true))])
->class(['table-cell px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true))])
->class(['laravel-livewire-tables-reorderingMinimised' => ($isBootstrap) && ($customThAttributes['default'] ?? true)])
+ ->except(['default','default-styling','default-colors'])
}}
>
diff --git a/resources/views/components/table/tr.blade.php b/resources/views/components/table/tr.blade.php
index 9f5f84b20..838240d82 100644
--- a/resources/views/components/table/tr.blade.php
+++ b/resources/views/components/table/tr.blade.php
@@ -2,34 +2,17 @@
@props(['row', 'rowIndex'])
@php
- $customAttributes = $this->getTrAttributes($row, $rowIndex);
+ $customAttributes = $this->getTrAttributesBag($row, $rowIndex);
@endphp
-hasDisplayLoadingPlaceholder())
- wire:loading.class.add="hidden d-none"
- @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)
+
merge()
->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','default-styling','default-colors'])
- }}
-
->
+ }}>
{{ $slot }}
diff --git a/resources/views/components/table/tr/bulk-actions.blade.php b/resources/views/components/table/tr/bulk-actions.blade.php
index e63d18df2..e1b2b1f7b 100644
--- a/resources/views/components/table/tr/bulk-actions.blade.php
+++ b/resources/views/components/table/tr/bulk-actions.blade.php
@@ -32,7 +32,7 @@
'ml-1 underline text-sm leading-5 font-medium focus:outline-none focus:underline transition duration-150 ease-in-out' => $this->isTailwind && ($this->getBulkActionsRowButtonAttributes['default-styling'] ?? true),
'text-blue-600 text-gray-700 focus:text-gray-800 dark:text-white dark:hover:text-gray-400' => $this->isTailwind && ($this->getBulkActionsRowButtonAttributes['default-colors'] ?? true),
'btn btn-primary btn-sm' => $this->isBootstrap && ($this->getBulkActionsRowButtonAttributes['default-styling'] ?? true)
- ])
+ ])->except(['default','default-styling','default-colors'])
}}
>
{{ __($this->getLocalisationPath.'Deselect All') }}
diff --git a/resources/views/components/table/tr/plain.blade.php b/resources/views/components/table/tr/plain.blade.php
index f299b3c0a..1afdd833c 100644
--- a/resources/views/components/table/tr/plain.blade.php
+++ b/resources/views/components/table/tr/plain.blade.php
@@ -1,24 +1,12 @@
@aware(['isTailwind','isBootstrap'])
@props(['customAttributes' => [], 'displayMinimisedOnReorder' => true])
-@if ($isTailwind)
- merge($customAttributes)
- ->class(['bg-white dark:bg-gray-700 dark:text-white' => $customAttributes['default'] ?? true])
- ->class(['laravel-livewire-tables-reorderingMinimised'])
- ->except(['default','default-styling','default-colors'])
- }}
- >
- {{ $slot }}
-
-@elseif ($isBootstrap)
- merge($customAttributes)
- ->class(['' => $customAttributes['default'] ?? true])
- ->class(['laravel-livewire-tables-reorderingMinimised'])
- ->except(['default','default-styling','default-colors'])
- }}
- >
- {{ $slot }}
-
-@endif
+merge($customAttributes)
+ ->class(['bg-white dark:bg-gray-700 dark:text-white' => $isTailwind && ($customAttributes['default'] ?? true)])
+ ->class(['laravel-livewire-tables-reorderingMinimised'])
+ ->except(['default','default-styling','default-colors'])
+ }}
+>
+ {{ $slot }}
+
diff --git a/src/Traits/Helpers/TableAttributeHelpers.php b/src/Traits/Helpers/TableAttributeHelpers.php
index 5c8125fa9..4f041d22b 100644
--- a/src/Traits/Helpers/TableAttributeHelpers.php
+++ b/src/Traits/Helpers/TableAttributeHelpers.php
@@ -99,12 +99,58 @@ public function getTrAttributes(Model $row, int $index): array
return isset($this->trAttributesCallback) ? call_user_func($this->trAttributesCallback, $row, $index) : ['default' => true];
}
+ #[Computed]
+ public function getTrAttributesBag(Model $row, int $index): ComponentAttributeBag
+ {
+ $default = [
+ 'id' => $this->getTableName().'-row-'.$row->{$this->getPrimaryKey()},
+ 'loopType' => $index % 2 === 0 ? 'even' : 'odd',
+ 'rowpk' => $row->{$this->getPrimaryKey()},
+ '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)',
+ ':draggable' => 'currentlyReorderingStatus',
+ 'wire:key' => $this->getTableName().'-tablerow-tr-'.$row->{$this->getPrimaryKey()},
+ ];
+
+ if ($this->hasDisplayLoadingPlaceholder()) {
+ $default['wire:loading.class.add'] = 'hidden d-none';
+ } else {
+ $default['wire:loading.class.delay'] = 'opacity-50 dark:bg-gray-900 dark:opacity-60';
+ }
+
+ return new ComponentAttributeBag(array_merge($default, $this->getTrAttributes($row, $index)));
+ }
+
#[Computed]
public function getTdAttributes(Column $column, Model $row, int $colIndex, int $rowIndex): array
{
return isset($this->tdAttributesCallback) ? call_user_func($this->tdAttributesCallback, $column, $row, $colIndex, $rowIndex) : ['default' => true];
}
+ #[Computed]
+ public function getTdAttributesBag(Column $column, Model $row, int $colIndex, int $rowIndex): ComponentAttributeBag
+ {
+ $default = [
+ 'wire:key' => $this->getTableName().'-table-td-'.$row->{$this->getPrimaryKey()}.'-'.$column->getSlug(),
+ 'default' => true,
+ 'default-colors' => true,
+ 'default-styling' => true,
+ ];
+ if ($column->isClickable()) {
+ if ($this->getTableRowUrlTarget($row) === 'navigate') {
+ $default['wire:navigate'] = '';
+ $default['href'] = $this->getTableRowUrl($row);
+ } else {
+ $target = $this->getTableRowUrlTarget($row) ?? '_self';
+ $default['onclick'] = "window.open('".$this->getTableRowUrl($row)."', '".$target."')";
+ }
+ }
+
+ return new ComponentAttributeBag(array_merge($default, $this->getTdAttributes($column, $row, $colIndex, $rowIndex)));
+ }
+
public function hasTableRowUrl(): bool
{
return isset($this->trUrlCallback);
diff --git a/src/Traits/Styling/Helpers/BulkActionStylingHelpers.php b/src/Traits/Styling/Helpers/BulkActionStylingHelpers.php
index adc3cea89..a734b8e74 100644
--- a/src/Traits/Styling/Helpers/BulkActionStylingHelpers.php
+++ b/src/Traits/Styling/Helpers/BulkActionStylingHelpers.php
@@ -2,6 +2,7 @@
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers;
+use Illuminate\Database\Eloquent\Model;
use Illuminate\View\ComponentAttributeBag;
use Livewire\Attributes\Computed;
@@ -74,6 +75,21 @@ public function getBulkActionsThCheckboxAttributes(): array
return $this->getCustomAttributes('bulkActionsThCheckboxAttributes');
}
+ /**
+ * Used to get attributes for the Bulk Actions TD
+ *
+ * @return array
+ */
+ public function getBulkActionsTdAttributesNew(string $rowPrimaryKey): array
+ {
+ $default = [
+ 'wire:key' => $this->getTableName().'-tbody-td-bulk-actions-'.$rowPrimaryKey,
+ ':displayMinimisedOnReorder' => 'true',
+ ];
+
+ return array_merge($default, $this->getBulkActionsTdAttributes());
+ }
+
/**
* Used to get attributes for the Bulk Actions TD
*
@@ -91,10 +107,28 @@ public function getBulkActionsTdAttributes(): array
*/
public function getBulkActionsTdCheckboxAttributes(): array
{
+
return $this->getCustomAttributes('bulkActionsTdCheckboxAttributes');
}
+ public function getBulkActionsTdCheckboxAttributesNew(string $rowPrimaryKey): array
+ {
+ $default = [
+ 'x-cloak' => '',
+ 'x-show' => '!currentlyReorderingStatus',
+ 'x-model' => 'selectedItems',
+ 'wire:key' => $this->getTableName().'-selectedItems-'.$rowPrimaryKey,
+ 'id' => $this->getTableName().'-row-bac-'.$rowPrimaryKey,
+ 'value' => $rowPrimaryKey,
+ 'wire:loading.attr.delay' => 'disabled',
+ 'type' => 'checkbox',
+ ];
+
+ return array_merge($default, $this->getBulkActionsTdCheckboxAttributes());
+
+ }
+
/**
* Used to get attributes for the Bulk Actions Row Buttons
*
diff --git a/tests/Unit/Traits/Configuration/BulkActionsStylingConfigurationTest.php b/tests/Unit/Traits/Configuration/BulkActionsStylingConfigurationTest.php
index 019c13d22..4ebfa4fae 100644
--- a/tests/Unit/Traits/Configuration/BulkActionsStylingConfigurationTest.php
+++ b/tests/Unit/Traits/Configuration/BulkActionsStylingConfigurationTest.php
@@ -133,4 +133,60 @@ public function test_bulk_actions_th_checkbox_attributes_returns_default_true_if
{
$this->assertSame(['default' => true, 'default-colors' => false, 'default-styling' => false], $this->basicTable->getBulkActionsThCheckboxAttributes());
}
+
+ public function test_can_set_bulk_actions_checkbox_attributes(): void
+ {
+ $this->assertSame([
+ 'x-cloak' => '',
+ 'x-show' => '!currentlyReorderingStatus',
+ 'x-model' => 'selectedItems',
+ 'wire:key' => 'table-selectedItems-5',
+ 'id' => 'table-row-bac-5',
+ 'value' => '5',
+ 'wire:loading.attr.delay' => 'disabled',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'default-colors' => false,
+ 'default-styling' => false,
+ ],
+ $this->basicTable->getBulkActionsTdCheckboxAttributesNew(5));
+
+ $this->assertSame([
+ 'x-cloak' => '',
+ 'x-show' => '!currentlyReorderingStatus',
+ 'x-model' => 'selectedItems',
+ 'wire:key' => 'table-selectedItems-14',
+ 'id' => 'table-row-bac-14',
+ 'value' => '14',
+ 'wire:loading.attr.delay' => 'disabled',
+ 'type' => 'checkbox',
+ 'default' => true,
+ 'default-colors' => false,
+ 'default-styling' => false,
+ ],
+ $this->basicTable->getBulkActionsTdCheckboxAttributesNew(14));
+
+ }
+
+ public function test_can_set_bulk_actions_td_attributes(): void
+ {
+ $this->assertSame([
+ 'wire:key' => 'table-tbody-td-bulk-actions-5',
+ ':displayMinimisedOnReorder' => 'true',
+ 'default' => true,
+ 'default-colors' => false,
+ 'default-styling' => false,
+ ],
+ $this->basicTable->getBulkActionsTdAttributesNew(5));
+
+ $this->assertSame([
+ 'wire:key' => 'table-tbody-td-bulk-actions-14',
+ ':displayMinimisedOnReorder' => 'true',
+ 'default' => true,
+ 'default-colors' => false,
+ 'default-styling' => false,
+ ],
+ $this->basicTable->getBulkActionsTdAttributesNew(14));
+
+ }
}