phases one of time logged now with log display
This commit is contained in:
+65
-118
@@ -44,34 +44,17 @@
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{
|
||||
$attributes
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->class([
|
||||
'fi-fo-builder',
|
||||
'fi-collapsible' => $isCollapsible,
|
||||
])
|
||||
}}
|
||||
>
|
||||
{{ $attributes->merge($getExtraAttributes(), escape: false)->class(['fi-fo-builder', 'fi-collapsible' => $isCollapsible]) }}>
|
||||
@if ($collapseAllActionIsVisible || $expandAllActionIsVisible)
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-builder-actions',
|
||||
'fi-hidden' => count($items) < 2,
|
||||
])
|
||||
>
|
||||
<div @class(['fi-fo-builder-actions', 'fi-hidden' => count($items) < 2])>
|
||||
@if ($collapseAllActionIsVisible)
|
||||
<span
|
||||
x-on:click="$dispatch('builder-collapse', '{{ $statePath }}')"
|
||||
>
|
||||
<span x-on:click="$dispatch('builder-collapse', '{{ $statePath }}')">
|
||||
{{ $collapseAllAction }}
|
||||
</span>
|
||||
@endif
|
||||
|
||||
@if ($expandAllActionIsVisible)
|
||||
<span
|
||||
x-on:click="$dispatch('builder-expand', '{{ $statePath }}')"
|
||||
>
|
||||
<span x-on:click="$dispatch('builder-expand', '{{ $statePath }}')">
|
||||
{{ $expandAllAction }}
|
||||
</span>
|
||||
@endif
|
||||
@@ -79,9 +62,7 @@
|
||||
@endif
|
||||
|
||||
@if (count($items))
|
||||
<ul
|
||||
x-sortable
|
||||
data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}"
|
||||
<ul x-sortable data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}"
|
||||
x-on:end.stop="
|
||||
$wire.mountAction(
|
||||
'reorder',
|
||||
@@ -89,8 +70,7 @@
|
||||
{ schemaComponent: '{{ $key }}' },
|
||||
)
|
||||
"
|
||||
class="fi-fo-builder-items"
|
||||
>
|
||||
class="fi-fo-builder-items">
|
||||
@php
|
||||
$hasBlockLabels = $hasBlockLabels();
|
||||
$hasBlockIcons = $hasBlockIcons();
|
||||
@@ -102,7 +82,7 @@
|
||||
@php
|
||||
$visibleExtraItemActions = array_filter(
|
||||
$extraItemActions,
|
||||
fn (Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
fn(Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
);
|
||||
$cloneAction = $cloneAction(['item' => $itemKey]);
|
||||
$cloneActionIsVisible = $isCloneable && $cloneAction->isVisible();
|
||||
@@ -115,39 +95,33 @@
|
||||
$moveUpAction = $moveUpAction(['item' => $itemKey])->disabled($loop->first);
|
||||
$moveUpActionIsVisible = $isReorderableWithButtons && $moveUpAction->isVisible();
|
||||
$reorderActionIsVisible = $isReorderableWithDragAndDrop && $reorderAction->isVisible();
|
||||
$hasItemHeader = $hasBlockHeaders && ($reorderActionIsVisible || $moveUpActionIsVisible || $moveDownActionIsVisible || $hasBlockIcons || $hasBlockLabels || $editActionIsVisible || $cloneActionIsVisible || $deleteActionIsVisible || $isCollapsible || $visibleExtraItemActions);
|
||||
$hasItemHeader =
|
||||
$hasBlockHeaders &&
|
||||
($reorderActionIsVisible ||
|
||||
$moveUpActionIsVisible ||
|
||||
$moveDownActionIsVisible ||
|
||||
$hasBlockIcons ||
|
||||
$hasBlockLabels ||
|
||||
$editActionIsVisible ||
|
||||
$cloneActionIsVisible ||
|
||||
$deleteActionIsVisible ||
|
||||
$isCollapsible ||
|
||||
$visibleExtraItemActions);
|
||||
@endphp
|
||||
|
||||
<li
|
||||
wire:ignore.self
|
||||
wire:key="{{ $item->getLivewireKey() }}.item"
|
||||
x-data="{
|
||||
isCollapsed: @if ($persistCollapsed) $persist(@js($isCollapsed($item))).as(`builder-${@js($key)}-${@js($itemKey)}-isCollapsed`) @else @js($isCollapsed($item)) @endif,
|
||||
}"
|
||||
<li wire:ignore.self wire:key="{{ $item->getLivewireKey() }}.item" x-data="{
|
||||
isCollapsed: @if ($persistCollapsed) $persist(@js($isCollapsed($item))).as(`builder-${@js($key)}-${@js($itemKey)}-isCollapsed`) @else @js($isCollapsed($item)) @endif,
|
||||
}"
|
||||
x-on:builder-expand.window="$event.detail === '{{ $statePath }}' && (isCollapsed = false)"
|
||||
x-on:builder-collapse.window="$event.detail === '{{ $statePath }}' && (isCollapsed = true)"
|
||||
x-on:expand="isCollapsed = false"
|
||||
x-sortable-item="{{ $itemKey }}"
|
||||
{{
|
||||
$item->getParentComponent()->getExtraAttributeBag()
|
||||
->class([
|
||||
'fi-fo-builder-item',
|
||||
'fi-fo-builder-item-has-header' => $hasItemHeader,
|
||||
])
|
||||
}}
|
||||
x-bind:class="{ 'fi-collapsed': isCollapsed }"
|
||||
>
|
||||
x-on:expand="isCollapsed = false" x-sortable-item="{{ $itemKey }}"
|
||||
{{ $item->getParentComponent()->getExtraAttributeBag()->class(['fi-fo-builder-item', 'fi-fo-builder-item-has-header' => $hasItemHeader]) }}
|
||||
x-bind:class="{ 'fi-collapsed': isCollapsed }">
|
||||
@if ($hasItemHeader)
|
||||
<div
|
||||
@if ($isCollapsible)
|
||||
x-on:click.stop="isCollapsed = !isCollapsed"
|
||||
@endif
|
||||
class="fi-fo-builder-item-header"
|
||||
>
|
||||
<div @if ($isCollapsible) x-on:click.stop="isCollapsed = !isCollapsed" @endif
|
||||
class="fi-fo-builder-item-header">
|
||||
@if ($reorderActionIsVisible || $moveUpActionIsVisible || $moveDownActionIsVisible)
|
||||
<ul
|
||||
class="fi-fo-builder-item-header-start-actions"
|
||||
>
|
||||
<ul class="fi-fo-builder-item-header-start-actions">
|
||||
@if ($reorderActionIsVisible)
|
||||
<li x-on:click.stop>
|
||||
{{ $reorderAction->extraAttributes(['x-sortable-handle' => true], merge: true) }}
|
||||
@@ -171,28 +145,29 @@
|
||||
@endphp
|
||||
|
||||
@if ($hasBlockIcons && filled($blockIcon))
|
||||
{{ \Filament\Support\generate_icon_html($blockIcon, attributes: (new \Illuminate\View\ComponentAttributeBag)->class(['fi-fo-builder-item-header-icon'])) }}
|
||||
{{ \Filament\Support\generate_icon_html($blockIcon, attributes: new \Illuminate\View\ComponentAttributeBag()->class(['fi-fo-builder-item-header-icon'])) }}
|
||||
@endif
|
||||
|
||||
@if ($hasBlockLabels)
|
||||
<{{ $blockLabelHeadingTag }}
|
||||
@class([
|
||||
'fi-fo-builder-item-header-label',
|
||||
'fi-truncated' => $isBlockLabelTruncated,
|
||||
])
|
||||
>
|
||||
<{{ $blockLabelHeadingTag }} @class([
|
||||
'fi-fo-builder-item-header-label',
|
||||
'fi-truncated' => $isBlockLabelTruncated,
|
||||
])>
|
||||
{{ $item->getParentComponent()->getLabel($item->getRawState(), $itemKey, $loop->index) }}
|
||||
|
||||
@if ($hasBlockNumbers)
|
||||
{{ $loop->iteration }}
|
||||
@endif
|
||||
</{{ $blockLabelHeadingTag }}>
|
||||
</{{ $blockLabelHeadingTag }}>
|
||||
@endif
|
||||
|
||||
@if ($editActionIsVisible || $cloneActionIsVisible || $deleteActionIsVisible || $isCollapsible || $visibleExtraItemActions)
|
||||
<ul
|
||||
class="fi-fo-builder-item-header-end-actions"
|
||||
>
|
||||
@if (
|
||||
$editActionIsVisible ||
|
||||
$cloneActionIsVisible ||
|
||||
$deleteActionIsVisible ||
|
||||
$isCollapsible ||
|
||||
$visibleExtraItemActions)
|
||||
<ul class="fi-fo-builder-item-header-end-actions">
|
||||
@foreach ($visibleExtraItemActions as $extraItemAction)
|
||||
<li x-on:click.stop>
|
||||
{{ $extraItemAction(['item' => $itemKey]) }}
|
||||
@@ -218,19 +193,13 @@
|
||||
@endif
|
||||
|
||||
@if ($isCollapsible)
|
||||
<li
|
||||
class="fi-fo-builder-item-header-collapsible-actions"
|
||||
x-on:click.stop="isCollapsed = !isCollapsed"
|
||||
>
|
||||
<div
|
||||
class="fi-fo-builder-item-header-collapse-action"
|
||||
>
|
||||
<li class="fi-fo-builder-item-header-collapsible-actions"
|
||||
x-on:click.stop="isCollapsed = !isCollapsed">
|
||||
<div class="fi-fo-builder-item-header-collapse-action">
|
||||
{{ $getAction('collapse') }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="fi-fo-builder-item-header-expand-action"
|
||||
>
|
||||
<div class="fi-fo-builder-item-header-expand-action">
|
||||
{{ $getAction('expand') }}
|
||||
</div>
|
||||
</li>
|
||||
@@ -240,29 +209,23 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
x-show="! isCollapsed"
|
||||
@class([
|
||||
'fi-fo-builder-item-content',
|
||||
'fi-fo-builder-item-content-has-preview' => $hasBlockPreviews && $item->getParentComponent()->hasPreview(),
|
||||
])
|
||||
>
|
||||
<div x-show="! isCollapsed" @class([
|
||||
'fi-fo-builder-item-content',
|
||||
'fi-fo-builder-item-content-has-preview' =>
|
||||
$hasBlockPreviews && $item->getParentComponent()->hasPreview(),
|
||||
])>
|
||||
@if ($hasBlockPreviews && $item->getParentComponent()->hasPreview())
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-builder-item-preview',
|
||||
'fi-interactive' => $hasInteractiveBlockPreviews,
|
||||
])
|
||||
>
|
||||
<div @class([
|
||||
'fi-fo-builder-item-preview',
|
||||
'fi-interactive' => $hasInteractiveBlockPreviews,
|
||||
])>
|
||||
{{ $item->getParentComponent()->renderPreview($item->getRawState()) }}
|
||||
</div>
|
||||
|
||||
@if ($editActionIsVisible && (! $hasInteractiveBlockPreviews))
|
||||
<div
|
||||
class="fi-fo-builder-item-preview-edit-overlay"
|
||||
role="button"
|
||||
x-on:click.stop="{{ '$wire.mountAction(\'edit\', { item: \'' . $itemKey . '\' }, { schemaComponent: \'' . $key . '\' })' }}"
|
||||
></div>
|
||||
@if ($editActionIsVisible && !$hasInteractiveBlockPreviews)
|
||||
<div class="fi-fo-builder-item-preview-edit-overlay" role="button"
|
||||
x-on:click.stop="{{ '$wire.mountAction(\'edit\', { item: \'' . $itemKey . '\' }, { schemaComponent: \'' . $key . '\' })' }}">
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
{{ $item }}
|
||||
@@ -270,19 +233,13 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@if (! $loop->last)
|
||||
@if (!$loop->last)
|
||||
@if ($isAddable && $addBetweenAction(['afterItem' => $itemKey])->isVisible())
|
||||
<li class="fi-fo-builder-add-between-items-ctn">
|
||||
<div class="fi-fo-builder-add-between-items">
|
||||
<div class="fi-fo-builder-block-picker-ctn">
|
||||
<x-filament-forms::builder.block-picker
|
||||
:action="$addBetweenAction"
|
||||
:after-item="$itemKey"
|
||||
:columns="$blockPickerColumns"
|
||||
:blocks="$blockPickerBlocks"
|
||||
:key="$key"
|
||||
:width="$blockPickerWidth"
|
||||
>
|
||||
<x-filament-forms::builder.block-picker :action="$addBetweenAction" :after-item="$itemKey"
|
||||
:columns="$blockPickerColumns" :blocks="$blockPickerBlocks" :key="$key" :width="$blockPickerWidth">
|
||||
<x-slot name="trigger">
|
||||
{{ $addBetweenAction(['afterItem' => $itemKey]) }}
|
||||
</x-slot>
|
||||
@@ -292,17 +249,13 @@
|
||||
</li>
|
||||
@elseif (filled($labelBetweenItems))
|
||||
<li class="fi-fo-builder-label-between-items-ctn">
|
||||
<div
|
||||
class="fi-fo-builder-label-between-items-divider-before"
|
||||
></div>
|
||||
<div class="fi-fo-builder-label-between-items-divider-before"></div>
|
||||
|
||||
<span class="fi-fo-builder-label-between-items">
|
||||
{{ $labelBetweenItems }}
|
||||
</span>
|
||||
|
||||
<div
|
||||
class="fi-fo-builder-label-between-items-divider-after"
|
||||
></div>
|
||||
<div class="fi-fo-builder-label-between-items-divider-after"></div>
|
||||
</li>
|
||||
@endif
|
||||
@endif
|
||||
@@ -311,14 +264,8 @@
|
||||
@endif
|
||||
|
||||
@if ($isAddable && $addAction->isVisible())
|
||||
<x-filament-forms::builder.block-picker
|
||||
:action="$addAction"
|
||||
:action-alignment="$addActionAlignment"
|
||||
:blocks="$blockPickerBlocks"
|
||||
:columns="$blockPickerColumns"
|
||||
:key="$key"
|
||||
:width="$blockPickerWidth"
|
||||
>
|
||||
<x-filament-forms::builder.block-picker :action="$addAction" :action-alignment="$addActionAlignment" :blocks="$blockPickerBlocks"
|
||||
:columns="$blockPickerColumns" :key="$key" :width="$blockPickerWidth">
|
||||
<x-slot name="trigger">
|
||||
{{ $addAction }}
|
||||
</x-slot>
|
||||
|
||||
+12
-27
@@ -15,33 +15,22 @@
|
||||
'width' => null,
|
||||
])
|
||||
|
||||
<x-filament::dropdown
|
||||
:placement="
|
||||
match ($actionAlignment) {
|
||||
Alignment::Start, Alignment::Left => 'bottom-start',
|
||||
Alignment::End, Alignment::Right => 'bottom-end',
|
||||
default => null,
|
||||
}
|
||||
"
|
||||
shift
|
||||
:width="$width"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes(
|
||||
$attributes->class([
|
||||
'fi-fo-builder-block-picker',
|
||||
($actionAlignment instanceof Alignment) ? ('fi-align-' . $actionAlignment->value) : $actionAlignment,
|
||||
]),
|
||||
)
|
||||
"
|
||||
>
|
||||
<x-filament::dropdown :placement="match ($actionAlignment) {
|
||||
Alignment::Start, Alignment::Left => 'bottom-start',
|
||||
Alignment::End, Alignment::Right => 'bottom-end',
|
||||
default => null,
|
||||
}" shift :width="$width" :attributes="\Filament\Support\prepare_inherited_attributes(
|
||||
$attributes->class([
|
||||
'fi-fo-builder-block-picker',
|
||||
$actionAlignment instanceof Alignment ? 'fi-align-' . $actionAlignment->value : $actionAlignment,
|
||||
]),
|
||||
)">
|
||||
<x-slot name="trigger">
|
||||
{{ $trigger }}
|
||||
</x-slot>
|
||||
|
||||
<x-filament::dropdown.list>
|
||||
<div
|
||||
{{ (new ComponentAttributeBag)->grid($columns, GridDirection::Column) }}
|
||||
>
|
||||
<div {{ new ComponentAttributeBag()->grid($columns, GridDirection::Column) }}>
|
||||
@foreach ($blocks as $block)
|
||||
@php
|
||||
$blockIcon = $block->getIcon();
|
||||
@@ -57,11 +46,7 @@
|
||||
$wireClickAction = "mountAction('{$action->getName()}', {$wireClickActionArguments}, { schemaComponent: '{$key}' })";
|
||||
@endphp
|
||||
|
||||
<x-filament::dropdown.list.item
|
||||
:icon="$blockIcon"
|
||||
x-on:click="close"
|
||||
:wire:click="$wireClickAction"
|
||||
>
|
||||
<x-filament::dropdown.list.item :icon="$blockIcon" x-on:click="close" :wire:click="$wireClickAction">
|
||||
{{ $block->getLabel() }}
|
||||
</x-filament::dropdown.list.item>
|
||||
@endforeach
|
||||
|
||||
@@ -15,50 +15,30 @@
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
x-load
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('checkbox-list', 'filament/forms') }}"
|
||||
x-data="checkboxListFormComponent({
|
||||
livewireId: @js($this->getId()),
|
||||
})"
|
||||
{{ $getExtraAlpineAttributeBag()->class(['fi-fo-checkbox-list']) }}
|
||||
>
|
||||
@if (! $isDisabled)
|
||||
livewireId: @js($this->getId()),
|
||||
})" {{ $getExtraAlpineAttributeBag()->class(['fi-fo-checkbox-list']) }}>
|
||||
@if (!$isDisabled)
|
||||
@if ($isSearchable)
|
||||
<x-filament::input.wrapper
|
||||
inline-prefix
|
||||
:prefix-icon="\Filament\Support\Icons\Heroicon::MagnifyingGlass"
|
||||
:prefix-icon-alias="\Filament\Forms\View\FormsIconAlias::COMPONENTS_CHECKBOX_LIST_SEARCH_FIELD"
|
||||
class="fi-fo-checkbox-list-search-input-wrp"
|
||||
>
|
||||
<input
|
||||
placeholder="{{ $getSearchPrompt() }}"
|
||||
type="search"
|
||||
<x-filament::input.wrapper inline-prefix :prefix-icon="\Filament\Support\Icons\Heroicon::MagnifyingGlass" :prefix-icon-alias="\Filament\Forms\View\FormsIconAlias::COMPONENTS_CHECKBOX_LIST_SEARCH_FIELD"
|
||||
class="fi-fo-checkbox-list-search-input-wrp">
|
||||
<input placeholder="{{ $getSearchPrompt() }}" type="search"
|
||||
x-model.debounce.{{ $getSearchDebounce() }}="search"
|
||||
class="fi-input fi-input-has-inline-prefix"
|
||||
/>
|
||||
class="fi-input fi-input-has-inline-prefix" />
|
||||
</x-filament::input.wrapper>
|
||||
@endif
|
||||
|
||||
@if ($isBulkToggleable && count($options))
|
||||
<div
|
||||
x-cloak
|
||||
class="fi-fo-checkbox-list-actions"
|
||||
wire:key="{{ $livewireKey }}.actions"
|
||||
>
|
||||
<span
|
||||
x-show="! areAllCheckboxesChecked"
|
||||
x-on:click="toggleAllCheckboxes()"
|
||||
wire:key="{{ $livewireKey }}.actions.select-all"
|
||||
>
|
||||
<div x-cloak class="fi-fo-checkbox-list-actions" wire:key="{{ $livewireKey }}.actions">
|
||||
<span x-show="! areAllCheckboxesChecked" x-on:click="toggleAllCheckboxes()"
|
||||
wire:key="{{ $livewireKey }}.actions.select-all">
|
||||
{{ $getAction('selectAll') }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
x-show="areAllCheckboxesChecked"
|
||||
x-on:click="toggleAllCheckboxes()"
|
||||
wire:key="{{ $livewireKey }}.actions.deselect-all"
|
||||
>
|
||||
<span x-show="areAllCheckboxesChecked" x-on:click="toggleAllCheckboxes()"
|
||||
wire:key="{{ $livewireKey }}.actions.deselect-all">
|
||||
{{ $getAction('deselectAll') }}
|
||||
</span>
|
||||
</div>
|
||||
@@ -66,22 +46,15 @@
|
||||
@endif
|
||||
|
||||
<div
|
||||
{{
|
||||
$getExtraAttributeBag()
|
||||
->grid($getColumns(), $gridDirection)
|
||||
->merge([
|
||||
{{ $getExtraAttributeBag()->grid($getColumns(), $gridDirection)->merge(
|
||||
[
|
||||
'x-show' => $isSearchable ? 'visibleCheckboxListOptions.length' : null,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-fo-checkbox-list-options',
|
||||
])
|
||||
}}
|
||||
>
|
||||
],
|
||||
escape: false,
|
||||
)->class(['fi-fo-checkbox-list-options']) }}>
|
||||
@forelse ($options as $value => $label)
|
||||
<div
|
||||
wire:key="{{ $livewireKey }}.options.{{ $value }}"
|
||||
@if ($isSearchable)
|
||||
x-show="
|
||||
<div wire:key="{{ $livewireKey }}.options.{{ $value }}"
|
||||
@if ($isSearchable) x-show="
|
||||
$el
|
||||
.querySelector('.fi-fo-checkbox-list-option-label')
|
||||
?.innerText.toLowerCase()
|
||||
@@ -90,29 +63,20 @@
|
||||
.querySelector('.fi-fo-checkbox-list-option-description')
|
||||
?.innerText.toLowerCase()
|
||||
.includes(search.toLowerCase())
|
||||
"
|
||||
@endif
|
||||
class="fi-fo-checkbox-list-option-ctn"
|
||||
>
|
||||
" @endif
|
||||
class="fi-fo-checkbox-list-option-ctn">
|
||||
<label class="fi-fo-checkbox-list-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
{{
|
||||
$extraInputAttributeBag
|
||||
->merge([
|
||||
<input type="checkbox"
|
||||
{{ $extraInputAttributeBag->merge(
|
||||
[
|
||||
'disabled' => $isDisabled || $isOptionDisabled($value, $label),
|
||||
'value' => e($value),
|
||||
'wire:loading.attr' => 'disabled',
|
||||
$wireModelAttribute => $statePath,
|
||||
'x-on:change' => $isBulkToggleable ? 'checkIfAllCheckboxesAreChecked()' : null,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-checkbox-input',
|
||||
'fi-valid' => ! $errors->has($statePath),
|
||||
'fi-invalid' => $errors->has($statePath),
|
||||
])
|
||||
}}
|
||||
/>
|
||||
],
|
||||
escape: false,
|
||||
)->class(['fi-checkbox-input', 'fi-valid' => !$errors->has($statePath), 'fi-invalid' => $errors->has($statePath)]) }} />
|
||||
|
||||
<div class="fi-fo-checkbox-list-option-text">
|
||||
<span class="fi-fo-checkbox-list-option-label">
|
||||
@@ -124,9 +88,7 @@
|
||||
</span>
|
||||
|
||||
@if ($hasDescription($value))
|
||||
<p
|
||||
class="fi-fo-checkbox-list-option-description"
|
||||
>
|
||||
<p class="fi-fo-checkbox-list-option-description">
|
||||
{{ $getDescription($value) }}
|
||||
</p>
|
||||
@endif
|
||||
@@ -139,11 +101,8 @@
|
||||
</div>
|
||||
|
||||
@if ($isSearchable)
|
||||
<div
|
||||
x-cloak
|
||||
x-show="search && ! visibleCheckboxListOptions.length"
|
||||
class="fi-fo-checkbox-list-no-search-results-message"
|
||||
>
|
||||
<div x-cloak x-show="search && ! visibleCheckboxListOptions.length"
|
||||
class="fi-fo-checkbox-list-no-search-results-message">
|
||||
{{ $getNoSearchResultsMessage() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -2,28 +2,27 @@
|
||||
$fieldWrapperView = $getFieldWrapperView();
|
||||
$statePath = $getStatePath();
|
||||
$attributes = $attributes
|
||||
->merge([
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled(),
|
||||
'id' => $getId(),
|
||||
'required' => $isRequired() && (! $isConcealed()),
|
||||
'wire:loading.attr' => 'disabled',
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
], escape: false)
|
||||
->merge(
|
||||
[
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled(),
|
||||
'id' => $getId(),
|
||||
'required' => $isRequired() && !$isConcealed(),
|
||||
'wire:loading.attr' => 'disabled',
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
],
|
||||
escape: false,
|
||||
)
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->merge($getExtraInputAttributes(), escape: false)
|
||||
->class([
|
||||
'fi-checkbox-input',
|
||||
'fi-valid' => ! $errors->has($statePath),
|
||||
'fi-valid' => !$errors->has($statePath),
|
||||
'fi-invalid' => $errors->has($statePath),
|
||||
]);
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
:inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center"
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" :inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center">
|
||||
@if ($isInline())
|
||||
<x-slot name="labelPrefix">
|
||||
<input type="checkbox" {{ $attributes }} />
|
||||
|
||||
@@ -13,36 +13,21 @@
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:valid="! $errors->has($statePath)"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class(['fi-fo-code-editor'])
|
||||
"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :valid="!$errors->has($statePath)" :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class(['fi-fo-code-editor'])">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('code-editor', 'filament/forms') }}"
|
||||
x-data="codeEditorFormComponent({
|
||||
canWrap: @js($canWrap()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isLive: @js($isLive),
|
||||
isLiveDebounced: @js($isLiveDebounced),
|
||||
isLiveOnBlur: @js($isLiveOnBlur),
|
||||
liveDebounce: @js($liveDebounce),
|
||||
language: @js($language?->value),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
|
||||
})"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$isDisabled,
|
||||
$language?->value,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
{{ $getExtraAlpineAttributeBag() }}
|
||||
>
|
||||
canWrap: @js($canWrap()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isLive: @js($isLive),
|
||||
isLiveDebounced: @js($isLiveDebounced),
|
||||
isLiveOnBlur: @js($isLiveOnBlur),
|
||||
liveDebounce: @js($liveDebounce),
|
||||
language: @js($language?->value),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
|
||||
})" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{ substr(md5(serialize([$isDisabled, $language?->value])), 0, 64) }}"
|
||||
{{ $getExtraAlpineAttributeBag() }}>
|
||||
<div x-ref="editor" x-cloak></div>
|
||||
</div>
|
||||
</x-filament::input.wrapper>
|
||||
|
||||
@@ -20,94 +20,63 @@
|
||||
$placeholder = $getPlaceholder();
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
:inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:inline-prefix="$isPrefixInline"
|
||||
:inline-suffix="$isSuffixInline"
|
||||
:prefix="$prefixLabel"
|
||||
:prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon"
|
||||
:prefix-icon-color="$prefixIconColor"
|
||||
:suffix="$suffixLabel"
|
||||
:suffix-actions="$suffixActions"
|
||||
:suffix-icon="$suffixIcon"
|
||||
:suffix-icon-color="$suffixIconColor"
|
||||
:valid="! $errors->has($statePath)"
|
||||
x-on:focus-input.stop="$el.querySelector('input')?.focus()"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class('fi-fo-color-picker')
|
||||
"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" :inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :inline-prefix="$isPrefixInline" :inline-suffix="$isSuffixInline" :prefix="$prefixLabel" :prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon" :prefix-icon-color="$prefixIconColor" :suffix="$suffixLabel" :suffix-actions="$suffixActions" :suffix-icon="$suffixIcon" :suffix-icon-color="$suffixIconColor"
|
||||
:valid="!$errors->has($statePath)" x-on:focus-input.stop="$el.querySelector('input')?.focus()" :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class('fi-fo-color-picker')">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('color-picker', 'filament/forms') }}"
|
||||
x-data="colorPickerFormComponent({
|
||||
isAutofocused: @js($isAutofocused()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isLive: @js($isLive),
|
||||
isLiveDebounced: @js($isLiveDebounced),
|
||||
isLiveOnBlur: @js($isLiveOnBlur),
|
||||
liveDebounce: @js($liveDebounce),
|
||||
state: $wire.$entangle('{{ $statePath }}'),
|
||||
})"
|
||||
x-on:keydown.esc="isOpen() && $event.stopPropagation()"
|
||||
isAutofocused: @js($isAutofocused()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isLive: @js($isLive),
|
||||
isLiveDebounced: @js($isLiveDebounced),
|
||||
isLiveOnBlur: @js($isLiveOnBlur),
|
||||
liveDebounce: @js($liveDebounce),
|
||||
state: $wire.$entangle('{{ $statePath }}'),
|
||||
})" x-on:keydown.esc="isOpen() && $event.stopPropagation()"
|
||||
x-on:focusout="if (isOpen() && ! $el.contains($event.relatedTarget)) $refs.panel.close()"
|
||||
{{ $getExtraAlpineAttributeBag()->class(['fi-input-wrp-content']) }}
|
||||
>
|
||||
<input
|
||||
x-on:focus="$refs.panel.open($refs.input)"
|
||||
x-on:keydown.enter.prevent.stop="togglePanelVisibility()"
|
||||
{{ $getExtraAlpineAttributeBag()->class(['fi-input-wrp-content']) }}>
|
||||
<input x-on:focus="$refs.panel.open($refs.input)" x-on:keydown.enter.prevent.stop="togglePanelVisibility()"
|
||||
x-ref="input"
|
||||
{{
|
||||
$getExtraInputAttributeBag()
|
||||
->merge([
|
||||
{{ $getExtraInputAttributeBag()->merge(
|
||||
[
|
||||
'autocomplete' => 'off',
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $getId(),
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'required' => $isRequired() && (! $isConcealed()),
|
||||
'required' => $isRequired() && !$isConcealed(),
|
||||
'type' => 'text',
|
||||
'x-model' . ($isLiveDebounced ? '.debounce.' . $liveDebounce : null) => 'state',
|
||||
'x-on:blur' => $isLiveOnBlur ? 'isOpen() ? null : commitState()' : null,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
])
|
||||
}}
|
||||
/>
|
||||
],
|
||||
escape: false,
|
||||
)->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' =>
|
||||
$isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' =>
|
||||
$isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
]) }} />
|
||||
|
||||
<div
|
||||
class="fi-fo-color-picker-preview my-auto me-3 size-5 shrink-0 rounded-full select-none"
|
||||
<div class="fi-fo-color-picker-preview my-auto me-3 size-5 shrink-0 rounded-full select-none"
|
||||
x-on:click="togglePanelVisibility()"
|
||||
x-bind:class="{
|
||||
'fi-empty': ! state,
|
||||
'fi-empty': !state,
|
||||
}"
|
||||
x-bind:style="{ 'background-color': state }"
|
||||
></div>
|
||||
x-bind:style="{ 'background-color': state }"></div>
|
||||
|
||||
<div
|
||||
wire:ignore.self
|
||||
wire:key="{{ $getLivewireKey() }}.panel"
|
||||
x-cloak
|
||||
x-float.placement.bottom-start.offset.flip.shift="{ offset: 8 }"
|
||||
x-ref="panel"
|
||||
class="fi-fo-color-picker-panel"
|
||||
>
|
||||
<div wire:ignore.self wire:key="{{ $getLivewireKey() }}.panel" x-cloak
|
||||
x-float.placement.bottom-start.offset.flip.shift="{ offset: 8 }" x-ref="panel"
|
||||
class="fi-fo-color-picker-panel">
|
||||
@php
|
||||
$tag = match ($getFormat()) {
|
||||
'hsl' => 'hsl-string',
|
||||
'rgb' => 'rgb-string',
|
||||
'rgba' => 'rgba-string',
|
||||
default => 'hex',
|
||||
} . '-color-picker';
|
||||
$tag =
|
||||
match ($getFormat()) {
|
||||
'hsl' => 'hsl-string',
|
||||
'rgb' => 'rgb-string',
|
||||
'rgba' => 'rgba-string',
|
||||
default => 'hex',
|
||||
} . '-color-picker';
|
||||
@endphp
|
||||
|
||||
<{{ $tag }} x-ref="picker" color="{{ $getState() }}" />
|
||||
|
||||
+66
-176
@@ -34,33 +34,17 @@
|
||||
$livewireKey = $getLivewireKey();
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
:inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:inline-prefix="$isPrefixInline"
|
||||
:inline-suffix="$isSuffixInline"
|
||||
:prefix="$prefixLabel"
|
||||
:prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon"
|
||||
:prefix-icon-color="$prefixIconColor"
|
||||
:suffix="$suffixLabel"
|
||||
:suffix-actions="$suffixActions"
|
||||
:suffix-icon="$suffixIcon"
|
||||
:suffix-icon-color="$suffixIconColor"
|
||||
:valid="! $errors->has($statePath)"
|
||||
x-on:focus-input.stop="$el.querySelector('input:not([type=hidden])')?.focus()"
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class(['fi-fo-date-time-picker'])"
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" :inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :inline-prefix="$isPrefixInline" :inline-suffix="$isSuffixInline" :prefix="$prefixLabel" :prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon" :prefix-icon-color="$prefixIconColor" :suffix="$suffixLabel" :suffix-actions="$suffixActions" :suffix-icon="$suffixIcon" :suffix-icon-color="$suffixIconColor"
|
||||
:valid="!$errors->has($statePath)" x-on:focus-input.stop="$el.querySelector('input:not([type=hidden])')?.focus()"
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class([
|
||||
'fi-fo-date-time-picker',
|
||||
])">
|
||||
@if ($isNative())
|
||||
<input
|
||||
{{
|
||||
$extraInputAttributeBag
|
||||
->merge($extraAlpineAttributes, escape: false)
|
||||
->merge([
|
||||
{{ $extraInputAttributeBag->merge($extraAlpineAttributes, escape: false)->merge(
|
||||
[
|
||||
'autofocus' => $isAutofocused,
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $id,
|
||||
@@ -69,62 +53,45 @@
|
||||
'min' => $hasTime ? $minDate : ($minDate ? \Carbon\Carbon::parse($minDate)->toDateString() : null),
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'readonly' => $isReadOnly,
|
||||
'required' => $isRequired && (! $isConcealed),
|
||||
'required' => $isRequired && !$isConcealed,
|
||||
'step' => $step,
|
||||
'type' => $type,
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
'x-data' => count($extraAlpineAttributes) ? '{}' : null,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
])
|
||||
}}
|
||||
/>
|
||||
],
|
||||
escape: false,
|
||||
)->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' =>
|
||||
$isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' =>
|
||||
$isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
]) }} />
|
||||
@else
|
||||
<div
|
||||
x-load
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('date-time-picker', 'filament/forms') }}"
|
||||
x-data="dateTimePickerFormComponent({
|
||||
defaultFocusedDate: @js($defaultFocusedDate),
|
||||
displayFormat:
|
||||
'{{ convert_date_format($getDisplayFormat())->to('day.js') }}',
|
||||
firstDayOfWeek: {{ $getFirstDayOfWeek() }},
|
||||
isAutofocused: @js($isAutofocused),
|
||||
locale: @js($getLocale()),
|
||||
shouldCloseOnDateSelection: @js($shouldCloseOnDateSelection()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
})"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$disabledDates,
|
||||
$isDisabled,
|
||||
$isReadOnly,
|
||||
$maxDate,
|
||||
$minDate,
|
||||
$hasDate,
|
||||
$hasTime,
|
||||
$hasSeconds,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
x-on:keydown.esc="isOpen() && $event.stopPropagation()"
|
||||
{{ $getExtraAlpineAttributeBag() }}
|
||||
>
|
||||
defaultFocusedDate: @js($defaultFocusedDate),
|
||||
displayFormat: '{{ convert_date_format($getDisplayFormat())->to('day.js') }}',
|
||||
firstDayOfWeek: {{ $getFirstDayOfWeek() }},
|
||||
isAutofocused: @js($isAutofocused),
|
||||
locale: @js($getLocale()),
|
||||
shouldCloseOnDateSelection: @js($shouldCloseOnDateSelection()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
})" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{ substr(
|
||||
md5(serialize([$disabledDates, $isDisabled, $isReadOnly, $maxDate, $minDate, $hasDate, $hasTime, $hasSeconds])),
|
||||
0,
|
||||
64,
|
||||
) }}"
|
||||
x-on:keydown.esc="isOpen() && $event.stopPropagation()" {{ $getExtraAlpineAttributeBag() }}>
|
||||
<input x-ref="maxDate" type="hidden" value="{{ $maxDate }}" />
|
||||
|
||||
<input x-ref="minDate" type="hidden" value="{{ $minDate }}" />
|
||||
|
||||
<input
|
||||
x-ref="disabledDates"
|
||||
type="hidden"
|
||||
value="{{ json_encode($disabledDates) }}"
|
||||
/>
|
||||
<input x-ref="disabledDates" type="hidden" value="{{ json_encode($disabledDates) }}" />
|
||||
|
||||
<button
|
||||
x-ref="button"
|
||||
x-on:click="togglePanelVisibility()"
|
||||
<button x-ref="button" x-on:click="togglePanelVisibility()"
|
||||
x-on:keydown.enter.prevent.stop="
|
||||
if (! $el.disabled) {
|
||||
isOpen() ? selectDate() : togglePanelVisibility()
|
||||
@@ -137,93 +104,42 @@
|
||||
x-on:keydown.backspace.prevent.stop="if (! $el.disabled) clearState()"
|
||||
x-on:keydown.clear.prevent.stop="if (! $el.disabled) clearState()"
|
||||
x-on:keydown.delete.prevent.stop="if (! $el.disabled) clearState()"
|
||||
aria-label="{{ $placeholder }}"
|
||||
type="button"
|
||||
tabindex="-1"
|
||||
@disabled($isDisabled || $isReadOnly)
|
||||
{{
|
||||
$getExtraTriggerAttributeBag()->class([
|
||||
'fi-fo-date-time-picker-trigger',
|
||||
])
|
||||
}}
|
||||
>
|
||||
<input
|
||||
@disabled($isDisabled)
|
||||
readonly
|
||||
placeholder="{{ $placeholder }}"
|
||||
wire:key="{{ $livewireKey }}.display-text"
|
||||
x-model="displayText"
|
||||
aria-label="{{ $placeholder }}" type="button" tabindex="-1" @disabled($isDisabled || $isReadOnly)
|
||||
{{ $getExtraTriggerAttributeBag()->class(['fi-fo-date-time-picker-trigger']) }}>
|
||||
<input @disabled($isDisabled) readonly placeholder="{{ $placeholder }}"
|
||||
wire:key="{{ $livewireKey }}.display-text" x-model="displayText"
|
||||
@if ($id = $getId()) id="{{ $id }}" @endif
|
||||
@class([
|
||||
'fi-fo-date-time-picker-display-text-input',
|
||||
])
|
||||
/>
|
||||
@class(['fi-fo-date-time-picker-display-text-input']) />
|
||||
</button>
|
||||
|
||||
<div
|
||||
x-ref="panel"
|
||||
x-cloak
|
||||
x-float.placement.bottom-start.offset.flip.shift="{ offset: 8 }"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.panel"
|
||||
@class([
|
||||
'fi-fo-date-time-picker-panel',
|
||||
])
|
||||
>
|
||||
<div x-ref="panel" x-cloak x-float.placement.bottom-start.offset.flip.shift="{ offset: 8 }" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.panel" @class(['fi-fo-date-time-picker-panel'])>
|
||||
@if ($hasDate)
|
||||
<div class="fi-fo-date-time-picker-panel-header">
|
||||
<select
|
||||
x-model="focusedMonth"
|
||||
class="fi-fo-date-time-picker-month-select"
|
||||
>
|
||||
<select x-model="focusedMonth" class="fi-fo-date-time-picker-month-select">
|
||||
<template x-for="(month, index) in months">
|
||||
<option
|
||||
x-bind:value="index"
|
||||
x-text="month"
|
||||
></option>
|
||||
<option x-bind:value="index" x-text="month"></option>
|
||||
</template>
|
||||
</select>
|
||||
|
||||
<input
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
x-model.debounce="focusedYear"
|
||||
class="fi-fo-date-time-picker-year-input"
|
||||
/>
|
||||
<input type="number" inputmode="numeric" x-model.debounce="focusedYear"
|
||||
class="fi-fo-date-time-picker-year-input" />
|
||||
</div>
|
||||
|
||||
<div class="fi-fo-date-time-picker-calendar-header">
|
||||
<template
|
||||
x-for="(day, index) in dayLabels"
|
||||
x-bind:key="index"
|
||||
>
|
||||
<div
|
||||
x-text="day"
|
||||
class="fi-fo-date-time-picker-calendar-header-day"
|
||||
></div>
|
||||
<template x-for="(day, index) in dayLabels" x-bind:key="index">
|
||||
<div x-text="day" class="fi-fo-date-time-picker-calendar-header-day"></div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div
|
||||
role="grid"
|
||||
class="fi-fo-date-time-picker-calendar"
|
||||
>
|
||||
<template
|
||||
x-for="day in emptyDaysInFocusedMonth"
|
||||
x-bind:key="day"
|
||||
>
|
||||
<div role="grid" class="fi-fo-date-time-picker-calendar">
|
||||
<template x-for="day in emptyDaysInFocusedMonth" x-bind:key="day">
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<template
|
||||
x-for="day in daysInFocusedMonth"
|
||||
x-bind:key="day"
|
||||
>
|
||||
<div
|
||||
x-text="day"
|
||||
x-on:click="dayIsDisabled(day) || selectDate(day)"
|
||||
x-on:mouseenter="setFocusedDay(day)"
|
||||
role="option"
|
||||
<template x-for="day in daysInFocusedMonth" x-bind:key="day">
|
||||
<div x-text="day" x-on:click="dayIsDisabled(day) || selectDate(day)"
|
||||
x-on:mouseenter="setFocusedDay(day)" role="option"
|
||||
x-bind:aria-selected="focusedDate.date() === day"
|
||||
x-bind:class="{
|
||||
'fi-fo-date-time-picker-calendar-day-today': dayIsToday(day),
|
||||
@@ -231,59 +147,33 @@
|
||||
'fi-selected': dayIsSelected(day),
|
||||
'fi-disabled': dayIsDisabled(day),
|
||||
}"
|
||||
class="fi-fo-date-time-picker-calendar-day"
|
||||
></div>
|
||||
class="fi-fo-date-time-picker-calendar-day"></div>
|
||||
</template>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($hasTime)
|
||||
<div class="fi-fo-date-time-picker-time-inputs">
|
||||
<input
|
||||
max="23"
|
||||
min="0"
|
||||
step="{{ $getHoursStep() }}"
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
x-on:blur="checkTimeInputValidity"
|
||||
x-on:invalid="timeInputInvalid"
|
||||
x-model.debounce="hour"
|
||||
/>
|
||||
<input max="23" min="0" step="{{ $getHoursStep() }}" type="number"
|
||||
inputmode="numeric" x-on:blur="checkTimeInputValidity" x-on:invalid="timeInputInvalid"
|
||||
x-model.debounce="hour" />
|
||||
|
||||
<span
|
||||
class="fi-fo-date-time-picker-time-input-separator"
|
||||
>
|
||||
<span class="fi-fo-date-time-picker-time-input-separator">
|
||||
:
|
||||
</span>
|
||||
|
||||
<input
|
||||
max="59"
|
||||
min="0"
|
||||
step="{{ $getMinutesStep() }}"
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
x-on:blur="checkTimeInputValidity"
|
||||
x-on:invalid="timeInputInvalid"
|
||||
x-model.debounce="minute"
|
||||
/>
|
||||
<input max="59" min="0" step="{{ $getMinutesStep() }}" type="number"
|
||||
inputmode="numeric" x-on:blur="checkTimeInputValidity" x-on:invalid="timeInputInvalid"
|
||||
x-model.debounce="minute" />
|
||||
|
||||
@if ($hasSeconds)
|
||||
<span
|
||||
class="fi-fo-date-time-picker-time-input-separator"
|
||||
>
|
||||
<span class="fi-fo-date-time-picker-time-input-separator">
|
||||
:
|
||||
</span>
|
||||
|
||||
<input
|
||||
max="59"
|
||||
min="0"
|
||||
step="{{ $getSecondsStep() }}"
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
x-on:blur="checkTimeInputValidity"
|
||||
x-on:invalid="timeInputInvalid"
|
||||
x-model.debounce="second"
|
||||
/>
|
||||
<input max="59" min="0" step="{{ $getSecondsStep() }}" type="number"
|
||||
inputmode="numeric" x-on:blur="checkTimeInputValidity"
|
||||
x-on:invalid="timeInputInvalid" x-model.debounce="second" />
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
if ($field) {
|
||||
$hasInlineLabel ??= $field->hasInlineLabel();
|
||||
$hasNestedRecursiveValidationRules ??= $field instanceof \Filament\Forms\Components\Contracts\HasNestedRecursiveValidationRules;
|
||||
$hasNestedRecursiveValidationRules ??=
|
||||
$field instanceof \Filament\Forms\Components\Contracts\HasNestedRecursiveValidationRules;
|
||||
$id ??= $field->getId();
|
||||
$isDisabled ??= $field->isDisabled();
|
||||
$label ??= $field->getLabel();
|
||||
@@ -50,83 +51,88 @@
|
||||
$aboveErrorMessageSchema = $field?->getChildSchema($field::ABOVE_ERROR_MESSAGE_SCHEMA_KEY)?->toHtmlString();
|
||||
$belowErrorMessageSchema = $field?->getChildSchema($field::BELOW_ERROR_MESSAGE_SCHEMA_KEY)?->toHtmlString();
|
||||
|
||||
$hasError = $hasErrors && (filled($errorMessage) || filled($errorMessages) || (filled($statePath) && ($errors->has($statePath) || ($hasNestedRecursiveValidationRules && $errors->has("{$statePath}.*")))));
|
||||
$hasError =
|
||||
$hasErrors &&
|
||||
(filled($errorMessage) ||
|
||||
filled($errorMessages) ||
|
||||
(filled($statePath) &&
|
||||
($errors->has($statePath) || ($hasNestedRecursiveValidationRules && $errors->has("{$statePath}.*")))));
|
||||
|
||||
if ($hasError && filled($statePath) && blank($errorMessage) && blank($errorMessages)) {
|
||||
if ($shouldShowAllValidationMessages) {
|
||||
$errorMessages = $errors->has($statePath) ? $errors->get($statePath) : ($hasNestedRecursiveValidationRules ? $errors->get("{$statePath}.*") : []);
|
||||
$errorMessages = $errors->has($statePath)
|
||||
? $errors->get($statePath)
|
||||
: ($hasNestedRecursiveValidationRules
|
||||
? $errors->get("{$statePath}.*")
|
||||
: []);
|
||||
|
||||
if (count($errorMessages) === 1) {
|
||||
$errorMessage = Arr::first($errorMessages);
|
||||
$errorMessages = [];
|
||||
}
|
||||
} else {
|
||||
$errorMessage = $errors->has($statePath) ? $errors->first($statePath) : ($hasNestedRecursiveValidationRules ? $errors->first("{$statePath}.*") : null);
|
||||
$errorMessage = $errors->has($statePath)
|
||||
? $errors->first($statePath)
|
||||
: ($hasNestedRecursiveValidationRules
|
||||
? $errors->first("{$statePath}.*")
|
||||
: null);
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div
|
||||
data-field-wrapper
|
||||
{{
|
||||
$attributes
|
||||
->merge($field?->getExtraFieldWrapperAttributes() ?? [], escape: false)
|
||||
->class([
|
||||
'fi-fo-field',
|
||||
'fi-fo-field-has-inline-label' => $hasInlineLabel,
|
||||
])
|
||||
}}
|
||||
>
|
||||
<div data-field-wrapper
|
||||
{{ $attributes->merge($field?->getExtraFieldWrapperAttributes() ?? [], escape: false)->class(['fi-fo-field', 'fi-fo-field-has-inline-label' => $hasInlineLabel]) }}>
|
||||
@if (filled($label) && $labelSrOnly)
|
||||
<{{ $labelTag }}
|
||||
@if ($labelTag === 'label')
|
||||
for="{{ $id }}"
|
||||
@if ($labelTag === 'label') for="{{ $id }}"
|
||||
@else
|
||||
id="{{ $id }}-label"
|
||||
@endif
|
||||
class="fi-fo-field-label fi-sr-only"
|
||||
>
|
||||
id="{{ $id }}-label" @endif
|
||||
class="fi-fo-field-label fi-sr-only">
|
||||
{{ $label }}
|
||||
</{{ $labelTag }}>
|
||||
</{{ $labelTag }}>
|
||||
@endif
|
||||
|
||||
@if ((filled($label) && (! $labelSrOnly)) || $hasInlineLabel || $aboveLabelSchema || $belowLabelSchema || $beforeLabelSchema || $afterLabelSchema || $labelPrefix || $labelSuffix)
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-field-label-col',
|
||||
"fi-vertical-align-{$inlineLabelVerticalAlignment->value}" => $hasInlineLabel,
|
||||
])
|
||||
>
|
||||
@if (
|
||||
(filled($label) && !$labelSrOnly) ||
|
||||
$hasInlineLabel ||
|
||||
$aboveLabelSchema ||
|
||||
$belowLabelSchema ||
|
||||
$beforeLabelSchema ||
|
||||
$afterLabelSchema ||
|
||||
$labelPrefix ||
|
||||
$labelSuffix)
|
||||
<div @class([
|
||||
'fi-fo-field-label-col',
|
||||
"fi-vertical-align-{$inlineLabelVerticalAlignment->value}" => $hasInlineLabel,
|
||||
])>
|
||||
{{ $aboveLabelSchema }}
|
||||
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-field-label-ctn',
|
||||
($label instanceof \Illuminate\View\ComponentSlot) ? $label->attributes->get('class') : null,
|
||||
])
|
||||
>
|
||||
<div @class([
|
||||
'fi-fo-field-label-ctn',
|
||||
$label instanceof \Illuminate\View\ComponentSlot
|
||||
? $label->attributes->get('class')
|
||||
: null,
|
||||
])>
|
||||
{{ $beforeLabelSchema }}
|
||||
|
||||
@if ((filled($label) && (! $labelSrOnly)) || $labelPrefix || $labelSuffix)
|
||||
@if ((filled($label) && !$labelSrOnly) || $labelPrefix || $labelSuffix)
|
||||
<{{ $labelTag }}
|
||||
@if ($labelTag === 'label')
|
||||
for="{{ $id }}"
|
||||
@if ($labelTag === 'label') for="{{ $id }}"
|
||||
@else
|
||||
id="{{ $id }}-label"
|
||||
@endif
|
||||
class="fi-fo-field-label"
|
||||
>
|
||||
id="{{ $id }}-label" @endif
|
||||
class="fi-fo-field-label">
|
||||
{{ $labelPrefix }}
|
||||
|
||||
@if (filled($label) && (! $labelSrOnly))
|
||||
@if (filled($label) && !$labelSrOnly)
|
||||
<span class="fi-fo-field-label-content">
|
||||
{{ $label }}@if ($required && (! $isDisabled))<sup class="fi-fo-field-label-required-mark">*</sup>
|
||||
{{ $label }}@if ($required && !$isDisabled)
|
||||
<sup class="fi-fo-field-label-required-mark">*</sup>
|
||||
@endif
|
||||
</span>
|
||||
@endif
|
||||
|
||||
{{ $labelSuffix }}
|
||||
</{{ $labelTag }}>
|
||||
</{{ $labelTag }}>
|
||||
@endif
|
||||
|
||||
{{ $afterLabelSchema }}
|
||||
@@ -136,7 +142,15 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ((! \Filament\Support\is_slot_empty($slot)) || $hasError || $aboveContentSchema || $belowContentSchema || $beforeContentSchema || $afterContentSchema || $aboveErrorMessageSchema || $belowErrorMessageSchema)
|
||||
@if (
|
||||
!\Filament\Support\is_slot_empty($slot) ||
|
||||
$hasError ||
|
||||
$aboveContentSchema ||
|
||||
$belowContentSchema ||
|
||||
$beforeContentSchema ||
|
||||
$afterContentSchema ||
|
||||
$aboveErrorMessageSchema ||
|
||||
$belowErrorMessageSchema)
|
||||
<div class="fi-fo-field-content-col">
|
||||
{{ $aboveContentSchema }}
|
||||
|
||||
@@ -160,10 +174,7 @@
|
||||
{{ $aboveErrorMessageSchema }}
|
||||
|
||||
@if (filled($errorMessages))
|
||||
<ul
|
||||
data-validation-error
|
||||
class="fi-fo-field-wrp-error-list"
|
||||
>
|
||||
<ul data-validation-error class="fi-fo-field-wrp-error-list">
|
||||
@foreach ($errorMessages as $errorMessage)
|
||||
<li class="fi-fo-field-wrp-error-message">
|
||||
@if ($areHtmlErrorMessagesAllowed)
|
||||
@@ -175,17 +186,11 @@
|
||||
@endforeach
|
||||
</ul>
|
||||
@elseif ($areHtmlErrorMessagesAllowed)
|
||||
<div
|
||||
data-validation-error
|
||||
class="fi-fo-field-wrp-error-message"
|
||||
>
|
||||
<div data-validation-error class="fi-fo-field-wrp-error-message">
|
||||
{!! $errorMessage !!}
|
||||
</div>
|
||||
@else
|
||||
<p
|
||||
data-validation-error
|
||||
class="fi-fo-field-wrp-error-message"
|
||||
>
|
||||
<p data-validation-error class="fi-fo-field-wrp-error-message">
|
||||
{{ $errorMessage }}
|
||||
</p>
|
||||
@endif
|
||||
|
||||
+174
-259
@@ -18,238 +18,193 @@
|
||||
|
||||
$alignment = $getAlignment() ?? Alignment::Start;
|
||||
|
||||
if (! $alignment instanceof Alignment) {
|
||||
$alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null;
|
||||
if (!$alignment instanceof Alignment) {
|
||||
$alignment = filled($alignment) ? Alignment::tryFrom($alignment) ?? $alignment : null;
|
||||
}
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
label-tag="div"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" label-tag="div">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('file-upload', 'filament/forms') }}"
|
||||
x-data="fileUploadFormComponent({
|
||||
acceptedFileTypes: @js($getAcceptedFileTypes()),
|
||||
automaticallyCropImagesAspectRatio: @js($automaticallyCropImagesAspectRatio),
|
||||
automaticallyOpenImageEditorForAspectRatio: @js($getAutomaticallyOpenImageEditorForAspectRatio()),
|
||||
automaticallyResizeImagesMode: @js($getAutomaticallyResizeImagesMode()),
|
||||
automaticallyResizeImagesHeight: @js($automaticallyResizeImagesHeight),
|
||||
automaticallyResizeImagesWidth: @js($automaticallyResizeImagesWidth),
|
||||
cancelUploadUsing: (fileKey) => {
|
||||
$wire.cancelUpload(`{{ $statePath }}.${fileKey}`)
|
||||
acceptedFileTypes: @js($getAcceptedFileTypes()),
|
||||
automaticallyCropImagesAspectRatio: @js($automaticallyCropImagesAspectRatio),
|
||||
automaticallyOpenImageEditorForAspectRatio: @js($getAutomaticallyOpenImageEditorForAspectRatio()),
|
||||
automaticallyResizeImagesMode: @js($getAutomaticallyResizeImagesMode()),
|
||||
automaticallyResizeImagesHeight: @js($automaticallyResizeImagesHeight),
|
||||
automaticallyResizeImagesWidth: @js($automaticallyResizeImagesWidth),
|
||||
cancelUploadUsing: (fileKey) => {
|
||||
$wire.cancelUpload(`{{ $statePath }}.${fileKey}`)
|
||||
},
|
||||
canEditSvgs: @js($canEditSvgs()),
|
||||
confirmSvgEditingMessage: @js(__('filament-forms::components.file_upload.editor.svg.messages.confirmation')),
|
||||
deleteUploadedFileUsing: async (fileKey) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'deleteUploadedFile', { fileKey },
|
||||
)
|
||||
},
|
||||
disabledSvgEditingMessage: @js(__('filament-forms::components.file_upload.editor.svg.messages.disabled')),
|
||||
getUploadedFilesUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getUploadedFiles'], { async: true },
|
||||
)
|
||||
},
|
||||
hasCircleCropper: @js($hasCircleCropper),
|
||||
hasImageEditor: @js($hasImageEditor),
|
||||
imageEditorEmptyFillColor: @js($getImageEditorEmptyFillColor()),
|
||||
imageEditorMode: @js($getImageEditorMode()),
|
||||
imageEditorViewportHeight: @js($getImageEditorViewportHeight()),
|
||||
imageEditorViewportWidth: @js($getImageEditorViewportWidth()),
|
||||
imagePreviewHeight: @js($getImagePreviewHeight()),
|
||||
isAvatar: @js($isAvatar),
|
||||
isDeletable: @js($isDeletable()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isDownloadable: @js($isDownloadable()),
|
||||
isImageEditorExplicitlyEnabled: @js($isImageEditorExplicitlyEnabled),
|
||||
isMultiple: @js($isMultiple),
|
||||
isOpenable: @js($isOpenable()),
|
||||
isPasteable: @js($isPasteable()),
|
||||
isPreviewable: @js($isPreviewable()),
|
||||
isReorderable: @js($isReorderable()),
|
||||
isSvgEditingConfirmed: @js($isSvgEditingConfirmed()),
|
||||
itemPanelAspectRatio: @js($getItemPanelAspectRatio()),
|
||||
loadingIndicatorPosition: @js($getLoadingIndicatorPosition()),
|
||||
locale: @js(app()->getLocale()),
|
||||
maxFiles: @js($maxFiles = $getMaxFiles()),
|
||||
maxFilesValidationMessage: @js($maxFiles ? trans_choice('validation.max.array', $maxFiles, ['attribute' => $getValidationAttribute(), 'max' => $maxFiles]) : null),
|
||||
maxParallelUploads: @js($getMaxParallelUploads()),
|
||||
maxSize: @js(($size = $getMaxSize()) ? "{$size}KB" : null),
|
||||
mimeTypeMap: @js($getMimeTypeMap()),
|
||||
minSize: @js(($size = $getMinSize()) ? "{$size}KB" : null),
|
||||
panelAspectRatio: @js($getPanelAspectRatio()),
|
||||
panelLayout: @js($getPanelLayout()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
removeUploadedFileButtonPosition: @js($getRemoveUploadedFileButtonPosition()),
|
||||
removeUploadedFileUsing: async (fileKey) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'removeUploadedFile', { fileKey },
|
||||
)
|
||||
},
|
||||
reorderUploadedFilesUsing: async (fileKeys) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'reorderUploadedFiles', { fileKeys },
|
||||
)
|
||||
},
|
||||
shouldAppendFiles: @js($shouldAppendFiles()),
|
||||
shouldAutomaticallyUpscaleImagesWhenResizing: @js($shouldAutomaticallyUpscaleImagesWhenResizing()),
|
||||
shouldOrientImageFromExif: @js($shouldOrientImagesFromExif()),
|
||||
shouldTransformImage: @js($automaticallyCropImagesAspectRatio || $automaticallyResizeImagesHeight || $automaticallyResizeImagesWidth),
|
||||
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)
|
||||
},
|
||||
canEditSvgs: @js($canEditSvgs()),
|
||||
confirmSvgEditingMessage: @js(__('filament-forms::components.file_upload.editor.svg.messages.confirmation')),
|
||||
deleteUploadedFileUsing: async (fileKey) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'deleteUploadedFile',
|
||||
{ fileKey },
|
||||
)
|
||||
error,
|
||||
(progressEvent) => {
|
||||
progress(true, progressEvent.detail.progress, 100)
|
||||
},
|
||||
disabledSvgEditingMessage: @js(__('filament-forms::components.file_upload.editor.svg.messages.disabled')),
|
||||
getUploadedFilesUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getUploadedFiles'],
|
||||
{ async: true },
|
||||
)
|
||||
},
|
||||
hasCircleCropper: @js($hasCircleCropper),
|
||||
hasImageEditor: @js($hasImageEditor),
|
||||
imageEditorEmptyFillColor: @js($getImageEditorEmptyFillColor()),
|
||||
imageEditorMode: @js($getImageEditorMode()),
|
||||
imageEditorViewportHeight: @js($getImageEditorViewportHeight()),
|
||||
imageEditorViewportWidth: @js($getImageEditorViewportWidth()),
|
||||
imagePreviewHeight: @js($getImagePreviewHeight()),
|
||||
isAvatar: @js($isAvatar),
|
||||
isDeletable: @js($isDeletable()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isDownloadable: @js($isDownloadable()),
|
||||
isImageEditorExplicitlyEnabled: @js($isImageEditorExplicitlyEnabled),
|
||||
isMultiple: @js($isMultiple),
|
||||
isOpenable: @js($isOpenable()),
|
||||
isPasteable: @js($isPasteable()),
|
||||
isPreviewable: @js($isPreviewable()),
|
||||
isReorderable: @js($isReorderable()),
|
||||
isSvgEditingConfirmed: @js($isSvgEditingConfirmed()),
|
||||
itemPanelAspectRatio: @js($getItemPanelAspectRatio()),
|
||||
loadingIndicatorPosition: @js($getLoadingIndicatorPosition()),
|
||||
locale: @js(app()->getLocale()),
|
||||
maxFiles: @js($maxFiles = $getMaxFiles()),
|
||||
maxFilesValidationMessage: @js($maxFiles ? trans_choice('validation.max.array', $maxFiles, ['attribute' => $getValidationAttribute(), 'max' => $maxFiles]) : null),
|
||||
maxParallelUploads: @js($getMaxParallelUploads()),
|
||||
maxSize: @js(($size = $getMaxSize()) ? "{$size}KB" : null),
|
||||
mimeTypeMap: @js($getMimeTypeMap()),
|
||||
minSize: @js(($size = $getMinSize()) ? "{$size}KB" : null),
|
||||
panelAspectRatio: @js($getPanelAspectRatio()),
|
||||
panelLayout: @js($getPanelLayout()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
removeUploadedFileButtonPosition: @js($getRemoveUploadedFileButtonPosition()),
|
||||
removeUploadedFileUsing: async (fileKey) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'removeUploadedFile',
|
||||
{ fileKey },
|
||||
)
|
||||
},
|
||||
reorderUploadedFilesUsing: async (fileKeys) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'reorderUploadedFiles',
|
||||
{ fileKeys },
|
||||
)
|
||||
},
|
||||
shouldAppendFiles: @js($shouldAppendFiles()),
|
||||
shouldAutomaticallyUpscaleImagesWhenResizing: @js($shouldAutomaticallyUpscaleImagesWhenResizing()),
|
||||
shouldOrientImageFromExif: @js($shouldOrientImagesFromExif()),
|
||||
shouldTransformImage: @js($automaticallyCropImagesAspectRatio || $automaticallyResizeImagesHeight || $automaticallyResizeImagesWidth),
|
||||
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
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$isDisabled,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
)
|
||||
},
|
||||
})" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{ substr(md5(serialize([$isDisabled])), 0, 64) }}"
|
||||
{{ $attributes->merge(
|
||||
[
|
||||
'aria-labelledby' => "{$id}-label",
|
||||
'id' => $id,
|
||||
'role' => 'group',
|
||||
], escape: false)
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->merge($getExtraAlpineAttributes(), escape: false)
|
||||
->class([
|
||||
'fi-fo-file-upload',
|
||||
'fi-fo-file-upload-avatar' => $isAvatar,
|
||||
($alignment instanceof Alignment) ? "fi-align-{$alignment->value}" : $alignment,
|
||||
])
|
||||
}}
|
||||
>
|
||||
],
|
||||
escape: false,
|
||||
)->merge($getExtraAttributes(), escape: false)->merge($getExtraAlpineAttributes(), escape: false)->class([
|
||||
'fi-fo-file-upload',
|
||||
'fi-fo-file-upload-avatar' => $isAvatar,
|
||||
$alignment instanceof Alignment ? "fi-align-{$alignment->value}" : $alignment,
|
||||
]) }}>
|
||||
<div class="fi-fo-file-upload-input-ctn">
|
||||
<input
|
||||
x-ref="input"
|
||||
{{
|
||||
$getExtraInputAttributeBag()
|
||||
->merge([
|
||||
'aria-labelledby' => "{$id}-label",
|
||||
'disabled' => $isDisabled,
|
||||
'multiple' => $isMultiple,
|
||||
'type' => 'file',
|
||||
], escape: false)
|
||||
}}
|
||||
/>
|
||||
<input x-ref="input"
|
||||
{{ $getExtraInputAttributeBag()->merge(
|
||||
[
|
||||
'aria-labelledby' => "{$id}-label",
|
||||
'disabled' => $isDisabled,
|
||||
'multiple' => $isMultiple,
|
||||
'type' => 'file',
|
||||
],
|
||||
escape: false,
|
||||
) }} />
|
||||
</div>
|
||||
|
||||
<div
|
||||
x-show="error"
|
||||
x-text="error"
|
||||
x-cloak
|
||||
class="fi-fo-file-upload-error-message"
|
||||
></div>
|
||||
<div x-show="error" x-text="error" x-cloak class="fi-fo-file-upload-error-message"></div>
|
||||
|
||||
@if ($hasImageEditor && (! $isDisabled))
|
||||
<div
|
||||
x-show="isEditorOpen"
|
||||
x-cloak
|
||||
x-on:click.stop=""
|
||||
x-trap.noscroll="isEditorOpen"
|
||||
x-on:keydown.escape.prevent.stop="closeEditor"
|
||||
@class([
|
||||
@if ($hasImageEditor && !$isDisabled)
|
||||
<div x-show="isEditorOpen" x-cloak x-on:click.stop="" x-trap.noscroll="isEditorOpen"
|
||||
x-on:keydown.escape.prevent.stop="closeEditor" @class([
|
||||
'fi-fo-file-upload-editor',
|
||||
'fi-fo-file-upload-editor-circle-cropper' => $hasCircleCropper,
|
||||
'fi-fo-file-upload-editor-crop-only' => ! $isImageEditorExplicitlyEnabled,
|
||||
])
|
||||
>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="fi-fo-file-upload-editor-overlay"
|
||||
></div>
|
||||
'fi-fo-file-upload-editor-crop-only' => !$isImageEditorExplicitlyEnabled,
|
||||
])>
|
||||
<div aria-hidden="true" class="fi-fo-file-upload-editor-overlay"></div>
|
||||
|
||||
<div class="fi-fo-file-upload-editor-window">
|
||||
<div class="fi-fo-file-upload-editor-image-ctn">
|
||||
<img
|
||||
x-ref="editor"
|
||||
class="fi-fo-file-upload-editor-image"
|
||||
/>
|
||||
<img x-ref="editor" class="fi-fo-file-upload-editor-image" />
|
||||
</div>
|
||||
|
||||
<div class="fi-fo-file-upload-editor-control-panel">
|
||||
@if ($isImageEditorExplicitlyEnabled)
|
||||
<div
|
||||
class="fi-fo-file-upload-editor-control-panel-main"
|
||||
>
|
||||
<div
|
||||
class="fi-fo-file-upload-editor-control-panel-group"
|
||||
>
|
||||
<div class="fi-fo-file-upload-editor-control-panel-main">
|
||||
<div class="fi-fo-file-upload-editor-control-panel-group">
|
||||
@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)
|
||||
[
|
||||
'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)
|
||||
<label>
|
||||
<x-filament::input.wrapper>
|
||||
<x-slot name="prefix">
|
||||
{{ $input['label'] }}
|
||||
</x-slot>
|
||||
|
||||
<input
|
||||
x-on:keyup.enter.prevent.stop="editor && {!! $input['alpineSaveHandler'] !!}"
|
||||
<input x-on:keyup.enter.prevent.stop="editor && {!! $input['alpineSaveHandler'] !!}"
|
||||
x-on:blur="editor && {!! $input['alpineSaveHandler'] !!}"
|
||||
x-ref="{{ $input['ref'] }}"
|
||||
x-on:keydown.enter.prevent
|
||||
type="text"
|
||||
class="fi-input"
|
||||
/>
|
||||
x-ref="{{ $input['ref'] }}" x-on:keydown.enter.prevent
|
||||
type="text" class="fi-input" />
|
||||
|
||||
<x-slot name="suffix">
|
||||
{{ $input['unit'] }}
|
||||
@@ -259,19 +214,14 @@
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="fi-fo-file-upload-editor-control-panel-group"
|
||||
>
|
||||
<div class="fi-fo-file-upload-editor-control-panel-group">
|
||||
@foreach ($getImageEditorActions() as $groupedActions)
|
||||
<div class="fi-btn-group">
|
||||
@foreach ($groupedActions as $action)
|
||||
<button
|
||||
aria-label="{{ $action['label'] }}"
|
||||
type="button"
|
||||
<button aria-label="{{ $action['label'] }}" type="button"
|
||||
x-on:click.prevent.stop="{{ $action['alpineClickHandler'] }}"
|
||||
x-tooltip="{ content: @js($action['label']), theme: $store.theme }"
|
||||
class="fi-btn"
|
||||
>
|
||||
class="fi-btn">
|
||||
{{ $action['iconHtml'] }}
|
||||
</button>
|
||||
@endforeach
|
||||
@@ -280,28 +230,22 @@
|
||||
</div>
|
||||
|
||||
@if (count($aspectRatios = $getImageEditorAspectRatioOptionsForJs()))
|
||||
<div
|
||||
class="fi-fo-file-upload-editor-control-panel-group"
|
||||
>
|
||||
<div
|
||||
class="fi-fo-file-upload-editor-control-panel-group-title"
|
||||
>
|
||||
<div class="fi-fo-file-upload-editor-control-panel-group">
|
||||
<div class="fi-fo-file-upload-editor-control-panel-group-title">
|
||||
{{ __('filament-forms::components.file_upload.editor.aspect_ratios.label') }}
|
||||
</div>
|
||||
|
||||
@foreach (collect($aspectRatios)->chunk(5) as $ratiosChunk)
|
||||
<div class="fi-btn-group">
|
||||
@foreach ($ratiosChunk as $label => $ratio)
|
||||
<button
|
||||
type="button"
|
||||
<button type="button"
|
||||
x-on:click.prevent.stop="
|
||||
currentRatio = @js($label) {!! ';' !!}
|
||||
editor.setAspectRatio(@js($ratio))
|
||||
"
|
||||
x-tooltip="{ content: @js(__('filament-forms::components.file_upload.editor.actions.set_aspect_ratio.label', ['ratio' => $label])), theme: $store.theme }"
|
||||
x-bind:class="{ 'fi-active': currentRatio === @js($label) }"
|
||||
class="fi-btn"
|
||||
>
|
||||
class="fi-btn">
|
||||
{{ $label }}
|
||||
</button>
|
||||
@endforeach
|
||||
@@ -312,59 +256,30 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
class="fi-fo-file-upload-editor-control-panel-footer"
|
||||
>
|
||||
<div class="fi-fo-file-upload-editor-control-panel-footer">
|
||||
@if ($isImageEditorExplicitlyEnabled)
|
||||
<button
|
||||
type="button"
|
||||
x-on:click.prevent="pond.imageEditEditor.oncancel"
|
||||
class="fi-btn"
|
||||
>
|
||||
<button type="button" x-on:click.prevent="pond.imageEditEditor.oncancel"
|
||||
class="fi-btn">
|
||||
{{ __('filament-forms::components.file_upload.editor.actions.cancel.label') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
x-on:click.prevent.stop="editor.reset()"
|
||||
{{
|
||||
(new \Illuminate\View\ComponentAttributeBag)
|
||||
->color(\Filament\Support\View\Components\ButtonComponent::class, 'danger')
|
||||
->class(['fi-btn fi-fo-file-upload-editor-control-panel-reset-action'])
|
||||
}}
|
||||
>
|
||||
<button type="button" x-on:click.prevent.stop="editor.reset()"
|
||||
{{ new \Illuminate\View\ComponentAttributeBag()->color(\Filament\Support\View\Components\ButtonComponent::class, 'danger')->class(['fi-btn fi-fo-file-upload-editor-control-panel-reset-action']) }}>
|
||||
{{ __('filament-forms::components.file_upload.editor.actions.reset.label') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
x-on:click.prevent="saveEditor"
|
||||
{{
|
||||
(new \Illuminate\View\ComponentAttributeBag)
|
||||
->color(\Filament\Support\View\Components\ButtonComponent::class, 'success')
|
||||
->class(['fi-btn'])
|
||||
}}
|
||||
>
|
||||
<button type="button" x-on:click.prevent="saveEditor"
|
||||
{{ new \Illuminate\View\ComponentAttributeBag()->color(\Filament\Support\View\Components\ButtonComponent::class, 'success')->class(['fi-btn']) }}>
|
||||
{{ __('filament-forms::components.file_upload.editor.actions.save.label') }}
|
||||
</button>
|
||||
@else
|
||||
<button
|
||||
type="button"
|
||||
x-on:click.prevent="saveEditor"
|
||||
{{
|
||||
(new \Illuminate\View\ComponentAttributeBag)
|
||||
->color(\Filament\Support\View\Components\ButtonComponent::class, 'success')
|
||||
->class(['fi-btn'])
|
||||
}}
|
||||
>
|
||||
<button type="button" x-on:click.prevent="saveEditor"
|
||||
{{ new \Illuminate\View\ComponentAttributeBag()->color(\Filament\Support\View\Components\ButtonComponent::class, 'success')->class(['fi-btn']) }}>
|
||||
{{ __('filament-forms::components.file_upload.editor.actions.save.label') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
x-on:click.prevent="pond.imageEditEditor.oncancel"
|
||||
class="fi-btn"
|
||||
>
|
||||
<button type="button" x-on:click.prevent="pond.imageEditEditor.oncancel"
|
||||
class="fi-btn">
|
||||
{{ __('filament-forms::components.file_upload.editor.actions.cancel.label') }}
|
||||
</button>
|
||||
@endif
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<input
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
{{ $attributes->merge(
|
||||
[
|
||||
'id' => $getId(),
|
||||
'type' => 'hidden',
|
||||
$applyStateBindingModifiers('wire:model') => $getStatePath(),
|
||||
], escape: false)
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->class(['fi-fo-hidden'])
|
||||
}}
|
||||
/>
|
||||
],
|
||||
escape: false,
|
||||
)->merge($getExtraAttributes(), escape: false)->class(['fi-fo-hidden']) }} />
|
||||
|
||||
@@ -14,46 +14,20 @@
|
||||
$livewireKey = $getLivewireKey();
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
class="fi-fo-key-value-wrp"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:valid="! $errors->has($statePath)"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class(['fi-fo-key-value'])
|
||||
"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" class="fi-fo-key-value-wrp">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :valid="!$errors->has($statePath)" :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class(['fi-fo-key-value'])">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('key-value', 'filament/forms') }}"
|
||||
x-data="keyValueFormComponent({
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
})"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$isDisabled,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
{{
|
||||
$attributes
|
||||
->merge($getExtraAlpineAttributes(), escape: false)
|
||||
->class(['fi-fo-key-value-table-ctn'])
|
||||
}}
|
||||
>
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
})" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{ substr(md5(serialize([$isDisabled])), 0, 64) }}"
|
||||
{{ $attributes->merge($getExtraAlpineAttributes(), escape: false)->class(['fi-fo-key-value-table-ctn']) }}>
|
||||
<table class="fi-fo-key-value-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@if ($isReorderable && (! $isDisabled))
|
||||
<th
|
||||
scope="col"
|
||||
x-show="rows.length"
|
||||
class="fi-has-action"
|
||||
></th>
|
||||
@if ($isReorderable && !$isDisabled)
|
||||
<th scope="col" x-show="rows.length" class="fi-has-action"></th>
|
||||
@endif
|
||||
|
||||
<th scope="col">
|
||||
@@ -64,66 +38,39 @@
|
||||
{{ $getValueLabel() }}
|
||||
</th>
|
||||
|
||||
@if ($isDeletable && (! $isDisabled))
|
||||
<th
|
||||
scope="col"
|
||||
x-show="rows.length"
|
||||
class="fi-has-action"
|
||||
></th>
|
||||
@if ($isDeletable && !$isDisabled)
|
||||
<th scope="col" x-show="rows.length" class="fi-has-action"></th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody
|
||||
@if ($isReorderable)
|
||||
x-on:end.stop="reorderRows($event)"
|
||||
@if ($isReorderable) x-on:end.stop="reorderRows($event)"
|
||||
x-sortable
|
||||
data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}"
|
||||
@endif
|
||||
>
|
||||
<template
|
||||
x-bind:key="index"
|
||||
x-for="(row, index) in rows"
|
||||
>
|
||||
<tr
|
||||
@if ($isReorderable)
|
||||
x-bind:x-sortable-item="row.key"
|
||||
@endif
|
||||
>
|
||||
@if ($isReorderable && (! $isDisabled))
|
||||
data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}" @endif>
|
||||
<template x-bind:key="index" x-for="(row, index) in rows">
|
||||
<tr @if ($isReorderable) x-bind:x-sortable-item="row.key" @endif>
|
||||
@if ($isReorderable && !$isDisabled)
|
||||
<td class="fi-has-action">
|
||||
<div
|
||||
x-sortable-handle
|
||||
class="fi-fo-key-value-table-row-sortable-handle"
|
||||
>
|
||||
<div x-sortable-handle class="fi-fo-key-value-table-row-sortable-handle">
|
||||
{{ $getAction('reorder') }}
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
|
||||
<td>
|
||||
<input
|
||||
@disabled((! $canEditKeys) || $isDisabled)
|
||||
placeholder="{{ $keyPlaceholder }}"
|
||||
type="text"
|
||||
x-model="row.key"
|
||||
x-on:input.debounce.{{ $debounce ?? '500ms' }}="updateState"
|
||||
class="fi-input"
|
||||
/>
|
||||
<input @disabled(!$canEditKeys || $isDisabled) placeholder="{{ $keyPlaceholder }}" type="text"
|
||||
x-model="row.key" x-on:input.debounce.{{ $debounce ?? '500ms' }}="updateState"
|
||||
class="fi-input" />
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input
|
||||
@disabled((! $canEditValues) || $isDisabled)
|
||||
placeholder="{{ $valuePlaceholder }}"
|
||||
type="text"
|
||||
x-model="row.value"
|
||||
x-on:input.debounce.{{ $debounce ?? '500ms' }}="updateState"
|
||||
class="fi-input"
|
||||
/>
|
||||
<input @disabled(!$canEditValues || $isDisabled) placeholder="{{ $valuePlaceholder }}"
|
||||
type="text" x-model="row.value"
|
||||
x-on:input.debounce.{{ $debounce ?? '500ms' }}="updateState" class="fi-input" />
|
||||
</td>
|
||||
|
||||
@if ($isDeletable && (! $isDisabled))
|
||||
@if ($isDeletable && !$isDisabled)
|
||||
<td class="fi-has-action">
|
||||
<div x-on:click="deleteRow(index)">
|
||||
{{ $getAction('delete') }}
|
||||
@@ -135,11 +82,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if ($isAddable && (! $isDisabled))
|
||||
<div
|
||||
x-on:click="addRow"
|
||||
class="fi-fo-key-value-add-action-ctn"
|
||||
>
|
||||
@if ($isAddable && !$isDisabled)
|
||||
<div x-on:click="addRow" class="fi-fo-key-value-add-action-ctn">
|
||||
{{ $getAction('add') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -8,13 +8,12 @@
|
||||
@if (filled($id) || filled($extraAttributes))
|
||||
{!! '<div' !!}
|
||||
{{-- Avoid formatting issues with unclosed elements --}}
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
{{ $attributes->merge(
|
||||
[
|
||||
'id' => $id,
|
||||
], escape: false)
|
||||
->merge($extraAttributes, escape: false)
|
||||
}}
|
||||
],
|
||||
escape: false,
|
||||
)->merge($extraAttributes, escape: false) }}
|
||||
>
|
||||
@endif
|
||||
|
||||
|
||||
+41
-54
@@ -15,63 +15,50 @@
|
||||
{!! str($getState())->markdown($getCommonMarkOptions(), $getCommonMarkExtensions())->sanitizeHtml() !!}
|
||||
</div>
|
||||
@else
|
||||
<x-filament::input.wrapper
|
||||
:valid="! $errors->has($statePath)"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class(['fi-fo-markdown-editor'])
|
||||
"
|
||||
>
|
||||
<div
|
||||
aria-labelledby="{{ $id }}-label"
|
||||
id="{{ $id }}"
|
||||
role="group"
|
||||
x-load
|
||||
<x-filament::input.wrapper :valid="!$errors->has($statePath)" :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class(['fi-fo-markdown-editor'])">
|
||||
<div aria-labelledby="{{ $id }}-label" id="{{ $id }}" role="group" x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('markdown-editor', 'filament/forms') }}"
|
||||
x-data="markdownEditorFormComponent({
|
||||
canAttachFiles: @js($hasFileAttachments()),
|
||||
isLiveDebounced: @js($isLiveDebounced()),
|
||||
isLiveOnBlur: @js($isLiveOnBlur()),
|
||||
label: @js($label),
|
||||
liveDebounce: @js($getNormalizedLiveDebounce()),
|
||||
maxHeight: @js($getMaxHeight()),
|
||||
minHeight: @js($getMinHeight()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
|
||||
toolbarButtons: @js($getToolbarButtons()),
|
||||
translations: @js(__('filament-forms::components.markdown_editor')),
|
||||
uploadFileAttachmentUsing: async (file, onSuccess, onError) => {
|
||||
const acceptedTypes = @js($fileAttachmentsAcceptedFileTypes)
|
||||
|
||||
if (acceptedTypes && ! acceptedTypes.includes(file.type)) {
|
||||
return onError(@js($fileAttachmentsAcceptedFileTypes ? __('filament-forms::components.markdown_editor.file_attachments_accepted_file_types_message', ['values' => implode(', ', $fileAttachmentsAcceptedFileTypes)]) : null))
|
||||
}
|
||||
|
||||
const maxSize = @js($fileAttachmentsMaxSize)
|
||||
|
||||
if (maxSize && file.size > +maxSize * 1024) {
|
||||
return onError(@js($fileAttachmentsMaxSize ? trans_choice('filament-forms::components.markdown_editor.file_attachments_max_size_message', $fileAttachmentsMaxSize, ['max' => $fileAttachmentsMaxSize]) : null))
|
||||
}
|
||||
|
||||
$wire.upload(`componentFileAttachments.{{ $statePath }}`, file, () => {
|
||||
$wire
|
||||
.callSchemaComponentMethod(
|
||||
'{{ $key }}',
|
||||
'saveUploadedFileAttachmentAndGetUrl',
|
||||
)
|
||||
.then((url) => {
|
||||
if (! url) {
|
||||
return onError()
|
||||
}
|
||||
|
||||
onSuccess(url)
|
||||
})
|
||||
canAttachFiles: @js($hasFileAttachments()),
|
||||
isLiveDebounced: @js($isLiveDebounced()),
|
||||
isLiveOnBlur: @js($isLiveOnBlur()),
|
||||
label: @js($label),
|
||||
liveDebounce: @js($getNormalizedLiveDebounce()),
|
||||
maxHeight: @js($getMaxHeight()),
|
||||
minHeight: @js($getMinHeight()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
|
||||
toolbarButtons: @js($getToolbarButtons()),
|
||||
translations: @js(__('filament-forms::components.markdown_editor')),
|
||||
uploadFileAttachmentUsing: async (file, onSuccess, onError) => {
|
||||
const acceptedTypes = @js($fileAttachmentsAcceptedFileTypes)
|
||||
|
||||
if (acceptedTypes && !acceptedTypes.includes(file.type)) {
|
||||
return onError(@js($fileAttachmentsAcceptedFileTypes ? __('filament-forms::components.markdown_editor.file_attachments_accepted_file_types_message', ['values' => implode(', ', $fileAttachmentsAcceptedFileTypes)]) : null))
|
||||
}
|
||||
|
||||
const maxSize = @js($fileAttachmentsMaxSize)
|
||||
|
||||
if (maxSize && file.size > +maxSize * 1024) {
|
||||
return onError(@js($fileAttachmentsMaxSize ? trans_choice('filament-forms::components.markdown_editor.file_attachments_max_size_message', $fileAttachmentsMaxSize, ['max' => $fileAttachmentsMaxSize]) : null))
|
||||
}
|
||||
|
||||
$wire.upload(`componentFileAttachments.{{ $statePath }}`, file, () => {
|
||||
$wire
|
||||
.callSchemaComponentMethod(
|
||||
'{{ $key }}',
|
||||
'saveUploadedFileAttachmentAndGetUrl',
|
||||
)
|
||||
.then((url) => {
|
||||
if (!url) {
|
||||
return onError()
|
||||
}
|
||||
|
||||
onSuccess(url)
|
||||
})
|
||||
},
|
||||
})"
|
||||
wire:ignore
|
||||
{{ $getExtraAlpineAttributeBag() }}
|
||||
>
|
||||
})
|
||||
},
|
||||
})" wire:ignore {{ $getExtraAlpineAttributeBag() }}>
|
||||
<textarea x-ref="editor" x-cloak></textarea>
|
||||
</div>
|
||||
</x-filament::input.wrapper>
|
||||
|
||||
+13
-15
@@ -12,21 +12,19 @@
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
{{ $attributes->merge(
|
||||
[
|
||||
'id' => $id,
|
||||
], escape: false)
|
||||
->merge($extraAttributes, escape: false)
|
||||
->class([
|
||||
'fi-fo-modal-table-select',
|
||||
'fi-fo-modal-table-select-disabled' => $isDisabled,
|
||||
'fi-fo-modal-table-select-multiple' => $isMultiple,
|
||||
])
|
||||
}}
|
||||
>
|
||||
@if (((! $isMultiple) && filled($optionLabel = $getOptionLabel())) ||
|
||||
($isMultiple && filled($optionLabels = $getOptionLabels())))
|
||||
],
|
||||
escape: false,
|
||||
)->merge($extraAttributes, escape: false)->class([
|
||||
'fi-fo-modal-table-select',
|
||||
'fi-fo-modal-table-select-disabled' => $isDisabled,
|
||||
'fi-fo-modal-table-select-multiple' => $isMultiple,
|
||||
]) }}>
|
||||
@if (
|
||||
(!$isMultiple && filled($optionLabel = $getOptionLabel())) ||
|
||||
($isMultiple && filled($optionLabels = $getOptionLabels())))
|
||||
@if ($isMultiple && $hasBadges)
|
||||
<div class="fi-fo-modal-table-select-badges-ctn">
|
||||
@foreach ($optionLabels as $optionLabel)
|
||||
@@ -60,7 +58,7 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (! $isDisabled)
|
||||
@if (!$isDisabled)
|
||||
<div>
|
||||
{{ $getAction('select') }}
|
||||
</div>
|
||||
|
||||
+9
-13
@@ -1,10 +1,9 @@
|
||||
@php
|
||||
$fieldWrapperView = $getFieldWrapperView();
|
||||
$placeholder = $getPlaceholder();
|
||||
$extraAttributes = $getExtraAttributeBag()
|
||||
->merge($getExtraAlpineAttributes(), escape: false);
|
||||
$extraInputAttributes = $getExtraInputAttributeBag()
|
||||
->merge([
|
||||
$extraAttributes = $getExtraAttributeBag()->merge($getExtraAlpineAttributes(), escape: false);
|
||||
$extraInputAttributes = $getExtraInputAttributeBag()->merge(
|
||||
[
|
||||
'autocomplete' => false,
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled(),
|
||||
@@ -12,18 +11,15 @@
|
||||
'length' => $getLength(),
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'readonly' => $isReadOnly(),
|
||||
'required' => $isRequired() && (! $isConcealed()),
|
||||
'required' => $isRequired() && !$isConcealed(),
|
||||
$applyStateBindingModifiers('wire:model') => $getStatePath(),
|
||||
], escape: false);
|
||||
],
|
||||
escape: false,
|
||||
);
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<x-filament::input.one-time-code
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($extraAttributes)"
|
||||
>
|
||||
<x-slot
|
||||
name="input"
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($extraInputAttributes)"
|
||||
></x-slot>
|
||||
<x-filament::input.one-time-code :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributes)">
|
||||
<x-slot name="input" :attributes="\Filament\Support\prepare_inherited_attributes($extraInputAttributes)"></x-slot>
|
||||
</x-filament::input.one-time-code>
|
||||
</x-dynamic-component>
|
||||
|
||||
+6
-17
@@ -14,27 +14,16 @@
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div
|
||||
data-field-wrapper
|
||||
{{
|
||||
(new ComponentAttributeBag)
|
||||
->merge($field?->getExtraFieldWrapperAttributes() ?? [], escape: false)
|
||||
->class([
|
||||
'fi-fo-field',
|
||||
])
|
||||
}}
|
||||
>
|
||||
<div data-field-wrapper
|
||||
{{ new ComponentAttributeBag()->merge($field?->getExtraFieldWrapperAttributes() ?? [], escape: false)->class(['fi-fo-field']) }}>
|
||||
@if (filled($label))
|
||||
<{{ $labelTag }}
|
||||
@if ($labelTag === 'label')
|
||||
for="{{ $id }}"
|
||||
@if ($labelTag === 'label') for="{{ $id }}"
|
||||
@else
|
||||
id="{{ $id }}-label"
|
||||
@endif
|
||||
class="fi-fo-field-label fi-sr-only"
|
||||
>
|
||||
id="{{ $id }}-label" @endif
|
||||
class="fi-fo-field-label fi-sr-only">
|
||||
{{ $label }}
|
||||
</{{ $labelTag }}>
|
||||
</{{ $labelTag }}>
|
||||
@endif
|
||||
|
||||
{{ $slot }}
|
||||
|
||||
@@ -14,39 +14,29 @@
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{
|
||||
$getExtraAttributeBag()
|
||||
->when(! $isInline, fn (ComponentAttributeBag $attributes) => $attributes->grid($getColumns(), $gridDirection))
|
||||
->class([
|
||||
'fi-fo-radio',
|
||||
'fi-inline' => $isInline,
|
||||
])
|
||||
}}
|
||||
>
|
||||
{{ $getExtraAttributeBag()->when(!$isInline, fn(ComponentAttributeBag $attributes) => $attributes->grid($getColumns(), $gridDirection))->class(['fi-fo-radio', 'fi-inline' => $isInline]) }}>
|
||||
@foreach ($getOptions() as $value => $label)
|
||||
@php
|
||||
$inputAttributes = $extraInputAttributeBag
|
||||
->merge([
|
||||
$inputAttributes = $extraInputAttributeBag->merge(
|
||||
[
|
||||
'autofocus' => $loop->first && $isAutofocused(),
|
||||
'disabled' => $isDisabled || $isOptionDisabled($value, $label),
|
||||
'id' => e($id . '-' . $value),
|
||||
'name' => $id,
|
||||
'value' => e($value),
|
||||
$wireModelAttribute => $statePath,
|
||||
], escape: false);
|
||||
],
|
||||
escape: false,
|
||||
);
|
||||
@endphp
|
||||
|
||||
<label class="fi-fo-radio-label">
|
||||
<input
|
||||
type="radio"
|
||||
{{
|
||||
$inputAttributes->class([
|
||||
'fi-radio-input',
|
||||
'fi-valid' => ! $errors->has($statePath),
|
||||
'fi-invalid' => $errors->has($statePath),
|
||||
])
|
||||
}}
|
||||
/>
|
||||
<input type="radio"
|
||||
{{ $inputAttributes->class([
|
||||
'fi-radio-input',
|
||||
'fi-valid' => !$errors->has($statePath),
|
||||
'fi-invalid' => $errors->has($statePath),
|
||||
]) }} />
|
||||
|
||||
<div class="fi-fo-radio-label-text">
|
||||
<p>
|
||||
|
||||
+54
-94
@@ -42,34 +42,17 @@
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{
|
||||
$attributes
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->class([
|
||||
'fi-fo-repeater',
|
||||
'fi-collapsible' => $isCollapsible,
|
||||
])
|
||||
}}
|
||||
>
|
||||
{{ $attributes->merge($getExtraAttributes(), escape: false)->class(['fi-fo-repeater', 'fi-collapsible' => $isCollapsible]) }}>
|
||||
@if ($collapseAllActionIsVisible || $expandAllActionIsVisible)
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-repeater-actions',
|
||||
'fi-hidden' => count($items) < 2,
|
||||
])
|
||||
>
|
||||
<div @class(['fi-fo-repeater-actions', 'fi-hidden' => count($items) < 2])>
|
||||
@if ($collapseAllActionIsVisible)
|
||||
<span
|
||||
x-on:click="$dispatch('repeater-collapse', '{{ $statePath }}')"
|
||||
>
|
||||
<span x-on:click="$dispatch('repeater-collapse', '{{ $statePath }}')">
|
||||
{{ $collapseAllAction }}
|
||||
</span>
|
||||
@endif
|
||||
|
||||
@if ($expandAllActionIsVisible)
|
||||
<span
|
||||
x-on:click="$dispatch('repeater-expand', '{{ $statePath }}')"
|
||||
>
|
||||
<span x-on:click="$dispatch('repeater-expand', '{{ $statePath }}')">
|
||||
{{ $expandAllAction }}
|
||||
</span>
|
||||
@endif
|
||||
@@ -77,24 +60,23 @@
|
||||
@endif
|
||||
|
||||
@if (count($items))
|
||||
<ul
|
||||
x-sortable
|
||||
{{
|
||||
(new ComponentAttributeBag)
|
||||
->grid($getGridColumns())
|
||||
->merge([
|
||||
<ul x-sortable
|
||||
{{ new ComponentAttributeBag()->grid($getGridColumns())->merge(
|
||||
[
|
||||
'data-sortable-animation-duration' => $getReorderAnimationDuration(),
|
||||
'x-on:end.stop' => '$wire.mountAction(\'reorder\', { items: $event.target.sortable.toArray() }, { schemaComponent: \'' . $key . '\' })',
|
||||
], escape: false)
|
||||
->class(['fi-fo-repeater-items'])
|
||||
}}
|
||||
>
|
||||
'x-on:end.stop' =>
|
||||
'$wire.mountAction(\'reorder\', { items: $event.target.sortable.toArray() }, { schemaComponent: \'' .
|
||||
$key .
|
||||
'\' })',
|
||||
],
|
||||
escape: false,
|
||||
)->class(['fi-fo-repeater-items']) }}>
|
||||
@foreach ($items as $itemKey => $item)
|
||||
@php
|
||||
$itemLabel = $getItemLabel($itemKey, $loop->index);
|
||||
$visibleExtraItemActions = array_filter(
|
||||
$extraItemActions,
|
||||
fn (Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
fn(Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
);
|
||||
$cloneAction = $cloneAction(['item' => $itemKey]);
|
||||
$cloneActionIsVisible = $isCloneable && $cloneAction->isVisible();
|
||||
@@ -105,36 +87,33 @@
|
||||
$moveUpAction = $moveUpAction(['item' => $itemKey])->disabled($loop->first);
|
||||
$moveUpActionIsVisible = $isReorderableWithButtons && $moveUpAction->isVisible();
|
||||
$reorderActionIsVisible = $isReorderableWithDragAndDrop && $reorderAction->isVisible();
|
||||
$hasItemHeader = $hasItemHeaders && ($reorderActionIsVisible || $moveUpActionIsVisible || $moveDownActionIsVisible || filled($itemLabel) || $cloneActionIsVisible || $deleteActionIsVisible || $isCollapsible || $visibleExtraItemActions);
|
||||
$hasItemHeader =
|
||||
$hasItemHeaders &&
|
||||
($reorderActionIsVisible ||
|
||||
$moveUpActionIsVisible ||
|
||||
$moveDownActionIsVisible ||
|
||||
filled($itemLabel) ||
|
||||
$cloneActionIsVisible ||
|
||||
$deleteActionIsVisible ||
|
||||
$isCollapsible ||
|
||||
$visibleExtraItemActions);
|
||||
@endphp
|
||||
|
||||
<li
|
||||
wire:ignore.self
|
||||
wire:key="{{ $item->getLivewireKey() }}.item"
|
||||
x-data="{
|
||||
isCollapsed: @if ($persistCollapsed) $persist(@js($isCollapsed($item))).as(`repeater-${@js($key)}-${@js($itemKey)}-isCollapsed`) @else @js($isCollapsed($item)) @endif,
|
||||
}"
|
||||
<li wire:ignore.self wire:key="{{ $item->getLivewireKey() }}.item" x-data="{
|
||||
isCollapsed: @if ($persistCollapsed) $persist(@js($isCollapsed($item))).as(`repeater-${@js($key)}-${@js($itemKey)}-isCollapsed`) @else @js($isCollapsed($item)) @endif,
|
||||
}"
|
||||
x-on:repeater-expand.window="$event.detail === '{{ $statePath }}' && (isCollapsed = false)"
|
||||
x-on:repeater-collapse.window="$event.detail === '{{ $statePath }}' && (isCollapsed = true)"
|
||||
x-on:expand="isCollapsed = false"
|
||||
x-sortable-item="{{ $itemKey }}"
|
||||
x-on:expand="isCollapsed = false" x-sortable-item="{{ $itemKey }}"
|
||||
@class([
|
||||
'fi-fo-repeater-item',
|
||||
'fi-fo-repeater-item-has-header' => $hasItemHeader,
|
||||
])
|
||||
x-bind:class="{ 'fi-collapsed': isCollapsed }"
|
||||
>
|
||||
]) x-bind:class="{ 'fi-collapsed': isCollapsed }">
|
||||
@if ($hasItemHeader)
|
||||
<div
|
||||
@if ($isCollapsible)
|
||||
x-on:click.stop="isCollapsed = !isCollapsed"
|
||||
@endif
|
||||
class="fi-fo-repeater-item-header"
|
||||
>
|
||||
<div @if ($isCollapsible) x-on:click.stop="isCollapsed = !isCollapsed" @endif
|
||||
class="fi-fo-repeater-item-header">
|
||||
@if ($reorderActionIsVisible || $moveUpActionIsVisible || $moveDownActionIsVisible)
|
||||
<ul
|
||||
class="fi-fo-repeater-item-header-start-actions"
|
||||
>
|
||||
<ul class="fi-fo-repeater-item-header-start-actions">
|
||||
@if ($reorderActionIsVisible)
|
||||
<li x-on:click.stop>
|
||||
{{ $reorderAction->extraAttributes(['x-sortable-handle' => true], merge: true) }}
|
||||
@@ -154,24 +133,20 @@
|
||||
@endif
|
||||
|
||||
@if (filled($itemLabel))
|
||||
<{{ $itemLabelHeadingTag }}
|
||||
@class([
|
||||
'fi-fo-repeater-item-header-label',
|
||||
'fi-truncated' => $isItemLabelTruncated,
|
||||
])
|
||||
>
|
||||
<{{ $itemLabelHeadingTag }} @class([
|
||||
'fi-fo-repeater-item-header-label',
|
||||
'fi-truncated' => $isItemLabelTruncated,
|
||||
])>
|
||||
{{ $itemLabel }}
|
||||
|
||||
@if ($hasItemNumbers)
|
||||
{{ $loop->iteration }}
|
||||
@endif
|
||||
</{{ $itemLabelHeadingTag }}>
|
||||
</{{ $itemLabelHeadingTag }}>
|
||||
@endif
|
||||
|
||||
@if ($cloneActionIsVisible || $deleteActionIsVisible || $isCollapsible || $visibleExtraItemActions)
|
||||
<ul
|
||||
class="fi-fo-repeater-item-header-end-actions"
|
||||
>
|
||||
<ul class="fi-fo-repeater-item-header-end-actions">
|
||||
@foreach ($visibleExtraItemActions as $extraItemAction)
|
||||
<li x-on:click.stop>
|
||||
{{ $extraItemAction(['item' => $itemKey]) }}
|
||||
@@ -191,19 +166,13 @@
|
||||
@endif
|
||||
|
||||
@if ($isCollapsible)
|
||||
<li
|
||||
class="fi-fo-repeater-item-header-collapsible-actions"
|
||||
x-on:click.stop="isCollapsed = !isCollapsed"
|
||||
>
|
||||
<div
|
||||
class="fi-fo-repeater-item-header-collapse-action"
|
||||
>
|
||||
<li class="fi-fo-repeater-item-header-collapsible-actions"
|
||||
x-on:click.stop="isCollapsed = !isCollapsed">
|
||||
<div class="fi-fo-repeater-item-header-collapse-action">
|
||||
{{ $getAction('collapse') }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="fi-fo-repeater-item-header-expand-action"
|
||||
>
|
||||
<div class="fi-fo-repeater-item-header-expand-action">
|
||||
{{ $getAction('expand') }}
|
||||
</div>
|
||||
</li>
|
||||
@@ -213,15 +182,12 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
x-show="! isCollapsed"
|
||||
class="fi-fo-repeater-item-content"
|
||||
>
|
||||
<div x-show="! isCollapsed" class="fi-fo-repeater-item-content">
|
||||
{{ $item }}
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@if (! $loop->last)
|
||||
@if (!$loop->last)
|
||||
@if ($isAddable && $addBetweenAction(['afterItem' => $itemKey])->isVisible())
|
||||
<li class="fi-fo-repeater-add-between-items-ctn">
|
||||
<div class="fi-fo-repeater-add-between-items">
|
||||
@@ -230,19 +196,13 @@
|
||||
</li>
|
||||
@elseif (filled($labelBetweenItems))
|
||||
<li class="fi-fo-repeater-label-between-items-ctn">
|
||||
<div
|
||||
class="fi-fo-repeater-label-between-items-divider-before"
|
||||
></div>
|
||||
<div class="fi-fo-repeater-label-between-items-divider-before"></div>
|
||||
|
||||
<span
|
||||
class="fi-fo-repeater-label-between-items"
|
||||
>
|
||||
<span class="fi-fo-repeater-label-between-items">
|
||||
{{ $labelBetweenItems }}
|
||||
</span>
|
||||
|
||||
<div
|
||||
class="fi-fo-repeater-label-between-items-divider-after"
|
||||
></div>
|
||||
<div class="fi-fo-repeater-label-between-items-divider-after"></div>
|
||||
</li>
|
||||
@endif
|
||||
@endif
|
||||
@@ -251,12 +211,12 @@
|
||||
@endif
|
||||
|
||||
@if ($isAddable && $addAction->isVisible())
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-repeater-add',
|
||||
($addActionAlignment instanceof Alignment) ? ('fi-align-' . $addActionAlignment->value) : $addActionAlignment,
|
||||
])
|
||||
>
|
||||
<div @class([
|
||||
'fi-fo-repeater-add',
|
||||
$addActionAlignment instanceof Alignment
|
||||
? 'fi-align-' . $addActionAlignment->value
|
||||
: $addActionAlignment,
|
||||
])>
|
||||
{{ $addAction }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
+27
-31
@@ -27,31 +27,24 @@
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{
|
||||
$attributes
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->class(['fi-fo-simple-repeater'])
|
||||
}}
|
||||
>
|
||||
<div {{ $attributes->merge($getExtraAttributes(), escape: false)->class(['fi-fo-simple-repeater']) }}>
|
||||
@if (count($items))
|
||||
<ul
|
||||
x-sortable
|
||||
{{
|
||||
(new ComponentAttributeBag)
|
||||
->grid($getGridColumns())
|
||||
->merge([
|
||||
<ul x-sortable
|
||||
{{ new ComponentAttributeBag()->grid($getGridColumns())->merge(
|
||||
[
|
||||
'data-sortable-animation-duration' => $getReorderAnimationDuration(),
|
||||
'x-on:end.stop' => '$wire.mountAction(\'reorder\', { items: $event.target.sortable.toArray() }, { schemaComponent: \'' . $key . '\' })',
|
||||
], escape: false)
|
||||
->class(['fi-fo-simple-repeater-items'])
|
||||
}}
|
||||
>
|
||||
'x-on:end.stop' =>
|
||||
'$wire.mountAction(\'reorder\', { items: $event.target.sortable.toArray() }, { schemaComponent: \'' .
|
||||
$key .
|
||||
'\' })',
|
||||
],
|
||||
escape: false,
|
||||
)->class(['fi-fo-simple-repeater-items']) }}>
|
||||
@foreach ($items as $itemKey => $item)
|
||||
@php
|
||||
$visibleExtraItemActions = array_filter(
|
||||
$extraItemActions,
|
||||
fn (Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
fn(Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
);
|
||||
$cloneAction = $cloneAction(['item' => $itemKey]);
|
||||
$cloneActionIsVisible = $isCloneable && $cloneAction->isVisible();
|
||||
@@ -64,16 +57,19 @@
|
||||
$reorderActionIsVisible = $isReorderableWithDragAndDrop && $reorderAction->isVisible();
|
||||
@endphp
|
||||
|
||||
<li
|
||||
wire:key="{{ $item->getLivewireKey() }}.item"
|
||||
x-sortable-item="{{ $itemKey }}"
|
||||
class="fi-fo-simple-repeater-item"
|
||||
>
|
||||
<li wire:key="{{ $item->getLivewireKey() }}.item" x-sortable-item="{{ $itemKey }}"
|
||||
class="fi-fo-simple-repeater-item">
|
||||
<div class="fi-fo-simple-repeater-item-content">
|
||||
{{ $item }}
|
||||
</div>
|
||||
|
||||
@if ($reorderActionIsVisible || $moveUpActionIsVisible || $moveDownActionIsVisible || $cloneActionIsVisible || $deleteActionIsVisible || $visibleExtraItemActions)
|
||||
@if (
|
||||
$reorderActionIsVisible ||
|
||||
$moveUpActionIsVisible ||
|
||||
$moveDownActionIsVisible ||
|
||||
$cloneActionIsVisible ||
|
||||
$deleteActionIsVisible ||
|
||||
$visibleExtraItemActions)
|
||||
<ul class="fi-fo-simple-repeater-item-actions">
|
||||
@if ($reorderActionIsVisible)
|
||||
<li x-on:click.stop>
|
||||
@@ -116,12 +112,12 @@
|
||||
@endif
|
||||
|
||||
@if ($isAddable && $addAction->isVisible())
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-simple-repeater-add',
|
||||
($addActionAlignment instanceof Alignment) ? ('fi-align-' . $addActionAlignment->value) : $addActionAlignment,
|
||||
])
|
||||
>
|
||||
<div @class([
|
||||
'fi-fo-simple-repeater-add',
|
||||
$addActionAlignment instanceof Alignment
|
||||
? 'fi-align-' . $addActionAlignment->value
|
||||
: $addActionAlignment,
|
||||
])>
|
||||
{{ $addAction }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
+51
-59
@@ -36,35 +36,27 @@
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{ $attributes
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->class([
|
||||
'fi-fo-table-repeater',
|
||||
'fi-compact' => $isCompact,
|
||||
]) }}
|
||||
>
|
||||
{{ $attributes->merge($getExtraAttributes(), escape: false)->class(['fi-fo-table-repeater', 'fi-compact' => $isCompact]) }}>
|
||||
@if (count($items))
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@if ((count($items) > 1) && ($isReorderableWithButtons || $isReorderableWithDragAndDrop))
|
||||
<th
|
||||
class="fi-fo-table-repeater-empty-header-cell"
|
||||
></th>
|
||||
@if (count($items) > 1 && ($isReorderableWithButtons || $isReorderableWithDragAndDrop))
|
||||
<th class="fi-fo-table-repeater-empty-header-cell"></th>
|
||||
@endif
|
||||
|
||||
@foreach ($tableColumns as $column)
|
||||
<th
|
||||
@class([
|
||||
'fi-wrapped' => $column->canHeaderWrap(),
|
||||
(($columnAlignment = $column->getAlignment()) instanceof Alignment) ? ('fi-align-' . $columnAlignment->value) : $columnAlignment,
|
||||
])
|
||||
@style([
|
||||
('width: ' . e($columnWidth = $column->getWidth())) => filled($columnWidth),
|
||||
])
|
||||
>
|
||||
@if (! $column->isHeaderLabelHidden())
|
||||
{{ $column->getLabel() }}@if ($column->isMarkedAsRequired())<sup class="fi-fo-table-repeater-header-required-mark">*</sup>
|
||||
<th @class([
|
||||
'fi-wrapped' => $column->canHeaderWrap(),
|
||||
($columnAlignment = $column->getAlignment()) instanceof Alignment
|
||||
? 'fi-align-' . $columnAlignment->value
|
||||
: $columnAlignment,
|
||||
]) @style([
|
||||
'width: ' . e($columnWidth = $column->getWidth()) => filled($columnWidth),
|
||||
])>
|
||||
@if (!$column->isHeaderLabelHidden())
|
||||
{{ $column->getLabel() }}@if ($column->isMarkedAsRequired())
|
||||
<sup class="fi-fo-table-repeater-header-required-mark">*</sup>
|
||||
@endif
|
||||
@else
|
||||
<span class="fi-sr-only">
|
||||
@@ -75,26 +67,27 @@
|
||||
@endforeach
|
||||
|
||||
@if (count($extraItemActions) || $isCloneable || $isDeletable)
|
||||
<th
|
||||
class="fi-fo-table-repeater-empty-header-cell"
|
||||
></th>
|
||||
<th class="fi-fo-table-repeater-empty-header-cell"></th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody
|
||||
x-sortable
|
||||
{{ (new ComponentAttributeBag)
|
||||
->merge([
|
||||
'data-sortable-animation-duration' => $getReorderAnimationDuration(),
|
||||
'x-on:end.stop' => '$wire.mountAction(\'reorder\', { items: $event.target.sortable.toArray() }, { schemaComponent: \'' . $key . '\' })',
|
||||
], escape: false) }}
|
||||
>
|
||||
<tbody x-sortable
|
||||
{{ new ComponentAttributeBag()->merge(
|
||||
[
|
||||
'data-sortable-animation-duration' => $getReorderAnimationDuration(),
|
||||
'x-on:end.stop' =>
|
||||
'$wire.mountAction(\'reorder\', { items: $event.target.sortable.toArray() }, { schemaComponent: \'' .
|
||||
$key .
|
||||
'\' })',
|
||||
],
|
||||
escape: false,
|
||||
) }}>
|
||||
@foreach ($items as $itemKey => $item)
|
||||
@php
|
||||
$visibleExtraItemActions = array_filter(
|
||||
$extraItemActions,
|
||||
fn (Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
fn(Action $action): bool => $action(['item' => $itemKey])->isVisible(),
|
||||
);
|
||||
$cloneAction = $cloneAction(['item' => $itemKey]);
|
||||
$cloneActionIsVisible = $isCloneable && $cloneAction->isVisible();
|
||||
@@ -108,16 +101,11 @@
|
||||
$itemStatePath = $item->getStatePath();
|
||||
@endphp
|
||||
|
||||
<tr
|
||||
wire:key="{{ $item->getLivewireKey() }}.item"
|
||||
x-sortable-item="{{ $itemKey }}"
|
||||
>
|
||||
@if ((count($items) > 1) && ($isReorderableWithButtons || $isReorderableWithDragAndDrop))
|
||||
<tr wire:key="{{ $item->getLivewireKey() }}.item" x-sortable-item="{{ $itemKey }}">
|
||||
@if (count($items) > 1 && ($isReorderableWithButtons || $isReorderableWithDragAndDrop))
|
||||
<td>
|
||||
@if ($reorderActionIsVisible || $moveUpActionIsVisible || $moveDownActionIsVisible)
|
||||
<div
|
||||
class="fi-fo-table-repeater-actions"
|
||||
>
|
||||
<div class="fi-fo-table-repeater-actions">
|
||||
@if ($reorderActionIsVisible)
|
||||
<div x-on:click.stop>
|
||||
{{ $reorderAction->extraAttributes(['x-sortable-handle' => true], merge: true) }}
|
||||
@@ -139,14 +127,18 @@
|
||||
@endif
|
||||
|
||||
@php
|
||||
$counter = 0
|
||||
$counter = 0;
|
||||
@endphp
|
||||
|
||||
@foreach ($item->getComponents(withHidden: true) as $schemaComponent)
|
||||
@php
|
||||
throw_unless(
|
||||
$schemaComponent instanceof \Filament\Schemas\Components\Component,
|
||||
new \Exception('Table repeaters must only contain schema components, but [' . $schemaComponent::class . '] was used.'),
|
||||
new \Exception(
|
||||
'Table repeaters must only contain schema components, but [' .
|
||||
$schemaComponent::class .
|
||||
'] was used.',
|
||||
),
|
||||
);
|
||||
@endphp
|
||||
|
||||
@@ -155,7 +147,7 @@
|
||||
{{ $schemaComponent }}
|
||||
@else
|
||||
@php
|
||||
$counter++
|
||||
$counter++;
|
||||
@endphp
|
||||
|
||||
@if ($schemaComponent->isVisible())
|
||||
@@ -164,11 +156,13 @@
|
||||
$columnVerticalAlignment = $currentColumn?->getVerticalAlignment();
|
||||
@endphp
|
||||
|
||||
<td
|
||||
@class([
|
||||
($columnVerticalAlignment instanceof VerticalAlignment) ? ('fi-vertical-align-' . $columnVerticalAlignment->value) : (is_string($columnVerticalAlignment) ? $columnVerticalAlignment : ''),
|
||||
])
|
||||
>
|
||||
<td @class([
|
||||
$columnVerticalAlignment instanceof VerticalAlignment
|
||||
? 'fi-vertical-align-' . $columnVerticalAlignment->value
|
||||
: (is_string($columnVerticalAlignment)
|
||||
? $columnVerticalAlignment
|
||||
: ''),
|
||||
])>
|
||||
{!! $schemaComponent->toSchemaHtml() !!}
|
||||
</td>
|
||||
@else
|
||||
@@ -181,9 +175,7 @@
|
||||
@if (count($extraItemActions) || $isCloneable || $isDeletable)
|
||||
<td>
|
||||
@if ($visibleExtraItemActions || $cloneActionIsVisible || $deleteActionIsVisible)
|
||||
<div
|
||||
class="fi-fo-table-repeater-actions"
|
||||
>
|
||||
<div class="fi-fo-table-repeater-actions">
|
||||
@foreach ($visibleExtraItemActions as $extraItemAction)
|
||||
<div x-on:click.stop>
|
||||
{{ $extraItemAction(['item' => $itemKey]) }}
|
||||
@@ -212,12 +204,12 @@
|
||||
@endif
|
||||
|
||||
@if ($isAddable && $addAction->isVisible())
|
||||
<div
|
||||
@class([
|
||||
'fi-fo-table-repeater-add',
|
||||
($addActionAlignment instanceof Alignment) ? ('fi-align-' . $addActionAlignment->value) : $addActionAlignment,
|
||||
])
|
||||
>
|
||||
<div @class([
|
||||
'fi-fo-table-repeater-add',
|
||||
$addActionAlignment instanceof Alignment
|
||||
? 'fi-align-' . $addActionAlignment->value
|
||||
: $addActionAlignment,
|
||||
])>
|
||||
{{ $addAction }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -20,72 +20,55 @@
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:valid="! $errors->has($statePath)"
|
||||
x-cloak
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class(['fi-fo-rich-editor'])
|
||||
"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :valid="!$errors->has($statePath)" x-cloak :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class(['fi-fo-rich-editor'])">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('rich-editor', 'filament/forms') }}"
|
||||
x-data="richEditorFormComponent({
|
||||
acceptedFileTypes: @js($fileAttachmentsAcceptedFileTypes),
|
||||
acceptedFileTypesValidationMessage: @js($fileAttachmentsAcceptedFileTypes ? __('filament-forms::components.rich_editor.file_attachments_accepted_file_types_message', ['values' => implode(', ', $fileAttachmentsAcceptedFileTypes)]) : null),
|
||||
activePanel: @js($getActivePanel()),
|
||||
canAttachFiles: @js($hasFileAttachments()),
|
||||
deleteCustomBlockButtonIconHtml: @js(\Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::Trash, alias: \Filament\Forms\View\FormsIconAlias::COMPONENTS_RICH_EDITOR_PANELS_CUSTOM_BLOCK_DELETE_BUTTON)->toHtml()),
|
||||
editCustomBlockButtonIconHtml: @js(\Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::PencilSquare, alias: \Filament\Forms\View\FormsIconAlias::COMPONENTS_RICH_EDITOR_PANELS_CUSTOM_BLOCK_EDIT_BUTTON)->toHtml()),
|
||||
extensions: @js($getTipTapJsExtensions()),
|
||||
floatingToolbars: @js($floatingToolbars),
|
||||
getMentionLabelsUsing: async (mentions) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'getMentionLabelsForJs',
|
||||
{ mentions },
|
||||
)
|
||||
},
|
||||
getMentionSearchResultsUsing: async (query, char) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'getMentionSearchResultsForJs',
|
||||
{ search: query, char },
|
||||
)
|
||||
},
|
||||
hasResizableImages: @js($hasResizableImages()),
|
||||
isDisabled: @js($isDisabled),
|
||||
label: @js($label),
|
||||
isLiveDebounced: @js($isLiveDebounced()),
|
||||
isLiveOnBlur: @js($isLiveOnBlur()),
|
||||
key: @js($key),
|
||||
linkProtocols: @js($linkProtocols),
|
||||
liveDebounce: @js($getNormalizedLiveDebounce()),
|
||||
livewireId: @js($this->getId()),
|
||||
maxFileSize: @js($fileAttachmentsMaxSize),
|
||||
maxFileSizeValidationMessage: @js($fileAttachmentsMaxSize ? trans_choice('filament-forms::components.rich_editor.file_attachments_max_size_message', $fileAttachmentsMaxSize, ['max' => $fileAttachmentsMaxSize]) : null),
|
||||
mentions: @js($mentions),
|
||||
mergeTags: @js($mergeTags),
|
||||
noMergeTagSearchResultsMessage: @js($getNoMergeTagSearchResultsMessage()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
|
||||
statePath: @js($statePath),
|
||||
textColors: @js($getTextColorsForJs()),
|
||||
uploadingFileMessage: @js($getUploadingFileMessage()),
|
||||
})"
|
||||
acceptedFileTypes: @js($fileAttachmentsAcceptedFileTypes),
|
||||
acceptedFileTypesValidationMessage: @js($fileAttachmentsAcceptedFileTypes ? __('filament-forms::components.rich_editor.file_attachments_accepted_file_types_message', ['values' => implode(', ', $fileAttachmentsAcceptedFileTypes)]) : null),
|
||||
activePanel: @js($getActivePanel()),
|
||||
canAttachFiles: @js($hasFileAttachments()),
|
||||
deleteCustomBlockButtonIconHtml: @js(\Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::Trash, alias: \Filament\Forms\View\FormsIconAlias::COMPONENTS_RICH_EDITOR_PANELS_CUSTOM_BLOCK_DELETE_BUTTON)->toHtml()),
|
||||
editCustomBlockButtonIconHtml: @js(\Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::PencilSquare, alias: \Filament\Forms\View\FormsIconAlias::COMPONENTS_RICH_EDITOR_PANELS_CUSTOM_BLOCK_EDIT_BUTTON)->toHtml()),
|
||||
extensions: @js($getTipTapJsExtensions()),
|
||||
floatingToolbars: @js($floatingToolbars),
|
||||
getMentionLabelsUsing: async (mentions) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'getMentionLabelsForJs', { mentions },
|
||||
)
|
||||
},
|
||||
getMentionSearchResultsUsing: async (query, char) => {
|
||||
return await $wire.callSchemaComponentMethod(
|
||||
@js($key),
|
||||
'getMentionSearchResultsForJs', { search: query, char },
|
||||
)
|
||||
},
|
||||
hasResizableImages: @js($hasResizableImages()),
|
||||
isDisabled: @js($isDisabled),
|
||||
label: @js($label),
|
||||
isLiveDebounced: @js($isLiveDebounced()),
|
||||
isLiveOnBlur: @js($isLiveOnBlur()),
|
||||
key: @js($key),
|
||||
linkProtocols: @js($linkProtocols),
|
||||
liveDebounce: @js($getNormalizedLiveDebounce()),
|
||||
livewireId: @js($this->getId()),
|
||||
maxFileSize: @js($fileAttachmentsMaxSize),
|
||||
maxFileSizeValidationMessage: @js($fileAttachmentsMaxSize ? trans_choice('filament-forms::components.rich_editor.file_attachments_max_size_message', $fileAttachmentsMaxSize, ['max' => $fileAttachmentsMaxSize]) : null),
|
||||
mentions: @js($mentions),
|
||||
mergeTags: @js($mergeTags),
|
||||
noMergeTagSearchResultsMessage: @js($getNoMergeTagSearchResultsMessage()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')", isOptimisticallyLive: false) }},
|
||||
statePath: @js($statePath),
|
||||
textColors: @js($getTextColorsForJs()),
|
||||
uploadingFileMessage: @js($getUploadingFileMessage()),
|
||||
})"
|
||||
x-bind:class="{
|
||||
'fi-fo-rich-editor-uploading-file': isUploadingFile,
|
||||
}"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$isDisabled,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
>
|
||||
@if ((! $isDisabled) && filled($toolbarButtons))
|
||||
wire:ignore wire:key="{{ $livewireKey }}.{{ substr(md5(serialize([$isDisabled])), 0, 64) }}">
|
||||
@if (!$isDisabled && filled($toolbarButtons))
|
||||
<div class="fi-fo-rich-editor-toolbar">
|
||||
@foreach ($toolbarButtons as $button => $buttonGroup)
|
||||
<div class="fi-fo-rich-editor-toolbar-group">
|
||||
@@ -101,11 +84,7 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
x-show="isUploadingFile"
|
||||
x-cloak
|
||||
class="fi-fo-rich-editor-uploading-file-message"
|
||||
>
|
||||
<div x-show="isUploadingFile" x-cloak class="fi-fo-rich-editor-uploading-file-message">
|
||||
{{ \Filament\Support\generate_loading_indicator_html() }}
|
||||
|
||||
<span>
|
||||
@@ -113,26 +92,16 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
x-show="! isUploadingFile && fileValidationMessage"
|
||||
x-cloak
|
||||
class="fi-fo-rich-editor-file-validation-message"
|
||||
>
|
||||
<span
|
||||
x-text="fileValidationMessage"
|
||||
x-show="! isUploadingFile && fileValidationMessage"
|
||||
></span>
|
||||
<div x-show="! isUploadingFile && fileValidationMessage" x-cloak
|
||||
class="fi-fo-rich-editor-file-validation-message">
|
||||
<span x-text="fileValidationMessage" x-show="! isUploadingFile && fileValidationMessage"></span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
{{ $getExtraInputAttributeBag()->class(['fi-fo-rich-editor-main']) }}
|
||||
>
|
||||
<div {{ $getExtraInputAttributeBag()->class(['fi-fo-rich-editor-main']) }}>
|
||||
<div class="fi-fo-rich-editor-content fi-prose" x-ref="editor">
|
||||
@foreach ($floatingToolbars as $nodeName => $buttons)
|
||||
<div
|
||||
x-ref="floatingToolbar::{{ $nodeName }}"
|
||||
class="fi-fo-rich-editor-floating-toolbar fi-not-prose"
|
||||
>
|
||||
<div x-ref="floatingToolbar::{{ $nodeName }}"
|
||||
class="fi-fo-rich-editor-floating-toolbar fi-not-prose">
|
||||
@foreach ($buttons as $button)
|
||||
@if (is_string($button))
|
||||
{{ $tools[$button] }}
|
||||
@@ -144,30 +113,16 @@
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if (! $isDisabled)
|
||||
<div
|
||||
x-show="isPanelActive()"
|
||||
x-cloak
|
||||
class="fi-fo-rich-editor-panels"
|
||||
>
|
||||
<div
|
||||
x-show="isPanelActive('customBlocks')"
|
||||
x-cloak
|
||||
class="fi-fo-rich-editor-panel"
|
||||
>
|
||||
@if (!$isDisabled)
|
||||
<div x-show="isPanelActive()" x-cloak class="fi-fo-rich-editor-panels">
|
||||
<div x-show="isPanelActive('customBlocks')" x-cloak class="fi-fo-rich-editor-panel">
|
||||
<div class="fi-fo-rich-editor-panel-header">
|
||||
<p class="fi-fo-rich-editor-panel-heading">
|
||||
{{ __('filament-forms::components.rich_editor.tools.custom_blocks') }}
|
||||
</p>
|
||||
|
||||
<div
|
||||
class="fi-fo-rich-editor-panel-close-btn-ctn"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
x-on:click="togglePanel()"
|
||||
class="fi-icon-btn"
|
||||
>
|
||||
<div class="fi-fo-rich-editor-panel-close-btn-ctn">
|
||||
<button type="button" x-on:click="togglePanel()" class="fi-icon-btn">
|
||||
{{ \Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::XMark, alias: \Filament\Forms\View\FormsIconAlias::COMPONENTS_RICH_EDITOR_PANELS_CUSTOM_BLOCKS_CLOSE_BUTTON) }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -176,25 +131,18 @@
|
||||
<div class="fi-fo-rich-editor-custom-blocks-ctn">
|
||||
@foreach ($groupedCustomBlocks as $customBlockGroupLabel => $groupBlocks)
|
||||
@if (filled($customBlockGroupLabel))
|
||||
<h4
|
||||
class="fi-fo-rich-editor-custom-blocks-group-header"
|
||||
>
|
||||
<h4 class="fi-fo-rich-editor-custom-blocks-group-header">
|
||||
{{ $customBlockGroupLabel }}
|
||||
</h4>
|
||||
@endif
|
||||
|
||||
<div
|
||||
class="fi-fo-rich-editor-custom-blocks-list"
|
||||
>
|
||||
<div class="fi-fo-rich-editor-custom-blocks-list">
|
||||
@foreach ($groupBlocks as $block)
|
||||
@php
|
||||
$blockId = $block::getId();
|
||||
@endphp
|
||||
|
||||
<button
|
||||
draggable="true"
|
||||
type="button"
|
||||
x-data="{ isLoading: false }"
|
||||
<button draggable="true" type="button" x-data="{ isLoading: false }"
|
||||
x-on:click="
|
||||
isLoading = true
|
||||
|
||||
@@ -207,13 +155,12 @@
|
||||
x-on:dragstart="$event.dataTransfer.setData('customBlock', @js($blockId))"
|
||||
x-on:open-modal.window="isLoading = false"
|
||||
x-on:run-rich-editor-commands.window="isLoading = false"
|
||||
class="fi-fo-rich-editor-custom-block-btn"
|
||||
>
|
||||
{{
|
||||
\Filament\Support\generate_loading_indicator_html((new \Illuminate\View\ComponentAttributeBag([
|
||||
class="fi-fo-rich-editor-custom-block-btn">
|
||||
{{ \Filament\Support\generate_loading_indicator_html(
|
||||
new \Illuminate\View\ComponentAttributeBag([
|
||||
'x-show' => 'isLoading',
|
||||
])))
|
||||
}}
|
||||
]),
|
||||
) }}
|
||||
|
||||
{{ $block::getLabel() }}
|
||||
</button>
|
||||
@@ -223,24 +170,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
x-show="isPanelActive('mergeTags')"
|
||||
x-cloak
|
||||
class="fi-fo-rich-editor-panel"
|
||||
>
|
||||
<div x-show="isPanelActive('mergeTags')" x-cloak class="fi-fo-rich-editor-panel">
|
||||
<div class="fi-fo-rich-editor-panel-header">
|
||||
<p class="fi-fo-rich-editor-panel-heading">
|
||||
{{ __('filament-forms::components.rich_editor.tools.merge_tags') }}
|
||||
</p>
|
||||
|
||||
<div
|
||||
class="fi-fo-rich-editor-panel-close-btn-ctn"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
x-on:click="togglePanel()"
|
||||
class="fi-icon-btn"
|
||||
>
|
||||
<div class="fi-fo-rich-editor-panel-close-btn-ctn">
|
||||
<button type="button" x-on:click="togglePanel()" class="fi-icon-btn">
|
||||
{{ \Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::XMark, alias: \Filament\Forms\View\FormsIconAlias::COMPONENTS_RICH_EDITOR_PANELS_MERGE_TAGS_CLOSE_BUTTON) }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -248,17 +185,11 @@
|
||||
|
||||
<div class="fi-fo-rich-editor-merge-tags-list">
|
||||
@foreach ($mergeTags as $tagId => $tagLabel)
|
||||
<button
|
||||
draggable="true"
|
||||
type="button"
|
||||
<button draggable="true" type="button"
|
||||
x-on:click="insertMergeTag(@js($tagId))"
|
||||
x-on:dragstart="$event.dataTransfer.setData('mergeTag', @js($tagId))"
|
||||
class="fi-fo-rich-editor-merge-tag-btn"
|
||||
>
|
||||
<span
|
||||
data-type="mergeTag"
|
||||
data-id="{{ $tagId }}"
|
||||
>
|
||||
class="fi-fo-rich-editor-merge-tag-btn">
|
||||
<span data-type="mergeTag" data-id="{{ $tagId }}">
|
||||
{{ $tagLabel }}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
+98
-141
@@ -13,7 +13,7 @@
|
||||
$isRequired = $isRequired();
|
||||
$isConcealed = $isConcealed();
|
||||
$isHtmlAllowed = $isHtmlAllowed();
|
||||
$isNative = (! ($isSearchable || $isMultiple || $isHtmlAllowed) && $isNative());
|
||||
$isNative = !($isSearchable || $isMultiple || $isHtmlAllowed) && $isNative();
|
||||
$isPrefixInline = $isPrefixInline();
|
||||
$isSuffixInline = $isSuffixInline();
|
||||
$key = $getKey();
|
||||
@@ -31,59 +31,41 @@
|
||||
$livewireKey = $getLivewireKey();
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
class="fi-fo-select-wrp"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:inline-prefix="$isPrefixInline"
|
||||
:inline-suffix="$isSuffixInline"
|
||||
:prefix="$prefixLabel"
|
||||
:prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon"
|
||||
:prefix-icon-color="$prefixIconColor"
|
||||
:suffix="$suffixLabel"
|
||||
:suffix-actions="$suffixActions"
|
||||
:suffix-icon="$suffixIcon"
|
||||
:suffix-icon-color="$suffixIconColor"
|
||||
:valid="! $errors->has($statePath)"
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" class="fi-fo-select-wrp">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :inline-prefix="$isPrefixInline" :inline-suffix="$isSuffixInline" :prefix="$prefixLabel" :prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon" :prefix-icon-color="$prefixIconColor" :suffix="$suffixLabel" :suffix-actions="$suffixActions" :suffix-icon="$suffixIcon" :suffix-icon-color="$suffixIconColor"
|
||||
:valid="!$errors->has($statePath)"
|
||||
:x-on:focus-input.stop="$isNative ? '$el.querySelector(\'select\')?.focus()' : '$el.querySelector(\'.fi-select-input-btn\')?.focus()'"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($getExtraAttributeBag())
|
||||
->class([
|
||||
'fi-fo-select',
|
||||
'fi-fo-select-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-fo-select-native' => $isNative,
|
||||
])
|
||||
"
|
||||
>
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($getExtraAttributeBag())->class([
|
||||
'fi-fo-select',
|
||||
'fi-fo-select-has-inline-prefix' =>
|
||||
$isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-fo-select-native' => $isNative,
|
||||
])">
|
||||
@if ($isNative)
|
||||
@php
|
||||
$options = $getOptions();
|
||||
@endphp
|
||||
|
||||
<select
|
||||
{{
|
||||
$extraInputAttributeBag
|
||||
->merge([
|
||||
{{ $extraInputAttributeBag->merge(
|
||||
[
|
||||
'autofocus' => $isAutofocused,
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $id,
|
||||
'required' => $isRequired && (! $isConcealed),
|
||||
'wire:key' => $hasDynamicOptions ? ($livewireKey . '.' . substr(md5(serialize($options)), 0, 64)) : null,
|
||||
'required' => $isRequired && !$isConcealed,
|
||||
'wire:key' => $hasDynamicOptions ? $livewireKey . '.' . substr(md5(serialize($options)), 0, 64) : null,
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-select-input',
|
||||
'fi-select-input-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
])
|
||||
}}
|
||||
>
|
||||
],
|
||||
escape: false,
|
||||
)->class([
|
||||
'fi-select-input',
|
||||
'fi-select-input-has-inline-prefix' =>
|
||||
$isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
]) }}>
|
||||
@if ($canSelectPlaceholder)
|
||||
<option value="">
|
||||
@if (! $isDisabled)
|
||||
@if (!$isDisabled)
|
||||
{{ $getPlaceholder() }}
|
||||
@endif
|
||||
</option>
|
||||
@@ -93,10 +75,7 @@
|
||||
@if (is_array($label))
|
||||
<optgroup label="{{ $value }}">
|
||||
@foreach ($label as $groupedValue => $groupedLabel)
|
||||
<option
|
||||
@disabled($isOptionDisabled($groupedValue, $groupedLabel))
|
||||
value="{{ $groupedValue }}"
|
||||
>
|
||||
<option @disabled($isOptionDisabled($groupedValue, $groupedLabel)) value="{{ $groupedValue }}">
|
||||
@if ($isHtmlAllowed)
|
||||
{!! $groupedLabel !!}
|
||||
@else
|
||||
@@ -106,10 +85,7 @@
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@else
|
||||
<option
|
||||
@disabled($isOptionDisabled($value, $label))
|
||||
value="{{ $value }}"
|
||||
>
|
||||
<option @disabled($isOptionDisabled($value, $label)) value="{{ $value }}">
|
||||
@if ($isHtmlAllowed)
|
||||
{!! $label !!}
|
||||
@else
|
||||
@@ -120,102 +96,83 @@
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<div
|
||||
class="fi-hidden"
|
||||
x-data="{
|
||||
isDisabled: @js($isDisabled),
|
||||
init() {
|
||||
const container = $el.nextElementSibling
|
||||
container.dispatchEvent(
|
||||
new CustomEvent('set-select-property', {
|
||||
detail: { isDisabled: this.isDisabled },
|
||||
}),
|
||||
)
|
||||
},
|
||||
}"
|
||||
></div>
|
||||
<div
|
||||
x-load
|
||||
<div class="fi-hidden" x-data="{
|
||||
isDisabled: @js($isDisabled),
|
||||
init() {
|
||||
const container = $el.nextElementSibling
|
||||
container.dispatchEvent(
|
||||
new CustomEvent('set-select-property', {
|
||||
detail: { isDisabled: this.isDisabled },
|
||||
}),
|
||||
)
|
||||
},
|
||||
}"></div>
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('select', 'filament/forms') }}"
|
||||
x-data="selectFormComponent({
|
||||
canOptionLabelsWrap: @js($canOptionLabelsWrap),
|
||||
canSelectPlaceholder: @js($canSelectPlaceholder),
|
||||
getOptionLabelUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getOptionLabel'],
|
||||
{ async: true },
|
||||
)
|
||||
},
|
||||
getOptionLabelsUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getOptionLabelsForJs'],
|
||||
{ async: true },
|
||||
)
|
||||
},
|
||||
getOptionsUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getOptionsForJs'],
|
||||
{ async: true },
|
||||
)
|
||||
},
|
||||
getSearchResultsUsing: async (search) => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getSearchResultsForJs', { search }],
|
||||
{ async: true },
|
||||
)
|
||||
},
|
||||
hasDynamicOptions: @js($hasDynamicOptions),
|
||||
hasDynamicSearchResults: @js($hasDynamicSearchResults()),
|
||||
hasInitialNoOptionsMessage: @js($hasInitialNoOptionsMessage),
|
||||
initialOptionLabel: @js((blank($state) || $isMultiple) ? null : $getOptionLabel()),
|
||||
initialOptionLabels: @js((filled($state) && $isMultiple) ? $getOptionLabelsForJs() : []),
|
||||
initialState: @js($state),
|
||||
isAutofocused: @js($isAutofocused),
|
||||
isDisabled: @js($isDisabled),
|
||||
isHtmlAllowed: @js($isHtmlAllowed),
|
||||
isMultiple: @js($isMultiple),
|
||||
isReorderable: @js($isReorderable),
|
||||
isSearchable: @js($isSearchable),
|
||||
livewireId: @js($this->getId()),
|
||||
loadingMessage: @js($getLoadingMessage()),
|
||||
maxItems: @js($getMaxItems()),
|
||||
maxItemsMessage: @js($getMaxItemsMessage()),
|
||||
noOptionsMessage: @js($getNoOptionsMessage()),
|
||||
noSearchResultsMessage: @js($getNoSearchResultsMessage()),
|
||||
options: @js($getOptionsForJs()),
|
||||
optionsLimit: @js($getOptionsLimit()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
position: @js($getPosition()),
|
||||
searchDebounce: @js($getSearchDebounce()),
|
||||
searchingMessage: @js($getSearchingMessage()),
|
||||
searchPrompt: @js($getSearchPrompt()),
|
||||
searchableOptionFields: @js($getSearchableOptionFields()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
statePath: @js($statePath),
|
||||
})"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$isDisabled,
|
||||
$isReorderable,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
canOptionLabelsWrap: @js($canOptionLabelsWrap),
|
||||
canSelectPlaceholder: @js($canSelectPlaceholder),
|
||||
getOptionLabelUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getOptionLabel'], { async: true },
|
||||
)
|
||||
},
|
||||
getOptionLabelsUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getOptionLabelsForJs'], { async: true },
|
||||
)
|
||||
},
|
||||
getOptionsUsing: async () => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getOptionsForJs'], { async: true },
|
||||
)
|
||||
},
|
||||
getSearchResultsUsing: async (search) => {
|
||||
return await Livewire.fireAction(
|
||||
$wire.__instance,
|
||||
'callSchemaComponentMethod',
|
||||
[@js($key), 'getSearchResultsForJs', { search }], { async: true },
|
||||
)
|
||||
},
|
||||
hasDynamicOptions: @js($hasDynamicOptions),
|
||||
hasDynamicSearchResults: @js($hasDynamicSearchResults()),
|
||||
hasInitialNoOptionsMessage: @js($hasInitialNoOptionsMessage),
|
||||
initialOptionLabel: @js(blank($state) || $isMultiple ? null : $getOptionLabel()),
|
||||
initialOptionLabels: @js(filled($state) && $isMultiple ? $getOptionLabelsForJs() : []),
|
||||
initialState: @js($state),
|
||||
isAutofocused: @js($isAutofocused),
|
||||
isDisabled: @js($isDisabled),
|
||||
isHtmlAllowed: @js($isHtmlAllowed),
|
||||
isMultiple: @js($isMultiple),
|
||||
isReorderable: @js($isReorderable),
|
||||
isSearchable: @js($isSearchable),
|
||||
livewireId: @js($this->getId()),
|
||||
loadingMessage: @js($getLoadingMessage()),
|
||||
maxItems: @js($getMaxItems()),
|
||||
maxItemsMessage: @js($getMaxItemsMessage()),
|
||||
noOptionsMessage: @js($getNoOptionsMessage()),
|
||||
noSearchResultsMessage: @js($getNoSearchResultsMessage()),
|
||||
options: @js($getOptionsForJs()),
|
||||
optionsLimit: @js($getOptionsLimit()),
|
||||
placeholder: @js($getPlaceholder()),
|
||||
position: @js($getPosition()),
|
||||
searchDebounce: @js($getSearchDebounce()),
|
||||
searchingMessage: @js($getSearchingMessage()),
|
||||
searchPrompt: @js($getSearchPrompt()),
|
||||
searchableOptionFields: @js($getSearchableOptionFields()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
statePath: @js($statePath),
|
||||
})" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{ substr(md5(serialize([$isDisabled, $isReorderable])), 0, 64) }}"
|
||||
x-on:keydown.esc="select.dropdown.isActive && $event.stopPropagation()"
|
||||
x-on:set-select-property="$event.detail.isDisabled ? select.disable() : select.enable()"
|
||||
{{
|
||||
$attributes
|
||||
->merge($getExtraAlpineAttributes(), escape: false)
|
||||
->class(['fi-select-input'])
|
||||
}}
|
||||
>
|
||||
{{ $attributes->merge($getExtraAlpineAttributes(), escape: false)->class(['fi-select-input']) }}>
|
||||
<div x-ref="select"></div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -6,56 +6,43 @@
|
||||
$isDisabled = $isDisabled();
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
:inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" :inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('slider', 'filament/forms') }}"
|
||||
x-data="sliderFormComponent({
|
||||
arePipsStepped: @js($arePipsStepped()),
|
||||
behavior: @js($getBehaviorForJs()),
|
||||
decimalPlaces: @js($getDecimalPlaces()),
|
||||
fillTrack: @js($getFillTrack()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isRtl: @js($isRtl()),
|
||||
isVertical: @js($isVertical),
|
||||
maxDifference: @js($getMaxDifference()),
|
||||
minDifference: @js($getMinDifference()),
|
||||
maxValue: @js($getMaxValue()),
|
||||
minValue: @js($getMinValue()),
|
||||
nonLinearPoints: @js($getNonLinearPoints()),
|
||||
pipsDensity: @js($getPipsDensity()),
|
||||
pipsFilter: @js($getPipsFilterForJs()),
|
||||
pipsFormatter: @js($getPipsFormatterForJs()),
|
||||
pipsMode: @js($pipsMode),
|
||||
pipsValues: @js($getPipsValues()),
|
||||
rangePadding: @js($getRangePadding()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }},
|
||||
step: @js($getStep()),
|
||||
tooltips: @js($getTooltipsForJs()),
|
||||
})"
|
||||
wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{
|
||||
substr(md5(serialize([
|
||||
$isDisabled,
|
||||
])), 0, 64)
|
||||
}}"
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
arePipsStepped: @js($arePipsStepped()),
|
||||
behavior: @js($getBehaviorForJs()),
|
||||
decimalPlaces: @js($getDecimalPlaces()),
|
||||
fillTrack: @js($getFillTrack()),
|
||||
isDisabled: @js($isDisabled),
|
||||
isRtl: @js($isRtl()),
|
||||
isVertical: @js($isVertical),
|
||||
maxDifference: @js($getMaxDifference()),
|
||||
minDifference: @js($getMinDifference()),
|
||||
maxValue: @js($getMaxValue()),
|
||||
minValue: @js($getMinValue()),
|
||||
nonLinearPoints: @js($getNonLinearPoints()),
|
||||
pipsDensity: @js($getPipsDensity()),
|
||||
pipsFilter: @js($getPipsFilterForJs()),
|
||||
pipsFormatter: @js($getPipsFormatterForJs()),
|
||||
pipsMode: @js($pipsMode),
|
||||
pipsValues: @js($getPipsValues()),
|
||||
rangePadding: @js($getRangePadding()),
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }},
|
||||
step: @js($getStep()),
|
||||
tooltips: @js($getTooltipsForJs()),
|
||||
})" wire:ignore
|
||||
wire:key="{{ $livewireKey }}.{{ substr(md5(serialize([$isDisabled])), 0, 64) }}"
|
||||
{{ $attributes->merge(
|
||||
[
|
||||
'id' => $getId(),
|
||||
], escape: false)
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->merge($getExtraAlpineAttributes(), escape: false)
|
||||
->class([
|
||||
'fi-fo-slider',
|
||||
'fi-fo-slider-has-pips' => $pipsMode,
|
||||
'fi-fo-slider-has-tooltips' => $hasTooltips(),
|
||||
'fi-fo-slider-vertical' => $isVertical,
|
||||
])
|
||||
}}
|
||||
></div>
|
||||
],
|
||||
escape: false,
|
||||
)->merge($getExtraAttributes(), escape: false)->merge($getExtraAlpineAttributes(), escape: false)->class([
|
||||
'fi-fo-slider',
|
||||
'fi-fo-slider-has-pips' => $pipsMode,
|
||||
'fi-fo-slider-has-tooltips' => $hasTooltips(),
|
||||
'fi-fo-slider-vertical' => $isVertical,
|
||||
]) }}>
|
||||
</div>
|
||||
</x-dynamic-component>
|
||||
|
||||
@@ -8,24 +8,26 @@
|
||||
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field">
|
||||
<div
|
||||
{{
|
||||
$attributes
|
||||
->merge([
|
||||
{{ $attributes->merge(
|
||||
[
|
||||
'id' => $id,
|
||||
], escape: false)
|
||||
->merge($extraAttributes, escape: false)
|
||||
}}
|
||||
>
|
||||
@livewire(TableSelectLivewireComponent::class, [
|
||||
'isDisabled' => $isDisabled(),
|
||||
'maxSelectableRecords' => $getMaxItems(),
|
||||
'model' => $getModel(),
|
||||
'record' => $getRecord(),
|
||||
'relationshipName' => $getRelationshipName(),
|
||||
'shouldIgnoreRelatedRecords' => $shouldIgnoreRelatedRecords(),
|
||||
'tableConfiguration' => base64_encode($getTableConfiguration()),
|
||||
'tableArguments' => $getTableArguments(),
|
||||
$applyStateBindingModifiers('wire:model') => $getStatePath(),
|
||||
], key($getLivewireKey()))
|
||||
],
|
||||
escape: false,
|
||||
)->merge($extraAttributes, escape: false) }}>
|
||||
@livewire(
|
||||
TableSelectLivewireComponent::class,
|
||||
[
|
||||
'isDisabled' => $isDisabled(),
|
||||
'maxSelectableRecords' => $getMaxItems(),
|
||||
'model' => $getModel(),
|
||||
'record' => $getRecord(),
|
||||
'relationshipName' => $getRelationshipName(),
|
||||
'shouldIgnoreRelatedRecords' => $shouldIgnoreRelatedRecords(),
|
||||
'tableConfiguration' => base64_encode($getTableConfiguration()),
|
||||
'tableArguments' => $getTableArguments(),
|
||||
$applyStateBindingModifiers('wire:model') => $getStatePath(),
|
||||
],
|
||||
key($getLivewireKey())
|
||||
)
|
||||
</div>
|
||||
</x-dynamic-component>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
$isAutofocused = $isAutofocused();
|
||||
$isDisabled = $isDisabled();
|
||||
$isPrefixInline = $isPrefixInline();
|
||||
$isReorderable = (! $isDisabled) && $isReorderable();
|
||||
$isReorderable = !$isDisabled && $isReorderable();
|
||||
$isSuffixInline = $isSuffixInline();
|
||||
$placeholder = $getPlaceholder();
|
||||
$prefixActions = $getPrefixActions();
|
||||
@@ -21,47 +21,21 @@
|
||||
$suffixLabel = $getSuffixLabel();
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
class="fi-fo-tags-input-wrp"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:inline-prefix="$isPrefixInline"
|
||||
:inline-suffix="$isSuffixInline"
|
||||
:prefix="$prefixLabel"
|
||||
:prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon"
|
||||
:prefix-icon-color="$prefixIconColor"
|
||||
:suffix="$suffixLabel"
|
||||
:suffix-actions="$suffixActions"
|
||||
:suffix-icon="$suffixIcon"
|
||||
:suffix-icon-color="$suffixIconColor"
|
||||
:valid="! $errors->has($statePath)"
|
||||
x-on:focus-input.stop="$el.querySelector('input')?.focus()"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($attributes)
|
||||
->merge($extraAttributes, escape: false)
|
||||
->class([
|
||||
'fi-fo-tags-input',
|
||||
'fi-disabled' => $isDisabled,
|
||||
])
|
||||
"
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" class="fi-fo-tags-input-wrp">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :inline-prefix="$isPrefixInline" :inline-suffix="$isSuffixInline" :prefix="$prefixLabel" :prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon" :prefix-icon-color="$prefixIconColor" :suffix="$suffixLabel" :suffix-actions="$suffixActions" :suffix-icon="$suffixIcon" :suffix-icon-color="$suffixIconColor"
|
||||
:valid="!$errors->has($statePath)" x-on:focus-input.stop="$el.querySelector('input')?.focus()" :attributes="\Filament\Support\prepare_inherited_attributes($attributes)
|
||||
->merge($extraAttributes, escape: false)
|
||||
->class(['fi-fo-tags-input', 'fi-disabled' => $isDisabled])">
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('tags-input', 'filament/forms') }}"
|
||||
x-data="tagsInputFormComponent({
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
splitKeys: @js($getSplitKeys()),
|
||||
})"
|
||||
{{ $getExtraAlpineAttributeBag() }}
|
||||
>
|
||||
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$statePath}')") }},
|
||||
splitKeys: @js($getSplitKeys()),
|
||||
})" {{ $getExtraAlpineAttributeBag() }}>
|
||||
<input
|
||||
{{
|
||||
$extraInputAttributeBag
|
||||
->merge([
|
||||
{{ $extraInputAttributeBag->merge(
|
||||
[
|
||||
'autocomplete' => 'off',
|
||||
'autofocus' => $isAutofocused,
|
||||
'disabled' => $isDisabled,
|
||||
@@ -70,21 +44,20 @@
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'type' => 'text',
|
||||
'x-bind' => 'input',
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
])
|
||||
}}
|
||||
/>
|
||||
],
|
||||
escape: false,
|
||||
)->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' =>
|
||||
$isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' =>
|
||||
$isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
]) }} />
|
||||
|
||||
<datalist id="{{ $id }}-suggestions">
|
||||
@foreach ($getSuggestions() as $suggestion)
|
||||
<template
|
||||
x-bind:key="@js($suggestion)"
|
||||
x-if="! (state?.includes(@js($suggestion)) ?? true)"
|
||||
>
|
||||
<template x-bind:key="@js($suggestion)"
|
||||
x-if="! (state?.includes(@js($suggestion)) ?? true)">
|
||||
<option value="{{ $suggestion }}" />
|
||||
</template>
|
||||
@endforeach
|
||||
@@ -92,37 +65,25 @@
|
||||
|
||||
<div wire:ignore>
|
||||
<template x-cloak x-if="state?.length">
|
||||
<div
|
||||
@if ($isReorderable)
|
||||
x-on:end.stop="reorderTags($event)"
|
||||
<div @if ($isReorderable) x-on:end.stop="reorderTags($event)"
|
||||
x-sortable
|
||||
data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}"
|
||||
@endif
|
||||
class="fi-fo-tags-input-tags-ctn"
|
||||
>
|
||||
<template
|
||||
x-for="(tag, index) in state"
|
||||
x-bind:key="`${tag}-${index}`"
|
||||
>
|
||||
<x-filament::badge
|
||||
:color="$color"
|
||||
:x-bind:x-sortable-item="$isReorderable ? 'index' : null"
|
||||
:x-sortable-handle="$isReorderable ? '' : null"
|
||||
data-sortable-animation-duration="{{ $getReorderAnimationDuration() }}" @endif
|
||||
class="fi-fo-tags-input-tags-ctn">
|
||||
<template x-for="(tag, index) in state" x-bind:key="`${tag}-${index}`">
|
||||
<x-filament::badge :color="$color"
|
||||
:x-bind:x-sortable-item="$isReorderable ? 'index' : null" :x-sortable-handle="$isReorderable ? '' : null"
|
||||
@class([
|
||||
'fi-reorderable' => $isReorderable,
|
||||
])
|
||||
>
|
||||
])>
|
||||
{{ $getTagPrefix() }}
|
||||
|
||||
<span x-text="tag"></span>
|
||||
|
||||
{{ $getTagSuffix() }}
|
||||
|
||||
<x-slot
|
||||
name="deleteButton"
|
||||
x-on:click.stop="deleteTag(tag)"
|
||||
:x-bind:aria-label="'\'' . __('filament-forms::components.tags_input.actions.delete.label') . ': \' + tag'"
|
||||
></x-slot>
|
||||
<x-slot name="deleteButton" x-on:click.stop="deleteTag(tag)"
|
||||
:x-bind:aria-label="'\''.__('filament-forms::components.tags_input.actions.delete.label').
|
||||
': \' + tag'"></x-slot>
|
||||
</x-filament::badge>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -42,68 +42,48 @@
|
||||
|
||||
$inputAttributes = $getExtraInputAttributeBag()
|
||||
->merge($extraAlpineAttributes, escape: false)
|
||||
->merge([
|
||||
'autocapitalize' => $getAutocapitalize(),
|
||||
'autocomplete' => $getAutocomplete(),
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $id,
|
||||
'inlinePrefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'inlineSuffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
'inputmode' => $getInputMode(),
|
||||
'list' => $datalistOptions ? $id . '-list' : null,
|
||||
'max' => (! $isConcealed) ? $getMaxValue() : null,
|
||||
'maxlength' => (! $isConcealed) ? $getMaxLength() : null,
|
||||
'min' => (! $isConcealed) ? $getMinValue() : null,
|
||||
'minlength' => (! $isConcealed) ? $getMinLength() : null,
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'readonly' => $isReadOnly(),
|
||||
'required' => $isRequired() && (! $isConcealed),
|
||||
'step' => $getStep(),
|
||||
'type' => $type,
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
'x-bind:type' => $isPasswordRevealable ? 'isPasswordRevealed ? \'text\' : \'password\'' : null,
|
||||
'x-mask' . ($mask instanceof \Filament\Support\RawJs ? ':dynamic' : '') => filled($mask) ? $mask : null,
|
||||
], escape: false)
|
||||
->merge(
|
||||
[
|
||||
'autocapitalize' => $getAutocapitalize(),
|
||||
'autocomplete' => $getAutocomplete(),
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $id,
|
||||
'inlinePrefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'inlineSuffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
'inputmode' => $getInputMode(),
|
||||
'list' => $datalistOptions ? $id . '-list' : null,
|
||||
'max' => !$isConcealed ? $getMaxValue() : null,
|
||||
'maxlength' => !$isConcealed ? $getMaxLength() : null,
|
||||
'min' => !$isConcealed ? $getMinValue() : null,
|
||||
'minlength' => !$isConcealed ? $getMinLength() : null,
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'readonly' => $isReadOnly(),
|
||||
'required' => $isRequired() && !$isConcealed,
|
||||
'step' => $getStep(),
|
||||
'type' => $type,
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
'x-bind:type' => $isPasswordRevealable ? 'isPasswordRevealed ? \'text\' : \'password\'' : null,
|
||||
'x-mask' . ($mask instanceof \Filament\Support\RawJs ? ':dynamic' : '') => filled($mask) ? $mask : null,
|
||||
],
|
||||
escape: false,
|
||||
)
|
||||
->class([
|
||||
'fi-revealable' => $isPasswordRevealable,
|
||||
]);
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
:inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:inline-prefix="$isPrefixInline"
|
||||
:inline-suffix="$isSuffixInline"
|
||||
:prefix="$prefixLabel"
|
||||
:prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon"
|
||||
:prefix-icon-color="$prefixIconColor"
|
||||
:suffix="$suffixLabel"
|
||||
:suffix-actions="$suffixActions"
|
||||
:suffix-icon="$suffixIcon"
|
||||
:suffix-icon-color="$suffixIconColor"
|
||||
:valid="! $errors->has($statePath)"
|
||||
:x-data="$xData"
|
||||
x-on:focus-input.stop="$el.querySelector('input')?.focus()"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class(['fi-fo-text-input'])
|
||||
"
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" :inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :inline-prefix="$isPrefixInline" :inline-suffix="$isSuffixInline" :prefix="$prefixLabel" :prefix-actions="$prefixActions"
|
||||
:prefix-icon="$prefixIcon" :prefix-icon-color="$prefixIconColor" :suffix="$suffixLabel" :suffix-actions="$suffixActions" :suffix-icon="$suffixIcon" :suffix-icon-color="$suffixIconColor"
|
||||
:valid="!$errors->has($statePath)" :x-data="$xData" x-on:focus-input.stop="$el.querySelector('input')?.focus()"
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class(['fi-fo-text-input'])">
|
||||
<input
|
||||
{{
|
||||
$inputAttributes->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
])
|
||||
}}
|
||||
/>
|
||||
{{ $inputAttributes->class([
|
||||
'fi-input',
|
||||
'fi-input-has-inline-prefix' => $isPrefixInline && (count($prefixActions) || $prefixIcon || filled($prefixLabel)),
|
||||
'fi-input-has-inline-suffix' => $isSuffixInline && (count($suffixActions) || $suffixIcon || filled($suffixLabel)),
|
||||
]) }} />
|
||||
</x-filament::input.wrapper>
|
||||
|
||||
@if ($datalistOptions)
|
||||
|
||||
@@ -9,63 +9,46 @@
|
||||
$placeholder = $getPlaceholder();
|
||||
$statePath = $getStatePath();
|
||||
|
||||
$initialHeight = (($rows ?? 2) * 1.5) + 0.75;
|
||||
$initialHeight = ($rows ?? 2) * 1.5 + 0.75;
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
class="fi-fo-textarea-wrp"
|
||||
>
|
||||
<x-filament::input.wrapper
|
||||
:disabled="$isDisabled"
|
||||
:valid="! $errors->has($statePath)"
|
||||
:attributes="
|
||||
\Filament\Support\prepare_inherited_attributes($extraAttributeBag)
|
||||
->class([
|
||||
'fi-fo-textarea',
|
||||
'fi-autosizable' => $shouldAutosize,
|
||||
])
|
||||
"
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" class="fi-fo-textarea-wrp">
|
||||
<x-filament::input.wrapper :disabled="$isDisabled" :valid="!$errors->has($statePath)" :attributes="\Filament\Support\prepare_inherited_attributes($extraAttributeBag)->class([
|
||||
'fi-fo-textarea',
|
||||
'fi-autosizable' => $shouldAutosize,
|
||||
])">
|
||||
<div wire:ignore.self style="height: '{{ $initialHeight . 'rem' }}'">
|
||||
<textarea
|
||||
x-load
|
||||
<textarea x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('textarea', 'filament/forms') }}"
|
||||
x-data="textareaFormComponent({
|
||||
initialHeight: @js($initialHeight),
|
||||
shouldAutosize: @js($shouldAutosize),
|
||||
state: $wire.$entangle('{{ $statePath }}'),
|
||||
})"
|
||||
@if ($shouldAutosize)
|
||||
x-intersect.once="resize()"
|
||||
x-on:resize.window="resize()"
|
||||
@endif
|
||||
initialHeight: @js($initialHeight),
|
||||
shouldAutosize: @js($shouldAutosize),
|
||||
state: $wire.$entangle('{{ $statePath }}'),
|
||||
})"
|
||||
@if ($shouldAutosize) x-intersect.once="resize()"
|
||||
x-on:resize.window="resize()" @endif
|
||||
x-model="state"
|
||||
@if ($isGrammarlyDisabled())
|
||||
data-gramm="false"
|
||||
@if ($isGrammarlyDisabled()) data-gramm="false"
|
||||
data-gramm_editor="false"
|
||||
data-enable-grammarly="false"
|
||||
@endif
|
||||
data-enable-grammarly="false" @endif
|
||||
{{ $getExtraAlpineAttributeBag() }}
|
||||
{{
|
||||
$getExtraInputAttributeBag()
|
||||
->merge([
|
||||
'autocomplete' => $getAutocomplete(),
|
||||
'autofocus' => $isAutofocused(),
|
||||
'cols' => $getCols(),
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $getId(),
|
||||
'maxlength' => (! $isConcealed) ? $getMaxLength() : null,
|
||||
'minlength' => (! $isConcealed) ? $getMinLength() : null,
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'readonly' => $isReadOnly(),
|
||||
'required' => $isRequired() && (! $isConcealed),
|
||||
'rows' => $rows,
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
], escape: false)
|
||||
}}
|
||||
></textarea>
|
||||
{{ $getExtraInputAttributeBag()->merge(
|
||||
[
|
||||
'autocomplete' => $getAutocomplete(),
|
||||
'autofocus' => $isAutofocused(),
|
||||
'cols' => $getCols(),
|
||||
'disabled' => $isDisabled,
|
||||
'id' => $getId(),
|
||||
'maxlength' => !$isConcealed ? $getMaxLength() : null,
|
||||
'minlength' => !$isConcealed ? $getMinLength() : null,
|
||||
'placeholder' => filled($placeholder) ? e($placeholder) : null,
|
||||
'readonly' => $isReadOnly(),
|
||||
'required' => $isRequired() && !$isConcealed,
|
||||
'rows' => $rows,
|
||||
$applyStateBindingModifiers('wire:model') => $statePath,
|
||||
],
|
||||
escape: false,
|
||||
) }}></textarea>
|
||||
</div>
|
||||
</x-filament::input.wrapper>
|
||||
</x-dynamic-component>
|
||||
|
||||
+8
-31
@@ -9,15 +9,8 @@
|
||||
$extraInputAttributeBag = $getExtraInputAttributeBag()->class(['fi-fo-toggle-buttons-input']);
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
tabindex="-1"
|
||||
class="fi-fo-toggle-buttons-wrp"
|
||||
>
|
||||
<div
|
||||
{{ $getExtraAttributeBag()->class(['fi-fo-toggle-buttons fi-btn-group']) }}
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" tabindex="-1" class="fi-fo-toggle-buttons-wrp">
|
||||
<div {{ $getExtraAttributeBag()->class(['fi-fo-toggle-buttons fi-btn-group']) }}>
|
||||
@foreach ($getOptions() as $value => $label)
|
||||
@php
|
||||
$inputId = "{$id}-{$value}";
|
||||
@@ -27,29 +20,13 @@
|
||||
$tooltip = $getTooltip($value);
|
||||
@endphp
|
||||
|
||||
<input
|
||||
@disabled($shouldOptionBeDisabled)
|
||||
id="{{ $inputId }}"
|
||||
@if (! $isMultiple)
|
||||
name="{{ $id }}"
|
||||
@endif
|
||||
type="{{ $isMultiple ? 'checkbox' : 'radio' }}"
|
||||
value="{{ $value }}"
|
||||
wire:loading.attr="disabled"
|
||||
{{ $wireModelAttribute }}="{{ $statePath }}"
|
||||
{{ $extraInputAttributeBag }}
|
||||
/>
|
||||
<input @disabled($shouldOptionBeDisabled) id="{{ $inputId }}"
|
||||
@if (!$isMultiple) name="{{ $id }}" @endif
|
||||
type="{{ $isMultiple ? 'checkbox' : 'radio' }}" value="{{ $value }}" wire:loading.attr="disabled"
|
||||
{{ $wireModelAttribute }}="{{ $statePath }}" {{ $extraInputAttributeBag }} />
|
||||
|
||||
<x-filament::button
|
||||
:color="$color"
|
||||
:disabled="$shouldOptionBeDisabled"
|
||||
:for="$inputId"
|
||||
grouped
|
||||
:icon="$icon"
|
||||
:label-sr-only="$areButtonLabelsHidden"
|
||||
tag="label"
|
||||
:tooltip="$tooltip"
|
||||
>
|
||||
<x-filament::button :color="$color" :disabled="$shouldOptionBeDisabled" :for="$inputId" grouped :icon="$icon"
|
||||
:label-sr-only="$areButtonLabelsHidden" tag="label" :tooltip="$tooltip">
|
||||
{{ $label }}
|
||||
</x-filament::button>
|
||||
@endforeach
|
||||
|
||||
+8
-36
@@ -14,22 +14,9 @@
|
||||
$extraInputAttributeBag = $getExtraInputAttributeBag()->class(['fi-fo-toggle-buttons-input']);
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
tabindex="-1"
|
||||
class="fi-fo-toggle-buttons-wrp"
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" tabindex="-1" class="fi-fo-toggle-buttons-wrp">
|
||||
<div
|
||||
{{
|
||||
$getExtraAttributeBag()
|
||||
->when(! $isInline, fn (ComponentAttributeBag $attributes) => $attributes->grid($getColumns(), $gridDirection))
|
||||
->class([
|
||||
'fi-fo-toggle-buttons',
|
||||
'fi-inline' => $isInline,
|
||||
])
|
||||
}}
|
||||
>
|
||||
{{ $getExtraAttributeBag()->when(!$isInline, fn(ComponentAttributeBag $attributes) => $attributes->grid($getColumns(), $gridDirection))->class(['fi-fo-toggle-buttons', 'fi-inline' => $isInline]) }}>
|
||||
@foreach ($getOptions() as $value => $label)
|
||||
@php
|
||||
$inputId = "{$id}-{$value}";
|
||||
@@ -40,28 +27,13 @@
|
||||
@endphp
|
||||
|
||||
<div class="fi-fo-toggle-buttons-btn-ctn">
|
||||
<input
|
||||
@if ($loop->first && $isAutofocused()) autofocus @endif
|
||||
@disabled($shouldOptionBeDisabled)
|
||||
id="{{ $inputId }}"
|
||||
@if (! $isMultiple)
|
||||
name="{{ $id }}"
|
||||
@endif
|
||||
type="{{ $isMultiple ? 'checkbox' : 'radio' }}"
|
||||
value="{{ $value }}"
|
||||
{{ $wireModelAttribute }}="{{ $statePath }}"
|
||||
{{ $extraInputAttributeBag }}
|
||||
/>
|
||||
<input @if ($loop->first && $isAutofocused()) autofocus @endif @disabled($shouldOptionBeDisabled)
|
||||
id="{{ $inputId }}" @if (!$isMultiple) name="{{ $id }}" @endif
|
||||
type="{{ $isMultiple ? 'checkbox' : 'radio' }}" value="{{ $value }}"
|
||||
{{ $wireModelAttribute }}="{{ $statePath }}" {{ $extraInputAttributeBag }} />
|
||||
|
||||
<x-filament::button
|
||||
:color="$color"
|
||||
:disabled="$shouldOptionBeDisabled"
|
||||
:for="$inputId"
|
||||
:icon="$icon"
|
||||
:label-sr-only="$areButtonLabelsHidden"
|
||||
tag="label"
|
||||
:tooltip="$tooltip"
|
||||
>
|
||||
<x-filament::button :color="$color" :disabled="$shouldOptionBeDisabled" :for="$inputId" :icon="$icon"
|
||||
:label-sr-only="$areButtonLabelsHidden" tag="label" :tooltip="$tooltip">
|
||||
{{ $label }}
|
||||
</x-filament::button>
|
||||
</div>
|
||||
|
||||
@@ -4,39 +4,34 @@
|
||||
$fieldWrapperView = $getFieldWrapperView();
|
||||
$statePath = $getStatePath();
|
||||
|
||||
$attributes = (new ComponentAttributeBag)
|
||||
->merge([
|
||||
'aria-checked' => 'false',
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled(),
|
||||
'id' => $getId(),
|
||||
'offColor' => $getOffColor() ?? 'gray',
|
||||
'offIcon' => $getOffIcon(),
|
||||
'onColor' => $getOnColor() ?? 'primary',
|
||||
'onIcon' => $getOnIcon(),
|
||||
'state' => '$wire.' . $applyStateBindingModifiers('$entangle(\'' . $statePath . '\')'),
|
||||
'wire:loading.attr' => 'disabled',
|
||||
'wire:target' => $statePath,
|
||||
], escape: false)
|
||||
$attributes = new ComponentAttributeBag()
|
||||
->merge(
|
||||
[
|
||||
'aria-checked' => 'false',
|
||||
'autofocus' => $isAutofocused(),
|
||||
'disabled' => $isDisabled(),
|
||||
'id' => $getId(),
|
||||
'offColor' => $getOffColor() ?? 'gray',
|
||||
'offIcon' => $getOffIcon(),
|
||||
'onColor' => $getOnColor() ?? 'primary',
|
||||
'onIcon' => $getOnIcon(),
|
||||
'state' => '$wire.' . $applyStateBindingModifiers('$entangle(\'' . $statePath . '\')'),
|
||||
'wire:loading.attr' => 'disabled',
|
||||
'wire:target' => $statePath,
|
||||
],
|
||||
escape: false,
|
||||
)
|
||||
->merge($getExtraAttributes(), escape: false)
|
||||
->merge($getExtraAlpineAttributes(), escape: false)
|
||||
->class(['fi-fo-toggle']);
|
||||
@endphp
|
||||
|
||||
<x-dynamic-component
|
||||
:component="$fieldWrapperView"
|
||||
:field="$field"
|
||||
:inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center"
|
||||
>
|
||||
<x-dynamic-component :component="$fieldWrapperView" :field="$field" :inline-label-vertical-alignment="\Filament\Support\Enums\VerticalAlignment::Center">
|
||||
@if ($isInline())
|
||||
<x-slot name="labelPrefix">
|
||||
<x-filament::toggle
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
|
||||
/>
|
||||
<x-filament::toggle :attributes="\Filament\Support\prepare_inherited_attributes($attributes)" />
|
||||
</x-slot>
|
||||
@else
|
||||
<x-filament::toggle
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
|
||||
/>
|
||||
<x-filament::toggle :attributes="\Filament\Support\prepare_inherited_attributes($attributes)" />
|
||||
@endif
|
||||
</x-dynamic-component>
|
||||
|
||||
Reference in New Issue
Block a user