Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jan 19, 2024
1 parent fb935e3 commit 4f6f9b7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
43 changes: 21 additions & 22 deletions resources/views/tables/columns/inline-chart.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,29 @@
$getChart = $getChart();
@endphp

@if (filled($descriptionAbove))
<p
@class([
'text-sm text-gray-500 dark:text-gray-400',
'whitespace-normal' => $canWrap,
])
>
{{ $descriptionAbove }}
</p>
@endif
@if (filled($descriptionAbove))
<p
@class([
'text-sm text-gray-500 dark:text-gray-400',
'whitespace-normal' => $canWrap,
])
>
{{ $descriptionAbove }}
</p>
@endif

@livewire($getChart,['maxWidth'=>$getMaxWidth])

@if (filled($descriptionBelow))
<p
@class([
'text-sm text-gray-500 dark:text-gray-400',
'whitespace-normal' => $canWrap,
])
>
{{ $descriptionBelow }}
</p>
@endif
@livewire($getChart,['maxWidth' => $getMaxWidth, 'record' => $getRecord()])

@if (filled($descriptionBelow))
<p
@class([
'text-sm text-gray-500 dark:text-gray-400',
'whitespace-normal' => $canWrap,
])
>
{{ $descriptionBelow }}
</p>
@endif

@pushonce('scripts')
<script>
Expand Down
14 changes: 7 additions & 7 deletions resources/views/widgets/inline-chart.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@php
use Filament\Support\Enums\MaxWidth;
use Filament\Support\Facades\FilamentView;
use Filament\Support\Enums\MaxWidth;
use Filament\Support\Facades\FilamentView;
$color = $this->getColor();
$heading = $this->getHeading();
$filters = $this->getFilters();
$color = $this->getColor();
$heading = $this->getHeading();
$filters = $this->getFilters();
@endphp
<x-filament-widgets::widget class="fi-wi-chart">
<div
Expand Down Expand Up @@ -34,9 +34,9 @@
>
<div
@if (FilamentView::hasSpaMode())
ax-load="visible"
ax-load="visible"
@else
ax-load
ax-load
@endif
ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('chart', 'filament/widgets') }}"
wire:ignore
Expand Down
3 changes: 3 additions & 0 deletions src/InlineChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget;
use Illuminate\Database\Eloquent\Model;

abstract class InlineChartWidget extends ChartWidget
{
Expand All @@ -17,6 +18,8 @@ abstract class InlineChartWidget extends ChartWidget

public ?string $maxWidth = '!w-[150px]';

public Model $record;

protected function getOptions(): RawJs
{
return RawJs::make(<<<'JS'
Expand Down

0 comments on commit 4f6f9b7

Please sign in to comment.