feat: add repeater item numbers

This commit is contained in:
Guilherme Saade
2025-09-10 13:49:52 -03:00
committed by GitHub
parent 32a57a1986
commit bf2d63d32e
3 changed files with 33 additions and 0 deletions
@@ -54,6 +54,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
protected string | Closure | null $itemLabel = null;
protected bool | Closure $hasItemNumbers = false;
protected Field | Closure | null $simpleField = null;
protected Alignment | string | Closure | null $addActionAlignment = null;
@@ -1014,6 +1016,13 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
return $this;
}
public function itemNumbers(bool | Closure $condition = true): static
{
$this->hasItemNumbers = $condition;
return $this;
}
public function fillFromRelationship(): void
{
$this->state(
@@ -1140,6 +1149,11 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
return $this->itemLabel !== null;
}
public function hasItemNumbers(): bool
{
return (bool) $this->evaluate($this->hasItemNumbers);
}
public function simple(Field | Closure | null $field): static
{
$this->simpleField = $field;