@php use Filament\Support\Enums\Alignment; use Filament\Support\Facades\FilamentView; $imageCropAspectRatio = $getImageCropAspectRatio(); $imageResizeTargetHeight = $getImageResizeTargetHeight(); $imageResizeTargetWidth = $getImageResizeTargetWidth(); $isAvatar = $isAvatar(); $statePath = $getStatePath(); $isDisabled = $isDisabled(); $hasImageEditor = $hasImageEditor(); $hasCircleCropper = $hasCircleCropper(); $alignment = $getAlignment() ?? Alignment::Start; if (! $alignment instanceof Alignment) { $alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null; } @endphp
{ return await $wire.removeFormUploadedFile(@js($statePath), fileKey) }, removeUploadedFileButtonPosition: @js($getRemoveUploadedFileButtonPosition()), reorderUploadedFilesUsing: async (files) => { return await $wire.reorderFormUploadedFiles(@js($statePath), files) }, shouldAppendFiles: @js($shouldAppendFiles()), shouldOrientImageFromExif: @js($shouldOrientImagesFromExif()), shouldTransformImage: @js($imageCropAspectRatio || $imageResizeTargetHeight || $imageResizeTargetWidth), state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }}, uploadButtonPosition: @js($getUploadButtonPosition()), uploadingMessage: @js($getUploadingMessage()), uploadProgressIndicatorPosition: @js($getUploadProgressIndicatorPosition()), uploadUsing: (fileKey, file, success, error, progress) => { $wire.upload( `{{ $statePath }}.${fileKey}`, file, () => { success(fileKey) }, error, (progressEvent) => { progress(true, progressEvent.detail.progress, 100) }, ) }, })" wire:ignore x-ignore {{ $attributes ->merge([ 'id' => $getId(), ], escape: false) ->merge($getExtraAttributes(), escape: false) ->merge($getExtraAlpineAttributes(), escape: false) ->class([ 'fi-fo-file-upload flex [&_.filepond--root]:font-sans', match ($alignment) { Alignment::Start => 'justify-start', Alignment::Center => 'justify-center', Alignment::End => 'justify-end', Alignment::Left => 'justify-left', Alignment::Right => 'justify-right', Alignment::Between, Alignment::Justify => 'justify-between', default => $alignment, }, ]) }} >
$isAvatar, 'w-full' => ! $isAvatar, ]) > merge([ 'disabled' => $isDisabled, 'multiple' => $isMultiple(), 'type' => 'file', ], escape: false) }} />
@if ($hasImageEditor && (! $isDisabled))
$hasCircleCropper, ]) >
@foreach ([ [ 'label' => __('filament-forms::components.file_upload.editor.fields.x_position.label'), 'ref' => 'xPositionInput', 'unit' => __('filament-forms::components.file_upload.editor.fields.x_position.unit'), 'alpineSaveHandler' => 'editor.setData({...editor.getData(true), x: +$el.value})', ], [ 'label' => __('filament-forms::components.file_upload.editor.fields.y_position.label'), 'ref' => 'yPositionInput', 'unit' => __('filament-forms::components.file_upload.editor.fields.y_position.unit'), 'alpineSaveHandler' => 'editor.setData({...editor.getData(true), y: +$el.value})', ], [ 'label' => __('filament-forms::components.file_upload.editor.fields.width.label'), 'ref' => 'widthInput', 'unit' => __('filament-forms::components.file_upload.editor.fields.width.unit'), 'alpineSaveHandler' => 'editor.setData({...editor.getData(true), width: +$el.value})', ], [ 'label' => __('filament-forms::components.file_upload.editor.fields.height.label'), 'ref' => 'heightInput', 'unit' => __('filament-forms::components.file_upload.editor.fields.height.unit'), 'alpineSaveHandler' => 'editor.setData({...editor.getData(true), height: +$el.value})', ], [ 'label' => __('filament-forms::components.file_upload.editor.fields.rotation.label'), 'ref' => 'rotationInput', 'unit' => __('filament-forms::components.file_upload.editor.fields.rotation.unit'), 'alpineSaveHandler' => 'editor.rotateTo(+$el.value)', ], ] as $input) @endforeach
@foreach ($getImageEditorActions(iconSizeClasses: 'h-5 w-5 mx-auto') as $groupedActions) @foreach ($groupedActions as $action) {{ $action['label'] }} @endforeach @endforeach
@if (count($aspectRatios = $getImageEditorAspectRatiosForJs()))
{{ __('filament-forms::components.file_upload.editor.aspect_ratios.label') }}
@foreach (collect($aspectRatios)->chunk(5) as $ratiosChunk) @foreach ($ratiosChunk as $label => $ratio) {{ $label }} @endforeach @endforeach
@endif
{{ __('filament-forms::components.file_upload.editor.actions.cancel.label') }} {{ __('filament-forms::components.file_upload.editor.actions.reset.label') }} {{ __('filament-forms::components.file_upload.editor.actions.save.label') }}
@endif