From 4108ef2647c680a6714ceddd55caece881ea308c Mon Sep 17 00:00:00 2001 From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com> Date: Tue, 13 Aug 2024 19:26:18 -0300 Subject: [PATCH] Fix responsive action bug (#1640) --- resources/views/components/cols.blade.php | 8 ++++++++ src/PowerGridComponent.php | 5 ++++- src/Providers/PowerGridServiceProvider.php | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/views/components/cols.blade.php b/resources/views/components/cols.blade.php index 361c7c92..62d7f7f7 100644 --- a/resources/views/components/cols.blade.php +++ b/resources/views/components/cols.blade.php @@ -15,6 +15,14 @@ $isFixedOnResponsive = true; } + if (data_get($column, 'isAction') && + in_array( + \PowerComponents\LivewirePowerGrid\Responsive::ACTIONS_COLUMN_NAME, + data_get($this->setUp, 'responsive.fixedColumns') + )) { + $isFixedOnResponsive = true; + } + if ($column->fixedOnResponsive) { $isFixedOnResponsive = true; } diff --git a/src/PowerGridComponent.php b/src/PowerGridComponent.php index b3a577ef..87fda43f 100644 --- a/src/PowerGridComponent.php +++ b/src/PowerGridComponent.php @@ -195,12 +195,15 @@ private function getTheme(): array return convertObjectsToArray((array) $themeBase->apply()); } - return Cache::rememberForever('powerGridTheme_' . $class, function () use ($class) { + /** @var array $theme */ + $theme = Cache::rememberForever('powerGridTheme_' . $class, function () use ($class) { /** @var ThemeBase $themeBase */ $themeBase = PowerGrid::theme($class); return convertObjectsToArray((array) $themeBase->apply()); }); + + return $theme; } /** diff --git a/src/Providers/PowerGridServiceProvider.php b/src/Providers/PowerGridServiceProvider.php index 524ae5c5..8ce0a910 100644 --- a/src/Providers/PowerGridServiceProvider.php +++ b/src/Providers/PowerGridServiceProvider.php @@ -110,7 +110,7 @@ private function macros(): void $perPage = $perPage ?: $this->model->getPerPage(); - $results = $this->model->newCollection( //@phpstan-ignore-line + $results = $this->model->newCollection( $engine->map( $this, $rawResults = $engine->paginate($this, $perPage, $page),