awcodes/filament-extras

这是我的包 filament-extras

v1.1.1 2023-04-07 13:35 UTC

README

Latest Version on Packagist Total Downloads

安装

您可以通过 composer 安装此包

composer require awcodes/filament-extras

可选地,您可以使用以下命令发布视图、资产或翻译

php artisan vendor:publish --tag=filament-extras-assets
php artisan vendor:publish --tag=filament-extras-translations
php artisan vendor:publish --tag=filament-extras-views

主题化

如果您正在使用 Filament 的自定义主题,您需要将此插件的视图添加到 Tailwind CSS 配置中。完成后,您可以通过将 'load_styles' 修改为 false 来在配置文件中禁用插件的样式表。

content: [
    ...
    "./vendor/awcodes/filament-extras/resources/views/**/*.blade.php",
],

管理员

固定侧边栏布局

直接从您的模型资源中的表单函数返回即可。

use Awcodes\FilamentExtras\Forms\Components\FixedWidthSidebar;

public static function form(Form $form): Form
{
    return FixedWidthSidebar::make()
        ->mainSchema([...])
        ->sidebarSchema([...])
        ->sidebarWidth(string|int $width = '20rem')
        ->breakpoint(string|int $breakpoint = 'md')
}

表单

日期输入

这是一个原生的 HTML 日期输入字段。有关使用此字段的更多信息,请参阅 MDN 文档

date input

use Awcodes\FilamentExtras\Forms\Components\DateInput;

DateInput::make(string $fieldname)
    ->label('Publish Date')
    ->withoutTime(bool|Closure $condition = true)
    ->withoutSeconds(bool|Closure $condition = true)
    ->minDate(DateTime|string|Closure|null $date)
    ->maxDate(DateTime|string|Closure|null $date)
    ->timezone(string|Closure|null $timezone)

密码生成器

password generator

所有来自 TextInput 的方法都可用。

use Awcodes\FilamentExtras\Forms\Components\PasswordGenerator;

PasswordGenerator::make(string $fieldname)
    ->passwordLength(int $length = 12)
    ->hasNumbers(bool $hasNumbers = true)
    ->hasSymbols(bool $hasSymbols = true)
    ->buttonLabel(string|Htmlable|Closure|null $label = 'Generate Password')
    ->buttonSize(string|Htmlable|Closure|null $size = 'md')
    ->buttonColor(string|Htmlable|Closure|null $color = 'primary')
    ->buttonIsOutlined(bool|Closure|null $condition = false)

时间戳

输出创建时间和更新时间信息块。

use Awcodes\FilamentExtras\Forms\Components\Timestamps;

Timestamps::make()

分隔符

仅输出合理的 hr 以帮助分隔组件。可以使用 Filament 主题颜色(如 'primary'、'danger' 等)或十六进制值(如 '#bada55')进行样式化。

use Awcodes\FilamentBundle\Forms\Components\Separator;

Separator::make()
    ->color(string $color)

标题

仅在表单中输出标题。可以使用 Filament 主题颜色(如 'primary'、'danger' 等)或十六进制值(如 '#bada55')进行样式化。

use Awcodes\FilamentBundle\Forms\Components\Heading;

Heading::make(string|int $level = 2)
    ->content('This is a test')
    ->color(string $color)

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全漏洞

请审查 我们的安全策略 了解如何报告安全漏洞。

鸣谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件