Skip to content

Commit

Permalink
Updates to release v2.1.5 fix #296 fix #298 fix #300
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Oct 30, 2019
1 parent 99dbf30 commit fe0fffb
Show file tree
Hide file tree
Showing 21 changed files with 236 additions and 205 deletions.
9 changes: 9 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Change Log: `yii2-widget-select2`
=================================

## Version 2.1.5

**Date:** _under development_

- (enh #300): Add Material Theme.
- (enh #299): Add Czech Translations.
- (enh #298, #289): Fix empty options.
- (enh #296): Change source input display from none to intelligent visibility hidden.

## Version 2.1.4

**Date:** 02-Sep-2019
Expand Down
31 changes: 17 additions & 14 deletions src/Select2.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AddonTrait;
use kartik\base\InputWidget;
use ReflectionException;
use Yii;
use yii\base\InvalidConfigException;
use yii\helpers\Html;
Expand Down Expand Up @@ -65,7 +66,7 @@ class Select2 extends InputWidget
*/
const THEME_KRAJEE_BS4 = 'krajee-bs4';
/**
* Select2 Material by Faeez
* Select2 Material Theme
*/
const THEME_MATERIAL = 'material';

Expand Down Expand Up @@ -196,8 +197,8 @@ class Select2 extends InputWidget

/**
* @inheritdoc
* @throws \ReflectionException
* @throws \yii\base\InvalidConfigException
* @throws ReflectionException
* @throws InvalidConfigException
*/
public function run()
{
Expand All @@ -207,8 +208,8 @@ public function run()

/**
* Initializes and renders the widget
* @throws \ReflectionException
* @throws \yii\base\InvalidConfigException
* @throws ReflectionException
* @throws InvalidConfigException
*/
public function renderWidget()
{
Expand All @@ -232,17 +233,19 @@ public function renderWidget()
$this->pluginOptions['minimumResultsForSearch'] = new JsExpression('Infinity');
}
$this->initPlaceholder();
if (!isset($this->data)) {
if (!isset($this->value) && !isset($this->initValueText)) {
if (empty($this->data)) {
$emptyValue = !isset($this->value) || $this->value === '';
$emptyInitText = !isset($this->initValueText) || $this->initValueText === '';
if ($emptyValue && $emptyInitText) {
$this->data = [];
} else {
if ($multiple) {
$key = isset($this->value) && is_array($this->value) ? $this->value : [];
$key = !$emptyValue && is_array($this->value) ? $this->value : [];
} else {
$key = isset($this->value) ? $this->value : '';
$key = !$emptyValue ? $this->value : '';
}
$val = isset($this->initValueText) ? $this->initValueText : $key;
$this->data = $multiple ? array_combine((array) $key, (array) $val) : [$key => $val];
$val = !$emptyInitText ? $this->initValueText : $key;
$this->data = $multiple ? array_combine((array)$key, (array)$val) : [$key => $val];
}
}
$this->initLanguage('language', true);
Expand All @@ -253,7 +256,7 @@ public function renderWidget()

/**
* Initializes and render the toggle all button
* @throws \yii\base\InvalidConfigException
* @throws InvalidConfigException
*/
protected function renderToggleAll()
{
Expand Down Expand Up @@ -366,7 +369,7 @@ protected function renderInput()
{
if ($this->pluginLoading) {
$this->_loadIndicator = '<div class="kv-plugin-loading loading-' . $this->options['id'] . '">&nbsp;</div>';
Html::addCssStyle($this->options, 'display:none');
Html::addCssStyle($this->options, ['width' => '1px', 'height' => '1px', 'visibility' => 'hidden']);
}
Html::addCssClass($this->options, 'form-control');
$input = $this->getInput('dropDownList', true);
Expand Down
2 changes: 1 addition & 1 deletion src/Select2Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;
Expand Down
2 changes: 1 addition & 1 deletion src/Select2KrajeeAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;
Expand Down
2 changes: 1 addition & 1 deletion src/ThemeAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;
Expand Down
4 changes: 1 addition & 3 deletions src/ThemeBootstrapAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AssetBundle;

/**
* Asset bundle for the bootstrap theme for [[Select2]] widget.
*
Expand Down
4 changes: 1 addition & 3 deletions src/ThemeClassicAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AssetBundle;

/**
* Asset bundle for the classic theme for [[Select2]] widget.
*
Expand Down
4 changes: 1 addition & 3 deletions src/ThemeDefaultAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AssetBundle;

/**
* Asset bundle for the default inbuilt theme for [[Select2]] widget.
*
Expand Down
4 changes: 1 addition & 3 deletions src/ThemeKrajeeAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AssetBundle;

/**
* Asset bundle for the Krajee theme for [[Select2]] widget.
*
Expand Down
4 changes: 1 addition & 3 deletions src/ThemeKrajeeBs4Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AssetBundle;

/**
* Asset bundle for the Krajee theme for [[Select2]] widget.
*
Expand Down
7 changes: 3 additions & 4 deletions src/ThemeMaterialAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.4
* @version 2.1.5
*/

namespace kartik\select2;

use kartik\base\AssetBundle;

/**
* Asset bundle for the Krajee theme for [[Select2]] widget.
*
* @author Mohamad Faeez <mfmdevsystem@gmail.com>
* @since 1.0
* @modified Kartik Visweswaran <kartikv2@gmail.com>
* @since 2.1.5
*/
class ThemeMaterialAsset extends ThemeAsset
{
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/select2-addl.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @version 2.1.4
* @version 2.1.5
*
* Additional CSS for Select2 for extra functionalities added by Krajee
*
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/select2-addl.min.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @version 2.1.4
* @version 2.1.5
*
* Additional CSS for Select2 for extra functionalities added by Krajee
*
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/select2-krajee-bs4.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @version 2.1.4
* @version 2.1.5
*
* Krajee Bootstrap 4.x Theme for Select2
*
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/select2-krajee-bs4.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/assets/css/select2-krajee.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @version 2.1.4
* @version 2.1.5
*
* Krajee Bootstrap 3.x Theme for Select2
*
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/select2-krajee.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe0fffb

Please sign in to comment.