jankapusta/nova-color-multi-status-field 问题修复 & 功能扩展

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

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

jankapusta/nova-color-multi-status-field

最新稳定版本:v0.9.9

Composer 安装命令:

composer require jankapusta/nova-color-multi-status-field

包简介

Laravel Nova field, for showing multiple statuses or activity history by colorful row of squares (e.g. last 52 weeks activity).

README 文档

README

This field allows to display (and store/edit) multiple values within 1 field as array or object. It will show values based on color map - as colorful square icons. Usually it is stored as json (but that depends purely on an Eloquent model implementation).

Field accepts both array and object values. If the data is an object, keys will be editable and will be displayed as tooltips (on hover)

repository on github

Possibility to edit values with string keys:

Screenshot Form

Display colorful squares based on value-to-color mapping. Showing keys on hover:

Screenshot Index

Installation

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

composer require jankapusta/nova-color-multi-status-field

Usage

Laravel migration example:

$table->json('guests_per_week');

Laravel model example

class Hotel extends Model {
    protected $casts = [
        'guests_per_week' => 'array',
    ];
    // ....
}

Hotel::create([
    'guests_per_week' => [
      'Feb 10' => 5,
      'Feb 17' => 1,
      'Feb 24' => 12,
      'Mar 3' => 4,
      'Mar 10' => 0,
      'Mar 17' => 8,
      'Mar 24' => 14,
      'Mar 31' => 2,
      'Apr 7' => 9,
    ],
]);

Then add a field into Nova Resource

ColorMultiStatus::make('Events per week', 'guests_per_week')
   ->colorMap([
            0 => 'white',
            2 => 'lightgrey',
            5 => '#d3dc83',
            8 => '#a7c742',
            13 => '#7dbd41',
            34 => '#6cda05',
        ])
// optional configuration
  ->iconSize(5) // in pixels - default is 4
  ->iconSpacing(2)   // in pixels - default is 1
  ->showTooltips(false) // to hide tooltips 
  ->width(80), // in pixels

License

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固