Skip to content

Commit

Permalink
feat(admin): view files
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaiyuxin103 committed Jun 3, 2024
1 parent 3a6a22e commit 2ab19ef
Show file tree
Hide file tree
Showing 239 changed files with 16,515 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<x-filament-actions::action
:action="$action"
dynamic-component="filament::badge"
:icon-position="$getIconPosition()"
:size="$getSize()"
class="fi-ac-badge-action"
>
{{ $getLabel() }}
</x-filament-actions::action>
9 changes: 9 additions & 0 deletions resources/views/vendor/filament-actions/badge-group.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<x-filament-actions::group
dynamic-component="filament::badge"
:group="$group"
:icon-position="$getIconPosition()"
:size="$getSize()"
class="fi-ac-badge-group"
>
{{ $getLabel() }}
</x-filament-actions::group>
13 changes: 13 additions & 0 deletions resources/views/vendor/filament-actions/button-action.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<x-filament-actions::action
:action="$action"
:badge="$getBadge()"
:badge-color="$getBadgeColor()"
dynamic-component="filament::button"
:icon-position="$getIconPosition()"
:labeled-from="$getLabeledFromBreakpoint()"
:outlined="$isOutlined()"
:size="$getSize()"
class="fi-ac-btn-action"
>
{{ $getLabel() }}
</x-filament-actions::action>
13 changes: 13 additions & 0 deletions resources/views/vendor/filament-actions/button-group.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<x-filament-actions::group
:badge="$getBadge()"
:badge-color="$getBadgeColor()"
dynamic-component="filament::button"
:group="$group"
:icon-position="$getIconPosition()"
:labeled-from="$getLabeledFromBreakpoint()"
:outlined="$isOutlined()"
:size="$getSize()"
class="fi-ac-btn-group"
>
{{ $getLabel() }}
</x-filament-actions::group>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@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()"
: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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-filament::actions
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
/>
124 changes: 124 additions & 0 deletions resources/views/vendor/filament-actions/components/group.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
@props([
'actions' => [],
'badge' => null,
'badgeColor' => null,
'button' => false,
'color' => null,
'dropdownMaxHeight' => null,
'dropdownOffset' => null,
'dropdownPlacement' => null,
'dropdownWidth' => null,
'dynamicComponent' => null,
'group' => null,
'icon' => null,
'iconPosition' => 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)
->iconPosition($iconPosition)
->iconSize($iconSize)
->label($label)
->size($size)
->tooltip($tooltip)
->view($view);
$badge === true
? $group->badge()
: $group->badge($badge);
if ($button) {
$group->button();
}
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()"
: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
Loading

0 comments on commit 2ab19ef

Please sign in to comment.