diff --git a/CHANGE.md b/CHANGE.md index 3c011291..6252d052 100755 --- a/CHANGE.md +++ b/CHANGE.md @@ -3,11 +3,15 @@ Change Log: `yii2-grid` ## Version 3.3.3 -**Date:** _under development_ +**Date:** 23-Aug-2019 +- (enh #922): Correct documentation for `floatHeaderOptions['top']`. +- (enh #918): Allow specific elements to be skipped from export via `export['skipExportElements']`. - Update GridView Asset Bundle Dependencies. +- (enh #919, #909): Enhance expand row cell click. - (enh #917): Correct checkbox column highlight behavior to accomodate changes in yiisoft/yii2#17332. -- (enh #916): Set ActionColumn button label aria-hidden as true for screen reader. +- (enh #916): Set ActionColumn button label `aria-hidden` as true for screen reader. +- (enh #773): Enhance grid grouping for more correct summary calculations for nested `GridView`. ## Version 3.3.2 diff --git a/README.md b/README.md index c733d4ce..242aeb12 100755 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ echo GridView::widget([ 'responsive' => true, 'hover' => true, 'floatHeader' => true, - 'floatHeaderOptions' => ['scrollingTop' => $scrollingTop], + 'floatHeaderOptions' => ['top' => $scrollingTop], 'showPageSummary' => true, 'panel' => [ 'type' => GridView::TYPE_PRIMARY diff --git a/src/ColumnTrait.php b/src/ColumnTrait.php index e95ec0c4..5dbaf831 100644 --- a/src/ColumnTrait.php +++ b/src/ColumnTrait.php @@ -539,6 +539,7 @@ protected function fetchContentOptions($model, $key, $index) Html::addCssStyle($options, "width:{$this->width};"); } $options['data-col-seq'] = array_search($this, $this->grid->columns); + Html::addCssClass($options, $this->grid->options['id']); return $options; } @@ -609,9 +610,9 @@ protected function initGrouping() if (empty($this->group)) { return; } + Html::addCssClass($this->headerOptions, ['kv-grid-group-header', $this->grid->options['id']]); + Html::addCssClass($this->filterOptions, ['kv-grid-group-filter', $this->grid->options['id']]); $view = $this->grid->getView(); - Html::addCssClass($this->headerOptions, 'kv-grid-group-header'); - Html::addCssClass($this->filterOptions, 'kv-grid-group-filter'); $this->headerOptions['data-group-key'] = $this->filterOptions['data-group-key'] = $this->columnKey; GridGroupAsset::register($view); $id = $this->grid->options['id']; @@ -632,7 +633,7 @@ protected function parseGrouping(&$options, $model, $key, $index) if (empty($this->group)) { return; } - Html::addCssClass($options, 'kv-grid-group'); + Html::addCssClass($options, ['kv-grid-group', $this->grid->options['id']]); $options['data-group-key'] = $this->columnKey; if (!empty($this->groupOddCssClass)) { $options['data-odd-css'] = $this->parseVal($this->groupOddCssClass, $model, $key, $index); diff --git a/src/GridView.php b/src/GridView.php index f8e90092..c9dfe745 100644 --- a/src/GridView.php +++ b/src/GridView.php @@ -9,6 +9,7 @@ namespace kartik\grid; +use Closure; use kartik\base\BootstrapInterface; use kartik\base\BootstrapTrait; use kartik\base\Config; @@ -923,6 +924,8 @@ class GridView extends YiiGridView implements BootstrapInterface * - `menuOptions`: _array_, HTML attributes for the export dropdown menu. Defaults to `['class' => 'dropdown-menu * dropdown-menu-right']`. This property is to be setup exactly as the `options` property required by the * [[\yii\bootstrap\Dropdown]] widget. + * - `skipExportElements`: _array_, the list of jQuery element selectors that will be skipped and removed from + * export. Defaults to `['.sr-only', '.hide']`. */ public $export = []; @@ -1219,6 +1222,7 @@ public function renderPageSummary() if (!isset($this->pageSummaryRowOptions['class'])) { $this->pageSummaryRowOptions['class'] = ($this->isBs4() ? 'table-' : '') . 'warning kv-page-summary'; } + Html::addCssClass($this->pageSummaryRowOptions, $this->options['id']); $row = $this->getPageSummaryRow(); if ($row === null) { return ''; @@ -1284,6 +1288,31 @@ public function renderTableBody() return $content; } + /** + * Renders a table row with the given data model and key. + * @param mixed $model the data model to be rendered + * @param mixed $key the key associated with the data model + * @param int $index the zero-based index of the data model among the model array returned by [[dataProvider]]. + * @return string the rendering result + */ + public function renderTableRow($model, $key, $index) + { + $cells = []; + /* @var $column Column */ + foreach ($this->columns as $column) { + $cells[] = $column->renderDataCell($model, $key, $index); + } + if ($this->rowOptions instanceof Closure) { + $options = call_user_func($this->rowOptions, $model, $key, $index, $this); + } else { + $options = $this->rowOptions; + } + $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key; + Html::addCssClass($options, $this->options['id']); + $this->rowOptions = $options; + return Html::tag('tr', implode('', $cells), $options); + } + /** * Renders the toggle data button. * @@ -1575,6 +1604,7 @@ protected function initExport() ], 'options' => ['class' => 'btn ' . $this->_defaultBtnCss, 'title' => Yii::t('kvgrid', 'Export')], 'menuOptions' => ['class' => 'dropdown-menu dropdown-menu-right '], + 'skipExportElements' => ['.sr-only', '.hide'], ], $this->export ); @@ -2196,6 +2226,7 @@ protected function registerAssets() 'target' => ArrayHelper::getValue($this->export, 'target', self::TARGET_BLANK), 'messages' => $this->export['messages'], 'exportConversions' => $this->exportConversions, + 'skipExportElements' => $this->export['skipExportElements'], 'showConfirmAlert' => ArrayHelper::getValue($this->export, 'showConfirmAlert', true), ] ); diff --git a/src/assets/js/kv-grid-expand.js b/src/assets/js/kv-grid-expand.js index 5aef5467..a2640ebd 100644 --- a/src/assets/js/kv-grid-expand.js +++ b/src/assets/js/kv-grid-expand.js @@ -303,8 +303,9 @@ var kvExpandRow; expandRow(false); } } - handler($cell, 'click', function () { + handler($cell, 'click', function (event) { toggleRow($cell); + event.stopPropagation(); }); handler($row, 'click', function (event) { var target = event.target, clickDisabled = $(target).length && diff --git a/src/assets/js/kv-grid-expand.min.js b/src/assets/js/kv-grid-expand.min.js index 34d3785b..b7911c9a 100644 --- a/src/assets/js/kv-grid-expand.min.js +++ b/src/assets/js/kv-grid-expand.min.js @@ -10,5 +10,4 @@ * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com - */ -var kvExpandRow;!function(e){"use strict";kvExpandRow=function(t,a){var n=".kvExpandRowColumn",l="kvRowNum_"+a,o=t.gridId,d=t.hiddenFromExport,i=t.detailUrl,r=t.onDetailLoaded,s=t.expandIcon,c=t.collapseIcon,v=t.expandTitle,p=t.collapseTitle,f=t.expandAllTitle,u=t.collapseAllTitle,x=t.expandOneOnly,h=t.enableRowClick,k=t.rowClickExcludedTags,g=t.enableCache,w=t.extraData,C=d?t.rowCssClass+" skip-export":t.rowCssClass,m=t.animationDuration,A=e("#"+o),y="."+a,b=A.find(".kv-expand-header-cell.kv-batch-toggle"+y),R=b.find(".kv-expand-header-icon"),E=void 0===t.collapseAll?!1:t.collapseAll,T=void 0===t.expandAll?!1:t.expandAll,I=A.find("td.kv-expand-icon-cell"+y+" .kv-expand-row:not(.kv-state-disabled)"),N=I.length,D="kv-expand-detail-loading",j=function(){var t=A.find("td.kv-expand-icon-cell"+y+":first"),a=t&&t.length?t.closest("tr"):"",n=0;return a&&a.length?(a.find("> td").each(function(){"none"!==e(this).css("display")&&n++}),n):0},O=j(),L=function(e){return e.hasClass("kv-state-collapsed")&&!e.hasClass("kv-state-disabled")},P=function(e){return e.hasClass("kv-state-expanded")&&!e.hasClass("kv-state-disabled")},S=function(e,t){e.length&&e.removeClass(t).addClass(t)},U=function(e){e.removeClass("kv-state-collapsed").addClass("kv-state-expanded")},F=function(e){e.removeClass("kv-state-expanded").addClass("kv-state-collapsed")},K=function(e){S(e,D)},Q=function(e){if(e.length){var t=isNaN(m)?1e3:m+200;setTimeout(function(){e.removeClass(D)},t)}},_=function(){var e=A.data(l);return e=e?parseInt(e):0,isNaN(e)?0:e},q=function(e){A.data(l,e)},z=function(){var e=_();A.data(l,e+1)},B=function(e,t,a,l){var o=l?t:t.split(" ").join(n+" ")+n;e.length&&e.off(o).on(o,a)};return A.data(l)||q(0),0===w.length&&(w={}),0===I.length?void S(b,"kv-state-disabled"):(I.each(function(){var a,n,l=e(this),o=l.find(">.kv-expand-icon"),d=o.closest(".kv-expand-icon-cell"),f=l.closest("tr"),u=d.find(".kv-expand-detail"),j=l.find(".kv-expanded-row"+y+":first"),S=j.data("key"),q=j.data("index");if(!L(o)&&!P(o))return!0;0===j.length&&(S=f.data("key"),a=f.next('tr.kv-expand-detail-row[data-key="'+S+'"]'),j=a.find(".kv-expanded-row"));var G=function(t){var a=e.extend({expandRowKey:S,expandRowInd:q},w),n=g?0===j.html().length:!0;return i.length>0&&n?void e.ajax({type:"POST",data:a,url:i,beforeSend:function(){K(d),A.trigger("kvexprow:beforeLoad",[q,S,w])},success:function(e){j.html(e),Q(d),"function"==typeof r&&r(),t(),A.trigger("kvexprow:loaded",[q,S,w])},error:function(){j.html('
Error fetching data. Please try again later.
'),A.trigger("kvexprow:error",[q,S,w]),Q(d)}}):(Q(d),void t())},H=function(t){A.find('tr[data-index="'+q+'"]').remove(),j.hide(),f.after(j);var a='';j.wrap('').parent().wrap(a),o.html(c),d.attr("title",p),t?j.slideDown(m,function(){F(o),j.show()}):(j.show(),F(o));var n=f.prevAll(),l=f.index()+1;n.push(f),e.each(n,function(t,a){var n=e(a).find("td[rowspan]");e.each(n,function(t,n){var o=parseInt(e(n).attr("rowspan"));e(a).index()+o>l&&e(n).attr("rowspan",o+1)})}),0===i.length&&Q(d)},J=function(){K(d),u.html(""),o.html(s),d.attr("title",v),n=j.closest(".kv-expand-detail-row"),j.slideUp(m,function(){j.unwrap().unwrap(),j.appendTo(u),U(o);var t=f.prevAll();t.push(f);var a=f.index()+1;e.each(t,function(t,n){var l=e(n).find("td[rowspan]");e.each(l,function(t,l){var o=parseInt(e(l).attr("rowspan"));e(n).index()+o>a&&e(l).attr("rowspan",o-1)})})}),Q(d)},M=function(){var a,n,l=!1,i=!1;if(!d.hasClass(D)){if(P(o)){if(n=x&&!E){if(a=e.extend({},t,{collapseAll:!0}),I.each(function(){return e(this).closest(".kv-expand-icon-cell").hasClass(D)?void(i=!0):void 0}),i)return;kvExpandRow(a),l=!0}return G(function(){H(!0)}),void(n&&!l||(A.trigger("kvexprow:toggle",[q,S,w,!0]),o.focus()))}L(o)&&(J(),A.trigger("kvexprow:toggle",[q,S,w,!1]),o.focus())}};return T?(P(o)&&G(function(){H(!0),z(),_()>=N&&(Q(b),R.focus())}),_()>=N&&(Q(b),R.focus()),!0):E?(L(o)&&(J(),z(),_()>=N&&(Q(b),R.focus())),_()>=N&&(Q(b),R.focus()),!0):(L(o)&&(i?G(function(){H(!1)}):H(!1)),B(d,"click",function(){M(d)}),void B(f,"click",function(t){var a=t.target,n=e(a).length&&e(a).hasClass("kv-disable-click")||-1!==e.inArray(a.nodeName,k);h&&!n&&M(d)}))}),void(b.length&&B(b,"click",function(){if(!b.hasClass(D)&&0!==I.length){var n=P(R),l=L(R),o=e.extend({},t,{expandAll:l,collapseAll:n});K(b),l?(q(I.find(".kv-state-collapsed").length),U(R),R.html(c),b.attr("title",u),A.trigger("kvexprow:toggleAll",[w,!1])):n&&(q(I.find(".kv-state-expanded").length),F(R),R.html(s),b.attr("title",f),A.trigger("kvexprow:toggleAll",[w,!0])),kvExpandRow(o,a)}})))}}(window.jQuery); \ No newline at end of file + */var kvExpandRow;!function(e){"use strict";kvExpandRow=function(t,a){var n=".kvExpandRowColumn",l="kvRowNum_"+a,o=t.gridId,i=t.hiddenFromExport,d=t.detailUrl,r=t.onDetailLoaded,s=t.expandIcon,c=t.collapseIcon,p=t.expandTitle,v=t.collapseTitle,f=t.expandAllTitle,u=t.collapseAllTitle,x=t.expandOneOnly,h=t.enableRowClick,k=t.rowClickExcludedTags,g=t.enableCache,w=t.extraData,C=i?t.rowCssClass+" skip-export":t.rowCssClass,m=t.animationDuration,A=e("#"+o),y="."+a,b=A.find(".kv-expand-header-cell.kv-batch-toggle"+y),R=b.find(".kv-expand-header-icon"),E=void 0===t.collapseAll?!1:t.collapseAll,T=void 0===t.expandAll?!1:t.expandAll,I=A.find("td.kv-expand-icon-cell"+y+" .kv-expand-row:not(.kv-state-disabled)"),N=I.length,D="kv-expand-detail-loading",j=function(){var t=A.find("td.kv-expand-icon-cell"+y+":first"),a=t&&t.length?t.closest("tr"):"",n=0;return a&&a.length?(a.find("> td").each(function(){"none"!==e(this).css("display")&&n++}),n):0},O=j(),P=function(e){return e.hasClass("kv-state-collapsed")&&!e.hasClass("kv-state-disabled")},L=function(e){return e.hasClass("kv-state-expanded")&&!e.hasClass("kv-state-disabled")},S=function(e,t){e.length&&e.removeClass(t).addClass(t)},U=function(e){e.removeClass("kv-state-collapsed").addClass("kv-state-expanded")},F=function(e){e.removeClass("kv-state-expanded").addClass("kv-state-collapsed")},K=function(e){S(e,D)},Q=function(e){if(e.length){var t=isNaN(m)?1e3:m+200;setTimeout(function(){e.removeClass(D)},t)}},_=function(){var e=A.data(l);return e=e?parseInt(e):0,isNaN(e)?0:e},q=function(e){A.data(l,e)},z=function(){var e=_();A.data(l,e+1)},B=function(e,t,a,l){var o=l?t:t.split(" ").join(n+" ")+n;e.length&&e.off(o).on(o,a)};return A.data(l)||q(0),0===w.length&&(w={}),0===I.length?void S(b,"kv-state-disabled"):(I.each(function(){var a,n,l=e(this),o=l.find(">.kv-expand-icon"),i=o.closest(".kv-expand-icon-cell"),f=l.closest("tr"),u=i.find(".kv-expand-detail"),j=l.find(".kv-expanded-row"+y+":first"),S=j.data("key"),q=j.data("index");if(!P(o)&&!L(o))return!0;0===j.length&&(S=f.data("key"),a=f.next('tr.kv-expand-detail-row[data-key="'+S+'"]'),j=a.find(".kv-expanded-row"));var G=function(t){var a=e.extend({expandRowKey:S,expandRowInd:q},w),n=g?0===j.html().length:!0;return d.length>0&&n?void e.ajax({type:"POST",data:a,url:d,beforeSend:function(){K(i),A.trigger("kvexprow:beforeLoad",[q,S,w])},success:function(e){j.html(e),Q(i),"function"==typeof r&&r(),t(),A.trigger("kvexprow:loaded",[q,S,w])},error:function(){j.html('
Error fetching data. Please try again later.
'),A.trigger("kvexprow:error",[q,S,w]),Q(i)}}):(Q(i),void t())},H=function(t){A.find('tr[data-index="'+q+'"]').remove(),j.hide(),f.after(j);var a='';j.wrap('').parent().wrap(a),o.html(c),i.attr("title",v),t?j.slideDown(m,function(){F(o),j.show()}):(j.show(),F(o));var n=f.prevAll(),l=f.index()+1;n.push(f),e.each(n,function(t,a){var n=e(a).find("td[rowspan]");e.each(n,function(t,n){var o=parseInt(e(n).attr("rowspan"));e(a).index()+o>l&&e(n).attr("rowspan",o+1)})}),0===d.length&&Q(i)},J=function(){K(i),u.html(""),o.html(s),i.attr("title",p),n=j.closest(".kv-expand-detail-row"),j.slideUp(m,function(){j.unwrap().unwrap(),j.appendTo(u),U(o);var t=f.prevAll();t.push(f);var a=f.index()+1;e.each(t,function(t,n){var l=e(n).find("td[rowspan]");e.each(l,function(t,l){var o=parseInt(e(l).attr("rowspan"));e(n).index()+o>a&&e(l).attr("rowspan",o-1)})})}),Q(i)},M=function(){var a,n,l=!1,d=!1;if(!i.hasClass(D)){if(L(o)){if(n=x&&!E){if(a=e.extend({},t,{collapseAll:!0}),I.each(function(){return e(this).closest(".kv-expand-icon-cell").hasClass(D)?void(d=!0):void 0}),d)return;kvExpandRow(a),l=!0}return G(function(){H(!0)}),void(n&&!l||(A.trigger("kvexprow:toggle",[q,S,w,!0]),o.focus()))}P(o)&&(J(),A.trigger("kvexprow:toggle",[q,S,w,!1]),o.focus())}};return T?(L(o)&&G(function(){H(!0),z(),_()>=N&&(Q(b),R.focus())}),_()>=N&&(Q(b),R.focus()),!0):E?(P(o)&&(J(),z(),_()>=N&&(Q(b),R.focus())),_()>=N&&(Q(b),R.focus()),!0):(P(o)&&(d?G(function(){H(!1)}):H(!1)),B(i,"click",function(e){M(i),e.stopPropagation()}),void B(f,"click",function(t){var a=t.target,n=e(a).length&&e(a).hasClass("kv-disable-click")||-1!==e.inArray(a.nodeName,k);h&&!n&&M(i)}))}),void(b.length&&B(b,"click",function(){if(!b.hasClass(D)&&0!==I.length){var n=L(R),l=P(R),o=e.extend({},t,{expandAll:l,collapseAll:n});K(b),l?(q(I.find(".kv-state-collapsed").length),U(R),R.html(c),b.attr("title",u),A.trigger("kvexprow:toggleAll",[w,!1])):n&&(q(I.find(".kv-state-expanded").length),F(R),R.html(s),b.attr("title",f),A.trigger("kvexprow:toggleAll",[w,!0])),kvExpandRow(o,a)}})))}}(window.jQuery); \ No newline at end of file diff --git a/src/assets/js/kv-grid-export.js b/src/assets/js/kv-grid-export.js index c02bd7ef..33dcf098 100644 --- a/src/assets/js/kv-grid-export.js +++ b/src/assets/js/kv-grid-export.js @@ -86,6 +86,7 @@ self.messages = gridOpts.messages; self.target = gridOpts.target; self.exportConversions = gridOpts.exportConversions; + self.skipExportElements = gridOpts.skipExportElements; self.showConfirmAlert = gridOpts.showConfirmAlert; self.action = gridOpts.action; self.bom = gridOpts.bom; @@ -210,10 +211,15 @@ }, clean: function (expType) { var self = this, $table = self.$table.clone(), $tHead, cssStyles = self.$element.data('cssStyles') || {}, - $container = self.$table.closest('.kv-grid-container'), + $container = self.$table.closest('.kv-grid-container'), skipElements = self.skipExportElements, safeRemove = function (selector) { $table.find(selector + '.' + self.gridId).remove(); }; + if (skipElements.length) { + $.each(skipElements, function(key, selector) { + $table.find(selector).remove(); + }); + } if (expType === 'html') { $table.find('.kv-grid-boolean').remove(); } diff --git a/src/assets/js/kv-grid-export.min.js b/src/assets/js/kv-grid-export.min.js index fd89c115..3ac41030 100644 --- a/src/assets/js/kv-grid-export.min.js +++ b/src/assets/js/kv-grid-export.min.js @@ -11,4 +11,4 @@ * Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com * For more JQuery plugins visit http://plugins.krajee.com * For more Yii related demos visit http://demos.krajee.com - */!function(f){"use strict";var m,r,e="urn:schemas-microsoft-com:office:";m={replaceAll:function(e,t,o){return e.split(t).join(o)},isEmpty:function(e,t){return null==e||0===e.length||t&&""===f.trim(e)},popupDialog:function(e,t,o,n){var i=screen.width/2-o/2;return window.open("",t,"",!0).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=60, left="+i)},slug:function(e){return e.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-")},templates:{html:'{css}{data}',pdf:"{before}\n{data}\n{after}",excel:'{css}\x3c!--[if gte mso 9]>{worksheet}{data}',popup:'Grid Export - © Krajee{msg}'}},(r=function(e,t){var o=this,n=t.gridOpts,i=t.genOpts;o.$element=f(e),o.gridId=n.gridId,o.$grid=f("#"+o.gridId),o.dialogLib=t.dialogLib,o.messages=n.messages,o.target=n.target,o.exportConversions=n.exportConversions,o.showConfirmAlert=n.showConfirmAlert,o.action=n.action,o.bom=n.bom,o.encoding=n.encoding,o.module=n.module,o.filename=i.filename,o.expHash=i.expHash,o.showHeader=i.showHeader,o.showFooter=i.showFooter,o.showPageSummary=i.showPageSummary,o.$table=o.$grid.find(".kv-grid-table:first"),o.columns=o.showHeader?"td,th":"td",o.alertMsg=t.alertMsg,o.config=t.config,o.popup="",o.listen()}).prototype={constructor:r,getArray:function(e){var n=this,t=n.clean(e),i=[],r={};return void 0!==n.config.colHeads&&0",{name:e}).val(t).hide()};"json"===e&&p.jsonReplacer&&delete p.jsonReplacer,o=s?h(s.getCsrfParam()||"_csrf",s.getCsrfToken()||null):null,(n="_popup"===d)&&(d="kvDownloadDialog",i.popup=m.popupDialog("",d,350,120),i.popup.focus(),i.setPopupAlert(i.messages.downloadProgress)),f("
",{action:i.action,target:d,method:"post",css:{display:"none"}}).append(h("export_filetype",e),h("export_filename",i.filename)).append(h("export_encoding",i.encoding),h("export_bom",i.bom?1:0)).append(h("export_content",t),h("module_id",i.module),o).append(h("export_mime",a),h("export_hash",l),h("hash_export_config",c)).append(h("export_config",JSON.stringify(p))).appendTo("body").submit().remove(),n&&i.setPopupAlert(i.messages.downloadComplete,!0)},exportHTML:function(){var e,t=this.clean("html"),o=this.config,n=o.cssFile?o.cssFile:[],i="";e=m.templates.html.replace("{encoding}",this.encoding),f.each(n,function(e,t){i+='\n'}),e=e.replace("{css}",i).replace("{data}",f("
").html(t).html()),this.download("html",e)},exportPDF:function(){var e=this,t=e.clean("pdf"),o=m.isEmpty(e.config.contentBefore)?"":e.config.contentBefore,n=m.isEmpty(e.config.contentAfter)?"":e.config.contentAfter,i=e.config.css,r=m.templates.pdf.replace("{css}",i).replace("{before}",o).replace("{after}",n).replace("{data}",f("
").html(t).html());e.download("pdf",r)},exportTEXT:function(e){var o=this,t=o.clean(e).find("tr:has("+o.columns+")"),n=String.fromCharCode(11),i=String.fromCharCode(0),r='"'+o.config.colDelimiter+'"',a='"'+o.config.rowDelimiter+'"',s='"'+t.map(function(e,t){return f(t).find(o.columns).map(function(e,t){return f(t).text().trim().replace(/"/g,'""')}).get().join(n)}).get().join(i).split(i).join(a).split(n).join(r)+'"';o.download(e,s)},exportJSON:function(){var e=this.getArray("json");e=JSON.stringify(e,this.config.jsonReplacer,this.config.indentSpace),this.download("json",e)},exportEXCEL:function(){var e,t,o=this,n=o.clean("xls"),i=o.config.cssFile&&o.config.cssFile.length?'':"";n.find("td[data-raw-value]").each(function(){((t=f(this)).css("mso-number-format")||0===t.css("mso-number-format")||"0"===t.css("mso-number-format"))&&t.html(t.attr("data-raw-value")).removeAttr("data-raw-value")}),e=m.templates.excel.replace("{encoding}",o.encoding).replace("{css}",i).replace("{worksheet}",o.config.worksheet).replace("{data}",f("
").html(n).html()).replace(/"/g,"'"),o.download("xls",e)}},f.fn.gridexport=function(n){var i=Array.apply(null,arguments);return i.shift(),this.each(function(){var e=f(this),t=e.data("gridexport"),o="object"==typeof n&&n;t||e.data("gridexport",t=new r(this,f.extend({},f.fn.gridexport.defaults,o,f(this).data()))),"string"==typeof n&&t[n].apply(t,i)})},f.fn.gridexport.defaults={dialogLib:"krajeeDialog"},f.fn.gridexport.Constructor=r}(window.jQuery); \ No newline at end of file + */!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.$h.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 h=0;l>h;h++)n=s[h],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"),h=t.isEmpty(a.config)?{}:a.config,f=a.target,m=function(t,o){return e("