Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
margarizaldi committed Mar 17, 2024
1 parent 015c2f8 commit e3c3b56
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Components/Concerns/HasHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ public function getHeaders(): array
$headers = $this->evaluate($this->headers) ?? [];
$fields = $this->childComponents;

if (count($headers) < count($fields)) {
foreach($fields as $field) {
$headers[] = Header::make($field->getLabel());
foreach ($fields as $index => $field) {
if (!isset($headers[$index]) || !is_string($headers[$index])) {
$headers[$index] = Header::make($field->getLabel());
} else {
$headers[$index] = Header::make($headers[$index]);
}
}

return array_map(
fn ($header) => $header instanceof Header ? $header : Header::make($header),
$headers,
);
return $headers;
}

public function shouldRenderHeader(): bool
Expand Down

0 comments on commit e3c3b56

Please sign in to comment.