From 4f212813b3c0a67ceedc59e4bda5827890520a3b Mon Sep 17 00:00:00 2001 From: Kartik Visweswaran Date: Fri, 3 Sep 2021 08:21:11 +0530 Subject: [PATCH] Fix #993: Enhancements to support Bootstrap v5.x --- CHANGE.md | 6 +- LICENSE.md | 2 +- composer.json | 3 +- src/ActionColumn.php | 38 ++++---- src/ActionColumnAsset.php | 2 +- src/BooleanColumn.php | 16 ++-- src/CheckboxColumn.php | 2 +- src/CheckboxColumnAsset.php | 2 +- src/ColumnTrait.php | 14 +-- src/DataColumn.php | 11 ++- src/Demo.php | 2 +- src/EditableColumn.php | 4 +- src/EditableColumnAction.php | 2 +- src/EditableColumnAsset.php | 2 +- src/EnumColumn.php | 2 +- src/ExpandRowColumn.php | 15 +-- src/ExpandRowColumnAsset.php | 2 +- src/FormulaColumn.php | 5 +- src/GridExportAsset.php | 2 +- src/GridFloatHeadAsset.php | 2 +- src/GridGroupAsset.php | 2 +- src/GridPerfectScrollbarAsset.php | 2 +- src/GridResizeColumnsAsset.php | 2 +- src/GridResizeStoreAsset.php | 2 +- src/GridToggleDataAsset.php | 2 +- src/GridView.php | 132 ++++++++++++++------------ src/GridViewAsset.php | 2 +- src/Module.php | 2 +- src/RadioColumn.php | 20 ++-- src/RadioColumnAsset.php | 2 +- src/SerialColumn.php | 2 +- src/assets/css/kv-grid-expand.css | 2 +- src/assets/css/kv-grid-expand.min.css | 2 +- src/assets/css/kv-grid.css | 13 ++- src/assets/css/kv-grid.min.css | 4 +- src/assets/js/kv-grid-checkbox.js | 4 +- src/assets/js/kv-grid-checkbox.min.js | 4 +- src/assets/js/kv-grid-editable.js | 4 +- src/assets/js/kv-grid-editable.min.js | 4 +- src/assets/js/kv-grid-expand.js | 4 +- src/assets/js/kv-grid-expand.min.js | 4 +- src/assets/js/kv-grid-export.js | 4 +- src/assets/js/kv-grid-export.min.js | 4 +- src/assets/js/kv-grid-group.js | 6 +- src/assets/js/kv-grid-group.min.js | 4 +- src/assets/js/kv-grid-radio.js | 4 +- src/assets/js/kv-grid-radio.min.js | 4 +- src/assets/js/kv-grid-toggle.js | 2 +- src/assets/js/kv-grid-toggle.min.js | 2 +- src/controllers/ExportController.php | 5 +- 50 files changed, 207 insertions(+), 177 deletions(-) diff --git a/CHANGE.md b/CHANGE.md index 92e51e2d..4287c2a7 100755 --- a/CHANGE.md +++ b/CHANGE.md @@ -3,8 +3,12 @@ Change Log: `yii2-grid` ## Version 3.3.6 -**Date:** _under development_ +**Date:** 02-Sep-2021 +- (enh #993): Enhancements to support Bootstrap v5.x. +- (enh #971): Correct `kv-grid-group.js` version. +- (enh #969): Update Fontawesome CDN version. +- (enh #968): Update Ukraine Translations. - (bug #959): Correct `filterOptions` column seq setting in ColumnTrait. - (bug #958): Correct ExpandRowColumn expand all & collapse all. - (enh #956): Update Portugese Brazilian Translations. diff --git a/LICENSE.md b/LICENSE.md index ce741c14..d745e186 100755 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2014 - 2020, Kartik Visweswaran +Copyright (c) 2014 - 2021, Kartik Visweswaran Krajee.com All rights reserved. diff --git a/composer.json b/composer.json index cc2d0d76..ded3e5d7 100755 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ ], "require": { "kartik-v/yii2-dialog": "~1.0", - "kartik-v/yii2-bootstrap4-dropdown": "~1.0" + "kartik-v/yii2-bootstrap4-dropdown": "~1.0", + "kartik-v/yii2-bootstrap5-dropdown": "~1.0" }, "autoload": { "psr-4": { diff --git a/src/ActionColumn.php b/src/ActionColumn.php index 5715d00a..2fd058c3 100644 --- a/src/ActionColumn.php +++ b/src/ActionColumn.php @@ -1,7 +1,7 @@ true, 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, - 'width' => '50px', + 'width' => '100px', ]); - /** @noinspection PhpUndefinedFieldInspection */ $this->_isDropdown = ($this->grid->bootstrap && $this->dropdown); if (!isset($this->header)) { $this->header = Yii::t('kvgrid', 'Actions'); @@ -217,19 +217,19 @@ protected function renderLabel(&$options, $title, $iconOptions = []) * @param string $name button name as written in the [[template]] * @param string $title the title of the button * @param string $icon the meaningful glyphicon suffix name for the button - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function setDefaultButton($name, $title, $icon) { - $isBs4 = $this->grid->isBs4(); + $notBs3 = !$this->grid->isBs(3); if (isset($this->buttons[$name])) { return; } - $this->buttons[$name] = function ($url) use ($name, $title, $icon, $isBs4) { + $this->buttons[$name] = function ($url) use ($name, $title, $icon, $notBs3) { $opts = "{$name}Options"; $options = ['title' => $title, 'aria-label' => $title, 'data-pjax' => '0']; if ($name === 'delete') { - $item = isset($this->grid->itemLabelSingle) ? $this->grid->itemLabelSingle : Yii::t('kvgrid', 'item'); + $item = $this->grid->itemLabelSingle ?? Yii::t('kvgrid', 'item'); $options['data-method'] = 'post'; $options['data-confirm'] = Yii::t('kvgrid', 'Are you sure to delete this {item}?', ['item' => $item]); } @@ -238,7 +238,7 @@ protected function setDefaultButton($name, $title, $icon) $link = Html::a($label, $url, $options); if ($this->_isDropdown) { $options['tabindex'] = '-1'; - return $isBs4 ? $link : "
  • {$link}
  • \n"; + return $notBs3 ? $link : "
  • {$link}
  • \n"; } else { return $link; } @@ -251,10 +251,10 @@ protected function setDefaultButton($name, $title, $icon) */ protected function initDefaultButtons() { - $isBs4 = $this->grid->isBs4(); - $this->setDefaultButton('view', Yii::t('kvgrid', 'View'), $isBs4 ? 'eye' : 'eye-open'); - $this->setDefaultButton('update', Yii::t('kvgrid', 'Update'), $isBs4 ? 'pencil-alt' : 'pencil'); - $this->setDefaultButton('delete', Yii::t('kvgrid', 'Delete'), $isBs4 ? 'trash-alt' : 'trash'); + $notBs3 = !$this->grid->isBs(3); + $this->setDefaultButton('view', Yii::t('kvgrid', 'View'), $notBs3 ? 'eye' : 'eye-open'); + $this->setDefaultButton('update', Yii::t('kvgrid', 'Update'), $notBs3 ? 'pencil-alt' : 'pencil'); + $this->setDefaultButton('delete', Yii::t('kvgrid', 'Delete'), $notBs3 ? 'trash-alt' : 'trash'); } /** @@ -263,8 +263,8 @@ protected function initDefaultButtons() */ protected function renderDataCellContent($model, $key, $index) { - $isBs4 = $this->grid->isBs4(); - if ($isBs4 && $this->_isDropdown) { + $notBs3 = !$this->grid->isBs(3); + if ($notBs3 && $this->_isDropdown) { Html::addCssClass($this->buttonOptions, 'dropdown-item'); } $content = parent::renderDataCellContent($model, $key, $index); @@ -278,13 +278,13 @@ protected function renderDataCellContent($model, $key, $index) $trimmed = trim($content); if ($this->_isDropdown && !empty($trimmed)) { $label = ArrayHelper::remove($options, 'label', Yii::t('kvgrid', 'Actions')); - $caret = $isBs4 ? '' : ArrayHelper::remove($options, 'caret', ' '); + $caret = $notBs3 ? '' : ArrayHelper::remove($options, 'caret', ' '); $options = array_replace_recursive($options, ['type' => 'button', 'data-toggle' => 'dropdown']); Html::addCssClass($options, 'dropdown-toggle'); $button = Html::button($label . $caret, $options); Html::addCssClass($this->dropdownMenu, 'dropdown-menu'); - $dropdown = $button . PHP_EOL . Html::tag($isBs4 ? 'div' : 'ul', $content, $this->dropdownMenu); - Html::addCssClass($this->dropdownOptions, $isBs4 ? 'btn-group' : 'dropdown'); + $dropdown = $button . PHP_EOL . Html::tag($notBs3 ? 'div' : 'ul', $content, $this->dropdownMenu); + Html::addCssClass($this->dropdownOptions, $notBs3 ? 'btn-group' : 'dropdown'); return Html::tag('div', $dropdown, $this->dropdownOptions); } return $content; diff --git a/src/ActionColumnAsset.php b/src/ActionColumnAsset.php index 321c68b4..bf8d2629 100644 --- a/src/ActionColumnAsset.php +++ b/src/ActionColumnAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/BooleanColumn.php b/src/BooleanColumn.php index 253fa7d4..2efc4215 100644 --- a/src/BooleanColumn.php +++ b/src/BooleanColumn.php @@ -3,13 +3,15 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ namespace kartik\grid; +use Exception; use Yii; +use yii\base\InvalidConfigException; use yii\helpers\Html; /** @@ -67,7 +69,7 @@ class BooleanColumn extends DataColumn /** * @inheritdoc - * @throws \yii\base\InvalidConfigException + * @throws InvalidConfigException */ public function init() { @@ -83,7 +85,7 @@ public function init() } $this->filter = [true => $this->trueLabel, false => $this->falseLabel]; if (empty($this->trueIcon)) { - $this->trueIcon = $this->getIconMarkup('true'); + $this->trueIcon = $this->getIconMarkup(); } if (empty($this->falseIcon)) { @@ -96,7 +98,7 @@ public function init() * Get icon HTML markup * @param string $type the type of markup `true` or `false` * @return string - * @throws \yii\base\InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function getIconMarkup($type = 'true') { @@ -104,12 +106,12 @@ protected function getIconMarkup($type = 'true') if (!$this->grid->bootstrap) { return $label; } - $isBs4 = $this->grid->isBs4(); + $notBs3 = !$this->grid->isBs(3); if ($type === 'true') { - return ($isBs4 ? GridView::ICON_ACTIVE_BS4 : GridView::ICON_ACTIVE) . + return ($notBs3 ? GridView::ICON_ACTIVE_BS4 : GridView::ICON_ACTIVE) . Html::tag('span', $this->trueLabel, ['class' => 'kv-grid-boolean']); } - return ($isBs4 ? GridView::ICON_INACTIVE_BS4 : GridView::ICON_INACTIVE) . + return ($notBs3 ? GridView::ICON_INACTIVE_BS4 : GridView::ICON_INACTIVE) . Html::tag('span', $this->falseLabel, ['class' => 'kv-grid-boolean']); } diff --git a/src/CheckboxColumn.php b/src/CheckboxColumn.php index 81e2280b..c933c2da 100644 --- a/src/CheckboxColumn.php +++ b/src/CheckboxColumn.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/CheckboxColumnAsset.php b/src/CheckboxColumnAsset.php index a910aa71..7a6e82f4 100644 --- a/src/CheckboxColumnAsset.php +++ b/src/CheckboxColumnAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/ColumnTrait.php b/src/ColumnTrait.php index b6eba7fc..c6a08226 100644 --- a/src/ColumnTrait.php +++ b/src/ColumnTrait.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ @@ -209,8 +209,6 @@ public function renderHeaderCell() Html::addCssClass($this->headerOptions, 'kv-merged-header'); } $this->headerOptions['data-col-seq'] = array_search($this, $this->grid->columns); - /** @noinspection PhpUndefinedClassInspection */ - /** @noinspection PhpUndefinedMethodInspection */ return parent::renderHeaderCell(); } @@ -225,8 +223,6 @@ public function renderFilterCell() return null; } $this->filterOptions['data-col-seq'] = array_search($this, $this->grid->columns); - /** @noinspection PhpUndefinedClassInspection */ - /** @noinspection PhpUndefinedMethodInspection */ return parent::renderFilterCell(); } @@ -262,8 +258,8 @@ public function parseExcelFormats(&$options, $model, $key, $index) if (isset($this->xlFormat)) { $fmt = $this->xlFormat; } elseif ($autoFormat && isset($this->format)) { - $tSep = isset($formatter->thousandSeparator) ? $formatter->thousandSeparator : ','; - $dSep = isset($formatter->decimalSeparator) ? $formatter->decimalSeparator : '.'; + $tSep = $formatter->thousandSeparator ?? ','; + $dSep = $formatter->decimalSeparator ?? '.'; switch ($format) { case 'text': case 'html': @@ -337,7 +333,7 @@ protected function renderPageSummaryCellContent() } $content = $this->getPageSummaryCellContent(); if ($this->pageSummary === true) { - $format = isset($this->pageSummaryFormat) ? $this->pageSummaryFormat : $this->format; + $format = $this->pageSummaryFormat ?? $this->format; return $this->grid->formatter->format($content, $format); } return ($content === null) ? $this->grid->emptyCell : $content; @@ -490,7 +486,7 @@ protected function isValidAlignment($type = 'hAlign') $this->hAlign === GridView::ALIGN_RIGHT || $this->hAlign === GridView::ALIGN_CENTER ); - } elseif ($type = 'vAlign') { + } elseif ($type === 'vAlign') { return ( $this->vAlign === GridView::ALIGN_TOP || $this->vAlign === GridView::ALIGN_MIDDLE || diff --git a/src/DataColumn.php b/src/DataColumn.php index 7f128673..8417d739 100644 --- a/src/DataColumn.php +++ b/src/DataColumn.php @@ -3,13 +3,16 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ namespace kartik\grid; use Closure; +use Exception; +use kartik\base\Widget; +use yii\base\InvalidConfigException; use yii\grid\DataColumn as YiiDataColumn; use kartik\base\Config; use yii\helpers\Html; @@ -211,7 +214,7 @@ class DataColumn extends YiiDataColumn /** * @inheritdoc - * @throws \yii\base\InvalidConfigException + * @throws InvalidConfigException */ public function init() { @@ -246,7 +249,7 @@ public function renderDataCell($model, $key, $index) * Renders filter inputs based on the `filterType` * * @return string - * @throws \Exception + * @throws Exception */ protected function renderFilterCellContent() { @@ -282,7 +285,7 @@ protected function renderFilterCellContent() return Html::activeCheckbox($this->grid->filterModel, $this->attribute, $this->filterInputOptions); } $options = array_replace_recursive($this->filterWidgetOptions, $options); - /** @var \kartik\base\Widget $widgetClass */ + /** @var Widget $widgetClass */ return $widgetClass::widget($options); } } diff --git a/src/Demo.php b/src/Demo.php index 6885fce8..715e9ab6 100644 --- a/src/Demo.php +++ b/src/Demo.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/EditableColumn.php b/src/EditableColumn.php index 17e23e7b..3e4f8deb 100644 --- a/src/EditableColumn.php +++ b/src/EditableColumn.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ @@ -154,7 +154,7 @@ public function renderDataCellContent($model, $key, $index) $id = $this->grid->options['id']; $this->_view->registerJs("kvRefreshEC('{$id}','{$this->_css}');"); } - $editableClass = ArrayHelper::remove($this->_editableOptions, 'class', Editable::className()); + $editableClass = ArrayHelper::remove($this->_editableOptions, 'class', Editable::class); if (!isset($this->_editableOptions['inlineSettings']['options'])) { $this->_editableOptions['inlineSettings']['options']['class'] = 'skip-export'; } else { diff --git a/src/EditableColumnAction.php b/src/EditableColumnAction.php index cd81aef0..5e61fba3 100644 --- a/src/EditableColumnAction.php +++ b/src/EditableColumnAction.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/EditableColumnAsset.php b/src/EditableColumnAsset.php index 568de391..e521eff3 100644 --- a/src/EditableColumnAsset.php +++ b/src/EditableColumnAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/EnumColumn.php b/src/EnumColumn.php index e5402e9f..704fa67f 100644 --- a/src/EnumColumn.php +++ b/src/EnumColumn.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/ExpandRowColumn.php b/src/ExpandRowColumn.php index fa2fd432..afd75b35 100644 --- a/src/ExpandRowColumn.php +++ b/src/ExpandRowColumn.php @@ -3,13 +3,14 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ namespace kartik\grid; use Closure; +use Exception; use Yii; use yii\base\InvalidConfigException; use yii\base\Model; @@ -78,7 +79,7 @@ class ExpandRowColumn extends DataColumn * following rules: * - If GridView `bootstrap` property is set to `true`, it will default to: * - [[GridView::ICON_EXPAND]] for Bootstrap 3.x - * - [[GridView::ICON_EXPAND_BS4]] for Bootstrap 4.x + * - [[GridView::ICON_EXPAND_BS4]] for Bootstrap 4.x / 5.x * - If GridView `bootstrap` property is set to `false`, then it will default to `+`. */ public $expandIcon; @@ -88,7 +89,7 @@ class ExpandRowColumn extends DataColumn * following rules: * - If GridView `bootstrap` property is set to `true`, it will default to: * - [[GridView::ICON_COLLAPSE]] for Bootstrap 3.x - * - [[GridView::ICON_COLLAPSE_BS4]] for Bootstrap 4.x + * - [[GridView::ICON_COLLAPSE_BS4]] for Bootstrap 4.x / 5.x * - If GridView `bootstrap` property is set to `false`, then it will default to `-`. */ public $collapseIcon; @@ -375,7 +376,7 @@ public function renderDataCell($model, $key, $index) * @param string $type one of `expand` or `collapse` * * @return string the icon indicator markup - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function getIcon($type) { @@ -384,12 +385,12 @@ protected function getIcon($type) return $this->$setting; } $bs = $this->grid->bootstrap; - $isBs4 = $this->grid->isBs4(); + $notBs3 = !$this->grid->isBs(3); if ($type === 'expand') { - return $bs ? ($isBs4 ? GridView::ICON_EXPAND_BS4 : GridView::ICON_EXPAND) : '+'; + return $bs ? ($notBs3 ? GridView::ICON_EXPAND_BS4 : GridView::ICON_EXPAND) : '+'; } if ($type === 'collapse') { - return $bs ? ($isBs4 ? GridView::ICON_COLLAPSE_BS4 : GridView::ICON_COLLAPSE) : '-'; + return $bs ? ($notBs3 ? GridView::ICON_COLLAPSE_BS4 : GridView::ICON_COLLAPSE) : '-'; } return null; } diff --git a/src/ExpandRowColumnAsset.php b/src/ExpandRowColumnAsset.php index 16220ba9..260abc40 100644 --- a/src/ExpandRowColumnAsset.php +++ b/src/ExpandRowColumnAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/FormulaColumn.php b/src/FormulaColumn.php index 1769af8c..756af72c 100644 --- a/src/FormulaColumn.php +++ b/src/FormulaColumn.php @@ -3,12 +3,13 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ namespace kartik\grid; +use Closure; use yii\base\InvalidConfigException; /** @@ -60,7 +61,7 @@ public function col($i, $params = []) if (empty($this->grid->columns[$i])) { throw new InvalidConfigException("Invalid column index {$i} used in FormulaColumn."); } - if (!isset($this->value) || !$this->value instanceof \Closure) { + if (!isset($this->value) || !($this->value instanceof Closure)) { throw new InvalidConfigException( "The 'value' must be set and defined as a `Closure` function for a FormulaColumn." ); diff --git a/src/GridExportAsset.php b/src/GridExportAsset.php index 587e845d..b129dbaf 100644 --- a/src/GridExportAsset.php +++ b/src/GridExportAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridFloatHeadAsset.php b/src/GridFloatHeadAsset.php index 123c895c..08171ac8 100644 --- a/src/GridFloatHeadAsset.php +++ b/src/GridFloatHeadAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridGroupAsset.php b/src/GridGroupAsset.php index 12131581..e87cf9e9 100644 --- a/src/GridGroupAsset.php +++ b/src/GridGroupAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridPerfectScrollbarAsset.php b/src/GridPerfectScrollbarAsset.php index b8d0c193..fe4edf58 100644 --- a/src/GridPerfectScrollbarAsset.php +++ b/src/GridPerfectScrollbarAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridResizeColumnsAsset.php b/src/GridResizeColumnsAsset.php index bff125c3..cef5bc87 100644 --- a/src/GridResizeColumnsAsset.php +++ b/src/GridResizeColumnsAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridResizeStoreAsset.php b/src/GridResizeStoreAsset.php index dad2589e..16fdfe27 100644 --- a/src/GridResizeStoreAsset.php +++ b/src/GridResizeStoreAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridToggleDataAsset.php b/src/GridToggleDataAsset.php index 055e4999..cd75e948 100644 --- a/src/GridToggleDataAsset.php +++ b/src/GridToggleDataAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/GridView.php b/src/GridView.php index accc7e87..96868c49 100644 --- a/src/GridView.php +++ b/src/GridView.php @@ -3,13 +3,14 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ namespace kartik\grid; use Closure; +use Exception; use kartik\base\BootstrapInterface; use kartik\base\BootstrapTrait; use kartik\base\Config; @@ -76,6 +77,11 @@ class GridView extends YiiGridView implements BootstrapInterface */ const TYPE_DEFAULT = 'default'; + /** + * @var string the **dark** bootstrap contextual color type (applicable only for panel contextual style) + */ + const TYPE_DARK = 'dark'; + /** * @var string the **primary** bootstrap contextual color type */ @@ -127,22 +133,22 @@ class GridView extends YiiGridView implements BootstrapInterface const ICON_COLLAPSE = ''; /** - * @var string the Bootstrap 4.x **active** icon markup for [[BooleanColumn]] + * @var string the Bootstrap 4.x / 5.x **active** icon markup for [[BooleanColumn]] */ const ICON_ACTIVE_BS4 = ''; /** - * @var string the Bootstrap 4.x **inactive** icon markup for [[BooleanColumn]] + * @var string the Bootstrap 4.x / 5.x **inactive** icon markup for [[BooleanColumn]] */ const ICON_INACTIVE_BS4 = ''; /** - * @var string the Bootstrap 4.x **expanded** icon markup for [[ExpandRowColumn]] + * @var string the Bootstrap 4.x / 5.x **expanded** icon markup for [[ExpandRowColumn]] */ const ICON_EXPAND_BS4 = ''; /** - * @var string the Bootstrap 4.x **collapsed** icon markup for [[ExpandRowColumn]] + * @var string the Bootstrap 4.x / 5.x **collapsed** icon markup for [[ExpandRowColumn]] */ const ICON_COLLAPSE_BS4 = ''; @@ -856,13 +862,13 @@ class GridView extends YiiGridView implements BootstrapInterface * 'all' => [ * 'icon' => 'resize-full', * 'label' => 'All', - * 'class' => 'btn btn-default', // 'btn btn-secondary' for BS4.x + * 'class' => 'btn btn-default', // 'btn btn-secondary' for BS4.x / BS5.x * 'title' => 'Show all data' * ], * 'page' => [ * 'icon' => 'resize-small', * 'label' => 'Page', - * 'class' => 'btn btn-default', // 'btn btn-secondary' for BS4.x + * 'class' => 'btn btn-default', // 'btn btn-secondary' for BS4.x / BS5.x * 'title' => 'Show first page data' * ], * ] @@ -917,7 +923,7 @@ class GridView extends YiiGridView implements BootstrapInterface * the page export items will be automatically generated based on settings in the `exportConfig` property. * - `options`: _array_, HTML attributes for the export menu button. Defaults to * - `['class' => 'btn btn-default']` for [[bsVersion]] = '3.x' or . - * - `['class' => 'btn btn-secondary']` for [[bsVersion]] = '4.x' + * - `['class' => 'btn btn-secondary']` for [[bsVersion]] = '4.x' / '5.x' * - `encoding`: _string_, the export output file encoding. If not set, defaults to `utf-8`. * - `bom`: `boolean`, whether a BOM is to be embedded for text or CSV files with utf-8 encoding. Defaults to * `true`. @@ -1061,7 +1067,7 @@ protected static function parseExportConfig($exportConfig, $defaultExportConfig) { if (is_array($exportConfig) && !empty($exportConfig)) { foreach ($exportConfig as $format => $setting) { - $setup = is_array($exportConfig[$format]) ? $exportConfig[$format] : []; + $setup = is_array($setting) ? $setting : []; $exportConfig[$format] = empty($setup) ? $defaultExportConfig[$format] : array_replace_recursive($defaultExportConfig[$format], $setup); } @@ -1094,7 +1100,9 @@ public function init() $this->bsVersion = $this->_module->bsVersion; } $this->initBsVersion(); - Html::addCssClass($this->options, 'is-bs' . ($this->isBs4() ? '4' : '3')); + $bsVer = $this->getBsVer(); + $notBs3 = $bsVer > 3; + Html::addCssClass($this->options, 'is-bs' . ($notBs3 ? '4' : '3')); $this->initPjaxContainerId(); if (!isset($this->itemLabelSingle)) { $this->itemLabelSingle = Yii::t('kvgrid', 'item'); @@ -1111,8 +1119,7 @@ public function init() if (!isset($this->itemLabelAccusative)) { $this->itemLabelAccusative = Yii::t('kvgrid', 'items-acc'); } - $isBs4 = $this->isBs4(); - if ($isBs4) { + if ($notBs3) { Html::addCssClass($this->options, 'kv-grid-bs4'); $this->setPagerOptionClass('linkContainerOptions', 'page-item'); $this->setPagerOptionClass('linkOptions', 'page-link'); @@ -1132,7 +1139,6 @@ public function init() } $this->_isShowAll = $request->getQueryParam($this->_toggleDataKey, $this->defaultPagination) === 'all'; if ($this->_isShowAll) { - /** @noinspection PhpUndefinedFieldInspection */ $this->dataProvider->pagination = false; } $this->_toggleButtonId = $this->options['id'] . '-togdata-' . ($this->_isShowAll ? 'all' : 'page'); @@ -1164,8 +1170,9 @@ public function initPjaxContainerId() /** * Adds CSS class to the pager parameter - * @param string $param the pager param - * @param string $css the CSS class + * @param string $param the pager param + * @param string $css the CSS class + * @throws Exception */ protected function setPagerOptionClass($param, $css) { @@ -1177,7 +1184,7 @@ protected function setPagerOptionClass($param, $css) /** * @inheritdoc * @throws InvalidConfigException - * @throws \Exception + * @throws Exception */ public function run() { @@ -1212,15 +1219,16 @@ public function run() * Renders the table page summary. * * @return string the rendering result. - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ public function renderPageSummary() { if (!$this->showPageSummary) { return null; } + $notBs3 = !$this->isBs(3); if (!isset($this->pageSummaryRowOptions['class'])) { - $this->pageSummaryRowOptions['class'] = ($this->isBs4() ? 'table-' : '') . 'warning kv-page-summary'; + $this->pageSummaryRowOptions['class'] = ($notBs3 ? 'table-' : '') . 'warning kv-page-summary'; } Html::addCssClass($this->pageSummaryRowOptions, $this->options['id']); $row = $this->getPageSummaryRow(); @@ -1235,6 +1243,7 @@ public function renderPageSummary() /** * Get the page summary row markup * @return string + * @throws Exception */ protected function getPageSummaryRow() { @@ -1327,6 +1336,7 @@ public static function parseKey($key) * Renders the toggle data button. * * @return string + * @throws Exception */ public function renderToggleData() { @@ -1350,7 +1360,7 @@ public function renderToggleData() * * @return string * @throws InvalidConfigException - * @throws \Exception + * @throws Exception */ public function renderExport() { @@ -1359,7 +1369,8 @@ public function renderExport() ) { return ''; } - $isBs4 = $this->isBs4(); + $bsVer = $this->getBsVer(); + $notBs3 = $bsVer > 3; $title = $this->export['label']; $icon = $this->export['icon']; $options = $this->export['options']; @@ -1406,16 +1417,17 @@ public function renderExport() 'encodeLabel' => false, ]; Html::addCssClass($this->exportContainer, 'btn-group'); - if ($isBs4) { + $dropdown = $this->getDropdownClass(true); + if ($notBs3) { $opts['buttonOptions'] = $options; $opts['renderContainer'] = false; - /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ - $out = Html::tag('div', \kartik\bs4dropdown\ButtonDropdown::widget($opts), $this->exportContainer); + /** @noinspection PhpUndefinedMethodInspection */ + $out = Html::tag('div', $dropdown::widget($opts), $this->exportContainer); } else { $opts['options'] = $options; $opts['containerOptions'] = $this->exportContainer; - /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ - $out = \yii\bootstrap\ButtonDropdown::widget($opts); + /** @noinspection PhpUndefinedMethodInspection */ + $out = $dropdown::widget($opts); } return $out; } @@ -1478,7 +1490,6 @@ public function renderColumnGroup() $cols = []; foreach ($this->columns as $column) { //Skip column with groupedRow - /** @noinspection PhpUndefinedFieldInspection */ if (property_exists($column, 'groupedRow') && $column->groupedRow) { continue; } @@ -1570,14 +1581,11 @@ protected function initModule() $this->moduleId = Module::MODULE; } $this->_module = Config::getModule($this->moduleId, Module::class); - if (isset($this->bsVersion)) { - return; - } } /** * Initialize grid export. - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function initExport() { @@ -1595,11 +1603,12 @@ protected function initExport() $this->export['fontAwesome'] = false; } $isFa = $this->export['fontAwesome']; - $isBs4 = $this->isBs4(); + $bsVer = $this->getBsVer(); + $notBs3 = $bsVer > 3; $this->export = array_replace_recursive( [ 'label' => '', - 'icon' => $isFa ? 'fa fa-share-square-o' : ($this->isBs4() ? 'fas fa-external-link-alt' : 'glyphicon glyphicon-export'), + 'icon' => $isFa ? 'fa fa-share-square-o' : ($notBs3 ? 'fas fa-external-link-alt' : 'glyphicon glyphicon-export'), 'messages' => [ 'allowPopups' => Yii::t( 'kvgrid', @@ -1692,10 +1701,16 @@ protected function initExport() 'padding' => '2px 1px', ], ]; + + $ver = $bsVer === 5 ? '5.1.0' : ($bsVer === 4 ? '4.6.0' : '3.4.1'); + $cssFile = ["https://cdn.jsdelivr.net/npm/bootstrap@{$ver}/dist/css/bootstrap.min.css"]; + if ($notBs3) { + $cssFile[] = 'https://use.fontawesome.com/releases/v5.3.1/css/all.css'; + } $defaultExportConfig = [ self::HTML => [ 'label' => Yii::t('kvgrid', 'HTML'), - 'icon' => $isBs4 ? 'fas fa-file-alt' : ($isFa ? 'fa fa-file-text' : 'glyphicon glyphicon-save'), + 'icon' => $notBs3 ? 'fas fa-file-alt' : ($isFa ? 'fa fa-file-text' : 'glyphicon glyphicon-save'), 'iconOptions' => ['class' => 'text-info'], 'showHeader' => true, 'showPageSummary' => true, @@ -1707,19 +1722,12 @@ protected function initExport() 'mime' => 'text/plain', 'cssStyles' => $cssStyles, 'config' => [ - 'cssFile' => $this->isBs4() ? - [ - 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css', - //'https://use.fontawesome.com/releases/v5.3.1/css/all.css', - // Use CDN version to avoid impact China site. It also work for worldwide - 'https://cdn.bootcss.com/font-awesome/5.3.1/css/all.css', - ] : - ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'], + 'cssFile' => $cssFile, ], ], self::CSV => [ 'label' => Yii::t('kvgrid', 'CSV'), - 'icon' => $isBs4 ? 'fas fa-file-code' : ($isFa ? 'fa fa-file-code-o' : 'glyphicon glyphicon-floppy-open'), + 'icon' => $notBs3 ? 'fas fa-file-code' : ($isFa ? 'fa fa-file-code-o' : 'glyphicon glyphicon-floppy-open'), 'iconOptions' => ['class' => 'text-primary'], 'showHeader' => true, 'showPageSummary' => true, @@ -1736,7 +1744,7 @@ protected function initExport() ], self::TEXT => [ 'label' => Yii::t('kvgrid', 'Text'), - 'icon' => $isBs4 ? 'far fa-file-alt' : ($isFa ? 'fa fa-file-text-o' : 'glyphicon glyphicon-floppy-save'), + 'icon' => $notBs3 ? 'far fa-file-alt' : ($isFa ? 'fa fa-file-text-o' : 'glyphicon glyphicon-floppy-save'), 'iconOptions' => ['class' => 'text-muted'], 'showHeader' => true, 'showPageSummary' => true, @@ -1753,7 +1761,7 @@ protected function initExport() ], self::EXCEL => [ 'label' => Yii::t('kvgrid', 'Excel'), - 'icon' => $isBs4 ? 'far fa-file-excel' : ($isFa ? 'fa fa-file-excel-o' : 'glyphicon glyphicon-floppy-remove'), + 'icon' => $notBs3 ? 'far fa-file-excel' : ($isFa ? 'fa fa-file-excel-o' : 'glyphicon glyphicon-floppy-remove'), 'iconOptions' => ['class' => 'text-success'], 'showHeader' => true, 'showPageSummary' => true, @@ -1771,7 +1779,7 @@ protected function initExport() ], self::PDF => [ 'label' => Yii::t('kvgrid', 'PDF'), - 'icon' => $isBs4 ? 'far fa-file-pdf' : ($isFa ? 'fa fa-file-pdf-o' : 'glyphicon glyphicon-floppy-disk'), + 'icon' => $notBs3 ? 'far fa-file-pdf' : ($isFa ? 'fa fa-file-pdf-o' : 'glyphicon glyphicon-floppy-disk'), 'iconOptions' => ['class' => 'text-danger'], 'showHeader' => true, 'showPageSummary' => true, @@ -1808,7 +1816,7 @@ protected function initExport() ], self::JSON => [ 'label' => Yii::t('kvgrid', 'JSON'), - 'icon' => $isBs4 ? 'far fa-file-code' : ($isFa ? 'fa fa-file-code-o' : 'glyphicon glyphicon-floppy-open'), + 'icon' => $notBs3 ? 'far fa-file-code' : ($isFa ? 'fa fa-file-code-o' : 'glyphicon glyphicon-floppy-open'), 'iconOptions' => ['class' => 'text-warning'], 'showHeader' => true, 'showPageSummary' => true, @@ -1837,14 +1845,14 @@ protected function initExport() /** * Initialize toggle data button options. - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function initToggleData() { if (!$this->toggleData) { return; } - $isBs4 = $this->isBs4(); + $notBs3 = !$this->isBs(3); $defBtnCss = 'btn ' . $this->_defaultBtnCss; $defaultOptions = [ 'maxCount' => 10000, @@ -1855,13 +1863,13 @@ protected function initToggleData() ['totalCount' => number_format($this->dataProvider->getTotalCount())] ), 'all' => [ - 'icon' => $isBs4 ? 'fas fa-expand' : 'glyphicon glyphicon-resize-full', + 'icon' => $notBs3 ? 'fas fa-expand' : 'glyphicon glyphicon-resize-full', 'label' => Yii::t('kvgrid', 'All'), 'class' => $defBtnCss, 'title' => Yii::t('kvgrid', 'Show all data'), ], 'page' => [ - 'icon' => $isBs4 ? 'fas fa-compress' : 'glyphicon glyphicon-resize-small', + 'icon' => $notBs3 ? 'fas fa-compress' : 'glyphicon glyphicon-resize-small', 'label' => Yii::t('kvgrid', 'Page'), 'class' => $defBtnCss, 'title' => Yii::t('kvgrid', 'Show first page data'), @@ -1885,7 +1893,7 @@ protected function initToggleData() /** * Initialize bootstrap specific styling. - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function initBootstrapStyle() { @@ -1959,7 +1967,7 @@ protected function initLayout() ]); if (is_array($this->replaceTags) && !empty($this->replaceTags)) { foreach ($this->replaceTags as $key => $value) { - if ($value instanceof \Closure) { + if ($value instanceof Closure) { $value = call_user_func($value, $this); } $this->layout = str_replace($key, $value, $this->layout); @@ -2025,7 +2033,7 @@ protected function endPjax() /** * Initializes and sets the grid panel layout based on the [[template]] and [[panel]] settings. - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function initPanel() { @@ -2048,18 +2056,18 @@ protected function initPanel() $panelBefore = ''; $panelAfter = ''; $panelFooter = ''; - $isBs4 = $this->isBs4(); + $notBs3 = !$this->isBs(3); if (isset($this->panelPrefix)) { static::initCss($options, $this->panelPrefix . $type); } else { $this->addCssClass($options, self::BS_PANEL); - Html::addCssClass($options, $isBs4 ? "border-{$type}" : "panel-{$type}"); + Html::addCssClass($options, $notBs3 ? "border-{$type}" : "panel-{$type}"); } static::initCss($summaryOptions, $this->getCssClass(self::BS_PULL_RIGHT)); - $titleTag = ArrayHelper::remove($titleOptions, 'tag', ($isBs4 ? 'h5' : 'h3')); - static::initCss($titleOptions, $isBs4 ? 'm-0' : $this->getCssClass(self::BS_PANEL_TITLE)); + $titleTag = ArrayHelper::remove($titleOptions, 'tag', ($notBs3 ? 'h5' : 'h3')); + static::initCss($titleOptions, $notBs3 ? 'm-0' : $this->getCssClass(self::BS_PANEL_TITLE)); if ($heading !== false) { - $color = $isBs4 ? ($type === 'default' ? ' bg-light' : " text-white bg-{$type}") : ''; + $color = ' ' . $this->getCssClass('panel-' . $type); static::initCss($headingOptions, $this->getCssClass(self::BS_PANEL_HEADING) . $color); $panelHeading = Html::tag('div', $this->panelHeadingTemplate, $headingOptions); } @@ -2096,6 +2104,7 @@ protected function initPanel() * Generates the toolbar. * * @return string + * @throws Exception */ protected function renderToolbar() { @@ -2121,7 +2130,7 @@ protected function renderToolbar() /** * Generates the toolbar container with the toolbar - * @throws InvalidConfigException + * @throws InvalidConfigException|Exception */ protected function renderToolbarContainer() { @@ -2144,9 +2153,10 @@ protected function renderToolbarContainer() /** * Generate HTML markup for additional table rows for header and/or footer. * - * @param array|string $data the table rows configuration + * @param array|string $data the table rows configuration * * @return string + * @throws Exception */ protected function generateRows($data) { @@ -2209,7 +2219,7 @@ protected function genToggleDataScript() /** * Registers client assets for the [[GridView]] widget. - * @throws \Exception + * @throws Exception */ protected function registerAssets() { diff --git a/src/GridViewAsset.php b/src/GridViewAsset.php index c44491e9..63910715 100644 --- a/src/GridViewAsset.php +++ b/src/GridViewAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/Module.php b/src/Module.php index 75e82310..4bde4091 100644 --- a/src/Module.php +++ b/src/Module.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/RadioColumn.php b/src/RadioColumn.php index f143fcab..dc9b366d 100644 --- a/src/RadioColumn.php +++ b/src/RadioColumn.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ @@ -16,7 +16,6 @@ use yii\helpers\ArrayHelper; use yii\helpers\Html; use yii\helpers\Json; -use yii\web\View; /** * RadioColumn displays a column of radio inputs in a grid view. It is different than the CheckboxColumn in the sense @@ -52,13 +51,16 @@ class RadioColumn extends Column public $showClear = true; /** - * @var array the HTML attributes for the clear button in the header. The following special option is recognized: - * - label: string, the label for the button (defaults to `×`); + * @var array the HTML attributes for the clear button in the header. Note that the CSS class 'kv-clear-radio' + * will automatically be added to this array. The following special option is recognized: + * - label: string, the label for the button. Defaults to: + * - `` for bootstrap 3.x and + * - `` for bootstrap 4.x and bootstrap 5.x */ - public $clearOptions = ['class' => 'close']; + public $clearOptions = []; /** - * @var array|\Closure the HTML attributes for radio inputs. This can either be an array of attributes or an + * @var array|Closure the HTML attributes for radio inputs. This can either be an array of attributes or an * anonymous function ([[Closure]]) that returns such an array. The signature of the function should be the * following: `function ($model, $key, $index, $column)`. Where `$model`, `$key`, and `$index` refer to the * model, key and index of the row currently being rendered and `$column` is a reference to the [[RadioColumn]] @@ -131,13 +133,15 @@ protected function renderHeaderCellContent() if ($this->header !== null || !$this->showClear) { return parent::renderHeaderCellContent(); } else { - $label = ArrayHelper::remove($this->clearOptions, 'label', '×'); + $icon = !$this->grid->isBs(3) ? '' : + ''; + $label = ArrayHelper::remove($this->clearOptions, 'label', $icon); Html::addCssClass($this->clearOptions, 'kv-clear-radio'); if (empty($this->clearOptions['title'])) { $this->clearOptions['title'] = Yii::t('kvgrid', 'Clear selection'); } $this->_view->registerJs("kvClearRadio({$this->_clientVars});"); - return Html::button($label, $this->clearOptions); + return Html::tag('span', $label, $this->clearOptions); } } diff --git a/src/RadioColumnAsset.php b/src/RadioColumnAsset.php index cb3c7351..d850d3d4 100644 --- a/src/RadioColumnAsset.php +++ b/src/RadioColumnAsset.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/SerialColumn.php b/src/SerialColumn.php index 9ee01f24..05868484 100644 --- a/src/SerialColumn.php +++ b/src/SerialColumn.php @@ -3,7 +3,7 @@ /** * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 */ diff --git a/src/assets/css/kv-grid-expand.css b/src/assets/css/kv-grid-expand.css index 87684840..b1a2533f 100644 --- a/src/assets/css/kv-grid-expand.css +++ b/src/assets/css/kv-grid-expand.css @@ -1,7 +1,7 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Gridview ExpandRowColumn styling and enhancements diff --git a/src/assets/css/kv-grid-expand.min.css b/src/assets/css/kv-grid-expand.min.css index 3a277456..bf54260a 100644 --- a/src/assets/css/kv-grid-expand.min.css +++ b/src/assets/css/kv-grid-expand.min.css @@ -1,7 +1,7 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Gridview ExpandRowColumn styling and enhancements diff --git a/src/assets/css/kv-grid.css b/src/assets/css/kv-grid.css index a266c127..0e953b18 100644 --- a/src/assets/css/kv-grid.css +++ b/src/assets/css/kv-grid.css @@ -1,7 +1,7 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Yii2 Gridview widget styling and enhancements for Bootstrap. @@ -352,7 +352,16 @@ * RadioColumn styles */ .kv-clear-radio { - float: none; + cursor: pointer; + font-weight: 700; + font-size: 1.35em; + text-shadow: 0 1px 0 #fff; +} + +.kv-clear-radio:focus, +.kv-clear-radio:hover { + color: #245269; + text-decoration: none; } /** diff --git a/src/assets/css/kv-grid.min.css b/src/assets/css/kv-grid.min.css index cd0d1a93..4b565ea6 100644 --- a/src/assets/css/kv-grid.min.css +++ b/src/assets/css/kv-grid.min.css @@ -1,9 +1,9 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Yii2 Gridview widget styling and enhancements for Bootstrap. * - */.kv-grid-container,.kv-grid-loading{position:relative}.kv-grid-boolean{display:none}.kv-grid-bs4 .card .kv-grid-table{margin:0}.kv-grid-bs4 a.asc:after,.kv-grid-bs4 a.desc:after{font-family:"Font Awesome 5 Free";font-weight:900}.kv-grid-bs4 a.asc:after{content:"\f15e"}.kv-grid-bs4 a.desc:after{content:"\f15d"}.kv-grid-bs4 .sort-numerical a.asc:after{content:"\f163"}.kv-grid-bs4 .sort-numerical a.desc:after{content:"\f162"}.kv-panel-pager{min-height:34px}.kv-panel-pager .pagination{margin:0 0 -5px;padding:0}.kv-panel-before{padding:10px;border-bottom:1px solid #ddd}.kv-panel-after{padding:10px;border-top:1px solid #ddd}.kv-table-float{border-top:none;border-bottom:none;background-color:#fff}.kv-grid-loading .card,.kv-grid-loading .table,.kv-loader-overlay{background:0 0;opacity:.6}.kv-align-center{text-align:center}.kv-align-left{text-align:left}.kv-align-right{text-align:right}.kv-align-top{vertical-align:top!important}.kv-align-bottom{vertical-align:bottom!important}.kv-align-middle{vertical-align:middle!important}.kv-nowrap{white-space:nowrap}.kv-merged-header{border-bottom-width:2px}.kv-page-summary,.kv-table-footer{border-top:4px double #ddd;font-weight:700}.kv-table-caption{font-size:1.5em;padding:8px;border:1px solid #ddd;border-bottom:none;text-align:center}.panel .kv-table-caption{border:none;border-bottom:1px solid #ddd}.kv-grid-loading{overflow:hidden;max-height:100%}.kv-grid-loading .kv-loader-overlay{display:block}.kv-loader-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:none}.kv-loader{position:absolute;background:url(../img/loading.gif) center center no-repeat #fff!important;width:100px;height:100px;top:50%;left:50%}.kv-grid-hide{display:none!important}.kv-grid-toolbar .dropdown-menu{z-index:1025}.panel .table-responsive>.floatThead-wrapper>.table,.panel>.floatThead-wrapper>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel .table-responsive>.floatThead-wrapper>.table caption,.panel>.floatThead-wrapper>.table caption,.panel>.panel-collapse>.table caption{padding-right:15px;padding-left:15px}.panel>.floatThead-wrapper>.table:first-child,.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.floatThead-wrapper>.table:last-child,.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.floatThead-wrapper>.table+.panel-body,.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table-responsive>.floatThead-wrapper+.panel-body{border-top:1px solid #ddd}.panel>.floatThead-wrapper>.table>tbody:first-child>tr:first-child td,.panel>.floatThead-wrapper>.table>tbody:first-child>tr:first-child th{border-top:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered,.panel>.floatThead-wrapper>.table-bordered{border:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>td:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>th:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>td:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>th:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>td:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>th:first-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>td:first-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>th:first-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>td:first-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>th:first-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>td:first-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>th:first-child{border-left:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>td:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>th:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>td:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>th:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>td:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>th:last-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>td:last-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>th:last-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>td:last-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>th:last-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>td:last-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>th:last-child{border-right:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>th,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr:first-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr:first-child>th,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>td,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>th,.panel>.floatThead-wrapper>.table-bordered>thead>tr:first-child>td,.panel>.floatThead-wrapper>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>th,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>th,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>td,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>th,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>td,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>th{border-bottom:0;border-radius:3px}@media screen and (max-width:480px){.kv-table-wrap td,.kv-table-wrap th{display:block;width:100%!important;text-align:center;font-size:1.2em}.kv-table-wrap tr>td:first-child{border-top:3px double #ccc;margin-top:10px;font-size:2em}}.kv-clear-radio{float:none}td.kv-group-even{background-color:#f0f1ff!important}.table-hover td.kv-group-even:hover{background-color:#d7d9ff!important}td.kv-group-odd{background-color:#f9fcff!important}.table-hover td.kv-group-odd:hover{background-color:#d7ecff!important}.kv-grouped-row{background-color:#FFF0F5!important;font-size:1.3em;padding-top:10px!important;padding-bottom:10px!important}.table-hover .kv-grouped-row:hover{background-color:#FFE4E1!important}.kv-grid-wrapper{position:relative;overflow:auto;height:300px}@media (max-width:768px){.hide-resize .rc-handle-container{overflow:hidden}} \ No newline at end of file + */.kv-grid-container,.kv-grid-loading{position:relative}.kv-grid-boolean{display:none}.kv-grid-bs4 .card .kv-grid-table{margin:0}.kv-grid-bs4 a.asc:after,.kv-grid-bs4 a.desc:after{font-family:"Font Awesome 5 Free";font-weight:900}.kv-grid-bs4 a.asc:after{content:"\f15e"}.kv-grid-bs4 a.desc:after{content:"\f15d"}.kv-grid-bs4 .sort-numerical a.asc:after{content:"\f163"}.kv-grid-bs4 .sort-numerical a.desc:after{content:"\f162"}.kv-panel-pager{min-height:34px}.kv-panel-pager .pagination{margin:0 0 -5px;padding:0}.kv-panel-before{padding:10px;border-bottom:1px solid #ddd}.kv-panel-after{padding:10px;border-top:1px solid #ddd}.kv-table-float{border-top:none;border-bottom:none;background-color:#fff}.kv-grid-loading .card,.kv-grid-loading .table,.kv-loader-overlay{background:0 0;opacity:.6}.kv-align-center{text-align:center}.kv-align-left{text-align:left}.kv-align-right{text-align:right}.kv-align-top{vertical-align:top!important}.kv-align-bottom{vertical-align:bottom!important}.kv-align-middle{vertical-align:middle!important}.kv-nowrap{white-space:nowrap}.kv-merged-header{border-bottom-width:2px}.kv-page-summary,.kv-table-footer{border-top:4px double #ddd;font-weight:700}.kv-table-caption{font-size:1.5em;padding:8px;border:1px solid #ddd;border-bottom:none;text-align:center}.panel .kv-table-caption{border:none;border-bottom:1px solid #ddd}.kv-grid-loading{overflow:hidden;max-height:100%}.kv-grid-loading .kv-loader-overlay{display:block}.kv-loader-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:none}.kv-loader{position:absolute;background:url(../img/loading.gif) center center no-repeat #fff!important;width:100px;height:100px;top:50%;left:50%}.kv-grid-hide{display:none!important}.kv-grid-toolbar .dropdown-menu{z-index:1025}.panel .table-responsive>.floatThead-wrapper>.table,.panel>.floatThead-wrapper>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel .table-responsive>.floatThead-wrapper>.table caption,.panel>.floatThead-wrapper>.table caption,.panel>.panel-collapse>.table caption{padding-right:15px;padding-left:15px}.panel>.floatThead-wrapper>.table:first-child,.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.floatThead-wrapper>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.floatThead-wrapper>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.floatThead-wrapper>.table:last-child,.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.floatThead-wrapper>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.floatThead-wrapper>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive>.floatThead-wrapper:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.floatThead-wrapper>.table+.panel-body,.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table-responsive>.floatThead-wrapper+.panel-body{border-top:1px solid #ddd}.panel>.floatThead-wrapper>.table>tbody:first-child>tr:first-child td,.panel>.floatThead-wrapper>.table>tbody:first-child>tr:first-child th{border-top:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered,.panel>.floatThead-wrapper>.table-bordered{border:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>td:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>th:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>td:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>th:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>td:first-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>th:first-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>td:first-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>th:first-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>td:first-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>th:first-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>td:first-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>th:first-child{border-left:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>td:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr>th:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>td:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr>th:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>td:last-child,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr>th:last-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>td:last-child,.panel>.floatThead-wrapper>.table-bordered>tbody>tr>th:last-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>td:last-child,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr>th:last-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>td:last-child,.panel>.floatThead-wrapper>.table-bordered>thead>tr>th:last-child{border-right:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>th,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr:first-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>thead>tr:first-child>th,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>td,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:first-child>th,.panel>.floatThead-wrapper>.table-bordered>thead>tr:first-child>td,.panel>.floatThead-wrapper>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>th,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>td,.panel .table-responsive>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>th,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>td,.panel>.floatThead-wrapper>.table-bordered>tbody>tr:last-child>th,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>td,.panel>.floatThead-wrapper>.table-bordered>tfoot>tr:last-child>th{border-bottom:0;border-radius:3px}@media screen and (max-width:480px){.kv-table-wrap td,.kv-table-wrap th{display:block;width:100%!important;text-align:center;font-size:1.2em}.kv-table-wrap tr>td:first-child{border-top:3px double #ccc;margin-top:10px;font-size:2em}}.kv-clear-radio{cursor:pointer;font-weight:700;font-size:1.35em;text-shadow:0 1px 0 #fff}.kv-clear-radio:focus,.kv-clear-radio:hover{color:#245269;text-decoration:none}td.kv-group-even{background-color:#f0f1ff!important}.table-hover td.kv-group-even:hover{background-color:#d7d9ff!important}td.kv-group-odd{background-color:#f9fcff!important}.table-hover td.kv-group-odd:hover{background-color:#d7ecff!important}.kv-grouped-row{background-color:#FFF0F5!important;font-size:1.3em;padding-top:10px!important;padding-bottom:10px!important}.table-hover .kv-grouped-row:hover{background-color:#FFE4E1!important}.kv-grid-wrapper{position:relative;overflow:auto;height:300px}@media (max-width:768px){.hide-resize .rc-handle-container{overflow:hidden}} \ No newline at end of file diff --git a/src/assets/js/kv-grid-checkbox.js b/src/assets/js/kv-grid-checkbox.js index b64ed165..f07c99d7 100644 --- a/src/assets/js/kv-grid-checkbox.js +++ b/src/assets/js/kv-grid-checkbox.js @@ -1,13 +1,13 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Client actions for kartik\grid\CheckboxColumn * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */ diff --git a/src/assets/js/kv-grid-checkbox.min.js b/src/assets/js/kv-grid-checkbox.min.js index 03d8cf43..4a0e0abb 100644 --- a/src/assets/js/kv-grid-checkbox.min.js +++ b/src/assets/js/kv-grid-checkbox.min.js @@ -1,13 +1,13 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Client actions for yii2-grid CheckboxColumn * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */var kvSelectRow,kvSelectColumn;!function(e){"use strict";kvSelectRow=function(n,i){var c="krajeeGrid",t="change."+c,l=e("#"+n),o=l.find(".kv-row-select input"),a=function(e,n){var c=e.closest("tr"),t=n||e;t.is(":checked")&&!e.attr("disabled")?c.removeClass(i).addClass(i):c.removeClass(i)},d=function(){o.each(function(){a(e(this))})};o.off(t).on(t,function(){a(e(this))}),l.find(".kv-all-select input").off(t).on(t,function(e){void 0===e.namespace&&e.handleObj.namespace===c&&setTimeout(function(){d()},100)}),d()},kvSelectColumn=function(n,i){var c,t,l,o="#"+n,a=e(o);i.multiple&&i.checkAll&&(c=o+" input[name='"+i.checkAll+"']",t=i["class"]?"input."+i["class"]:"input[name='"+i.name+"']",l=o+" "+t+":enabled",e(document).off("click.yiiGridView",c).on("click.yiiGridView",c,function(){a.find(t+":enabled").prop("checked",this.checked)}),e(document).off("click.yiiGridView",l).on("click.yiiGridView",l,function(){var e=a.find(t).length===a.find(t+":checked").length;a.find("input[name='"+i.checkAll+"']").prop("checked",e)}))}}(window.jQuery); \ No newline at end of file diff --git a/src/assets/js/kv-grid-editable.js b/src/assets/js/kv-grid-editable.js index 78633236..db638c0c 100644 --- a/src/assets/js/kv-grid-editable.js +++ b/src/assets/js/kv-grid-editable.js @@ -1,13 +1,13 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Client actions for yii2-grid EditableColumn * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */ diff --git a/src/assets/js/kv-grid-editable.min.js b/src/assets/js/kv-grid-editable.min.js index 042c07ba..fcac3d03 100644 --- a/src/assets/js/kv-grid-editable.min.js +++ b/src/assets/js/kv-grid-editable.min.js @@ -1,13 +1,13 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Client actions for yii2-grid EditableColumn * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */var kvRefreshEC;!function(i){"use strict";kvRefreshEC=function(e,n){var t=i("#"+e);t.find("."+n).each(function(){i(this).on("editableSuccess",function(){t.yiiGridView("applyFilter")})})}}(window.jQuery); \ No newline at end of file diff --git a/src/assets/js/kv-grid-expand.js b/src/assets/js/kv-grid-expand.js index fd644603..cdd5f872 100644 --- a/src/assets/js/kv-grid-expand.js +++ b/src/assets/js/kv-grid-expand.js @@ -1,13 +1,13 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * jQuery methods library for yii2-grid expand row column * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */ diff --git a/src/assets/js/kv-grid-expand.min.js b/src/assets/js/kv-grid-expand.min.js index 227c970c..16275988 100644 --- a/src/assets/js/kv-grid-expand.min.js +++ b/src/assets/js/kv-grid-expand.min.js @@ -1,13 +1,13 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * jQuery methods library for yii2-grid expand row column * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */ diff --git a/src/assets/js/kv-grid-export.js b/src/assets/js/kv-grid-export.js index ddcd9601..e51822a7 100644 --- a/src/assets/js/kv-grid-export.js +++ b/src/assets/js/kv-grid-export.js @@ -1,14 +1,14 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Grid Export Validation Module for Yii's Gridview. Supports export of * grid data as CSV, HTML, or Excel. * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */ diff --git a/src/assets/js/kv-grid-export.min.js b/src/assets/js/kv-grid-export.min.js index 443da5aa..706e9c09 100644 --- a/src/assets/js/kv-grid-export.min.js +++ b/src/assets/js/kv-grid-export.min.js @@ -1,14 +1,14 @@ /*! * @package yii2-grid * @author Kartik Visweswaran - * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2020 + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2021 * @version 3.3.6 * * Grid Export Validation Module for Yii's Gridview. Supports export of * grid data as CSV, HTML, or Excel. * * Author: Kartik Visweswaran - * Copyright: 2014 - 2020, Kartik Visweswaran, Krajee.com + * Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com */!function(e){"use strict";var t,o,n="urn:schemas-microsoft-com:office:",r="http://www.w3.org/TR/REC-html40";t={replaceAll:function(e,t,o){return e.split(t).join(o)},isEmpty:function(t,o){return null===t||void 0===t||0===t.length||o&&""===e.trim(t)},popupDialog:function(e,t,o,n){var r=screen.width/2-o/2,i=60,a=window.open("",t,"",!0);return a.close(),window.open(e,t,"toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+o+", height="+n+", top="+i+", left="+r)},slug:function(e){return e.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-")},templates:{html:'{css}{data}',pdf:"{before}\n{data}\n{after}",excel:'{css}{data}',popup:'Grid Export - © Krajee{msg}'}},o=function(t,o){var n=this,r=o.gridOpts,i=o.genOpts;n.$element=e(t),n.gridId=r.gridId,n.$grid=e("#"+n.gridId),n.dialogLib=o.dialogLib,n.messages=r.messages,n.target=r.target,n.exportConversions=r.exportConversions,n.skipExportElements=r.skipExportElements,n.showConfirmAlert=r.showConfirmAlert,n.action=r.action,n.bom=r.bom,n.encoding=r.encoding,n.module=r.module,n.filename=i.filename,n.expHash=i.expHash,n.showHeader=i.showHeader,n.showFooter=i.showFooter,n.showPageSummary=i.showPageSummary,n.$table=n.$grid.find(".kv-grid-table:first"),n.columns=n.showHeader?"td,th":"td",n.alertMsg=o.alertMsg,n.config=o.config,n.popup="",n.listen()},o.prototype={constructor:o,getArray:function(o){var n=this,r=n.clean(o),i=[],a={};return void 0!==n.config.colHeads&&n.config.colHeads.length>0?i=n.config.colHeads:r.find("thead tr th").each(function(o){var r=e(this).text().trim(),a=t.slug(r);i[o]=!n.config.slugColHeads||t.isEmpty(a)?"col_"+o:a}),r.find('tbody tr:has("td")').each(function(t){a[t]={},e(this).children("td").each(function(o){var n=i[o];a[t][n]=e(this).text().trim()})}),a},setPopupAlert:function(e){var o=this;if(void 0!==o.popup.document)if(arguments.length&&arguments[1]){var n=o.popup.document.getElementsByTagName("body");setTimeout(function(){n[0].innerHTML=e},1200)}else{var r=t.templates.popup.replace("{msg}",e);o.popup.document.write(r)}},processExport:function(e,o){var n=this;setTimeout(function(){t.isEmpty(o)?n[e]():n[e](o)},100)},listenClick:function(e){var o=this,n=arguments.length>1?arguments[1]:"",r=window[o.dialogLib];o.$element.off("click.gridexport").on("click.gridexport",function(i){if(i.stopPropagation(),i.preventDefault(),!o.showConfirmAlert)return void o.processExport(e,n);var a=o.messages,s=t.isEmpty(o.alertMsg)?"":o.alertMsg,l=t.isEmpty(a.allowPopups)?"":a.allowPopups,c=t.isEmpty(a.confirmDownload)?"":a.confirmDownload,p="";return p=s.length&&l.length?s+"\n\n"+l:!s.length&&l.length?l:s.length&&!l.length?s:"",c.length&&(p=p+"\n\n"+c),t.isEmpty(p)?void 0:(r.confirm(p,function(t){t&&o.processExport(e,n),i.preventDefault()}),!1)})},listen:function(){var e=this;e.$element.hasClass("export-csv")&&e.listenClick("exportTEXT","csv"),e.$element.hasClass("export-txt")&&e.listenClick("exportTEXT","txt"),e.$element.hasClass("export-html")&&e.listenClick("exportHTML"),e.$element.hasClass("export-xls")&&e.listenClick("exportEXCEL"),e.$element.hasClass("export-json")&&e.listenClick("exportJSON"),e.$element.hasClass("export-pdf")&&e.listenClick("exportPDF")},clean:function(t){var o,n=this,r=n.$table.clone(),i=n.$element.data("cssStyles")||{},a=n.$table.closest(".kv-grid-container"),s=n.skipExportElements,l=function(e){r.find(e+"."+n.gridId).remove()};s.length&&e.each(s,function(e,t){r.find(t).remove()}),"html"===t&&r.find(".kv-grid-boolean").remove(),o=a.hasClass("kv-grid-wrapper")?a.closest(".floatThead-wrapper").find(".kv-thead-float thead"):a.find(".kv-thead-float thead"),o.length&&(o=o.clone(),r.find("thead").before(o).remove()),r.find("tr.filters").remove(),r.find("th").removeAttr("rowspan"),r.find("th").find("a").each(function(){e(this).contents().unwrap()}),r.find("form,input,textarea,select,script").remove(),r.find("[onclick]").removeAttr("onclick"),r.find('a[href*="javascript"]').attr("href","#"),n.showHeader||r.children("thead").remove(),n.showPageSummary||l(".kv-page-summary-container"),n.showFooter||l(".kv-footer-container"),n.showCaption||l(".kv-caption-container"),r.find(".skip-export").remove(),r.find(".skip-export-"+t).remove(),r.find(".strip-tags-export").each(function(){var t=e(this),o=t.text();t.html(o)});var c=r.html();return c=n.preProcess(c,t),r.html(c),e.each(i,function(t,o){r.find(t).each(function(){var t=e(this),n=t.attr("style")||"";e.each(o,function(e,t){n+=e+":"+t+";"}),n&&t.attr("style",n)})}),r},preProcess:function(e,o){var n,r,i,a=this,s=a.exportConversions,l=s.length,c=e,p="from_"+o,d="to_"+o;if(l>0)for(var f=0;l>f;f++)n=s[f],r=void 0!==n[p]?n[p]:void 0!==n.from?n.from:"",i=void 0!==n[d]?n[d]:void 0!==n.to?n.to:"",r.length&&i.length&&(c=t.replaceAll(c,r,i));return c},download:function(o,n){var r,i,a=this,s=a.$element,l=s.attr("data-mime")||"text/plain",c=window.yii,p=s.attr("data-hash")||"",d=s.attr("data-hash-export-config"),f=t.isEmpty(a.config)?{}:a.config,h=a.target,m=function(t,o){return e("