Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
205 lines
8 KiB
PHP
205 lines
8 KiB
PHP
@php
|
|
use Filament\Support\Facades\FilamentAsset;
|
|
use Filament\Support\View\ComponentAttributeBag as FilamentComponentAttributeBag;
|
|
use Filament\Widgets\View\Components\ChartWidgetComponent;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
$color = $this->getColor();
|
|
$heading = $this->getHeading();
|
|
$description = $this->getDescription();
|
|
$filters = $this->getFilters();
|
|
$isCollapsible = $this->isCollapsible();
|
|
$type = $this->getType();
|
|
$maxHeight = $this->getMaxHeight();
|
|
$hasMaxHeight = filled($maxHeight) && $maxHeight !== '100%';
|
|
$isEmpty = $this->isEmpty();
|
|
|
|
// The chart paints onto a bare `<canvas>`, which exposes no accessible name, so build a text
|
|
// alternative from the widget's heading and description (WCAG 1.1.1) for `role="img"` + `aria-label`.
|
|
$chartAccessibleLabel = trim(implode('. ', array_filter([
|
|
$heading instanceof Htmlable ? strip_tags($heading->toHtml()) : $heading,
|
|
$description instanceof Htmlable ? strip_tags($description->toHtml()) : $description,
|
|
], fn ($value): bool => filled($value))));
|
|
@endphp
|
|
|
|
<x-filament-widgets::widget class="fi-wi-chart">
|
|
<x-filament::section
|
|
:description="$description"
|
|
:heading="$heading"
|
|
:collapsible="$isCollapsible"
|
|
>
|
|
@if ($filters || method_exists($this, 'getFiltersSchema'))
|
|
<x-slot name="afterHeader">
|
|
@if ($filters)
|
|
<x-filament::input.wrapper
|
|
inline-prefix
|
|
wire:target="filter"
|
|
class="fi-wi-chart-filter"
|
|
>
|
|
<x-filament::input.select
|
|
:aria-label="__('filament-widgets::chart.filter.label')"
|
|
inline-prefix
|
|
wire:model.live="filter"
|
|
>
|
|
@foreach ($filters as $value => $label)
|
|
<option value="{{ $value }}">
|
|
{{ $label }}
|
|
</option>
|
|
@endforeach
|
|
</x-filament::input.select>
|
|
</x-filament::input.wrapper>
|
|
@endif
|
|
|
|
@if (method_exists($this, 'getFiltersSchema'))
|
|
<x-filament::dropdown
|
|
placement="bottom-end"
|
|
shift
|
|
width="xs"
|
|
class="fi-wi-chart-filter"
|
|
>
|
|
<x-slot name="trigger">
|
|
{{ $this->getFiltersTriggerAction() }}
|
|
</x-slot>
|
|
|
|
<div class="fi-wi-chart-filter-content">
|
|
{{ $this->getFiltersSchema() }}
|
|
|
|
@if (method_exists($this, 'hasDeferredFilters') && $this->hasDeferredFilters())
|
|
<div
|
|
class="fi-wi-chart-filter-content-actions-ctn"
|
|
>
|
|
{{ $this->getFiltersApplyAction() }}
|
|
|
|
{{ $this->getFiltersResetAction() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-filament::dropdown>
|
|
@endif
|
|
</x-slot>
|
|
@endif
|
|
|
|
<div
|
|
@if ($pollingInterval = $this->getPollingInterval())
|
|
wire:poll.{{ $pollingInterval }}="updateChartData"
|
|
@endif
|
|
@if ($isEmpty)
|
|
style="display: none"
|
|
@endif
|
|
>
|
|
<div
|
|
x-load
|
|
x-load-src="{{ FilamentAsset::getAlpineComponentSrc('chart', 'filament/widgets') }}"
|
|
wire:ignore
|
|
data-chart-type="{{ $type }}"
|
|
x-data="chart({
|
|
cachedData: @js($this->getCachedData()),
|
|
options: @js($this->getOptions()),
|
|
type: @js($type),
|
|
})"
|
|
{{
|
|
(new FilamentComponentAttributeBag)
|
|
->color(ChartWidgetComponent::class, $color)
|
|
->class([
|
|
'fi-wi-chart-frame',
|
|
'fi-wi-chart-canvas-ctn',
|
|
'fi-wi-chart-frame-no-aspect-ratio' => $hasMaxHeight,
|
|
])
|
|
}}
|
|
>
|
|
<canvas
|
|
x-ref="canvas"
|
|
@if (filled($chartAccessibleLabel))
|
|
role="img"
|
|
aria-label="{{ $chartAccessibleLabel }}"
|
|
@endif
|
|
@style([
|
|
'width: 100%',
|
|
'height: 100%; max-height: 100%' => ! $hasMaxHeight,
|
|
('max-height: ' . e($maxHeight)) => $hasMaxHeight,
|
|
])
|
|
></canvas>
|
|
|
|
{{--
|
|
Chart.js paints the chart onto the canvas, where a stylesheet cannot reach it. These empty
|
|
elements carry the colors it should use, so that a theme can set them with an ordinary
|
|
`color` declaration and they follow light and dark mode like any other element.
|
|
--}}
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="backgroundColorElement"
|
|
class="fi-wi-chart-bg-color"
|
|
></span>
|
|
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="borderColorElement"
|
|
class="fi-wi-chart-border-color"
|
|
></span>
|
|
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="gridColorElement"
|
|
class="fi-wi-chart-grid-color"
|
|
></span>
|
|
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="textColorElement"
|
|
class="fi-wi-chart-text-color"
|
|
></span>
|
|
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="tooltipBackgroundColorElement"
|
|
class="fi-wi-chart-tooltip-bg-color"
|
|
></span>
|
|
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="tooltipTextColorElement"
|
|
class="fi-wi-chart-tooltip-text-color"
|
|
></span>
|
|
|
|
<span
|
|
aria-hidden="true"
|
|
x-ref="tooltipBorderColorElement"
|
|
class="fi-wi-chart-tooltip-border-color"
|
|
></span>
|
|
</div>
|
|
</div>
|
|
|
|
@if ($isEmpty)
|
|
@if ($emptyState = $this->getEmptyState())
|
|
{{ $emptyState }}
|
|
@else
|
|
<div
|
|
@class([
|
|
'fi-wi-chart-frame',
|
|
'fi-wi-chart-frame-no-aspect-ratio' => $hasMaxHeight,
|
|
])
|
|
@style([
|
|
('min-height: ' . e($maxHeight)) => $hasMaxHeight,
|
|
])
|
|
>
|
|
<x-filament::empty-state
|
|
:contained="false"
|
|
:description="$this->getEmptyStateDescription()"
|
|
:heading="$this->getEmptyStateHeading()"
|
|
:icon="$this->getEmptyStateIcon()"
|
|
icon-color="gray"
|
|
>
|
|
@if ($emptyStateActions = $this->getEmptyStateActions())
|
|
<x-slot name="footer">
|
|
<x-filament::actions
|
|
:actions="$emptyStateActions"
|
|
alignment="center"
|
|
/>
|
|
</x-slot>
|
|
@endif
|
|
</x-filament::empty-state>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
</x-filament::section>
|
|
</x-filament-widgets::widget>
|