Skip to content

Commit

Permalink
Fix missing td action class for inline filters (#1575)
Browse files Browse the repository at this point in the history
* enable realtime update when debug has enable

* Fix missing tdFilters classes

* remove unnecessary count colspan

* fix phpstan
  • Loading branch information
luanfreitasdev committed May 27, 2024
1 parent 9593691 commit 4a67838
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions resources/views/components/inline-filters.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ class="{{ $tdClasses }}"
$filterClass = str(data_get($column, 'filters.className'));
@endphp
<td
class="{{ data_get($theme, 'table.tdBodyClass') }}"
@class([data_get($theme, 'table.tdBodyClass'), data_get($theme, 'table.tdFiltersClass')])
wire:key="column-filter-{{ data_get($column, 'field') }}"
style="{{ data_get($column, 'hidden') === true ? 'display:none' : '' }}; {{ data_get($theme, 'table.tdBodyStyle') }}"
@style([
'display:none' => data_get($column, 'hidden') === true,
data_get($theme, 'table.tdBodyStyle'),
data_get($theme, 'table.tdFiltersStyle')
])
>
<div wire:key="filter-{{ data_get($column, 'field') }}-{{ $loop->index }}">
@if ($filterClass->contains('FilterMultiSelect'))
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/table/th-empty.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class="{{ data_get($theme, 'table.trBodyClass') }}"
<th
class="{{ data_get($theme, 'table.tdBodyEmptyClass') }}"
style="{{ data_get($theme, 'table.tdBodyEmptyStyle') }}"
colspan="{{ ($checkbox ? 1 : 0) + count($columns) + (data_get($setUp, 'detail.showCollapseIcon') ? 1 : 0) }}"
colspan="999"
>
{!! $this->processNoDataLabel() !!}
</th>
Expand Down
7 changes: 7 additions & 0 deletions src/PowerGridComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ private function getTheme(): array
{
$class = $this->template() ?? powerGridTheme();

if (app()->hasDebugModeEnabled()) {
/** @var ThemeBase $themeBase */
$themeBase = PowerGrid::theme($class);

return convertObjectsToArray((array) $themeBase->apply());
}

return Cache::rememberForever('powerGridTheme_' . $class, function () use ($class) {
/** @var ThemeBase $themeBase */
$themeBase = PowerGrid::theme($class);
Expand Down
6 changes: 3 additions & 3 deletions src/Themes/Tailwind.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function table(): Table
->th('font-extrabold px-2 pr-4 py-3 text-left text-xs text-pg-primary-700 tracking-wider whitespace-nowrap dark:text-pg-primary-300')
->tbody('text-pg-primary-800')
->trBody('border-b border-pg-primary-100 dark:border-pg-primary-600 hover:bg-pg-primary-50 dark:bg-pg-primary-800 dark:hover:bg-pg-primary-700')
->tdBody('px-3 py-2 whitespace-nowrap dark:text-pg-primary-200')
->tdBodyEmpty('px-3 py-2 whitespace-nowrap dark:text-pg-primary-200')
->tdBody('p-2 whitespace-nowrap dark:text-pg-primary-200')
->tdBodyEmpty('p-2 whitespace-nowrap dark:text-pg-primary-200')
->trBodyClassTotalColumns('')
->tdBodyTotalColumns('px-3 py-2 whitespace-nowrap dark:text-pg-primary-200 text-sm text-pg-primary-600 text-right space-y-2');
->tdBodyTotalColumns('p-2 whitespace-nowrap dark:text-pg-primary-200 text-sm text-pg-primary-600 text-right space-y-2');
}

public function footer(): Footer
Expand Down

0 comments on commit 4a67838

Please sign in to comment.