lubosdz / yii2-ui-range-plus-minus
UI input widget for Yii2 framework
Installs: 781
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.0
- yiisoft/yii2-jui: ~2.0.0
README
Widget for framework Yii2 which enables to collect numeric values within specified min - max range. Supports increasing - decreasing the value by configured step and basic theming for bootstrap 3 or 4.
Installation
$ composer require "lubosdz/yii2-ui-range-plus-minus" : "~1.1.0"
Usage
use lubosdz\ui\RangePlusMinus; <?= $form->field($model, 'area_m2')->widget(RangePlusMinus::className(), [ 'bsVersion' => 3, // <-- enforce bootstrap 3 layout, since 1.0.3 is default BS4 'unit' => 'm2', 'min' => 10, 'max' => 100, 'tooHigh' => Yii::t('app', 'Maximum value is {max}.'), 'tooLow' => Yii::t('app', 'Minimum value is {min}.'), 'step' => 5, 'cssClassMinus' => 'glyphicon glyphicon-minus', 'cssClassPlus' => 'glyphicon glyphicon-plus', 'options' => [ 'onchange' => new JsExpression('console.log(this)'), ], ]) ?> <?= RangePlusMinus::widget([ 'model' => $model, 'attribute' => 'frequency', 'unit' => 'MHz', 'min' => 10, 'max' => 100, 'decimals' => 3, 'step' => 0.05, 'cssMinusButton' => 'bg-success text-white', 'cssMinusIcon' => 'fa fa-chevron-down', 'cssPlusButton' => 'bg-info text-white', 'cssPlusIcon' => 'fa fa-chevron-up', ]) ?>
Widget options
License
This extension is open source and licensed under BSD-3-Clause (same as Yii2 framework).
Switching from BS3 to BS 4 - since 1.1.0
If you are using this widget for BS3, after upgrading to 1.1.0+ please set proper bootstrap version attribute bsVersion = 3
- see example above.
Changelog
- 1.1.1 - [18.07.2023] Minor fixes to PHP 8.2+
- 1.1.0 - [26.02.2020] Added default support for BS4, fixed validation for 0, minor theming enhancements
- 1.0.2 - [13.09.2018] Fixed namespace
- 1.0.0 - [13.09.2018] Initial release