mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
feature: add support for input prefixes
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"/js/filament.js": "/js/filament.js?id=a3029b69d87820f78653",
|
||||
"/css/filament.css": "/css/filament.css?id=926a639e9dbb366c5426"
|
||||
"/css/filament.css": "/css/filament.css?id=8f9feb8beeb1e047d26e"
|
||||
}
|
||||
|
||||
@@ -7,18 +7,25 @@
|
||||
:label="__($formComponent->label)"
|
||||
:required="$formComponent->required"
|
||||
>
|
||||
<input
|
||||
{!! $formComponent->autocomplete ? "autocomplete=\"{$formComponent->autocomplete}\"" : null !!}
|
||||
{!! $formComponent->autofocus ? 'autofocus' : null !!}
|
||||
{!! $formComponent->disabled ? 'disabled' : null !!}
|
||||
{!! $formComponent->id ? "id=\"{$formComponent->id}\"" : null !!}
|
||||
{!! $formComponent->name ? "{$formComponent->nameAttribute}=\"{$formComponent->name}\"" : null !!}
|
||||
{!! $formComponent->maxLength ? "maxlength=\"{$formComponent->maxLength}\"" : null !!}
|
||||
{!! $formComponent->minLength ? "minlength=\"{$formComponent->minLength}\"" : null !!}
|
||||
{!! $formComponent->placeholder ? "placeholder=\"{$formComponent->placeholder}\"" : null !!}
|
||||
{!! $formComponent->required ? 'required' : null !!}
|
||||
{!! $formComponent->type ? "type=\"{$formComponent->type}\"" : null !!}
|
||||
class="block w-full rounded shadow-sm placeholder-gray-400 focus:placeholder-gray-500 placeholder-opacity-100 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50 {{ $errors->has($formComponent->name) ? 'border-danger-600 motion-safe:animate-shake' : 'border-gray-300' }}"
|
||||
{!! Filament\format_attributes($formComponent->extraAttributes) !!}
|
||||
/>
|
||||
<div class="flex border-gray-300 rounded shadow-sm">
|
||||
@if($formComponent->prefix)
|
||||
<span class="inline-flex items-center px-3 text-gray-500 border border-r-0 border-gray-300 rounded-l-md bg-gray-50 sm:text-sm">
|
||||
{{ $formComponent->prefix }}
|
||||
</span>
|
||||
@endif
|
||||
<input
|
||||
{!! $formComponent->autocomplete ? "autocomplete=\"{$formComponent->autocomplete}\"" : null !!}
|
||||
{!! $formComponent->autofocus ? 'autofocus' : null !!}
|
||||
{!! $formComponent->disabled ? 'disabled' : null !!}
|
||||
{!! $formComponent->id ? "id=\"{$formComponent->id}\"" : null !!}
|
||||
{!! $formComponent->name ? "{$formComponent->nameAttribute}=\"{$formComponent->name}\"" : null !!}
|
||||
{!! $formComponent->maxLength ? "maxlength=\"{$formComponent->maxLength}\"" : null !!}
|
||||
{!! $formComponent->minLength ? "minlength=\"{$formComponent->minLength}\"" : null !!}
|
||||
{!! $formComponent->placeholder ? "placeholder=\"{$formComponent->placeholder}\"" : null !!}
|
||||
{!! $formComponent->required ? 'required' : null !!}
|
||||
{!! $formComponent->type ? "type=\"{$formComponent->type}\"" : null !!}
|
||||
class="block w-full rounded-r-md placeholder-gray-400 focus:placeholder-gray-500 placeholder-opacity-100 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50 {{ $errors->has($formComponent->name) ? 'border-danger-600 motion-safe:animate-shake' : 'border-gray-300' }}"
|
||||
{!! Filament\format_attributes($formComponent->extraAttributes) !!}
|
||||
/>
|
||||
</div>
|
||||
</x-forms::field-group>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Forms\Components\Concerns;
|
||||
|
||||
trait HasPrefix
|
||||
{
|
||||
public $prefix;
|
||||
|
||||
public function prefix($prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ class TextInput extends Field
|
||||
use Concerns\CanBeUnique;
|
||||
use Concerns\CanBeLengthConstrained;
|
||||
use Concerns\HasPlaceholder;
|
||||
use Concerns\HasPrefix;
|
||||
|
||||
public $type = 'text';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user