mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-28 03:44:19 +08:00
feat: add repeater item numbers
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user