<?php

namespace Dcat\Admin\Form\Field;

class Ip extends Text
{
    public static $js = '@jquery.inputmask';
    public static $css = '@jquery.inputmask';

    protected $rules = ['nullable', 'ip'];

    /**
     * @see https://github.com/RobinHerbots/Inputmask#options
     *
     * @var array
     */
    protected $options = [
        'alias' => 'ip',
    ];

    public function render()
    {
        $this->inputmask($this->options);

        $this->defaultAttribute('style', 'width: 160px;flex:none');

        $this->prepend('<i class="fa fa-laptop fa-fw"></i>')
            ->defaultAttribute('style', 'width: 200px');

        return parent::render();
    }
}
