[增添]添加了datasource的setting数据库以及默认值
This commit is contained in:
87
vendor/filament/tables/resources/views/components/columns/column.blade.php
vendored
Normal file
87
vendor/filament/tables/resources/views/components/columns/column.blade.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
@props([
|
||||
'column',
|
||||
'isClickDisabled' => false,
|
||||
'record',
|
||||
'recordAction' => null,
|
||||
'recordKey' => null,
|
||||
'recordUrl' => null,
|
||||
'shouldOpenRecordUrlInNewTab' => false,
|
||||
])
|
||||
|
||||
@php
|
||||
use Filament\Support\Enums\Alignment;
|
||||
|
||||
$action = $column->getAction();
|
||||
$alignment = $column->getAlignment() ?? Alignment::Start;
|
||||
$name = $column->getName();
|
||||
$shouldOpenUrlInNewTab = $column->shouldOpenUrlInNewTab();
|
||||
$tooltip = $column->getTooltip();
|
||||
$url = $column->getUrl();
|
||||
|
||||
if (! $alignment instanceof Alignment) {
|
||||
$alignment = filled($alignment) ? (Alignment::tryFrom($alignment) ?? $alignment) : null;
|
||||
}
|
||||
|
||||
$columnClasses = \Illuminate\Support\Arr::toCssClasses([
|
||||
'flex w-full disabled:pointer-events-none',
|
||||
match ($alignment) {
|
||||
Alignment::Start => 'justify-start text-start',
|
||||
Alignment::Center => 'justify-center text-center',
|
||||
Alignment::End => 'justify-end text-end',
|
||||
Alignment::Left => 'justify-start text-left',
|
||||
Alignment::Right => 'justify-end text-right',
|
||||
Alignment::Justify, Alignment::Between => 'justify-between text-justify',
|
||||
default => $alignment,
|
||||
},
|
||||
]);
|
||||
|
||||
$slot = $column->viewData(['recordKey' => $recordKey]);
|
||||
@endphp
|
||||
|
||||
<div
|
||||
@if (filled($tooltip))
|
||||
x-data="{}"
|
||||
x-tooltip="{
|
||||
content: @js($tooltip),
|
||||
theme: $store.theme,
|
||||
}"
|
||||
@endif
|
||||
{{ $attributes->class(['fi-ta-col-wrp']) }}
|
||||
>
|
||||
@if (($url || ($recordUrl && $action === null)) && (! $isClickDisabled))
|
||||
<a
|
||||
{{ \Filament\Support\generate_href_html($url ?: $recordUrl, $url ? $shouldOpenUrlInNewTab : $shouldOpenRecordUrlInNewTab) }}
|
||||
class="{{ $columnClasses }}"
|
||||
>
|
||||
{{ $slot }}
|
||||
</a>
|
||||
@elseif (($action || $recordAction) && (! $isClickDisabled))
|
||||
@php
|
||||
if ($action instanceof \Filament\Tables\Actions\Action) {
|
||||
$wireClickAction = "mountTableAction('{$action->getName()}', '{$recordKey}')";
|
||||
} elseif ($action) {
|
||||
$wireClickAction = "callTableColumnAction('{$name}', '{$recordKey}')";
|
||||
} else {
|
||||
if ($this->getTable()->getAction($recordAction)) {
|
||||
$wireClickAction = "mountTableAction('{$recordAction}', '{$recordKey}')";
|
||||
} else {
|
||||
$wireClickAction = "{$recordAction}('{$recordKey}')";
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
<button
|
||||
type="button"
|
||||
wire:click="{{ $wireClickAction }}"
|
||||
wire:loading.attr="disabled"
|
||||
wire:target="{{ $wireClickAction }}"
|
||||
class="{{ $columnClasses }}"
|
||||
>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@else
|
||||
<div class="{{ $columnClasses }}">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
72
vendor/filament/tables/resources/views/components/columns/layout.blade.php
vendored
Normal file
72
vendor/filament/tables/resources/views/components/columns/layout.blade.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
@props([
|
||||
'components',
|
||||
'record',
|
||||
'recordKey' => null,
|
||||
'rowLoop' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$getHiddenClasses = function (Filament\Tables\Columns\Column | Filament\Tables\Columns\Layout\Component $layoutComponent): ?string {
|
||||
if ($breakpoint = $layoutComponent->getHiddenFrom()) {
|
||||
return match ($breakpoint) {
|
||||
'sm' => 'sm:hidden',
|
||||
'md' => 'md:hidden',
|
||||
'lg' => 'lg:hidden',
|
||||
'xl' => 'xl:hidden',
|
||||
'2xl' => '2xl:hidden',
|
||||
};
|
||||
}
|
||||
|
||||
if ($breakpoint = $layoutComponent->getVisibleFrom()) {
|
||||
return match ($breakpoint) {
|
||||
'sm' => 'hidden sm:block',
|
||||
'md' => 'hidden md:block',
|
||||
'lg' => 'hidden lg:block',
|
||||
'xl' => 'hidden xl:block',
|
||||
'2xl' => 'hidden 2xl:block',
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
@endphp
|
||||
|
||||
@foreach ($components as $layoutComponent)
|
||||
@php
|
||||
$layoutComponent->record($record);
|
||||
$layoutComponent->rowLoop($rowLoop);
|
||||
|
||||
$isColumn = $layoutComponent instanceof \Filament\Tables\Columns\Column;
|
||||
@endphp
|
||||
|
||||
@if ($layoutComponent->isVisible())
|
||||
<x-filament::grid.column
|
||||
:default="$layoutComponent->getColumnSpan('default')"
|
||||
:sm="$layoutComponent->getColumnSpan('sm')"
|
||||
:md="$layoutComponent->getColumnSpan('md')"
|
||||
:lg="$layoutComponent->getColumnSpan('lg')"
|
||||
:xl="$layoutComponent->getColumnSpan('xl')"
|
||||
:twoXl="$layoutComponent->getColumnSpan('2xl')"
|
||||
:defaultStart="$layoutComponent->getColumnStart('default')"
|
||||
:smStart="$layoutComponent->getColumnStart('sm')"
|
||||
:mdStart="$layoutComponent->getColumnStart('md')"
|
||||
:lgStart="$layoutComponent->getColumnStart('lg')"
|
||||
:xlStart="$layoutComponent->getColumnStart('xl')"
|
||||
:twoXlStart="$layoutComponent->getColumnStart('2xl')"
|
||||
@class([
|
||||
'flex-1 w-full' => $layoutComponent->canGrow(),
|
||||
$getHiddenClasses($layoutComponent),
|
||||
])
|
||||
>
|
||||
@if ($isColumn)
|
||||
<x-filament-tables::columns.column
|
||||
:column="$layoutComponent->inline()"
|
||||
:record="$record"
|
||||
:record-key="$recordKey"
|
||||
/>
|
||||
@else
|
||||
{{ $layoutComponent->viewData(['recordKey' => $recordKey]) }}
|
||||
@endif
|
||||
</x-filament::grid.column>
|
||||
@endif
|
||||
@endforeach
|
||||
5
vendor/filament/tables/resources/views/components/columns/placeholder.blade.php
vendored
Normal file
5
vendor/filament/tables/resources/views/components/columns/placeholder.blade.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<div
|
||||
class="fi-ta-placeholder text-sm leading-6 text-gray-400 dark:text-gray-500"
|
||||
>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
Reference in New Issue
Block a user