scouser03/nova4-multicolumn 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

scouser03/nova4-multicolumn

Composer 安装命令:

composer require scouser03/nova4-multicolumn

包简介

A Laravel Nova field.

关键字:

README 文档

README

Attention: Please, this package is clone https://github.com/fourstacks/nova-repeatable-fields because This package is possibly abandoned and add support nova 4

This package contains a Laravel Nova field that enables the creation of repeatable sets of 'sub' fields. Nova users are free to create, reorder and delete multiple rows of data with the sub fields you define. Data is saved to the database as JSON.

Installation

You can install this package in to a Laravel app that uses Nova via composer:

composer require scouser03/nova4-multicolumn

Usage

namespace App\Nova;

use Scouser03\Nova4Multicolumn\Nova4Multicolumn;

// ...

class Post extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            Nova4Nova4Multicolumn::make('attributes'),

            // ...
        ];
    }
}

In order to use this package you should also ensure the Eloquent model that your Nova resource represents, is casting the attribute you wish to use a MultiColumn field for, to an array:

namespace App;

// ...

class Post extends Model
{
    protected $casts = [
        'attributes' => 'array'
    ]
}

The underlying database field should be either a string or text type field.

Configuration

This package comes with various options that you can use to define the sub fields within your MultiColumn and

addField

Parameters: array

Every MultiColumn field you create should contain at least one sub field added via addField. The addField method accepts an array of sub field configuration options:

Nova4Multicolumn::make('attributes')
    ->addField([
        // configuation options
    ])

Configuration options are:

label
[
    'label' => 'field label',
    //...
]

All sub fields must, at a minimum, be defined with a 'label'. This is a human-readable string that will appear in the Nova UI.

name
[
    'name' => 'field_name',
    //...
]

By default, the name of the sub field (used when saving the data in the database) will be generated automatically using a snake case version of the sub field label. Alternatively you are free to override this convention and define a custom name to be used.

type
[
    'type' => 'text',
    //...
]

By default, the input type of the sub field will be a standard text field. You are free to define a different field type if you wish. Currently supported sub field types are: 'text', 'number', 'select', 'textarea'.

placeholder
[
    'placeholder' => 'Placheholder',
    //...
]

By default, the input placeholder will be the same as the sub field label. However you are free to define a custom placeholder using this option that will appear instead.

width

[
    'width' => 'w-1/2',
    //...
]

If you choose to display your sub fields in a row (rather than stacked - see the displayStackedForm option below) you can define the widths of your fields using Tailwind's fractional width classes. You do not need to define widths for all your fields unless you want to. If no widths are entered for any sub fields all sub fields will be the same width.

Note that you are free to mix and match widths. For example you may with to set your first two fields to 50% width using w-1/2 then set the final field to be full width via w-full.

If you are displaying your sub fields in a stacked layout then width options will have no effect.

options
[
    'options' => [
        'first' => 'First',
        'second' => 'Second',
    ],
    //...
]

If the type of the sub field you are defining is 'select', you will need to define an array of options for the select field. These are defined using an array of key/value pairs.

attributes
[
    'attributes' => [
        'min' => 1,
        'max' => '20',
        'style' => 'color: red'
    ],
    //...
]

Via the attributes key you are free to define any custom properties you wish to add to the input via an associative array. These will be added via v-bind. For example you may wish to add min or max steps to a number field or a style attribute to a text field.

addButtonText

Nova4Multicolumn::make('attributes')
    ->addButtonText('Add new dog');

You are free to configure the text for the button used to add a new set of sub fields in the Nova UI. By default this button is labelled 'Add row' but you can override this using the addButtonText option.

summaryLabel

Nova4Multicolumn::make('attributes')
    ->summaryLabel('Dogs');

displayStackedForm

Nova4Multicolumn::make('attributes')
    ->displayStackedForm();

initialRows

Nova4Multicolumn::make('attributes')
    ->initialRows(4);

Sets the initial number of rows that will be pre-added on form initialization. For forms with existing rows, it will append up to the set number of rows.

maximumRows

Nova4Multicolumn::make('attributes')
    ->maximumRows(4);

Sets the maximum number of rows as the upper limit. Upon reaching this limit, you will not be able to add new rows.

heading

Nova4Multicolumn::make('attributes')
    ->heading('attributes');

Changelog

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

License

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

scouser03/nova4-multicolumn 适用场景与选型建议

scouser03/nova4-multicolumn 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 643 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 10 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 scouser03/nova4-multicolumn 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 scouser03/nova4-multicolumn 我们能提供哪些服务?
定制开发 / 二次开发

基于 scouser03/nova4-multicolumn 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 643
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-26