mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-21 13:30:51 +08:00
fix: Responsive chart height (#18033)
* fix: Responsive chart height * clean up * tweak
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,4 +1,38 @@
|
||||
.fi-wi-chart {
|
||||
& .fi-wi-chart-canvas-ctn {
|
||||
@apply aspect-square;
|
||||
}
|
||||
|
||||
@supports (container-type: inline-size) {
|
||||
& .fi-section-content {
|
||||
@apply @container;
|
||||
}
|
||||
|
||||
& .fi-wi-chart-canvas-ctn {
|
||||
@apply @sm:aspect-[2];
|
||||
|
||||
&[data-chart-type='doughnut'],
|
||||
&[data-chart-type='pie'],
|
||||
&[data-chart-type='polarArea'],
|
||||
&[data-chart-type='radar'] {
|
||||
@apply aspect-square;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@supports not (container-type: inline-size) {
|
||||
& .fi-wi-chart-canvas-ctn {
|
||||
@apply sm:aspect-[2];
|
||||
|
||||
&[data-chart-type='doughnut'],
|
||||
&[data-chart-type='pie'],
|
||||
&[data-chart-type='polarArea'],
|
||||
&[data-chart-type='radar'] {
|
||||
@apply aspect-square;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
& .fi-wi-chart-filter {
|
||||
&.fi-input-wrp {
|
||||
@apply w-max sm:-my-2;
|
||||
|
||||
@@ -85,6 +85,7 @@ export default function chart({ cachedData, options, type }) {
|
||||
|
||||
options ??= {}
|
||||
options.borderWidth ??= 2
|
||||
options.maintainAspectRatio ??= false
|
||||
options.pointBackgroundColor ??= borderColor
|
||||
options.pointHitRadius ??= 4
|
||||
options.pointRadius ??= 2
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
$description = $this->getDescription();
|
||||
$filters = $this->getFilters();
|
||||
$isCollapsible = $this->isCollapsible();
|
||||
$type = $this->getType();
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget class="fi-wi-chart">
|
||||
@@ -64,12 +65,13 @@
|
||||
x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('chart', 'filament/widgets') }}"
|
||||
wire:ignore
|
||||
data-chart-type="{{ $type }}"
|
||||
x-data="chart({
|
||||
cachedData: @js($this->getCachedData()),
|
||||
options: @js($this->getOptions()),
|
||||
type: @js($this->getType()),
|
||||
type: @js($type),
|
||||
})"
|
||||
{{ (new ComponentAttributeBag)->color(ChartWidgetComponent::class, $color) }}
|
||||
{{ (new ComponentAttributeBag)->color(ChartWidgetComponent::class, $color)->class(['fi-wi-chart-canvas-ctn']) }}
|
||||
>
|
||||
<canvas
|
||||
x-ref="canvas"
|
||||
|
||||
Reference in New Issue
Block a user