digital-creative/batch-edit-toolbar

允许您一次性更新资源的单个列。

资助包维护!
milewski

安装: 361

依赖项: 0

建议者: 0

安全: 0

星标: 7

关注者: 2

分支: 0

开放问题: 1

语言:Vue

v0.0.4 2023-10-21 13:10 UTC

This package is auto-updated.

Last update: 2024-08-28 10:08:43 UTC


README

Latest Version on Packagist Total Downloads License

允许您直接从索引页面一次性更新资源的单个列。

安装

您可以通过composer安装此包

composer require digital-creative/batch-edit-toolbar

基本用法

要使用新的功能,您只需将batchEditable方法添加到您的字段定义中,此方法应返回一个包含以下定义的选项的数组。

class UserResource extends Resource
{
    public function fields(NovaRequest $request): array
    {
        return [
            Text::make('Title', 'title')
                ->rules('required')
                ->batchEditable(fn () => [
                    'icon' => 'annotation', // accepts any heroicon name supported by Nova: https://v1.heroicons.com
                    
                    /**
                     * These are all optional, and the current values are the default ones
                     */
                    'tooltip' => 'Update {attribute}', // Appears when hovering the icon.
                    'title' => 'Update {attribute}', // Appears in the modal title.
                    'cancelButtonText' => 'Cancel', // Appears in the modal cancel button.
                    'confirmButtonText' => 'Update', // Appears in the modal confirm button.
                    'confirmText' => null, // Appears above the field in the modal.
                    'modalSize' => '2xl', // Can be "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl".
                    'modalStyle' => 'window', // Can be either 'fullscreen' or 'window'.
                ]),
    
            /**
             * You can also use a custom SVG icon directly 
             */
            Text::make('Description', 'description')
                ->rules('required')
                ->batchEditable(fn () => [
                    'icon' => <<<SVG
                        <svg>...</svg>
                    SVG,
                ]),                
        ];
    }
}

⭐️ 显示您的支持

如果此项目对您有所帮助,请给予⭐️支持!

您可能还喜欢的其他包

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。