[增添]添加了datasource的setting数据库以及默认值
This commit is contained in:
35
vendor/filament/widgets/resources/views/components/widget.blade.php
vendored
Normal file
35
vendor/filament/widgets/resources/views/components/widget.blade.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
@php
|
||||
$columnSpan = $this->getColumnSpan();
|
||||
|
||||
if (! is_array($columnSpan)) {
|
||||
$columnSpan = [
|
||||
'default' => $columnSpan,
|
||||
];
|
||||
}
|
||||
|
||||
$columnStart = $this->getColumnStart();
|
||||
|
||||
if (! is_array($columnStart)) {
|
||||
$columnStart = [
|
||||
'default' => $columnStart,
|
||||
];
|
||||
}
|
||||
@endphp
|
||||
|
||||
<x-filament::grid.column
|
||||
:default="$columnSpan['default'] ?? 1"
|
||||
:sm="$columnSpan['sm'] ?? null"
|
||||
:md="$columnSpan['md'] ?? null"
|
||||
:lg="$columnSpan['lg'] ?? null"
|
||||
:xl="$columnSpan['xl'] ?? null"
|
||||
:twoXl="$columnSpan['2xl'] ?? null"
|
||||
:defaultStart="$columnStart['default'] ?? null"
|
||||
:smStart="$columnStart['sm'] ?? null"
|
||||
:mdStart="$columnStart['md'] ?? null"
|
||||
:lgStart="$columnStart['lg'] ?? null"
|
||||
:xlStart="$columnStart['xl'] ?? null"
|
||||
:twoXlStart="$columnStart['2xl'] ?? null"
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->class('fi-wi-widget')"
|
||||
>
|
||||
{{ $slot }}
|
||||
</x-filament::grid.column>
|
||||
39
vendor/filament/widgets/resources/views/components/widgets.blade.php
vendored
Normal file
39
vendor/filament/widgets/resources/views/components/widgets.blade.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
@props([
|
||||
'columns' => [
|
||||
'lg' => 2,
|
||||
],
|
||||
'data' => [],
|
||||
'widgets' => [],
|
||||
])
|
||||
|
||||
<x-filament::grid
|
||||
:default="$columns['default'] ?? 1"
|
||||
:sm="$columns['sm'] ?? null"
|
||||
:md="$columns['md'] ?? null"
|
||||
:lg="$columns['lg'] ?? ($columns ? (is_array($columns) ? null : $columns) : 2)"
|
||||
:xl="$columns['xl'] ?? null"
|
||||
:two-xl="$columns['2xl'] ?? null"
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->class('fi-wi gap-6')"
|
||||
>
|
||||
@php
|
||||
$normalizeWidgetClass = function (string | Filament\Widgets\WidgetConfiguration $widget): string {
|
||||
if ($widget instanceof \Filament\Widgets\WidgetConfiguration) {
|
||||
return $widget->widget;
|
||||
}
|
||||
|
||||
return $widget;
|
||||
};
|
||||
@endphp
|
||||
|
||||
@foreach ($widgets as $widgetKey => $widget)
|
||||
@php
|
||||
$widgetClass = $normalizeWidgetClass($widget);
|
||||
@endphp
|
||||
|
||||
@livewire(
|
||||
$widgetClass,
|
||||
[...(($widget instanceof \Filament\Widgets\WidgetConfiguration) ? [...$widget->widget::getDefaultProperties(), ...$widget->getProperties()] : $widget::getDefaultProperties()), ...$data],
|
||||
key("{$widgetClass}-{$widgetKey}"),
|
||||
)
|
||||
@endforeach
|
||||
</x-filament::grid>
|
||||
Reference in New Issue
Block a user