定制 eom-plus/nova-input-group 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eom-plus/nova-input-group

最新稳定版本:1.0.4

Composer 安装命令:

composer require eom-plus/nova-input-group

包简介

A Laravel Nova field.

README 文档

README

A Laravel Nova4 text field formatted as input group

Latest Version on Packagist Total Downloads GitHub forks GitHub issues License

image

This custom field allow to append or prepend text and/or heroicon icon. Text can also be HTML. For HTML, a dedicated component is used intead of v-html directive. HTML markup is sanitazed previously sanitized using DOMPurify library to avoid vulnaribility. Note that when you HMTL you can also use Emojis icons.

Installation

composer require eom-plus/nova-input-group

Usage

Import it in your resources and add the InputGroup to fields method. We have added various methods to add flexibility to the component. You can append , prepend or both at the same time.

...
use EomPlus\NovaInputGroup\InputGroup;

public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        Text::make('Name', 'name'),
        InputGroup::make('Subdomain', 'subdomain')
           ->appendIcon('cube', 'after')
           ->append('<i>@example.com</i>')
           ->prependIcon('cube')
           ->prepend('test')
           ->prependExtraClasses('bg-green-500 text-white')
           ->asHtml()  

    ];
}
...

But we have maintained the old method for backward compatibility with Decency Input Group

Example using legacy way

...
use EomPlus\NovaInputGroup\InputGroup;

public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        Text::make('Name', 'name'),

        InputGroup::make('Subdomain', 'subdomain')
           ->position('after')
           ->text('@example.com'),

    ];
}
...

Methods

  • prepend(value) Prepend text to input field

  • prependIcon(name, position) Prepend heroicon to input field. You can choose between 'before' and 'after'. When not used, 'before' is used.

  • prependExtraClasses(value) Prepend extra css classes to input field to change background or text color for example.

  • append(value) Append text to input field

  • appendIcon(name, position) Append heroicon to input field. You can choose between 'before' and 'after'. When not used, 'before' is used.

  • appendExtraClasses(value) Append extra css classes to input field to change background or text color for example.

  • asHtml() render value as HTML

Legacy methods for backwards compatibility (avoid to use them)

  • position(text) You can choose between 'before' and 'after'. When not used, 'before' is used.
  • text(value) The text to be displayed.

Changelog

Please see CHANGELOG for more information on what has changed recently.

TODO

  • Support other kind of field
  • Testcases
  • PS4 code compliance
  • More examples
  • Fix field length
  • Add buttons and dropdown support

Security and contributions.

If you discover any security related issues, please use the issue tracker. All PRs are welcome

Credits

⭐️ Show Your Support

Please give a ⭐️ if this project helped you!

Other Packages You Might Like

Take a look to our Github repositories as we have a lot of forked nova components with fixes that are still not merge into main owner branch.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 1
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-07