[增添]添加了datasource的setting数据库以及默认值

This commit is contained in:
makotocc0107
2024-08-27 09:57:44 +08:00
parent d111dfaea4
commit 72eb990970
10955 changed files with 978898 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
@props([
'action',
'dynamicComponent',
'icon' => null,
])
@php
$isDisabled = $action->isDisabled();
$url = $action->getUrl();
@endphp
<x-dynamic-component
:color="$action->getColor()"
:component="$dynamicComponent"
:disabled="$isDisabled"
:form="$action->getFormToSubmit()"
:form-id="$action->getFormId()"
:href="$isDisabled ? null : $url"
:icon="$icon ?? $action->getIcon()"
:icon-size="$action->getIconSize()"
:key-bindings="$action->getKeyBindings()"
:label-sr-only="$action->isLabelHidden()"
:tag="$url ? 'a' : 'button'"
:target="($url && $action->shouldOpenUrlInNewTab()) ? '_blank' : null"
:tooltip="$action->getTooltip()"
:type="$action->canSubmitForm() ? 'submit' : 'button'"
:wire:click="$action->getLivewireClickHandler()"
:wire:target="$action->getLivewireTarget()"
:x-on:click="$action->getAlpineClickHandler()"
:attributes="
\Filament\Support\prepare_inherited_attributes($attributes)
->merge($action->getExtraAttributes(), escape: false)
->class(['fi-ac-action'])
"
>
{{ $slot }}
</x-dynamic-component>

View File

@@ -0,0 +1,3 @@
<x-filament::actions
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
/>

View File

@@ -0,0 +1,126 @@
@props([
'actions' => [],
'badge' => null,
'badgeColor' => null,
'button' => false,
'color' => null,
'dropdownMaxHeight' => null,
'dropdownOffset' => null,
'dropdownPlacement' => null,
'dropdownWidth' => null,
'dynamicComponent' => null,
'group' => null,
'icon' => null,
'iconSize' => null,
'iconButton' => false,
'label' => null,
'link' => false,
'size' => null,
'tooltip' => null,
'view' => null,
])
@if (! ($dynamicComponent && $group))
@php
$group = \Filament\Actions\ActionGroup::make($actions)
->badgeColor($badgeColor)
->color($color)
->dropdownMaxHeight($dropdownMaxHeight)
->dropdownOffset($dropdownOffset)
->dropdownPlacement($dropdownPlacement)
->dropdownWidth($dropdownWidth)
->icon($icon)
->iconSize($iconSize)
->label($label)
->size($size)
->tooltip($tooltip)
->view($view);
$badge === true
? $group->badge()
: $group->badge($badge);
if ($button) {
$group
->button()
->iconPosition($attributes->get('iconPosition') ?? $attributes->get('icon-position'))
->outlined($attributes->get('outlined') ?? false);
}
if ($iconButton) {
$group->iconButton();
}
if ($link) {
$group->link();
}
@endphp
{{ $group }}
@elseif (! $group->hasDropdown())
@foreach ($group->getActions() as $action)
@if ($action->isVisible())
{{ $action }}
@endif
@endforeach
@else
@php
$actionLists = [];
$singleActions = [];
foreach ($group->getActions() as $action) {
if ($action->isHidden()) {
continue;
}
if ($action instanceof \Filament\Actions\ActionGroup && (! $action->hasDropdown())) {
if (count($singleActions)) {
$actionLists[] = $singleActions;
$singleActions = [];
}
$actionLists[] = array_filter(
$action->getActions(),
fn ($action): bool => $action->isVisible(),
);
} else {
$singleActions[] = $action;
}
}
if (count($singleActions)) {
$actionLists[] = $singleActions;
}
@endphp
<x-filament::dropdown
:max-height="$group->getDropdownMaxHeight()"
:offset="$group->getDropdownOffset()"
:placement="$group->getDropdownPlacement() ?? 'bottom-start'"
:width="$group->getDropdownWidth()"
teleport
>
<x-slot name="trigger">
<x-dynamic-component
:color="$group->getColor()"
:component="$dynamicComponent"
:icon="$group->getIcon()"
:icon-size="$group->getIconSize()"
:label-sr-only="$group->isLabelHidden()"
:size="$group->getSize()"
:tooltip="$group->getTooltip()"
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->merge($group->getExtraAttributes(), escape: false)"
>
{{ $slot }}
</x-dynamic-component>
</x-slot>
@foreach ($actionLists as $actions)
<x-filament::dropdown.list>
@foreach ($actions as $action)
{{ $action }}
@endforeach
</x-filament::dropdown.list>
@endforeach
</x-filament::dropdown>
@endif

View File

@@ -0,0 +1,295 @@
@if ($this instanceof \Filament\Actions\Contracts\HasActions && (! $this->hasActionsModalRendered))
<form wire:submit.prevent="callMountedAction">
@php
$action = $this->getMountedAction();
@endphp
<x-filament::modal
:alignment="$action?->getModalAlignment()"
:autofocus="$action?->isModalAutofocused()"
:close-button="$action?->hasModalCloseButton()"
:close-by-clicking-away="$action?->isModalClosedByClickingAway()"
:close-by-escaping="$action?->isModalClosedByEscaping()"
:description="$action?->getModalDescription()"
display-classes="block"
:extra-modal-window-attribute-bag="$action?->getExtraModalWindowAttributeBag()"
:footer-actions="$action?->getVisibleModalFooterActions()"
:footer-actions-alignment="$action?->getModalFooterActionsAlignment()"
:heading="$action?->getModalHeading()"
:icon="$action?->getModalIcon()"
:icon-color="$action?->getModalIconColor()"
:id="$this->getId() . '-action'"
:slide-over="$action?->isModalSlideOver()"
:sticky-footer="$action?->isModalFooterSticky()"
:sticky-header="$action?->isModalHeaderSticky()"
:visible="filled($action)"
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedActions.length) open()"
x-on:modal-closed.stop="
const mountedActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedActionShouldOpenModal) {
return
}
if ($wire.mountedFormComponentActions.length) {
return
}
$wire.unmountAction(false)
"
x-on:opened-form-component-action-modal.window="if ($event.detail.id === '{{ $this->getId() }}') close()"
>
@if ($action)
{{ $action->getModalContent() }}
@if (count(($infolist = $action->getInfolist())?->getComponents() ?? []))
{{ $infolist }}
@elseif ($this->mountedActionHasForm(mountedAction: $action))
{{ $this->getMountedActionForm(mountedAction: $action) }}
@endif
{{ $action->getModalContentFooter() }}
@endif
</x-filament::modal>
</form>
@php
$this->hasActionsModalRendered = true;
@endphp
@endif
@if ($this instanceof \Filament\Tables\Contracts\HasTable && (! $this->hasTableModalRendered))
<form wire:submit.prevent="callMountedTableAction">
@php
$action = $this->getMountedTableAction();
@endphp
<x-filament::modal
:alignment="$action?->getModalAlignment()"
:autofocus="$action?->isModalAutofocused()"
:close-button="$action?->hasModalCloseButton()"
:close-by-clicking-away="$action?->isModalClosedByClickingAway()"
:close-by-escaping="$action?->isModalClosedByEscaping()"
:description="$action?->getModalDescription()"
display-classes="block"
:extra-modal-window-attribute-bag="$action?->getExtraModalWindowAttributeBag()"
:footer-actions="$action?->getVisibleModalFooterActions()"
:footer-actions-alignment="$action?->getModalFooterActionsAlignment()"
:heading="$action?->getModalHeading()"
:icon="$action?->getModalIcon()"
:icon-color="$action?->getModalIconColor()"
:id="$this->getId() . '-table-action'"
:slide-over="$action?->isModalSlideOver()"
:sticky-footer="$action?->isModalFooterSticky()"
:sticky-header="$action?->isModalHeaderSticky()"
:visible="filled($action)"
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.table.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedTableActions.length) open()"
x-on:modal-closed.stop="
const mountedTableActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedTableActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedTableActionShouldOpenModal) {
return
}
if ($wire.mountedFormComponentActions.length) {
return
}
$wire.unmountTableAction(false)
"
x-on:opened-form-component-action-modal.window="if ($event.detail.id === '{{ $this->getId() }}') close()"
>
@if ($action)
{{ $action->getModalContent() }}
@if (count(($infolist = $action->getInfolist())?->getComponents() ?? []))
{{ $infolist }}
@elseif ($this->mountedTableActionHasForm(mountedAction: $action))
{{ $this->getMountedTableActionForm() }}
@endif
{{ $action->getModalContentFooter() }}
@endif
</x-filament::modal>
</form>
<form wire:submit.prevent="callMountedTableBulkAction">
@php
$action = $this->getMountedTableBulkAction();
@endphp
<x-filament::modal
:alignment="$action?->getModalAlignment()"
:autofocus="$action?->isModalAutofocused()"
:close-button="$action?->hasModalCloseButton()"
:close-by-clicking-away="$action?->isModalClosedByClickingAway()"
:close-by-escaping="$action?->isModalClosedByEscaping()"
:description="$action?->getModalDescription()"
display-classes="block"
:extra-modal-window-attribute-bag="$action?->getExtraModalWindowAttributeBag()"
:footer-actions="$action?->getVisibleModalFooterActions()"
:footer-actions-alignment="$action?->getModalFooterActionsAlignment()"
:heading="$action?->getModalHeading()"
:icon="$action?->getModalIcon()"
:icon-color="$action?->getModalIconColor()"
:id="$this->getId() . '-table-bulk-action'"
:slide-over="$action?->isModalSlideOver()"
:sticky-footer="$action?->isModalFooterSticky()"
:sticky-header="$action?->isModalHeaderSticky()"
:visible="filled($action)"
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.table.bulk-actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedTableBulkAction) open()"
x-on:modal-closed.stop="
const mountedTableBulkActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedTableBulkActionShouldOpenModal(mountedBulkAction: $action)) }}
if (! mountedTableBulkActionShouldOpenModal) {
return
}
if ($wire.mountedFormComponentActions.length) {
return
}
$wire.unmountTableBulkAction(false)
"
x-on:opened-form-component-action-modal.window="if ($event.detail.id === '{{ $this->getId() }}') close()"
>
@if ($action)
{{ $action->getModalContent() }}
@if (count(($infolist = $action->getInfolist())?->getComponents() ?? []))
{{ $infolist }}
@elseif ($this->mountedTableBulkActionHasForm(mountedBulkAction: $action))
{{ $this->getMountedTableBulkActionForm(mountedBulkAction: $action) }}
@endif
{{ $action->getModalContentFooter() }}
@endif
</x-filament::modal>
</form>
@php
$this->hasTableModalRendered = true;
@endphp
@endif
@if ($this instanceof \Filament\Infolists\Contracts\HasInfolists && (! $this->hasInfolistsModalRendered))
<form wire:submit.prevent="callMountedInfolistAction">
@php
$action = $this->getMountedInfolistAction();
@endphp
<x-filament::modal
:alignment="$action?->getModalAlignment()"
:autofocus="$action?->isModalAutofocused()"
:close-button="$action?->hasModalCloseButton()"
:close-by-clicking-away="$action?->isModalClosedByClickingAway()"
:close-by-escaping="$action?->isModalClosedByEscaping()"
:description="$action?->getModalDescription()"
display-classes="block"
:extra-modal-window-attribute-bag="$action?->getExtraModalWindowAttributeBag()"
:footer-actions="$action?->getVisibleModalFooterActions()"
:footer-actions-alignment="$action?->getModalFooterActionsAlignment()"
:heading="$action?->getModalHeading()"
:icon="$action?->getModalIcon()"
:icon-color="$action?->getModalIconColor()"
:id="$this->getId() . '-infolist-action'"
:slide-over="$action?->isModalSlideOver()"
:sticky-footer="$action?->isModalFooterSticky()"
:sticky-header="$action?->isModalHeaderSticky()"
:visible="filled($action)"
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.infolist.actions.' . $action->getName() . '.modal' : null"
x-on:closed-form-component-action-modal.window="if (($event.detail.id === '{{ $this->getId() }}') && $wire.mountedInfolistActions.length) open()"
x-on:modal-closed.stop="
const mountedInfolistActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedInfolistActionShouldOpenModal(mountedAction: $action)) }}
if (! mountedInfolistActionShouldOpenModal) {
return
}
if ($wire.mountedFormComponentActions.length) {
return
}
$wire.unmountInfolistAction(false)
"
x-on:opened-form-component-action-modal.window="if ($event.detail.id === '{{ $this->getId() }}') close()"
>
@if ($action)
{{ $action->getModalContent() }}
@if (count(($infolist = $action->getInfolist())?->getComponents() ?? []))
{{ $infolist }}
@elseif ($this->mountedInfolistActionHasForm(mountedAction: $action))
{{ $this->getMountedInfolistActionForm(mountedAction: $action) }}
@endif
{{ $action->getModalContentFooter() }}
@endif
</x-filament::modal>
</form>
@php
$this->hasInfolistsModalRendered = true;
@endphp
@endif
@if (! $this->hasFormsModalRendered)
@php
$action = $this->getMountedFormComponentAction();
@endphp
<form wire:submit.prevent="callMountedFormComponentAction">
<x-filament::modal
:alignment="$action?->getModalAlignment()"
:autofocus="$action?->isModalAutofocused()"
:close-button="$action?->hasModalCloseButton()"
:close-by-clicking-away="$action?->isModalClosedByClickingAway()"
:close-by-escaping="$action?->isModalClosedByEscaping()"
:description="$action?->getModalDescription()"
display-classes="block"
:extra-modal-window-attribute-bag="$action?->getExtraModalWindowAttributeBag()"
:footer-actions="$action?->getVisibleModalFooterActions()"
:footer-actions-alignment="$action?->getModalFooterActionsAlignment()"
:heading="$action?->getModalHeading()"
:icon="$action?->getModalIcon()"
:icon-color="$action?->getModalIconColor()"
:id="$this->getId() . '-form-component-action'"
:slide-over="$action?->isModalSlideOver()"
:sticky-footer="$action?->isModalFooterSticky()"
:sticky-header="$action?->isModalHeaderSticky()"
:visible="filled($action)"
:width="$action?->getModalWidth()"
:wire:key="$action ? $this->getId() . '.' . $action->getComponent()->getStatePath() . '.actions.' . $action->getName() . '.modal' : null"
x-on:modal-closed.stop="
const mountedFormComponentActionShouldOpenModal = {{ \Illuminate\Support\Js::from($action && $this->mountedFormComponentActionShouldOpenModal()) }}
if (mountedFormComponentActionShouldOpenModal) {
$wire.unmountFormComponentAction(false)
}
"
>
@if ($action)
{{ $action->getModalContent() }}
@if (count(($infolist = $action->getInfolist())?->getComponents() ?? []))
{{ $infolist }}
@elseif ($this->mountedFormComponentActionHasForm(mountedAction: $action))
{{ $this->getMountedFormComponentActionForm(mountedAction: $action) }}
@endif
{{ $action->getModalContentFooter() }}
@endif
</x-filament::modal>
</form>
@php
$this->hasFormsModalRendered = true;
@endphp
@endif