Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix form fields ax-load issue on spa-mode #9204

Merged
merged 13 commits into from
Nov 20, 2023
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@php
use Filament\Support\Facades\FilamentView;

$isDisabled = $isDisabled();
$isPrefixInline = $isPrefixInline();
$isSuffixInline = $isSuffixInline();
Expand Down Expand Up @@ -32,7 +34,11 @@
>
<div
x-ignore
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('color-picker', 'filament/forms') }}"
x-data="colorPickerFormComponent({
isAutofocused: @js($isAutofocused()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@php
use Filament\Support\Facades\FilamentView;

$datalistOptions = $getDatalistOptions();
$extraAlpineAttributes = $getExtraAlpineAttributes();
$id = $getId();
Expand Down Expand Up @@ -57,7 +59,12 @@
@else
<div
x-ignore
ax-load
@if (FilamentView::hasSpaMode())
wire:ignore
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('date-time-picker', 'filament/forms') }}"
x-data="dateTimePickerFormComponent({
displayFormat:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@php
use Filament\Support\Enums\Alignment;
use Filament\Support\Facades\FilamentView;
@endphp

<x-dynamic-component
Expand All @@ -24,7 +25,11 @@
@endphp

<div
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('file-upload', 'filament/forms') }}"
x-data="fileUploadFormComponent({
acceptedFileTypes: @js($getAcceptedFileTypes()),
Expand Down
10 changes: 9 additions & 1 deletion packages/forms/resources/views/components/key-value.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@php
use Filament\Support\Facades\FilamentView;
@endphp

<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
@php
$debounce = $getLiveDebounce();
Expand All @@ -24,7 +28,11 @@
}}
>
<div
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('key-value', 'filament/forms') }}"
wire:ignore
x-data="keyValueFormComponent({
Expand Down
10 changes: 9 additions & 1 deletion packages/forms/resources/views/components/rich-editor.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@php
use Filament\Support\Facades\FilamentView;
@endphp

<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
@php
$id = $getId();
Expand Down Expand Up @@ -25,7 +29,11 @@ class="fi-fo-rich-editor fi-disabled prose block w-full max-w-none rounded-lg bg
}}
>
<div
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('rich-editor', 'filament/forms') }}"
x-data="richEditorFormComponent({
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
Expand Down
8 changes: 7 additions & 1 deletion packages/forms/resources/views/components/select.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@php
use Filament\Support\Facades\FilamentView;

$canSelectPlaceholder = $canSelectPlaceholder();
$isDisabled = $isDisabled();
$isPrefixInline = $isPrefixInline();
Expand Down Expand Up @@ -89,7 +91,11 @@ class="fi-fo-select"
@else
<div
x-ignore
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('select', 'filament/forms') }}"
x-data="selectFormComponent({
canSelectPlaceholder: @js($canSelectPlaceholder),
Expand Down
10 changes: 9 additions & 1 deletion packages/forms/resources/views/components/tags-input.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@php
use Filament\Support\Facades\FilamentView;
@endphp

<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
@php
$id = $getId();
Expand All @@ -6,7 +10,11 @@
@endphp

<div
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('tags-input', 'filament/forms') }}"
x-data="tagsInputFormComponent({
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
Expand Down
8 changes: 7 additions & 1 deletion packages/forms/resources/views/components/textarea.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@php
use Filament\Support\Facades\FilamentView;

$isConcealed = $isConcealed();
$rows = $getRows();
$shouldAutosize = $shouldAutosize();
Expand All @@ -10,7 +12,11 @@
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<textarea
@if ($shouldAutosize)
ax-load
@if (FilamentView::hasSpaMode())
ax-load="visible"
@else
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('textarea', 'filament/forms') }}"
x-data="textareaFormComponent({ initialHeight: @js($initialHeight) })"
x-ignore
Expand Down