-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy pathHasEmptyState.php
More file actions
53 lines (42 loc) · 1.42 KB
/
HasEmptyState.php
File metadata and controls
53 lines (42 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Filament\Widgets\ChartWidget\Concerns;
use BackedEnum;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Support\Facades\FilamentIcon;
use Filament\Support\Icons\Heroicon;
use Filament\Widgets\View\WidgetsIconAlias;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
trait HasEmptyState
{
protected ?string $emptyState = null;
protected ?string $emptyStateDescription = null;
protected ?string $emptyStateHeading = null;
protected string | BackedEnum | null $emptyStateIcon = null;
public function getEmptyState(): View | Htmlable | null
{
return is_string($this->emptyState) ? view($this->emptyState) : null;
}
/**
* @return array<Action | ActionGroup>
*/
public function getEmptyStateActions(): array
{
return [];
}
public function getEmptyStateDescription(): string | Htmlable | null
{
return $this->emptyStateDescription;
}
public function getEmptyStateHeading(): string | Htmlable
{
return $this->emptyStateHeading ?? __('filament-widgets::chart.empty.heading');
}
public function getEmptyStateIcon(): string | BackedEnum | Htmlable
{
return $this->emptyStateIcon
?? FilamentIcon::resolve(WidgetsIconAlias::CHART_WIDGET_EMPTY_STATE)
?? Heroicon::OutlinedXMark;
}
}