This commit is contained in:
Ralph J. Smit
2025-02-10 19:08:50 +01:00
parent 29d8170e9f
commit 4d83e6c38e
4 changed files with 31 additions and 31 deletions
@@ -46,11 +46,11 @@ class ComponentContainer extends ViewComponent
{
return match ($parameterName) {
'livewire' => [$this->getLivewire()],
'record' => [$this->getRecord()],
'record' => [$this->getRecord()],
default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName),
};
}
/**
* @return array<mixed>
*/
@@ -36,7 +36,7 @@ class Component extends ViewComponent
protected function resolveDefaultClosureDependencyForEvaluationByName(string $parameterName): array
{
return match ($parameterName) {
'livewire' => [$this->getLivewire()],
'livewire' => [$this->getLivewire()],
'record' => [$this->getRecord()],
'state' => [$this->getState()],
default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName),
+21 -21
View File
@@ -10,25 +10,25 @@ use Livewire\Component;
class Livewire extends Component implements HasForms, HasInfolists
{
use InteractsWithForms;
use InteractsWithInfolists;
public $data;
public static function make(): static
{
return new static;
}
public function data($data): static
{
$this->data = $data;
return $this;
}
public function getData()
{
return $this->data;
}
use InteractsWithForms;
use InteractsWithInfolists;
public $data;
public static function make(): static
{
return new static;
}
public function data($data): static
{
$this->data = $data;
return $this;
}
public function getData()
{
return $this->data;
}
}
+7 -7
View File
@@ -15,8 +15,8 @@ it('can inject the correct `$livewire` for infolists outside a panel', function
->assertSee('First Entry State')
->assertSee('Second Entry Label')
->assertSee('Second Entry State')
->assertSee('Third Entry Label')
->assertSee('Third Entry State (dynamic)');
->assertSee('Third Entry Label')
->assertSee('Third Entry State (dynamic)');
});
class TestComponentWithInfolist extends Livewire
@@ -55,11 +55,11 @@ class TestComponentWithInfolist extends Livewire
->label('Second Entry Label'),
Infolists\Components\TextEntry::make('third_entry')
->label('Third Entry Label')
->getStateUsing(function (TestComponentWithInfolist $livewire) {
expect($livewire)->toBe($this);
return 'Third Entry State (dynamic)';
}),
->getStateUsing(function (TestComponentWithInfolist $livewire) {
expect($livewire)->toBe($this);
return 'Third Entry State (dynamic)';
}),
];
});
}