Merge branch 'pr/411' into develop

This commit is contained in:
Dan Harrin
2021-06-03 20:52:46 +01:00
3 changed files with 84 additions and 0 deletions
@@ -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;
}