mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
wip
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
:label="$formComponent->getLabel()"
|
||||
:required="$formComponent->isRequired()"
|
||||
>
|
||||
@if($formComponent->isInlineLayout())
|
||||
<x-slot name="labelPrefix">
|
||||
@if ($formComponent->isInline())
|
||||
<x-slot name="labelPrefix">
|
||||
@endif
|
||||
<input
|
||||
{!! $formComponent->isAutofocused() ? 'autofocus' : null !!}
|
||||
@@ -20,7 +20,7 @@
|
||||
class="rounded text-primary-600 shadow-sm focus:border-primary-700 focus:ring focus:ring-blue-200 focus:ring-opacity-50 {{ $errors->has($formComponent->getName()) ? 'border-danger-600 ' : 'border-gray-300' }}"
|
||||
{!! Filament\format_attributes($formComponent->getExtraAttributes()) !!}
|
||||
/>
|
||||
@if($formComponent->isInlineLayout())
|
||||
</x-slot>
|
||||
@if ($formComponent->isInline())
|
||||
</x-slot>
|
||||
@endif
|
||||
</x-forms::field-group>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
:label="$formComponent->getLabel()"
|
||||
:required="$formComponent->isRequired()"
|
||||
>
|
||||
@if($formComponent->isInlineLayout())
|
||||
<x-slot name="labelPrefix">
|
||||
@if ($formComponent->isInline())
|
||||
<x-slot name="labelPrefix">
|
||||
@endif
|
||||
<button
|
||||
x-data="{ value: @entangle($formComponent->getName()){{ Str::of($formComponent->getBindingAttribute())->after('wire:model') }} }"
|
||||
@@ -61,7 +61,7 @@
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
@if($formComponent->isInlineLayout())
|
||||
</x-slot>
|
||||
@if ($formComponent->isInline())
|
||||
</x-slot>
|
||||
@endif
|
||||
</x-forms::field-group>
|
||||
|
||||
@@ -5,10 +5,12 @@ namespace Filament\Forms\Components;
|
||||
class Checkbox extends Field
|
||||
{
|
||||
use Concerns\CanBeAutofocused;
|
||||
use Concerns\CanAlternateLayoutDirection;
|
||||
use Concerns\CanBeInline;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->default(false)->inline();
|
||||
$this->default(false);
|
||||
|
||||
$this->inline();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace Filament\Forms\Components\Concerns;
|
||||
|
||||
trait CanAlternateLayoutDirection
|
||||
trait CanBeInline
|
||||
{
|
||||
protected $isInlineLayout = false;
|
||||
protected $isInline = false;
|
||||
|
||||
public function inline()
|
||||
{
|
||||
$this->configure(function () {
|
||||
$this->isInlineLayout = true;
|
||||
$this->isInline = true;
|
||||
});
|
||||
|
||||
return $this;
|
||||
@@ -18,14 +18,14 @@ trait CanAlternateLayoutDirection
|
||||
public function stacked()
|
||||
{
|
||||
$this->configure(function () {
|
||||
$this->isInlineLayout = false;
|
||||
$this->isInline = false;
|
||||
});
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isInlineLayout(): bool
|
||||
public function isInline()
|
||||
{
|
||||
return $this->isInlineLayout;
|
||||
return $this->isInline;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use Filament\Forms\Components\Field;
|
||||
class Toggle extends Field
|
||||
{
|
||||
use Concerns\CanBeAutofocused;
|
||||
use Concerns\CanAlternateLayoutDirection;
|
||||
use Concerns\CanBeInline;
|
||||
|
||||
protected $onIcon;
|
||||
|
||||
@@ -16,7 +16,9 @@ class Toggle extends Field
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->default(false)->inline();
|
||||
$this->default(false);
|
||||
|
||||
$this->inline();
|
||||
}
|
||||
|
||||
public function onIcon($icon)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Resources\Forms\Components\Concerns;
|
||||
|
||||
trait CanBeInline
|
||||
{
|
||||
use \Filament\Forms\Components\Concerns\CanBeInline;
|
||||
}
|
||||
Reference in New Issue
Block a user