@if($this->shouldShowRowsSelector())
|
@@ -87,7 +87,7 @@
-
+
diff --git a/resources/views/tailwind_3_prefixed/components/actions.blade.php b/resources/views/tailwind_3_prefixed/components/actions.blade.php
deleted file mode 100644
index 38aa15c..0000000
--- a/resources/views/tailwind_3_prefixed/components/actions.blade.php
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-@if($this->shouldShowActionsSelector())
- @php($visibleActions = collect($this->actions)->filter(fn(DefStudio\WiredTables\Elements\Action $action) => $action->isVisible()))
- @if($this->config(\DefStudio\WiredTables\Enums\Config::group_actions))
-
- class('tw-relative')}} wire:key="wt-{{$this->id}}-actions-wrapper" x-data="{show_actions: false}">
-
-
- @foreach($visibleActions->chunk($this->config(\DefStudio\WiredTables\Enums\Config::actions_columns, $visibleActions->count() > 3 ? 3 : 1)) as $action_group)
-
- @foreach($action_group as $index => $action)
-
-
-
-
- @endforeach
-
- @endforeach
-
-
-
- @else
- class('tw-flex')}} wire:key="wt-{{$this->id}}-actions-wrapper">
- @foreach($visibleActions as $index => $action)
-
-
-
-
- @endforeach
-
- @endif
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/body/content.blade.php b/resources/views/tailwind_3_prefixed/components/body/content.blade.php
deleted file mode 100644
index a076ee5..0000000
--- a/resources/views/tailwind_3_prefixed/components/body/content.blade.php
+++ /dev/null
@@ -1,14 +0,0 @@
-@props(['column'])
-
-@if($column->get(\DefStudio\WiredTables\Enums\Config::clamp))
-
-
- {{$slot}}
-
-
- {{$slot}}
-
-
-@else
- {{$slot}}
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/body/index.blade.php b/resources/views/tailwind_3_prefixed/components/body/index.blade.php
deleted file mode 100644
index 9d5a357..0000000
--- a/resources/views/tailwind_3_prefixed/components/body/index.blade.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
class(['tw-divide-y tw-divide-gray-200' => $this->config(\DefStudio\WiredTables\Enums\Config::enable_row_dividers)])}}>
-{{$slot}}
-
diff --git a/resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php b/resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php
deleted file mode 100644
index d93d29f..0000000
--- a/resources/views/tailwind_3_prefixed/components/body/rows-selector.blade.php
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-@props(['model'])
-
-@if($this->shouldShowRowsSelector())
- class(['tw-pl-6 tw-py-3 tw-text-left'])}}
- >
-
- |
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/body/td.blade.php b/resources/views/tailwind_3_prefixed/components/body/td.blade.php
deleted file mode 100644
index bdea00a..0000000
--- a/resources/views/tailwind_3_prefixed/components/body/td.blade.php
+++ /dev/null
@@ -1,68 +0,0 @@
-render();
-
-$attributes = $attributes->merge([
- 'wire:key' => "wt-$this->id-row-{$this->getRowId($model)}-cell",
- 'style' => ($width = $column->get(\DefStudio\WiredTables\Enums\Config::limit)) ? "max-width: {$width}px;" : '',
-])->class([
- "tw-px-4 tw-py-2" => $this->config(\DefStudio\WiredTables\Enums\Config::compact_table),
- "tw-px-6 tw-py-3" => !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table),
- "tw-whitespace-nowrap" => !$column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table) && !$column->get(\DefStudio\WiredTables\Enums\Config::limit),
- "tw-truncate" => $this->config(\DefStudio\WiredTables\Enums\Config::limit),
- "tw-font-medium",
- "tw-min-w-[15rem]" => $column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && \Illuminate\Support\Str::of($content->toHtml())->trim()->isNotEmpty(),
- $column->getTextClasses(),
-]) ;
-
-if ($emit = $column->getEmit()) {
- $emit = \Illuminate\Support\Arr::wrap($emit);
-
- $params = collect($emit)
- ->map(fn ($value) => is_array($value) ? json_encode($value) : "'$value'")
- ->join(',');
-
- $attributes = $attributes->merge([
- 'wire:click' => "\$emit($params)",
- 'class' => 'cursor-pointer',
- ]);
-}
-
-$clamp_width = $column->get(\DefStudio\WiredTables\Enums\Config::clamp);
-
-?>
-@props(['column', 'model'])
-
-
- @if($url = $column->getUrl())
- get(\DefStudio\WiredTables\Enums\Config::url_target)) ? "target='$url_target'": ''}}>
- {{$content}}
-
- @elseif($column->get(\DefStudio\WiredTables\Enums\Config::limit) && str($content->toHtml())->toString())
-
-
- {{$content}}
-
-
- {{$content}}
-
-
-
- @else
- {{$content}}
- @endif
- |
diff --git a/resources/views/tailwind_3_prefixed/components/body/tr.blade.php b/resources/views/tailwind_3_prefixed/components/body/tr.blade.php
deleted file mode 100644
index ddc0e38..0000000
--- a/resources/views/tailwind_3_prefixed/components/body/tr.blade.php
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-@props(['model'])
-
-class([
- 'tw-bg-white' => !$this->config(\DefStudio\WiredTables\Enums\Config::striped),
- 'odd:tw-bg-white even:tw-bg-gray-50' => $this->config(\DefStudio\WiredTables\Enums\Config::striped),
- 'hover:tw-bg-gray-200' => $this->config(\DefStudio\WiredTables\Enums\Config::hover),
- ])}}
->{{$slot}}
-
diff --git a/resources/views/tailwind_3_prefixed/components/debug.blade.php b/resources/views/tailwind_3_prefixed/components/debug.blade.php
deleted file mode 100644
index 6a0ed8f..0000000
--- a/resources/views/tailwind_3_prefixed/components/debug.blade.php
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-@if($this->config(\DefStudio\WiredTables\Enums\Config::debug))
- class("tw-my-3 tw-border tw-rounded-md tw-overflow-hidden")}} x-cloak>
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
@php($this->configuration()->dump())
-
@php($this->configuration()->header->dump())
-
@dump($this->sorting)
-
- @if($this->paginationEnabled())
- @dump(['page' => $this->page, 'page size' => $this->pageSize])
- @else
- @dump("Pagination disabled")
- @endif
-
-
- @if($this->shouldShowRowsSelector())
- @dump(['selected' => collect($this->selection)->keys()->toArray()])
- @else
- @dump("Row selection not needed")
- @endif
-
-
-
- @foreach($this->columns as $index => $column)
- -
-
-
- @endforeach
-
-
- @foreach($this->columns as $index => $column)
-
- {{$column->dump()}}
-
- @endforeach
-
-
-
-
- @foreach($this->actions as $index => $action)
- -
-
-
- @endforeach
-
-
- @foreach($this->actions as $index => $action)
-
- {{$action->dump()}}
-
- @endforeach
-
-
-
-
- @foreach($this->filters as $index => $filter)
- -
-
-
- @endforeach
-
-
- @foreach($this->filters as $index => $filter)
-
- {{$filter->dump()}}
-
- @endforeach
-
-
-
- {{ $this->debugQuery()}}
-
-
-
- @foreach($this->dumpLabels() as $label)
- -
-
-
- @endforeach
-
-
- @foreach($this->dumpLabels() as $label)
-
- @foreach($this->dumps()->where(fn(DefStudio\WiredTables\Elements\Dump $dump) => $dump->getLabel() === $label) as $dump)
- {{$dump->print()}}
- @endforeach
-
- @endforeach
-
-
-
-
-
-
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php b/resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php
deleted file mode 100644
index ed61784..0000000
--- a/resources/views/tailwind_3_prefixed/components/elements/checkbox.blade.php
+++ /dev/null
@@ -1,13 +0,0 @@
-class([
- "tw-rounded",
- "tw-border-gray-300",
- "tw-text-indigo-600",
- "tw-shadow-sm",
- "focus:tw-border-indigo-300",
- "focus:tw-ring focus:tw-ring-indigo-200",
- "focus:tw-ring-opacity-50",
- "tw-cursor-pointer",
- ])}}
-/>
diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php
deleted file mode 100644
index 5d9226b..0000000
--- a/resources/views/tailwind_3_prefixed/components/elements/filters/checkbox.blade.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-@props(['filter', 'label' => true])
-
-
- @if($label)
-
- @endif
-
-
-
-
diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php
deleted file mode 100644
index 981ffd6..0000000
--- a/resources/views/tailwind_3_prefixed/components/elements/filters/date.blade.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-@props(['filter', 'label' => true])
-
-
- @if($label)
-
- @endif
-
-
-
diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php
deleted file mode 100644
index 68f599c..0000000
--- a/resources/views/tailwind_3_prefixed/components/elements/filters/select.blade.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-@props(['filter', 'label' => true])
-
-
- @if($label)
-
- @endif
-
-
-
-
diff --git a/resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php b/resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php
deleted file mode 100644
index 13ff136..0000000
--- a/resources/views/tailwind_3_prefixed/components/elements/filters/text.blade.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-@props(['filter', 'label' => true])
-
-
- @if($label)
-
- @endif
-
-
-
diff --git a/resources/views/tailwind_3_prefixed/components/filters.blade.php b/resources/views/tailwind_3_prefixed/components/filters.blade.php
deleted file mode 100644
index 6bc00de..0000000
--- a/resources/views/tailwind_3_prefixed/components/filters.blade.php
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-@if($this->shouldShowFiltersSelector())
- @php($visibleFilters = $this->globalFilters()->filter(fn($filter) => $filter->isVisible()))
-
- @if($this->config(\DefStudio\WiredTables\Enums\Config::group_filters))
- class('tw-relative')}} wire:key="wt-{{$this->id}}-filters-wrapper" x-data="{show: false}">
-
-
-
- @foreach($visibleFilters->chunk($this->config(\DefStudio\WiredTables\Enums\Config::filters_columns, $visibleFilters->count() > 2 ? 2 : 1)) as $filter_group)
-
- @foreach($filter_group as $filter)
-
-
-
-
- @endforeach
-
- @endforeach
-
-
- @else
- class('tw-flex')}} wire:key="wt-{{$this->id}}-filters-wrapper">
- @foreach($visibleFilters as $filter)
-
- @endforeach
-
- @endif
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/footer/index.blade.php b/resources/views/tailwind_3_prefixed/components/footer/index.blade.php
deleted file mode 100644
index 3b13f7f..0000000
--- a/resources/views/tailwind_3_prefixed/components/footer/index.blade.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-class([
- "tw-bg-gray-50" => !$this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode),
- "tw-bg-gray-700" => $this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode),
-])}}>
- {{$slot}}
-
diff --git a/resources/views/tailwind_3_prefixed/components/footer/td.blade.php b/resources/views/tailwind_3_prefixed/components/footer/td.blade.php
deleted file mode 100644
index 6089b36..0000000
--- a/resources/views/tailwind_3_prefixed/components/footer/td.blade.php
+++ /dev/null
@@ -1,30 +0,0 @@
-class([
- "tw-px-4 tw-py-2" => $this->config(\DefStudio\WiredTables\Enums\Config::compact_table),
- "tw-px-6 tw-py-3" => !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table),
- "tw-whitespace-nowrap" => !$column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && !$this->config(\DefStudio\WiredTables\Enums\Config::compact_table) && !$column->get(\DefStudio\WiredTables\Enums\Config::limit),
- "tw-font-medium",
- "tw-min-w-[15rem]" => $column->get(\DefStudio\WiredTables\Enums\Config::wrapText) && \Illuminate\Support\Str::of($content->toHtml())->trim()->isNotEmpty(),
- $column->getTextClasses(),
-]);
-
-?>
-
-@props(['column', 'model'])
-
-
- {{$this->getColumnSum($column->name())}}
- |
-
diff --git a/resources/views/tailwind_3_prefixed/components/header/filters.blade.php b/resources/views/tailwind_3_prefixed/components/header/filters.blade.php
deleted file mode 100644
index 2423d32..0000000
--- a/resources/views/tailwind_3_prefixed/components/header/filters.blade.php
+++ /dev/null
@@ -1,29 +0,0 @@
-
-@if($this->shouldShowColumnFilters())
-
- @if($this->shouldShowRowsSelector())
- |
- @endif
- @foreach($this->columns as $column)
-
- @php($columnFilter = $this->getFilterByName($column->name()))
- @if($columnFilter && $columnFilter->isColumnFilter())
-
- @endif
- |
- @endforeach
-
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/header/index.blade.php b/resources/views/tailwind_3_prefixed/components/header/index.blade.php
deleted file mode 100644
index fd6a092..0000000
--- a/resources/views/tailwind_3_prefixed/components/header/index.blade.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-class([
- "tw-bg-gray-50" => !$this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode),
- "tw-bg-gray-700" => $this->headerConfig(\DefStudio\WiredTables\Enums\Config::dark_mode),
-])}}>
- {{$slot}}
-
diff --git a/resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php b/resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php
deleted file mode 100644
index e5da9d4..0000000
--- a/resources/views/tailwind_3_prefixed/components/header/rows-selector.blade.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-@if($this->shouldShowRowsSelector())
- class([
- "tw-px-6 tw-text-left tw-align-middle",
- "tw-py-3" => !$this->shouldShowColumnFilters(),
- "tw-pt-3" => $this->shouldShowColumnFilters(),
- ])}}
- >
- selectedIds()) || collect($this->getVisibleRowsIds())->reject(fn (int $id) => collect($this->selectedIds())->contains($id))->isNotEmpty()) {
- $this->allSelected = false;
- } else {
- $this->allSelected = true;
- }
- ?>
-
- |
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/header/th.blade.php b/resources/views/tailwind_3_prefixed/components/header/th.blade.php
deleted file mode 100644
index c6e6f2c..0000000
--- a/resources/views/tailwind_3_prefixed/components/header/th.blade.php
+++ /dev/null
@@ -1,78 +0,0 @@
-getTextClasses()}";
-?>
-
-@props(['column'])
-
-
-class([
- "tw-px-6 tw-relative",
- "tw-py-3" => !$this->shouldShowColumnFilters(),
- "tw-pt-3" => $this->shouldShowColumnFilters(),
- ])}}>
- @if($column->isSortable())
-
- @else
-
- {{$column->name()}}
-
- @endif
- |
-
diff --git a/resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php b/resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php
deleted file mode 100644
index 2522cf7..0000000
--- a/resources/views/tailwind_3_prefixed/components/page-size-selector.blade.php
+++ /dev/null
@@ -1,18 +0,0 @@
-config(\DefStudio\WiredTables\Enums\Config::available_page_sizes);
-
-?>
-
-@if($availablePageSize && count($availablePageSize)>1)
-
-@endif
-
diff --git a/resources/views/tailwind_3_prefixed/components/pagination.blade.php b/resources/views/tailwind_3_prefixed/components/pagination.blade.php
deleted file mode 100644
index ba5eaba..0000000
--- a/resources/views/tailwind_3_prefixed/components/pagination.blade.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-@if($this->paginationEnabled())
- class("sm:tw-flex tw-items-center tw-p-3 tw-pt-0")}}>
-
- @if($this->pageSize !== 'all')
-
- {{$this->rows->links('wired-tables::livewire-pagination')}}
-
- @endif
-
-
-
-
-
-
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/search.blade.php b/resources/views/tailwind_3_prefixed/components/search.blade.php
deleted file mode 100644
index 2f059dd..0000000
--- a/resources/views/tailwind_3_prefixed/components/search.blade.php
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-@if($this->isSearchable())
-
-@endif
diff --git a/resources/views/tailwind_3_prefixed/components/table.blade.php b/resources/views/tailwind_3_prefixed/components/table.blade.php
deleted file mode 100644
index 691a906..0000000
--- a/resources/views/tailwind_3_prefixed/components/table.blade.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-class([
- "tw-min-w-full",
- 'tw-divide-y tw-divide-gray-200' => $this->config(\DefStudio\WiredTables\Enums\Config::enable_row_dividers)
-])}}>
- {{$header}}
-
- {{$slot}}
-
diff --git a/resources/views/tailwind_3_prefixed/components/top.blade.php b/resources/views/tailwind_3_prefixed/components/top.blade.php
deleted file mode 100644
index 4f5b3d9..0000000
--- a/resources/views/tailwind_3_prefixed/components/top.blade.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
- @if($this->activeFilters()->isNotEmpty())
-
-
Filters:
- @foreach($this->activeFilters() as $filter)
-
- {{$filter->name()}}: {{$filter->formattedValue()}}
-
-
-
- @endforeach
-
- @endif
-
- @if(!empty($this->sorting))
-
-
Sort:
- @foreach($this->sorting as $columnName => $dir)
-
- {{$columnName}}: {{$dir}}
-
-
-
- @endforeach
-
- @endif
-
-
-
- @if($this->config(\DefStudio\WiredTables\Enums\Config::is_searchable, true))
-
- @endif
-
-
-
-
-
-
-
-
-
-
diff --git a/resources/views/tailwind_3_prefixed/components/wrapper.blade.php b/resources/views/tailwind_3_prefixed/components/wrapper.blade.php
deleted file mode 100644
index 76e49dd..0000000
--- a/resources/views/tailwind_3_prefixed/components/wrapper.blade.php
+++ /dev/null
@@ -1,7 +0,0 @@
-class([
- "tw-min-h-[300px]",
- "tw-flex tw-flex-col sm:tw-rounded-lg",
- "tw-shadow-[0_0_15px_-2px_rgba(0,0,0,0.1)]" => $this->config(\DefStudio\WiredTables\Enums\Config::wrapper_shadow)
-])}}>
- {{$slot}}
-
diff --git a/resources/views/tailwind_3_prefixed/dummy.blade.php b/resources/views/tailwind_3_prefixed/dummy.blade.php
deleted file mode 100644
index b6056fe..0000000
--- a/resources/views/tailwind_3_prefixed/dummy.blade.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
diff --git a/resources/views/tailwind_3_prefixed/livewire-pagination.blade.php b/resources/views/tailwind_3_prefixed/livewire-pagination.blade.php
deleted file mode 100644
index d03550c..0000000
--- a/resources/views/tailwind_3_prefixed/livewire-pagination.blade.php
+++ /dev/null
@@ -1,116 +0,0 @@
-
- @if ($paginator->hasPages())
- @php(isset($this->numberOfPaginatorsRendered[$paginator->getPageName()]) ? $this->numberOfPaginatorsRendered[$paginator->getPageName()]++ : $this->numberOfPaginatorsRendered[$paginator->getPageName()] = 1)
-
-
- @endif
-
diff --git a/resources/views/tailwind_3_prefixed/main.blade.php b/resources/views/tailwind_3_prefixed/main.blade.php
deleted file mode 100644
index 7eb96fd..0000000
--- a/resources/views/tailwind_3_prefixed/main.blade.php
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
- @if(count($this->selectedIds())>0 && count($this->selectedIds()) < $this->totalRowsCount && $this->rows->hasPages())
-
-
- {{count($this->selectedIds())}} rows selected so far,
-
-
- select all {{$this->totalRowsCount}} rows
-
-
-
- @endif
-
- config(\DefStudio\WiredTables\Enums\Config::poll))wire:poll.{{$poll}}ms @endif
- @class([
- 'tw-overflow-auto tw-mb-3',
- 'tw-rounded-md' => $this->config(\DefStudio\WiredTables\Enums\Config::rounded),
- 'tw-shadow-md' => $this->config(\DefStudio\WiredTables\Enums\Config::table_shadow),
- ])
- >
-
-
-
-
-
- @foreach($this->columns as $column)
- @continue(!$column->isVisible())
- @php($column->setParentConfiguration($this->configuration()->header))
-
- @endforeach
-
-
-
-
-
-
-
- @forelse($this->rows as $model)
-
-
- @foreach($this->columns as $column)
- @continue(!$column->isVisible())
- @php($column->setParentConfiguration($this->configuration()))
- @php($column->setModel($model))
-
- @endforeach
-
- @empty
-
- |
- {{$this->config(\DefStudio\WiredTables\Enums\Config::empty_message, __('No data found'))}}
- |
-
- @endforelse
-
-
-
- @if(collect($this->columns)->some(fn(\DefStudio\WiredTables\Elements\Column $column) => !!$column->get(\DefStudio\WiredTables\Enums\Config::with_sum)))
-
-
- @if($this->shouldShowRowsSelector())
- |
- @endif
-
- @foreach($this->columns as $column)
- @continue(!$column->isVisible())
-
-
- @endforeach
-
-
- @endif
-
-
-
-
-
-
-
-
-
-
diff --git a/resources/views/tailwind_3_prefixed/values/boolean.blade.php b/resources/views/tailwind_3_prefixed/values/boolean.blade.php
deleted file mode 100644
index 7ee8a56..0000000
--- a/resources/views/tailwind_3_prefixed/values/boolean.blade.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-@if($value)
-
-@else
-
-@endif
diff --git a/src/Concerns/HasFilters.php b/src/Concerns/HasFilters.php
index 1d4d430..cb8145f 100644
--- a/src/Concerns/HasFilters.php
+++ b/src/Concerns/HasFilters.php
@@ -87,7 +87,7 @@ public function getFilterByName(string $name): Filter|null
return collect($this->_filters)->first(fn (Filter $filter) => $filter->name() === $name);
}
- public function updatedFilterValues($value, $key): void
+ public function updatedFilterValues(): void
{
if ($this->paginationEnabled()) {
$this->setPage(1);
diff --git a/src/Concerns/HasTextConfiguration.php b/src/Concerns/HasTextConfiguration.php
index 172ff7e..212d05a 100644
--- a/src/Concerns/HasTextConfiguration.php
+++ b/src/Concerns/HasTextConfiguration.php
@@ -5,7 +5,6 @@
namespace DefStudio\WiredTables\Concerns;
use DefStudio\WiredTables\Enums\Config;
-use Illuminate\Support\Collection;
trait HasTextConfiguration
{
@@ -17,7 +16,6 @@ public function getTextClasses(): string
Config::font_size_class,
])->map(fn (Config $config) => $this->get($config))
->filter()
- ->when(config("wired-tables.style") === 'tailwind_3_prefixed', fn (Collection $collection) => $collection->map(fn (string $class) => "tw-$class"))
->join(' ');
}
diff --git a/src/Elements/Column.php b/src/Elements/Column.php
index f76cc83..7fabd57 100644
--- a/src/Elements/Column.php
+++ b/src/Elements/Column.php
@@ -36,7 +36,7 @@ public function __construct(WiredTable $table, string $name, string|null $dbColu
$this->set(Config::name, $name)
->set(Config::db_column, $dbColumn)
- ->set(Config::id, md5($this->name().$this->dbColumn().$table->id));
+ ->set(Config::id, md5($this->name().$this->dbColumn().$table->getId()));
}
protected function initDefaults(): void
diff --git a/tests/Pest.php b/tests/Pest.php
index 24fd985..d96d00f 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -67,7 +67,7 @@ protected function columns(): void
$table->bootedHasPagination();
$table->bootedHasFilters();
- $table->forgetComputed('slug');
+ unset($table->slug);
return $table;
}
diff --git a/tests/Unit/Concerns/HasConfiguration.php b/tests/Unit/Concerns/HasConfiguration.php
index 59f8f3b..d7e5ca9 100644
--- a/tests/Unit/Concerns/HasConfiguration.php
+++ b/tests/Unit/Concerns/HasConfiguration.php
@@ -30,7 +30,8 @@
'preserve_state' => true,
'striped' => true,
'enable_row_dividers' => false,
- 'drop_shadow' => false,
+ 'wrapper_shadow' => false,
+ 'table_shadow' => false,
'hover' => false,
'support_multiple_sorting' => false,
'group_filters' => true,
@@ -38,6 +39,8 @@
'filters_columns' => 1,
'actions_columns' => 1,
'always_show_actions' => false,
+ 'is_searchable' => true,
+ 'rounded' => false,
]);
expect($table->configuration()->header->toArray())->toBe([
diff --git a/tests/Unit/Concerns/HasFilters.php b/tests/Unit/Concerns/HasFilters.php
index f856f89..b572ff2 100644
--- a/tests/Unit/Concerns/HasFilters.php
+++ b/tests/Unit/Concerns/HasFilters.php
@@ -208,11 +208,13 @@ protected function columns(): void
expect(fakeTable()->hasFilters())->toBeTrue();
});
-it('can tell if filters selector should be shown', function (WiredTable $table, bool $visible) {
+it('can tell if filters selector should be shown', function ($table, bool $visible) {
+ $table = $table();
+
expect($table->shouldShowFiltersSelector())->toBe($visible);
})->with([
'no filters' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -223,10 +225,10 @@ protected function columns(): void
$this->column('Name');
}
}),
- 'visible' => false,
+ false,
],
'no global filters' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -242,10 +244,10 @@ protected function filters(): void
$this->filter('Name')->displayOnColumn();
}
}),
- 'visible' => false,
+ false,
],
'hidden filter' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -261,19 +263,21 @@ protected function filters(): void
$this->filter('Name')->hidden();
}
}),
- 'visible' => false,
+ false,
],
'visible filter' => [
- 'table' => fn () => fakeTable(),
- 'visible' => true,
+ fn () => fakeTable(),
+ true,
],
]);
-it('can tell if column filters should be shown', function (WiredTable $table, bool $visible) {
+it('can tell if column filters should be shown', function ($table, bool $visible) {
+ $table = $table();
+
expect($table->shouldShowColumnFilters())->toBe($visible);
})->with([
'no filters' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -284,10 +288,10 @@ protected function columns(): void
$this->column('Name');
}
}),
- 'visible' => false,
+ false,
],
'no column filters' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -303,10 +307,10 @@ protected function filters(): void
$this->filter('Name');
}
}),
- 'visible' => false,
+ false,
],
'hidden filter' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -322,10 +326,10 @@ protected function filters(): void
$this->filter('Name')->displayOnColumn()->hidden();
}
}),
- 'visible' => false,
+ false,
],
'visible filter' => [
- 'table' => fn () => fakeTable(new class () extends WiredTable {
+ fn () => fakeTable(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -341,7 +345,7 @@ protected function filters(): void
$this->filter('Name')->displayOnColumn();
}
}),
- 'visible' => true,
+ true,
],
]);
diff --git a/tests/Unit/Concerns/HasPagination.php b/tests/Unit/Concerns/HasPagination.php
index 468cbf2..976a821 100644
--- a/tests/Unit/Concerns/HasPagination.php
+++ b/tests/Unit/Concerns/HasPagination.php
@@ -10,16 +10,16 @@
test('pagination is mounted', function () {
$table = fakeTable();
- expect($table->pageSize)->toBe(10);
+ expect($table->pageSize)->toBe('10');
});
test('page is reset when page size changes', function () {
$table = fakeTable();
- $table->page = 2;
+ $table->setPage(2);
$table->updatedPageSize();
- expect($table->page)->toBe(1);
+ expect($table->paginators)->toBe(['page' => 1]);
});
it('can change page size', function () {
@@ -28,7 +28,7 @@
$table->setPageSize(20);
;
- expect($table->pageSize)->toBe(20);
+ expect($table->pageSize)->toBe('20');
});
it('prevents invalid page sizes', function () {
@@ -54,7 +54,7 @@
$table = fakeTable();
- expect($table->pageSize)->toBe(50);
+ expect($table->pageSize)->toBe('50');
});
test('cached page size is updated', function () {
@@ -65,5 +65,5 @@
$table = fakeTable();
$table->setPageSize(20);
- expect(Cache::get("httplocalhost-42-state-page-size"))->toBe(20);
+ expect(Cache::get("httplocalhost-42-state-page-size"))->toBe('20');
});
diff --git a/tests/Unit/Concerns/HasQueryStrings.php b/tests/Unit/Concerns/HasQueryStrings.php
index 7b9b8c9..3569215 100644
--- a/tests/Unit/Concerns/HasQueryStrings.php
+++ b/tests/Unit/Concerns/HasQueryStrings.php
@@ -16,8 +16,8 @@
expect($table->queryString())->toBe([
- "search" => ['except' => '', 'as' => 'foo.search'],
- "sorting" => ['except' => [], 'as' => 'foo.sort'],
- "filterValues" => ['except' => '', 'as' => 'foo.filters'],
+ "search" => ['except' => '', 'as' => 'foo_search'],
+ "sorting" => ['except' => [], 'as' => 'foo_sort'],
+ "filterValues" => ['except' => '', 'as' => 'foo_filters'],
]);
});
diff --git a/tests/Unit/Concerns/HasSearch.php b/tests/Unit/Concerns/HasSearch.php
index c651678..530b9b3 100644
--- a/tests/Unit/Concerns/HasSearch.php
+++ b/tests/Unit/Concerns/HasSearch.php
@@ -135,7 +135,7 @@ protected function columns(): void
$table->search = 'foo';
- expect($table)->rawQuery()->toBe('select * from "cars" where ("name" like \'%foo%\') limit 10 offset 0');
+ expect($table)->rawQuery()->toBe('select * from "cars" where ("name" like \'%foo%\' or 0 >= 1) limit 10 offset 0');
});
diff --git a/tests/Unit/Configurations/TableConfiguration.php b/tests/Unit/Configurations/TableConfiguration.php
index 1c44064..5d90632 100644
--- a/tests/Unit/Configurations/TableConfiguration.php
+++ b/tests/Unit/Configurations/TableConfiguration.php
@@ -21,7 +21,8 @@
'preserve_state' => true,
'striped' => true,
'enable_row_dividers' => false,
- 'drop_shadow' => false,
+ 'wrapper_shadow' => false,
+ 'table_shadow' => false,
'hover' => false,
'support_multiple_sorting' => false,
'group_filters' => true,
@@ -29,6 +30,8 @@
'filters_columns' => 1,
'actions_columns' => 1,
'always_show_actions' => false,
+ "is_searchable" => true,
+ "rounded" => false,
]);
});
diff --git a/tests/Unit/Elements/Action.php b/tests/Unit/Elements/Action.php
index b7d8bc2..45d0d64 100644
--- a/tests/Unit/Elements/Action.php
+++ b/tests/Unit/Elements/Action.php
@@ -71,11 +71,13 @@
]);
});
-it('can compute its method', function (Action $action, string $method) {
+it('can compute its method', function ($action, string $method) {
+ $action = $action();
+
expect($action->method())->toBe($method);
})->with([
'closure' => [
- 'action' => fn () => (new Action(new class () extends WiredTable {
+ fn () => (new Action(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -86,10 +88,10 @@ protected function columns(): void
$this->column('test');
}
}, 'my action'))->handle(fn () => null),
- 'method' => 'handleAction',
+ 'handleAction',
],
'method given' => [
- 'action' => fn () => (new Action(new class () extends WiredTable {
+ fn () => (new Action(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -104,10 +106,10 @@ public function test(): void
{
}
}, 'my action', 'test')),
- 'method' => 'test',
+ 'test',
],
'camel' => [
- 'action' => fn () => (new Action(new class () extends WiredTable {
+ fn () => (new Action(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -122,10 +124,10 @@ public function myAction(): void
{
}
}, 'my action')),
- 'method' => 'myAction',
+ 'myAction',
],
'snake' => [
- 'action' => fn () => (new Action(new class () extends WiredTable {
+ fn () => (new Action(new class () extends WiredTable {
protected function query(): Builder|Relation
{
return Car::query();
@@ -140,7 +142,7 @@ public function my_action(): void
{
}
}, 'my action')),
- 'method' => 'my_action',
+ 'my_action',
],
]);
@@ -163,29 +165,31 @@ public function my_action(): void
expect($processed)->toBeTrue();
});
-test("visibility", function (Action $action, bool $visible) {
+test("visibility", function ($action, bool $visible) {
+ $action = $action();
+
expect($action->isVisible())->toBe($visible);
})->with([
'hidden by configuration' => [
- 'action' => fn () => (new Action(fakeTable(), 'my action'))->hidden(),
- 'visible' => false,
+ fn () => (new Action(fakeTable(), 'my action'))->hidden(),
+ false,
],
'hidden by closure' => [
- 'action' => fn () => (new Action(fakeTable(), 'my action'))->hidden(fn () => true),
- 'visible' => false,
+ fn () => (new Action(fakeTable(), 'my action'))->hidden(fn () => true),
+ false,
],
'visible by table configuration (row selection not needed)' => [
- 'action' => function () {
+ function () {
$table = fakeTable();
$table->configuration()->alwaysShowActions();
$action = new Action($table, 'my action');
return $action;
},
- 'visible' => true,
+ true,
],
'visible by table configuration (row selection required)' => [
- 'action' => function () {
+ function () {
$table = fakeTable();
$table->configuration()->alwaysShowActions();
$action = new Action($table, 'my action');
@@ -193,14 +197,14 @@ public function my_action(): void
return $action;
},
- 'visible' => true,
+ true,
],
'visible if row selection is not needed' => [
- 'action' => fn () => new Action(fakeTable(), 'my action'),
- 'visible' => true,
+ fn () => new Action(fakeTable(), 'my action'),
+ true,
],
'visible if rows are selected' => [
- 'action' => function () {
+ function () {
$table = fakeTable();
$table->selectRows([1]);
$action = new Action($table, 'my action');
@@ -208,10 +212,10 @@ public function my_action(): void
return $action;
},
- 'visible' => true,
+ true,
],
'hidden if no rows are selected and row selection is required' => [
- 'action' => fn () => (new Action(fakeTable(), 'my action'))->withRowSelection(),
- 'visible' => false,
+ fn () => (new Action(fakeTable(), 'my action'))->withRowSelection(),
+ false,
],
]);
diff --git a/tests/Unit/Elements/Column.php b/tests/Unit/Elements/Column.php
index 631afd5..1277b48 100644
--- a/tests/Unit/Elements/Column.php
+++ b/tests/Unit/Elements/Column.php
@@ -15,7 +15,7 @@
test('defaults', function () {
$table = fakeTable();
- $table->id = 1234;
+ $table->setId(1234);
$column = new Column($table, "Test");
@@ -60,7 +60,7 @@
it('can return its id', function () {
$table = fakeTable();
- $table->id = 1234;
+ $table->setId(1234);
$column = new Column($table, "Test");
diff --git a/tests/Unit/Styles/TailwindPrefixed.php b/tests/Unit/Styles/TailwindPrefixed.php
deleted file mode 100644
index be7568e..0000000
--- a/tests/Unit/Styles/TailwindPrefixed.php
+++ /dev/null
@@ -1,60 +0,0 @@
-replace("resources". DIRECTORY_SEPARATOR. "views". DIRECTORY_SEPARATOR. "tailwind_3", "resources". DIRECTORY_SEPARATOR. "views". DIRECTORY_SEPARATOR. "tailwind_3_prefixed")->toString();
-
- expect($prefixed_file)->toBeFile();
-
- $file_match = [];
- preg_match_all($pattern, File::get($file), $file_match);
-
- $prefixed_match = [];
- preg_match_all($pattern, File::get($prefixed_file), $prefixed_match);
-
-
- if (isset($file_match[1])) {
- foreach ($file_match[1] as $class_index => $class) {
- $items = Str::of($class)->replace("\r\n", '')->replace("\n", '')->replace("\t", '')->explode(' ')->filter()->values();
-
- $prefixed_items = Str::of($prefixed_match[1][$class_index])->replace("\r\n", '')->replace("\n", '')->replace("\t", '')->explode(' ')->filter()->values();
-
- $items->each(function (string $item, $item_index) use ($file, $prefixed_items) {
- $prefixed_item = $prefixed_items->get($item_index);
-
- if (Str::of($item)->contains("{{")) {
- return;
- }
-
- if (Str::of($item)->before('[')->contains(':')) {
- $item = Str::of($item)->after(':')->toString();
- $prefixed_item = Str::of($prefixed_item)->after(':')->toString();
- }
-
- try {
- if (Str::of($item)->startsWith('-')) {
- expect($prefixed_item)->toBe("-tw$item");
-
- return;
- }
-
- expect($prefixed_item)->toBe("tw-$item");
- } catch (ExpectationFailedException $e) {
- throw new ExpectationFailedException("Class was not prefixed in [$file]", $e->getComparisonFailure());
- }
- });
- }
- }
- }
- }
-});