diff --git a/src/Traits/Helpers/ComponentHelpers.php b/src/Traits/Helpers/ComponentHelpers.php
index 96eae35f8..0e3168cc3 100644
--- a/src/Traits/Helpers/ComponentHelpers.php
+++ b/src/Traits/Helpers/ComponentHelpers.php
@@ -3,6 +3,7 @@
namespace Rappasoft\LaravelLivewireTables\Traits\Helpers;
use Illuminate\Database\Eloquent\Builder;
+use Livewire\Attributes\Computed;
trait ComponentHelpers
{
@@ -29,6 +30,7 @@ public function hasPrimaryKey(): bool
/**
* @return mixed
*/
+ #[Computed]
public function getPrimaryKey()
{
return $this->primaryKey;
@@ -69,21 +71,25 @@ public function getTheme(): string
return $this->theme ?? config('livewire-tables.theme', 'tailwind');
}
+ #[Computed]
public function isTailwind(): bool
{
return $this->getTheme() === 'tailwind';
}
+ #[Computed]
public function isBootstrap(): bool
{
return $this->getTheme() === 'bootstrap-4' || $this->getTheme() === 'bootstrap-5';
}
+ #[Computed]
public function isBootstrap4(): bool
{
return $this->getTheme() === 'bootstrap-4';
}
+ #[Computed]
public function isBootstrap5(): bool
{
return $this->getTheme() === 'bootstrap-5';
@@ -117,11 +123,18 @@ public function setTableName(string $name): string
return $this->tableName = $name;
}
+ #[Computed]
public function getTableName(): string
{
return $this->tableName;
}
+ #[Computed]
+ public function getTableId(): string
+ {
+ return $this->getTableAttributes()['id'];
+ }
+
public function isTableNamed(string $name): bool
{
return $this->tableName === $name;
From da066861321a2289d78559272b36ae04d24fe5d1 Mon Sep 17 00:00:00 2001
From: Joe <104938042+lrljoe@users.noreply.github.com>
Date: Sat, 10 Aug 2024 03:56:03 +0100
Subject: [PATCH 061/338] v3.4.5 (#1836)
## [v3.4.5] - 2024-08-10
### Bug Fixes
- Fix sort queryString bug by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1835
---
CHANGELOG.md | 4 ++++
src/Traits/Helpers/SortingHelpers.php | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11b79fdde..0ac54b890 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to `laravel-livewire-tables` will be documented in this file
+## [v3.4.5] - 2024-08-10
+### Bug Fixes
+- Fix sort queryString bug by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1835
+
## [v3.4.4] - 2024-08-10
### New Features
- Boolean/Toggle Filter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1830
diff --git a/src/Traits/Helpers/SortingHelpers.php b/src/Traits/Helpers/SortingHelpers.php
index b9ea81ba1..c78ec9a2f 100644
--- a/src/Traits/Helpers/SortingHelpers.php
+++ b/src/Traits/Helpers/SortingHelpers.php
@@ -19,6 +19,16 @@ public function getSingleSortingStatus(): bool
public function getSorts(): array
{
+ foreach ($this->sorts as $column => $direction) {
+ if (is_array($direction)) {
+ foreach ($direction as $colAppend => $actualDirection) {
+ $this->sorts[$column.'.'.$colAppend] = $actualDirection;
+ unset($this->sorts[$column]);
+ }
+ }
+
+ }
+
return $this->sorts;
}
From 3724177fe933cfd317be70ceb581dbed479604cf Mon Sep 17 00:00:00 2001
From: Joe <104938042+lrljoe@users.noreply.github.com>
Date: Fri, 16 Aug 2024 04:10:46 +0100
Subject: [PATCH 062/338] 3.4.6 - Develop to Master (#1847)
## [v3.4.6] - 2024-08-16
### New Features
- Column Features - deselectedIf/selectedIf by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1846
- Add setTrimSearchStringEnabled/setTrimSearchStringDisabled by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1843
### Bug Fixes
- Restore the original JS methods for users with published views by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1848
### Tweaks
- Remove Component from Column, move getRows into ComputedProperty by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1838
- Clean up filter generic data by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1837
- Clean up of Views, Properties by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1850
---
.github/workflows/run-phpstan.yml | 2 +-
CHANGELOG.md | 12 +
docs/columns/column-selection.md | 35 +++
docs/search/available-methods.md | 24 ++
resources/js/laravel-livewire-tables.js | 218 +++++++++++++++++-
resources/js/laravel-livewire-tables.min.js | 2 +-
.../components/includes/loading.blade.php | 6 +-
.../views/components/pagination.blade.php | 97 ++++----
.../table/collapsed-columns.blade.php | 24 +-
.../views/components/table/empty.blade.php | 10 +-
resources/views/components/table/td.blade.php | 6 +-
.../table/td/bulk-actions.blade.php | 8 +-
.../table/td/collapsed-columns.blade.php | 14 +-
.../components/table/td/reorder.blade.php | 2 +-
resources/views/components/table/th.blade.php | 10 +-
.../table/th/bulk-actions.blade.php | 8 +-
.../table/th/collapsed-columns.blade.php | 14 +-
resources/views/components/table/tr.blade.php | 6 +-
.../table/tr/bulk-actions.blade.php | 9 +-
.../components/table/tr/footer.blade.php | 22 +-
.../table/tr/secondary-header.blade.php | 17 +-
.../components/tools/filter-pills.blade.php | 6 +-
.../components/tools/sorting-pills.blade.php | 30 +--
.../views/components/tools/toolbar.blade.php | 70 +++---
.../toolbar/items/bulk-actions.blade.php | 46 ++--
.../toolbar/items/filter-button.blade.php | 36 +--
.../toolbar/items/filter-popover.blade.php | 26 +--
.../toolbar/items/filter-slidedown.blade.php | 32 +--
.../items/pagination-dropdown.blade.php | 12 +-
.../toolbar/items/reorder-buttons.blade.php | 12 +-
.../toolbar/items/search-field.blade.php | 26 +--
resources/views/components/wrapper.blade.php | 8 +-
resources/views/datatable.blade.php | 18 +-
.../views/includes/columns/boolean.blade.php | 4 +-
resources/views/includes/debug.blade.php | 4 +-
resources/views/includes/offline.blade.php | 6 +-
src/DataTransferObjects/FilterGenericData.php | 32 ++-
src/Traits/ComponentUtilities.php | 2 +
.../Configuration/ColumnConfiguration.php | 8 +-
.../Configuration/ComponentConfiguration.php | 14 ++
.../Configuration/FilterConfiguration.php | 2 +-
.../Configuration/SearchConfiguration.php | 27 ++-
src/Traits/Helpers/ColumnHelpers.php | 12 +-
src/Traits/Helpers/ColumnSelectHelpers.php | 20 +-
src/Traits/Helpers/ComponentHelpers.php | 5 +
src/Traits/Helpers/FilterHelpers.php | 1 +
src/Traits/Helpers/SearchHelpers.php | 5 +
src/Traits/WithBulkActions.php | 4 +-
src/Traits/WithColumnSelect.php | 20 +-
src/Traits/WithColumns.php | 13 +-
src/Traits/WithData.php | 12 +-
src/Traits/WithFilters.php | 11 +-
src/Traits/WithPagination.php | 12 +-
src/Traits/WithQueryString.php | 4 +-
src/Traits/WithReordering.php | 9 +-
src/Traits/WithSearch.php | 44 ++--
src/Traits/WithSorting.php | 1 +
src/Views/Columns/BooleanColumn.php | 3 +-
src/Views/Columns/ButtonGroupColumn.php | 2 +
src/Views/Columns/ColorColumn.php | 4 +-
src/Views/Columns/ImageColumn.php | 2 +
src/Views/Columns/LinkColumn.php | 2 +
src/Views/Columns/WireLinkColumn.php | 2 +
src/Views/Traits/Columns/IsSelectable.php | 22 ++
.../Configuration/ColumnConfiguration.php | 21 ++
src/Views/Traits/Core/HasFooter.php | 45 +++-
src/Views/Traits/Core/HasSecondaryHeader.php | 44 +++-
src/Views/Traits/Helpers/ColumnHelpers.php | 34 ++-
src/Views/Traits/IsColumn.php | 6 +
tests/DataTableComponentTest.php | 1 -
.../DebuggableDataTest.php | 1 +
tests/Http/Livewire/PetsTable.php | 2 +-
tests/TestCase.php | 5 -
tests/Traits/Helpers/ColumnHelpersTest.php | 12 +-
.../Helpers/ColumnSelectHelpersTest.php | 11 +-
.../Traits/Helpers/PaginationHelpersTest.php | 2 +
tests/Traits/Helpers/SearchHelpersTest.php | 36 +++
tests/Traits/Visuals/FilterVisualsTest.php | 4 +
tests/Traits/WithMountTest.php | 3 -
.../Configuration/ColumnConfigurationTest.php | 75 ++++--
80 files changed, 1062 insertions(+), 417 deletions(-)
diff --git a/.github/workflows/run-phpstan.yml b/.github/workflows/run-phpstan.yml
index 4faf52718..c8163e5ac 100644
--- a/.github/workflows/run-phpstan.yml
+++ b/.github/workflows/run-phpstan.yml
@@ -84,7 +84,7 @@ jobs:
run: composer update --${{ matrix.stability }} --no-interaction
- name: Install PHPStan
- run: composer require nunomaduro/larastan:^2.0 --dev --no-interaction
+ run: composer require larastan/larastan:^2.0 --dev --no-interaction
- name: Run PHPStan Tests
run: ./vendor/bin/phpstan analyse
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ac54b890..02091bd22 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,18 @@
All notable changes to `laravel-livewire-tables` will be documented in this file
+## [v3.4.6] - 2024-08-15
+### New Features
+- Column Features - deselectedIf/selectedIf by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1846
+- Add setTrimSearchStringEnabled/setTrimSearchStringDisabled by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1843
+
+### Bug Fixes
+- Restore the original JS methods for users with published views by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1848
+
+### Tweaks
+- Remove Component from Column, move getRows into ComputedProperty by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1838
+- Clean up filter generic data by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1837
+
## [v3.4.5] - 2024-08-10
### Bug Fixes
- Fix sort queryString bug by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1835
diff --git a/docs/columns/column-selection.md b/docs/columns/column-selection.md
index 94c0674a5..fae9eb906 100644
--- a/docs/columns/column-selection.md
+++ b/docs/columns/column-selection.md
@@ -23,6 +23,41 @@ Column::make('Address', 'address.address')
->deselected(),
```
+## DeselectedIf
+
+If you would like a column to be included in the column select but deselected based on an external parameter/callback, you may use this approach.
+
+Returning "true" will deselect the Column by default, returning "false" will select the Column by default
+
+```php
+Column::make('Address', 'address.address')
+ ->deselectedIf(fn() => 2 > 1),
+```
+
+or
+
+```php
+Column::make('Address', 'address.address')
+ ->deselectedIf(!Auth::user()),
+```
+
+## SelectedIf
+
+If you would like a column to be included in the column select and selected based on an external parameter/callback, you may use this approach.
+
+Returning "true" will select the Column by default, returning "false" will deselect the Column by default
+
+```php
+Column::make('Address', 'address.address')
+ ->selectedIf(fn() => 2 > 1),
+```
+or
+
+```php
+Column::make('Address', 'address.address')
+ ->selectedIf(Auth::user()),
+```
+
## Available Methods
### setColumnSelectStatus
diff --git a/docs/search/available-methods.md b/docs/search/available-methods.md
index e05ce7649..1d8397a5f 100644
--- a/docs/search/available-methods.md
+++ b/docs/search/available-methods.md
@@ -168,3 +168,27 @@ public function configure(): void
$this->setSearchThrottle(1000);
}
```
+
+## setTrimSearchStringEnabled
+
+A new behaviour, which will trim search strings of whitespace at either end
+
+```php
+public function configure(): void
+{
+ // Will trim whitespace from either end of search strings
+ $this->setTrimSearchStringEnabled();
+}
+```
+
+## setTrimSearchStringDisabled
+
+The default behaviour, does not trim search strings of whitespace.
+
+```php
+public function configure(): void
+{
+ // Will not trim whitespace from either end of search strings
+ $this->setTrimSearchStringDisabled();
+}
+```
diff --git a/resources/js/laravel-livewire-tables.js b/resources/js/laravel-livewire-tables.js
index 9df2c5ca0..7d48524d2 100644
--- a/resources/js/laravel-livewire-tables.js
+++ b/resources/js/laravel-livewire-tables.js
@@ -1,7 +1,7 @@
/*jshint esversion: 6 */
document.addEventListener('alpine:init', () => {
-
+
Alpine.data('laravellivewiretable', (wire, showBulkActionsAlpine, tableID, primaryKeyName) => ({
listeners: [],
childElementOpen: false,
@@ -103,13 +103,11 @@ document.addEventListener('alpine:init', () => {
},
reorderToggle() {
if (this.currentlyReorderingStatus) {
- console.log("Disable Reordering");
wire.disableReordering();
}
else {
if (this.hideReorderColumnUnlessReorderingStatus) {
this.reorderDisplayColumn = true;
- console.log("enableReordering");
}
this.setupEvenOddClasses();
wire.enableReordering();
@@ -120,7 +118,6 @@ document.addEventListener('alpine:init', () => {
if (this.hideReorderColumnUnlessReorderingStatus) {
this.reorderDisplayColumn = false;
}
- console.log("cancelReorder");
wire.disableReordering();
@@ -367,4 +364,217 @@ document.addEventListener('alpine:init', () => {
}));
+
+
+ Alpine.data('tableWrapper', (wire, showBulkActionsAlpine) => ({
+ listeners: [],
+ childElementOpen: false,
+ filtersOpen: wire.entangle('filterSlideDownDefaultVisible'),
+ paginationCurrentCount: wire.entangle('paginationCurrentCount'),
+ paginationTotalItemCount: wire.entangle('paginationTotalItemCount'),
+ paginationCurrentItems: wire.entangle('paginationCurrentItems'),
+ selectedItems: wire.entangle('selected'),
+ selectAllStatus: wire.entangle('selectAll'),
+ delaySelectAll: wire.entangle('delaySelectAll'),
+ hideBulkActionsWhenEmpty: wire.entangle('hideBulkActionsWhenEmpty'),
+ toggleSelectAll() {
+ if (!showBulkActionsAlpine) {
+ return;
+ }
+
+ if (this.paginationTotalItemCount === this.selectedItems.length) {
+ this.clearSelected();
+ this.selectAllStatus = false;
+ } else {
+ if (this.delaySelectAll)
+ {
+ this.setAllItemsSelected();
+ }
+ else
+ {
+ this.setAllSelected();
+ }
+ }
+ },
+ setAllItemsSelected() {
+ if (!showBulkActionsAlpine) {
+ return;
+ }
+ this.selectAllStatus = true;
+ this.selectAllOnPage();
+ },
+ setAllSelected() {
+ if (!showBulkActionsAlpine) {
+ return;
+ }
+ if (this.delaySelectAll)
+ {
+ this.selectAllStatus = true;
+ this.selectAllOnPage();
+ }
+ else
+ {
+ wire.setAllSelected();
+ }
+ },
+ clearSelected() {
+ if (!showBulkActionsAlpine) {
+ return;
+ }
+ this.selectAllStatus = false;
+ wire.clearSelected();
+ },
+ selectAllOnPage() {
+ if (!showBulkActionsAlpine) {
+ return;
+ }
+
+ let tempSelectedItems = this.selectedItems;
+ const iterator = this.paginationCurrentItems.values();
+ for (const value of iterator) {
+ tempSelectedItems.push(value.toString());
+ }
+ this.selectedItems = [...new Set(tempSelectedItems)];
+ },
+ destroy() {
+ this.listeners.forEach((listener) => {
+ listener();
+ });
+ }
+ }));
+
+ Alpine.data('reorderFunction', (wire, tableID, primaryKeyName) => ({
+ dragging: false,
+ reorderEnabled: false,
+ sourceID: '',
+ targetID: '',
+ evenRowClasses: '',
+ oddRowClasses: '',
+ currentlyHighlightedElement: '',
+ evenRowClassArray: {},
+ oddRowClassArray: {},
+ evenNotInOdd: {},
+ oddNotInEven: {},
+ orderedRows: [],
+ defaultReorderColumn: wire.get('defaultReorderColumn'),
+ reorderStatus: wire.get('reorderStatus'),
+ currentlyReorderingStatus: wire.entangle('currentlyReorderingStatus'),
+ hideReorderColumnUnlessReorderingStatus: wire.entangle('hideReorderColumnUnlessReorderingStatus'),
+ reorderDisplayColumn: wire.entangle('reorderDisplayColumn'),
+ dragStart(event) {
+ this.$nextTick(() => { this.setupEvenOddClasses() });
+ this.sourceID = event.target.id;
+ event.dataTransfer.effectAllowed = 'move';
+ event.dataTransfer.setData('text/plain', event.target.id);
+ event.target.classList.add("laravel-livewire-tables-dragging");
+ },
+ dragOverEvent(event) {
+ if (typeof this.currentlyHighlightedElement == 'object') {
+ this.currentlyHighlightedElement.classList.remove('laravel-livewire-tables-highlight-bottom', 'laravel-livewire-tables-highlight-top');
+ }
+ let target = event.target.closest('tr');
+ this.currentlyHighlightedElement = target;
+
+ if (event.offsetY < (target.getBoundingClientRect().height / 2)) {
+ target.classList.add('laravel-livewire-tables-highlight-top');
+ target.classList.remove('laravel-livewire-tables-highlight-bottom');
+ }
+ else {
+ target.classList.remove('laravel-livewire-tables-highlight-top');
+ target.classList.add('laravel-livewire-tables-highlight-bottom');
+ }
+ },
+ dragLeaveEvent(event) {
+ event.target.closest('tr').classList.remove('laravel-livewire-tables-highlight-bottom', 'laravel-livewire-tables-highlight-top');
+ },
+ dropEvent(event) {
+ if (typeof this.currentlyHighlightedElement == 'object') {
+ this.currentlyHighlightedElement.classList.remove('laravel-livewire-tables-highlight-bottom', 'laravel-livewire-tables-highlight-top');
+ }
+
+ let target = event.target.closest('tr');
+ let parent = event.target.closest('tr').parentNode;
+ let element = document.getElementById(this.sourceID).closest('tr');
+ element.classList.remove("laravel-livewire-table-dragging");
+ let originalPosition = element.rowIndex;
+ let newPosition = target.rowIndex;
+ let table = document.getElementById(tableID);
+ let loopStart = originalPosition;
+ if (event.offsetY > (target.getBoundingClientRect().height / 2)) {
+ parent.insertBefore(element, target.nextSibling);
+ }
+ else {
+ parent.insertBefore(element, target);
+ }
+ if (newPosition < originalPosition) {
+ loopStart = newPosition;
+ }
+ let nextLoop = 'even';
+ for (let i = 1, row; row = table.rows[i]; i++) {
+ if (!row.classList.contains('hidden') && !row.classList.contains('md:hidden') ) {
+ if (nextLoop === 'even') {
+ row.classList.remove(...this.oddNotInEven);
+ row.classList.add(...this.evenNotInOdd);
+ nextLoop = 'odd';
+ }
+ else {
+ row.classList.remove(...this.evenNotInOdd);
+ row.classList.add(...this.oddNotInEven);
+ nextLoop = 'even';
+ }
+ }
+ }
+ },
+ reorderToggle() {
+ this.$nextTick(() => { this.setupEvenOddClasses() });
+ if (this.currentlyReorderingStatus) {
+ wire.disableReordering();
+
+ }
+ else {
+ this.setupEvenOddClasses();
+ if (this.hideReorderColumnUnlessReorderingStatus) {
+ this.reorderDisplayColumn = true;
+ }
+ wire.enableReordering();
+
+ }
+ },
+ cancelReorder() {
+ if (this.hideReorderColumnUnlessReorderingStatus) {
+ this.reorderDisplayColumn = false;
+ }
+ wire.disableReordering();
+
+ },
+ updateOrderedItems() {
+ let table = document.getElementById(tableID);
+ let orderedRows = [];
+ for (let i = 1, row; row = table.rows[i]; i++) {
+ orderedRows.push({ [primaryKeyName]: row.getAttribute('rowpk'), [this.defaultReorderColumn]: i });
+ }
+ wire.storeReorder(orderedRows);
+ },
+ setupEvenOddClasses() {
+ if (this.evenNotInOdd.length === undefined || this.evenNotInOdd.length == 0 || this.oddNotInEven.length === undefined || this.oddNotInEven.length == 0)
+ {
+ let tbody = document.getElementById(tableID).getElementsByTagName('tbody')[0];
+ let evenRowClassArray = [];
+ let oddRowClassArray = [];
+
+ if (tbody.rows[0] !== undefined && tbody.rows[1] !== undefined) {
+ evenRowClassArray = Array.from(tbody.rows[0].classList);
+ oddRowClassArray = Array.from(tbody.rows[1].classList);
+ this.evenNotInOdd = evenRowClassArray.filter(element => !oddRowClassArray.includes(element));
+ this.oddNotInEven = oddRowClassArray.filter(element => !evenRowClassArray.includes(element));
+
+ evenRowClassArray = []
+ oddRowClassArray = []
+ }
+ }
+ },
+ init() {
+ }
+ }));
+
});
\ No newline at end of file
diff --git a/resources/js/laravel-livewire-tables.min.js b/resources/js/laravel-livewire-tables.min.js
index 99394f483..f9b60100f 100644
--- a/resources/js/laravel-livewire-tables.min.js
+++ b/resources/js/laravel-livewire-tables.min.js
@@ -1 +1 @@
-document.addEventListener("alpine:init",()=>{Alpine.data("laravellivewiretable",(e,t,i,l)=>({listeners:[],childElementOpen:!1,filtersOpen:e.entangle("filterSlideDownDefaultVisible"),paginationCurrentCount:e.entangle("paginationCurrentCount"),paginationTotalItemCount:e.entangle("paginationTotalItemCount"),paginationCurrentItems:e.entangle("paginationCurrentItems"),selectedItems:e.entangle("selected"),selectAllStatus:e.entangle("selectAll"),delaySelectAll:e.entangle("delaySelectAll"),hideBulkActionsWhenEmpty:e.entangle("hideBulkActionsWhenEmpty"),dragging:!1,reorderEnabled:!1,sourceID:"",targetID:"",evenRowClasses:"",oddRowClasses:"",currentlyHighlightedElement:"",evenRowClassArray:{},oddRowClassArray:{},evenNotInOdd:{},oddNotInEven:{},orderedRows:[],defaultReorderColumn:e.get("defaultReorderColumn"),reorderStatus:e.entangle("reorderStatus"),currentlyReorderingStatus:e.entangle("currentlyReorderingStatus"),hideReorderColumnUnlessReorderingStatus:e.entangle("hideReorderColumnUnlessReorderingStatus"),reorderDisplayColumn:e.entangle("reorderDisplayColumn"),dragStart(e){this.$nextTick(()=>{this.setupEvenOddClasses()}),this.sourceID=e.target.id,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",e.target.id),e.target.classList.add("laravel-livewire-tables-dragging")},dragOverEvent(e){"object"==typeof this.currentlyHighlightedElement&&this.currentlyHighlightedElement.classList.remove("laravel-livewire-tables-highlight-bottom","laravel-livewire-tables-highlight-top");let t=e.target.closest("tr");this.currentlyHighlightedElement=t,e.offsetY
t.getBoundingClientRect().height/2?l.insertBefore(s,t.nextSibling):l.insertBefore(s,t),r{this.setupEvenOddClasses()})},cancelReorder(){this.hideReorderColumnUnlessReorderingStatus&&(this.reorderDisplayColumn=!1),console.log("cancelReorder"),e.disableReordering()},updateOrderedItems(){let t=document.getElementById(i),s=[];for(let a=1,r;r=t.rows[a];a++)s.push({[l]:r.getAttribute("rowpk"),[this.defaultReorderColumn]:a});e.storeReorder(s)},setupEvenOddClasses(){if(void 0===this.evenNotInOdd.length||0==this.evenNotInOdd.length||void 0===this.oddNotInEven.length||0==this.oddNotInEven.length){let e=document.getElementById(i).getElementsByTagName("tbody")[0],t=[],l=[];void 0!==e.rows[0]&&void 0!==e.rows[1]&&(t=Array.from(e.rows[0].classList),l=Array.from(e.rows[1].classList),this.evenNotInOdd=t.filter(e=>!l.includes(e)),this.oddNotInEven=l.filter(e=>!t.includes(e)),t=[],l=[])}},toggleSelectAll(){t&&(this.paginationTotalItemCount===this.selectedItems.length?(this.clearSelected(),this.selectAllStatus=!1):this.delaySelectAll?this.setAllItemsSelected():this.setAllSelected())},setAllItemsSelected(){t&&(this.selectAllStatus=!0,this.selectAllOnPage())},setAllSelected(){t&&(this.delaySelectAll?(this.selectAllStatus=!0,this.selectAllOnPage()):e.setAllSelected())},clearSelected(){t&&(this.selectAllStatus=!1,e.clearSelected())},selectAllOnPage(){if(!t)return;let e=this.selectedItems,i=this.paginationCurrentItems.values();for(let l of i)e.push(l.toString());this.selectedItems=[...new Set(e)]},destroy(){this.listeners.forEach(e=>{e()})}})),Alpine.data("booleanFilter",(e,t,i,l)=>({switchOn:!1,value:e.entangle("filterComponents."+t).live,init(){this.switchOn=!1,void 0!==this.value&&(this.switchOn=Boolean(Number(this.value))),this.listeners.push(Livewire.on("filter-was-set",e=>{e.tableName==i&&e.filterKey==t&&(this.switchOn=e.value??l)}))}})),Alpine.data("numberRangeFilter",(e,t,i,l,s)=>({allFilters:e.entangle("filterComponents",!1),originalMin:0,originalMax:100,filterMin:0,filterMax:100,currentMin:0,currentMax:100,hasUpdate:!1,wireValues:e.entangle("filterComponents."+t,!1),defaultMin:l.minRange,defaultMax:l.maxRange,restrictUpdates:!1,initialiseStyles(){let e=document.getElementById(i);e.style.setProperty("--value-a",this.wireValues.min??this.filterMin),e.style.setProperty("--text-value-a",JSON.stringify(this.wireValues.min??this.filterMin)),e.style.setProperty("--value-b",this.wireValues.max??this.filterMax),e.style.setProperty("--text-value-b",JSON.stringify(this.wireValues.max??this.filterMax))},updateStyles(e,t){let l=document.getElementById(i);l.style.setProperty("--value-a",e),l.style.setProperty("--text-value-a",JSON.stringify(e)),l.style.setProperty("--value-b",t),l.style.setProperty("--text-value-b",JSON.stringify(t))},setupWire(){void 0!==this.wireValues?(this.filterMin=this.originalMin=void 0!==this.wireValues.min?this.wireValues.min:this.defaultMin,this.filterMax=this.originalMax=void 0!==this.wireValues.max?this.wireValues.max:this.defaultMax):(this.filterMin=this.originalMin=this.defaultMin,this.filterMax=this.originalMax=this.defaultMax),this.updateStyles(this.filterMin,this.filterMax)},allowUpdates(){this.updateWire()},updateWire(){let e=parseInt(this.filterMin),t=parseInt(this.filterMax);(e!=this.originalMin||t!=this.originalMax)&&(tthis.setupWire())}})),Alpine.data("flatpickrFilter",(e,t,i,l,s)=>({wireValues:e.entangle("filterComponents."+t),flatpickrInstance:flatpickr(l,{mode:"range",altFormat:i.altFormat??"F j, Y",altInput:i.altInput??!1,allowInput:i.allowInput??!1,allowInvalidPreload:!0,ariaDateFormat:i.ariaDateFormat??"F j, Y",clickOpens:!0,dateFormat:i.dateFormat??"Y-m-d",defaultDate:i.defaultDate??null,defaultHour:i.defaultHour??12,defaultMinute:i.defaultMinute??0,enableTime:i.enableTime??!1,enableSeconds:i.enableSeconds??!1,hourIncrement:i.hourIncrement??1,locale:i.locale??"en",minDate:i.earliestDate??null,maxDate:i.latestDate??null,minuteIncrement:i.minuteIncrement??5,shorthandCurrentMonth:i.shorthandCurrentMonth??!1,time_24hr:i.time_24hr??!1,weekNumbers:i.weekNumbers??!1,onOpen:function(){window.childElementOpen=!0},onChange:function(i,l,s){if(i.length>1){var a=l.split(" ")[0],r=l.split(" ")[2],n={};window.childElementOpen=!1,window.filterPopoverOpen=!1,n={minDate:a,maxDate:r},e.set("filterComponents."+t,n)}}}),setupWire(){if(void 0!==this.wireValues){if(void 0!==this.wireValues.minDate&&void 0!==this.wireValues.maxDate){let e=[this.wireValues.minDate,this.wireValues.maxDate];this.flatpickrInstance.setDate(e)}else this.flatpickrInstance.setDate([])}else this.flatpickrInstance.setDate([])},init(){this.setupWire(),this.$watch("wireValues",e=>this.setupWire())}}))});
+document.addEventListener('alpine:init',()=>{Alpine.data('laravellivewiretable',(wire,showBulkActionsAlpine,tableID,primaryKeyName)=>({listeners:[],childElementOpen:!1,filtersOpen:wire.entangle('filterSlideDownDefaultVisible'),paginationCurrentCount:wire.entangle('paginationCurrentCount'),paginationTotalItemCount:wire.entangle('paginationTotalItemCount'),paginationCurrentItems:wire.entangle('paginationCurrentItems'),selectedItems:wire.entangle('selected'),selectAllStatus:wire.entangle('selectAll'),delaySelectAll:wire.entangle('delaySelectAll'),hideBulkActionsWhenEmpty:wire.entangle('hideBulkActionsWhenEmpty'),dragging:!1,reorderEnabled:!1,sourceID:'',targetID:'',evenRowClasses:'',oddRowClasses:'',currentlyHighlightedElement:'',evenRowClassArray:{},oddRowClassArray:{},evenNotInOdd:{},oddNotInEven:{},orderedRows:[],defaultReorderColumn:wire.get('defaultReorderColumn'),reorderStatus:wire.entangle('reorderStatus'),currentlyReorderingStatus:wire.entangle('currentlyReorderingStatus'),hideReorderColumnUnlessReorderingStatus:wire.entangle('hideReorderColumnUnlessReorderingStatus'),reorderDisplayColumn:wire.entangle('reorderDisplayColumn'),dragStart(a){this.$nextTick(()=>this.setupEvenOddClasses());this.sourceID=a.target.id;a.dataTransfer.effectAllowed='move';a.dataTransfer.setData('text/plain',a.target.id);a.target.classList.add('laravel-livewire-tables-dragging')},dragOverEvent(A){typeof this.currentlyHighlightedElement=='object'&&this.currentlyHighlightedElement.classList.remove('laravel-livewire-tables-highlight-bottom','laravel-livewire-tables-highlight-top');let b=A.target.closest('tr');this.currentlyHighlightedElement=b;A.offsetY<(b.getBoundingClientRect().height/2)?(b.classList.add('laravel-livewire-tables-highlight-top'),b.classList.remove('laravel-livewire-tables-highlight-bottom')):(b.classList.remove('laravel-livewire-tables-highlight-top'),b.classList.add('laravel-livewire-tables-highlight-bottom'))},dragLeaveEvent(_){_.target.closest('tr').classList.remove('laravel-livewire-tables-highlight-bottom','laravel-livewire-tables-highlight-top')},dropEvent(B){typeof this.currentlyHighlightedElement=='object'&&this.currentlyHighlightedElement.classList.remove('laravel-livewire-tables-highlight-bottom','laravel-livewire-tables-highlight-top');let c=B.target.closest('tr');let C=B.target.closest('tr').parentNode;let d=document.getElementById(this.sourceID).closest('tr');d.classList.remove('laravel-livewire-table-dragging');let e=d.rowIndex;let f=c.rowIndex;let g=document.getElementById(tableID);B.offsetY>(c.getBoundingClientRect().height/2)?C.insertBefore(d,c.nextSibling):C.insertBefore(d,c);fthis.setupEvenOddClasses())},cancelReorder(){this.hideReorderColumnUnlessReorderingStatus&&(this.reorderDisplayColumn=!1);wire.disableReordering()},updateOrderedItems(){let _a=document.getElementById(tableID);let D=[];for(let i=1,_B;_B=_a.rows[i];i++)D.push({[primaryKeyName]:_B.getAttribute('rowpk'),[this.defaultReorderColumn]:i});wire.storeReorder(D)},setupEvenOddClasses(){if(this.evenNotInOdd.length===void 0||this.evenNotInOdd.length==0||this.oddNotInEven.length===void 0||this.oddNotInEven.length==0){let _A=document.getElementById(tableID).getElementsByTagName('tbody')[0];let E=[];let _c=[];(_A.rows[0]!==void 0&&_A.rows[1]!==void 0)&&(E=[..._A.rows[0].classList],_c=[..._A.rows[1].classList],this.evenNotInOdd=E.filter(aA=>!_c.includes(aA)),this.oddNotInEven=_c.filter(aB=>!E.includes(aB)),E=[],_c=[])}},toggleSelectAll(){if(!showBulkActionsAlpine)return;if(this.paginationTotalItemCount===this.selectedItems.length){this.clearSelected();this.selectAllStatus=!1}else this.delaySelectAll?this.setAllItemsSelected():this.setAllSelected()},setAllItemsSelected(){if(!showBulkActionsAlpine)return;this.selectAllStatus=!0;this.selectAllOnPage()},setAllSelected(){if(!showBulkActionsAlpine)return;this.delaySelectAll?(this.selectAllStatus=!0,this.selectAllOnPage()):(wire.setAllSelected())},clearSelected(){if(!showBulkActionsAlpine)return;this.selectAllStatus=!1;wire.clearSelected()},selectAllOnPage(){if(!showBulkActionsAlpine)return;let aC=this.selectedItems;var aD=this.paginationCurrentItems.values();for(const aE of aD)aC.push(`${aE}`);this.selectedItems=[...new Set(aC)]},destroy(){for(const aF of this.listeners)aF()}}));Alpine.data('booleanFilter',(aG,aH,_C,_d)=>({switchOn:!1,value:aG.entangle(`filterComponents.${aH}`).live,init(){this.switchOn=!1;this.value!==void 0&&(this.switchOn=!!+this.value);this.listeners.push(Livewire.on('filter-was-set',aI=>{(aI.tableName==_C&&aI.filterKey==aH)&&(this.switchOn=aI.value??_d)}))}}));Alpine.data('numberRangeFilter',(aJ,aK,aL,_D,_e)=>({allFilters:aJ.entangle('filterComponents',!1),originalMin:0,originalMax:100,filterMin:0,filterMax:100,currentMin:0,currentMax:100,hasUpdate:!1,wireValues:aJ.entangle(`filterComponents.${aK}`,!1),defaultMin:_D['minRange'],defaultMax:_D['maxRange'],restrictUpdates:!1,initialiseStyles(){let aM=document.getElementById(aL);aM.style.setProperty('--value-a',this.wireValues['min']??this.filterMin);aM.style.setProperty('--text-value-a',JSON.stringify(this.wireValues['min']??this.filterMin));aM.style.setProperty('--value-b',this.wireValues['max']??this.filterMax);aM.style.setProperty('--text-value-b',JSON.stringify(this.wireValues['max']??this.filterMax))},updateStyles(aN,aO){let aP=document.getElementById(aL);aP.style.setProperty('--value-a',aN);aP.style.setProperty('--text-value-a',JSON.stringify(aN));aP.style.setProperty('--value-b',aO);aP.style.setProperty('--text-value-b',JSON.stringify(aO))},setupWire(){this.wireValues!==void 0?(this.filterMin=this.originalMin=(this.wireValues['min']!==void 0)?this.wireValues['min']:this.defaultMin,this.filterMax=this.originalMax=(this.wireValues['max']!==void 0)?this.wireValues['max']:this.defaultMax):(this.filterMin=this.originalMin=this.defaultMin,this.filterMax=this.originalMax=this.defaultMax);this.updateStyles(this.filterMin,this.filterMax)},allowUpdates(){this.updateWire()},updateWire(){let aQ=parseInt(this.filterMin);let aR=parseInt(this.filterMax);if(aQ!=this.originalMin||aR!=this.originalMax){aRthis.setupWire())}}));Alpine.data('flatpickrFilter',(aS,aT,aU,aV,_E)=>({wireValues:aS.entangle(`filterComponents.${aT}`),flatpickrInstance:flatpickr(aV,{mode:'range',altFormat:aU['altFormat']??'F j, Y',altInput:aU['altInput']??!1,allowInput:aU['allowInput']??!1,allowInvalidPreload:!0,ariaDateFormat:aU['ariaDateFormat']??'F j, Y',clickOpens:!0,dateFormat:aU['dateFormat']??'Y-m-d',defaultDate:aU['defaultDate']??null,defaultHour:aU['defaultHour']??12,defaultMinute:aU['defaultMinute']??0,enableTime:aU['enableTime']??!1,enableSeconds:aU['enableSeconds']??!1,hourIncrement:aU['hourIncrement']??1,locale:aU['locale']??'en',minDate:aU['earliestDate']??null,maxDate:aU['latestDate']??null,minuteIncrement:aU['minuteIncrement']??5,shorthandCurrentMonth:aU['shorthandCurrentMonth']??!1,time_24hr:aU['time_24hr']??!1,weekNumbers:aU['weekNumbers']??!1,onOpen:function(){window.childElementOpen=!0},onChange:function(aW,aX,aY){if(aW.length>1){var aZ=aX.split(' ')[0],bA=aX.split(' ')[2],F={};window.childElementOpen=window.filterPopoverOpen=!1;F={'minDate':aZ,'maxDate':bA};aS.set(`filterComponents.${aT}`,F)}}}),setupWire(){if(this.wireValues!==void 0)if(this.wireValues.minDate!==void 0&&this.wireValues.maxDate!==void 0){this.flatpickrInstance.setDate([this.wireValues.minDate,this.wireValues.maxDate])}else this.flatpickrInstance.setDate([]);else this.flatpickrInstance.setDate([])},init(){this.setupWire();this.$watch('wireValues',value=>this.setupWire())}}));Alpine.data('tableWrapper',(wire,showBulkActionsAlpine)=>({listeners:[],childElementOpen:!1,filtersOpen:wire.entangle('filterSlideDownDefaultVisible'),paginationCurrentCount:wire.entangle('paginationCurrentCount'),paginationTotalItemCount:wire.entangle('paginationTotalItemCount'),paginationCurrentItems:wire.entangle('paginationCurrentItems'),selectedItems:wire.entangle('selected'),selectAllStatus:wire.entangle('selectAll'),delaySelectAll:wire.entangle('delaySelectAll'),hideBulkActionsWhenEmpty:wire.entangle('hideBulkActionsWhenEmpty'),toggleSelectAll(){if(!showBulkActionsAlpine)return;if(this.paginationTotalItemCount===this.selectedItems.length){this.clearSelected();this.selectAllStatus=!1}else this.delaySelectAll?this.setAllItemsSelected():this.setAllSelected()},setAllItemsSelected(){if(!showBulkActionsAlpine)return;this.selectAllStatus=!0;this.selectAllOnPage()},setAllSelected(){if(!showBulkActionsAlpine)return;this.delaySelectAll?(this.selectAllStatus=!0,this.selectAllOnPage()):(wire.setAllSelected())},clearSelected(){if(!showBulkActionsAlpine)return;this.selectAllStatus=!1;wire.clearSelected()},selectAllOnPage(){if(!showBulkActionsAlpine)return;let bB=this.selectedItems;var bC=this.paginationCurrentItems.values();for(const bD of bC)bB.push(`${bD}`);this.selectedItems=[...new Set(bB)]},destroy(){for(const bE of this.listeners)bE()}}));Alpine.data('reorderFunction',(wire,tableID,primaryKeyName)=>({dragging:!1,reorderEnabled:!1,sourceID:'',targetID:'',evenRowClasses:'',oddRowClasses:'',currentlyHighlightedElement:'',evenRowClassArray:{},oddRowClassArray:{},evenNotInOdd:{},oddNotInEven:{},orderedRows:[],defaultReorderColumn:wire.get('defaultReorderColumn'),reorderStatus:wire.get('reorderStatus'),currentlyReorderingStatus:wire.entangle('currentlyReorderingStatus'),hideReorderColumnUnlessReorderingStatus:wire.entangle('hideReorderColumnUnlessReorderingStatus'),reorderDisplayColumn:wire.entangle('reorderDisplayColumn'),dragStart(bF){this.$nextTick(()=>this.setupEvenOddClasses());this.sourceID=bF.target.id;bF.dataTransfer.effectAllowed='move';bF.dataTransfer.setData('text/plain',bF.target.id);bF.target.classList.add('laravel-livewire-tables-dragging')},dragOverEvent(bG){typeof this.currentlyHighlightedElement=='object'&&this.currentlyHighlightedElement.classList.remove('laravel-livewire-tables-highlight-bottom','laravel-livewire-tables-highlight-top');let bH=bG.target.closest('tr');this.currentlyHighlightedElement=bH;bG.offsetY<(bH.getBoundingClientRect().height/2)?(bH.classList.add('laravel-livewire-tables-highlight-top'),bH.classList.remove('laravel-livewire-tables-highlight-bottom')):(bH.classList.remove('laravel-livewire-tables-highlight-top'),bH.classList.add('laravel-livewire-tables-highlight-bottom'))},dragLeaveEvent(bI){bI.target.closest('tr').classList.remove('laravel-livewire-tables-highlight-bottom','laravel-livewire-tables-highlight-top')},dropEvent(bJ){typeof this.currentlyHighlightedElement=='object'&&this.currentlyHighlightedElement.classList.remove('laravel-livewire-tables-highlight-bottom','laravel-livewire-tables-highlight-top');let bK=bJ.target.closest('tr');let bL=bJ.target.closest('tr').parentNode;let bM=document.getElementById(this.sourceID).closest('tr');bM.classList.remove('laravel-livewire-table-dragging');let bN=bM.rowIndex;let _f=bK.rowIndex;let G=document.getElementById(tableID);bJ.offsetY>(bK.getBoundingClientRect().height/2)?bL.insertBefore(bM,bK.nextSibling):bL.insertBefore(bM,bK);_fthis.setupEvenOddClasses());if(this.currentlyReorderingStatus)wire.disableReordering();else{this.setupEvenOddClasses();this.hideReorderColumnUnlessReorderingStatus&&(this.reorderDisplayColumn=!0);wire.enableReordering()}},cancelReorder(){this.hideReorderColumnUnlessReorderingStatus&&(this.reorderDisplayColumn=!1);wire.disableReordering()},updateOrderedItems(){let bP=document.getElementById(tableID);let bQ=[];for(let i=1,bR;bR=bP.rows[i];i++)bQ.push({[primaryKeyName]:bR.getAttribute('rowpk'),[this.defaultReorderColumn]:i});wire.storeReorder(bQ)},setupEvenOddClasses(){if(this.evenNotInOdd.length===void 0||this.evenNotInOdd.length==0||this.oddNotInEven.length===void 0||this.oddNotInEven.length==0){let bS=document.getElementById(tableID).getElementsByTagName('tbody')[0];let bT=[];let bU=[];(bS.rows[0]!==void 0&&bS.rows[1]!==void 0)&&(bT=[...bS.rows[0].classList],bU=[...bS.rows[1].classList],this.evenNotInOdd=bT.filter(bV=>!bU.includes(bV)),this.oddNotInEven=bU.filter(bW=>!bT.includes(bW)),bT=[],bU=[])}},init(){}}))});
diff --git a/resources/views/components/includes/loading.blade.php b/resources/views/components/includes/loading.blade.php
index 7c71772ed..b60d41016 100644
--- a/resources/views/components/includes/loading.blade.php
+++ b/resources/views/components/includes/loading.blade.php
@@ -2,8 +2,8 @@
@props(['colCount' => 1])
@php
-$customAttributes['loader-wrapper'] = $component->getLoadingPlaceHolderWrapperAttributes();
-$customAttributes['loader-icon'] = $component->getLoadingPlaceHolderIconAttributes();
+$customAttributes['loader-wrapper'] = $this->getLoadingPlaceHolderWrapperAttributes();
+$customAttributes['loader-icon'] = $this->getLoadingPlaceHolderIconAttributes();
@endphp
@if($this->hasLoadingPlaceholderBlade())
@include($this->getLoadingPlaceHolderBlade(), ['colCount' => $colCount])
@@ -27,7 +27,7 @@
->except('default');
}}
>