From 47191eda344c9188d362b0f4f5c475ac164839dc Mon Sep 17 00:00:00 2001 From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:43:21 -0300 Subject: [PATCH] [6.x] Fix showCollapseIcon bug (#1697) * Fix default toggle-detail * Fix default toggle-detail * build assets --- resources/views/components/row.blade.php | 6 +++++- src/Concerns/HasActions.php | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/views/components/row.blade.php b/resources/views/components/row.blade.php index 1eb173ef..4d63c202 100644 --- a/resources/views/components/row.blade.php +++ b/resources/views/components/row.blade.php @@ -8,8 +8,12 @@ 'view' => data_get($setUp, 'detail.viewIcon') ?? null, ]) +@php + $defaultCollapseIcon = data_get($theme, 'root') . '.toggle-detail'; +@endphp + @includeWhen(data_get($setUp, 'detail.showCollapseIcon'), - data_get(collect($row->__powergrid_rules)->last(), 'toggleDetailView'), + data_get(collect($row->__powergrid_rules)->last(), 'toggleDetailView') ?? $defaultCollapseIcon, [ 'view' => data_get($setUp, 'detail.viewIcon') ?? null, ] diff --git a/src/Concerns/HasActions.php b/src/Concerns/HasActions.php index 2c2e530b..55008608 100644 --- a/src/Concerns/HasActions.php +++ b/src/Concerns/HasActions.php @@ -125,7 +125,10 @@ public function prepareActionRulesForRows(mixed $row, ?object $loop = null): arr ]; } - $showToggleDetail = data_get($rule, 'rule.toggleableVisibility') === 'show' || (bool) data_get($this->setUp, 'detail.showCollapseIcon'); + $showToggleDetail = $apply && data_get($rule, 'rule.toggleDetailVisibility') + ? data_get($rule, 'rule.toggleDetailVisibility') === 'show' + : (bool) data_get($this->setUp, 'detail.showCollapseIcon'); + $toggleableVisibility = $apply ? data_get($rule, 'rule.toggleableVisibility') : []; $editOnClickVisibility = $apply ? data_get($rule, 'rule.editOnClickVisibility') : []; $fieldHideEditOnClick = $apply && (bool) data_get($rule, 'rule.fieldHideEditOnClick');