ekilei/yii2-numstepper-widget

Input simular number

dev-master 2019-07-30 10:49 UTC

This package is auto-updated.

Last update: 2024-09-29 05:22:01 UTC


README

Numstepper является надстройкой над InputWidget, предназначен для адаптивных сайтов, удобен в применении на декстопе и на мобильных устройствах.

Numstepper is an add-on above the InputWidget, designed for adaptive sites, convenient for use on the desktop and on mobile devices.

<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className()) ?>
?>

C параметрами

With parameters

ScreenShot

<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
    [
        'min' => -28,
        'max' => 28,
    ])
?>

C исключением и значением при инициализации

With exception and initialization value

<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
    [
        'min' => -28,
        'max' => 28,
        'exclude' => [0],
        'default' => (int)$model->day ? (int)$model->day : 1,
    ])
?>

C подсказкой

With a hint

ScreenShot

<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
    'min' => -28,
    'max' => 28,
    'exclude' => [0],
    'default' => (int)$model->day ? (int)$model->day : 1,
    ])
     ->hint(Yii::t('app','Negative numbers make it possible to choose a day from the end of the month.').'
            <br>'.Yii::t('app','Example').': "-1" = [31,30,28(29)], а "-3" = [29,28,26(27)] ') 
?>

Со своими иконками кнопок

With own icon buttons

ScreenShot

<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
    [
        'default' => (int)$model->day ? (int)$model->day : 1,
        'minusButton' => 'menu-down',
        'plusButton' => 'menu-up',
    ])
?>

С изменением расположением кнопок

With the change in the arrangement of the buttons

ScreenShot

<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
    [
        'default' => (int)$model->day ? (int)$model->day : 1,
        'minusButton' => 'menu-down',
        'plusButton' => 'menu-up',
        'prepend' => [],
        'append' => ['{minus}','{plus}'],
    ])
?>

Установка

Install

composer require ekilei/yii2-numstepper-widget "dev-master"