mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Merge branch 'pr/411' into develop
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<x-forms::field-group
|
||||
:column-span="$formComponent->getColumnSpan()"
|
||||
:error-key="$formComponent->getName()"
|
||||
:for="$formComponent->getId()"
|
||||
:label="$formComponent->getLabel()"
|
||||
>
|
||||
<div class="flex">
|
||||
<span
|
||||
class="block w-full placeholder-gray-400 placeholder-opacity-100 px-3 py-2 cursor-default"
|
||||
>
|
||||
{{ $formComponent->getValue() }}
|
||||
</span>
|
||||
</div>
|
||||
</x-forms::field-group>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Forms\Components;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Placeholder extends Component
|
||||
{
|
||||
protected $name;
|
||||
|
||||
protected $value;
|
||||
|
||||
public function __construct($name, $value)
|
||||
{
|
||||
$this->name($name);
|
||||
$this->value($value);
|
||||
|
||||
$this->setUp();
|
||||
}
|
||||
|
||||
public function getLabel()
|
||||
{
|
||||
if ($this->label === null) {
|
||||
return (string) Str::of($this->getName())
|
||||
->afterLast('.')
|
||||
->kebab()
|
||||
->replace(['-', '_'], ' ')
|
||||
->ucfirst();
|
||||
}
|
||||
|
||||
return parent::getLabel();
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
protected function name($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function value($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function make($name, $value)
|
||||
{
|
||||
return new static($name, $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Resources\Forms\Components;
|
||||
|
||||
class Placeholder extends \Filament\Forms\Components\Placeholder
|
||||
{
|
||||
use Concerns\CanBeDependentOnResourceRecord;
|
||||
}
|
||||
Reference in New Issue
Block a user