承接 infinityxtech/filament-world-map-widget 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

infinityxtech/filament-world-map-widget

最新稳定版本:v2.0.1

Composer 安装命令:

composer require infinityxtech/filament-world-map-widget

包简介

World map stats widget

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

image

Installation

You can install the package via composer:

composer require infinityxtech/filament-world-map-widget

Usage

php artisan make:filament-map-widget MapWidget

Available maps

Map::WORLD
Map::WORLD_MERC
Map::US_MILL_EN
Map::US_MERC_EN
Map::US_LCC_EN
Map::US_AEA_EN
Map::SPAIN
Map::RUSSIA
Map::CANADA
Map::IRAQ
Map::BRASIL

Available methods

    /**
     * Returns the stats to be displayed on the map.
     * Keys represent country codes, and values are the associated data points.
     *
     * @return array
     */
    public function stats(): array
    {
        return [
            'US' => 35000, // Data for the United States
            'RS' => 15000  // Data for Serbia
        ];
    }

    /**
     * Provides the heading text for the widget.
     *
     * @return string|Htmlable|null The heading text or HTML content.
     */
    public function heading(): string|Htmlable|null
    {
        return 'World Map'; // Default heading for the widget
    }

    /**
     * Provides the tooltip text for the widget.
     *
     * @return string|Htmlable Tooltip content or HTML.
     */
    public function tooltip(): string|Htmlable
    {
        return 'stats'; // Tooltip text displayed on hover
    }

    /**
     * Defines the map type to be displayed.
     *
     * @return Map|string The map type, defaults to the WORLD map.
     */
    public function map(): Map|string
    {
        return Map::WORLD; // Enum value for the world map
    }

    /**
     * Provides a custom URL for the map data, if any.
     *
     * @return string|null The custom map URL or null if not provided.
     */
    public function customMapUrl(): ?string
    {
        return null; // No custom map URL by default
    }

    /**
     * Specifies the RGB color values for the map.
     *
     * @return array The RGB color values as an array [R, G, B].
     */
    public function color(): array
    {
        return [0, 120, 215]; // Default blue color for the map
    }

    /**
     * Specifies the height of the widget container.
     *
     * @return string The height value in CSS-compatible format.
     */
    public function height(): string
    {
        return '332px'; // Default widget height
    }

    /**
     * Additional configuration options for the widget.
     *
     * @return array An array of additional options.
     */
    public function additionalOptions(): array
    {
        return []; // No additional options by default
    }
  • To include custom map, you will need to make a url accessible js file that you can set with customMapUrl() and map() with custom naming.
    public function map (): Map|string {
        return 'custom-map';
    }

    public function customMapUrl (): ?string {
        return 'https://example.test/js/custom-map.js';
    }

For more additional options check: Jsvectormap

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-02