mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
fix(repeater): bubble afterStateUpdated to parents
This commit is contained in:
@@ -162,6 +162,21 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
});
|
||||
}
|
||||
|
||||
protected function callAfterStateUpdatedOnParents(Component $component, bool $isLive = false): void
|
||||
{
|
||||
if (! $isLive && ! $component->isLive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$parent = $component->getContainer()->getParentComponent();
|
||||
|
||||
if ($parent) {
|
||||
$parent->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($parent, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAddAction(): Action
|
||||
{
|
||||
$action = Action::make($this->getAddActionName())
|
||||
@@ -185,6 +200,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->collapsed(false, shouldMakeComponentCollapsible: false);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->button()
|
||||
->size(ActionSize::Small)
|
||||
@@ -260,6 +277,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->collapsed(false, shouldMakeComponentCollapsible: false);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->button()
|
||||
->size(ActionSize::Small)
|
||||
@@ -320,6 +339,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->collapsed(false, shouldMakeComponentCollapsible: false);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->iconButton()
|
||||
->size(ActionSize::Small)
|
||||
@@ -359,6 +380,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->state($items);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->iconButton()
|
||||
->size(ActionSize::Small)
|
||||
@@ -397,6 +420,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->state($items);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->iconButton()
|
||||
->size(ActionSize::Small)
|
||||
@@ -435,6 +460,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->state($items);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->iconButton()
|
||||
->size(ActionSize::Small)
|
||||
@@ -476,6 +503,8 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
$component->state($items);
|
||||
|
||||
$component->callAfterStateUpdated();
|
||||
|
||||
$this->callAfterStateUpdatedOnParents($component);
|
||||
})
|
||||
->livewireClickHandlerEnabled(false)
|
||||
->iconButton()
|
||||
|
||||
Reference in New Issue
Block a user