Skip to content

Commit

Permalink
Updates to release v2.1.8 fixes #326
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jul 22, 2020
1 parent d44105a commit 78efbcd
Show file tree
Hide file tree
Showing 28 changed files with 339 additions and 215 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.8

**Date:** 21-Jul-2020

- (enh #326): Correct styling for all themes.
- (enh #321): Add Kazakh Translations.
- (enh #316): Add Uzbek Translations.
- (enh #311): Add Turkish Translations.

## Version 2.1.7

**Date:** 15-Nov-2019
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 - 2019, Kartik Visweswaran
Copyright (c) 2014 - 2020, Kartik Visweswaran
Krajee.com
All rights reserved.

Expand Down
27 changes: 24 additions & 3 deletions src/Select2.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down Expand Up @@ -236,7 +236,11 @@ public function renderWidget()
if (empty($this->data)) {
$emptyValue = !isset($this->value) || $this->value === '';
$emptyInitText = !isset($this->initValueText) || $this->initValueText === '';
$emptyData = !isset($this->pluginOptions['placeholder']) && !$multiple ? ['' => '']: [];
if (!isset($this->pluginOptions['placeholder']) && !$multiple && $this->isRequired()) {
$emptyData = ['' => ''];
} else {
$emptyData = [];
}
if ($emptyValue && $emptyInitText) {
$this->data = $emptyData;
} else {
Expand Down Expand Up @@ -435,4 +439,21 @@ public function registerAssets()
}
$this->registerPlugin($this->pluginName, "jQuery('#{$id}')", "initS2Loading('{$id}','{$this->_s2OptionsVar}')");
}

protected function isRequired()
{
if (!empty($this->options['required'])) {
return true;
}
if (!$this->hasModel()) {
return false;
}
$validators = $this->model->getValidators($this->attribute);
foreach ($validators as $validator) {
if ($validator instanceof yii\validators\RequiredValidator) {
return true;
}
}
return false;
}
}
4 changes: 2 additions & 2 deletions src/Select2Asset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/Select2KrajeeAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/ThemeAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/ThemeBootstrapAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/ThemeClassicAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/ThemeDefaultAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/ThemeKrajeeAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
4 changes: 2 additions & 2 deletions src/ThemeKrajeeBs4Asset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand Down
6 changes: 3 additions & 3 deletions src/ThemeMaterialAsset.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2019
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @package yii2-widgets
* @subpackage yii2-widget-select2
* @version 2.1.7
* @version 2.1.8
*/

namespace kartik\select2;
Expand All @@ -14,7 +14,7 @@
*
* @author Mohamad Faeez <[email protected]>
* @modified Kartik Visweswaran <[email protected]>
* @since 2.1.7
* @since 2.1.8
*/
class ThemeMaterialAsset extends ThemeAsset
{
Expand Down
4 changes: 2 additions & 2 deletions 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.7
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @version 2.1.8
*
* Additional CSS for Select2 for extra functionalities added by Krajee
*
Expand Down
4 changes: 2 additions & 2 deletions 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.7
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @version 2.1.8
*
* Additional CSS for Select2 for extra functionalities added by Krajee
*
Expand Down
31 changes: 27 additions & 4 deletions src/assets/css/select2-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,33 @@
border-top-color: transparent;
}
.select2-container--bootstrap .select2-selection__clear {
position: absolute;
color: #999;
cursor: pointer;
float: right;
font-weight: bold;
margin-right: 10px;
}
.select2-container--bootstrap .select2-selection__clear:hover {
color: #333;
}
.select2-container--bootstrap .select2-selection--single .select2-selection__clear,
.select2-container--bootstrap .select2-selection--multiple .select2-selection__clear {
font-size: 16px;
}
.select2-container--bootstrap .select2-selection--single .select2-selection__clear {
right: 1.2rem;
}
.select2-container--bootstrap[dir="rtl"] .select2-selection--single .select2-selection__clear {
left: 1.2rem;
right: auto;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__clear {
right: 1rem;
}
.select2-container--bootstrap[dir="rtl"] .select2-selection--multiple .select2-selection__clear {
left: 1rem;
right: auto;
}
.select2-container--bootstrap.select2-container--disabled .select2-selection {
border-color: #ccc;
-webkit-box-shadow: none;
Expand Down Expand Up @@ -282,9 +300,8 @@
line-height: 1.428571429;
list-style: none;
margin: 0;
overflow: hidden;
padding: 0;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
Expand Down Expand Up @@ -312,11 +329,17 @@
min-width: 5em;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove {
border: none;
background: none;
box-shadow: none;
outline: none;
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
font-weight: 700;
margin-right: 3px;
font-size: 1rem;
line-height: 1.2rem;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333;
Expand Down
Loading

0 comments on commit 78efbcd

Please sign in to comment.