/*!
SearchPanes 1.2.1
2019-2020 SpryMedia Ltd - datatables.net/license
*/
(function(){var g,s,t,n=function(a,b,d,c,f,h){var e=this;void 0===h&&(h=null);if(!s||!s.versionCheck||!s.versionCheck("1.10.0"))throw Error("SearchPane requires DataTables 1.10 or newer");if(!s.select)throw Error("SearchPane requires Select");a=new s.Api(a);this.classes=g.extend(!0,{},n.classes);this.c=g.extend(!0,{},n.defaults,b);this.customPaneSettings=h;this.s={cascadeRegen:!1,clearing:!1,colOpts:[],deselect:!1,displayed:!1,dt:a,dtPane:void 0,filteringActive:!1,index:d,indexes:[],lastCascade:!1,
lastSelect:!1,listSet:!1,name:void 0,redraw:!1,rowData:{arrayFilter:[],arrayOriginal:[],arrayTotals:[],bins:{},binsOriginal:{},binsTotal:{},filterMap:new Map,totalOptions:0},scrollTop:0,searchFunction:void 0,selectPresent:!1,serverSelect:[],serverSelecting:!1,showFiltered:!1,tableLength:null,updating:!1};b=a.columns().eq(0).toArray().length;this.colExists=this.s.index").addClass(this.classes.buttonGroup),clear:g('').addClass(this.classes.dull).addClass(this.classes.paneButton).addClass(this.classes.clearButton),
container:g("
").addClass(this.classes.container).addClass(this.classes.layout+(10>b?c:c.split("-")[0]+"-9")),countButton:g('').addClass(this.classes.paneButton).addClass(this.classes.countButton),dtP:g(""+(this.colExists?g(a.column(this.colExists?this.s.index:0).header()).text():this.customPaneSettings.header||"Custom Pane")+" | |
---|
"),lower:g("").addClass(this.classes.subRow2).addClass(this.classes.narrowButton),
nameButton:g('').addClass(this.classes.paneButton).addClass(this.classes.nameButton),panesContainer:f,searchBox:g("").addClass(this.classes.paneInputButton).addClass(this.classes.search),searchButton:g('').addClass(this.classes.paneButton),searchCont:g("").addClass(this.classes.searchCont),searchLabelCont:g("").addClass(this.classes.searchLabelCont),topRow:g("").addClass(this.classes.topRow),
upper:g("").addClass(this.classes.subRow1).addClass(this.classes.narrowSearch)};this.s.displayed=!1;a=this.s.dt;this.selections=[];this.s.colOpts=this.colExists?this._getOptions():this._getBonusOptions();var l=this.s.colOpts,c=g('').addClass(this.classes.paneButton);g(c).text(a.i18n("searchPanes.clearPane","X"));this.dom.container.addClass(l.className);this.dom.container.addClass(null!==this.customPaneSettings&&void 0!==this.customPaneSettings.className?this.customPaneSettings.className:
"");this.s.name=void 0!==this.s.colOpts.name?this.s.colOpts.name:null!==this.customPaneSettings&&void 0!==this.customPaneSettings.name?this.customPaneSettings.name:this.colExists?g(a.column(this.s.index).header()).text():this.customPaneSettings.header||"Custom Pane";g(f).append(this.dom.container);var p=a.table(0).node();this.s.searchFunction=function(a,b,c){if(0===e.selections.length||a.nTable!==p)return!0;a=null;e.colExists&&(a=b[e.s.index],"filter"!==l.orthogonal.filter&&(a=e.s.rowData.filterMap.get(c),
a instanceof g.fn.dataTable.Api&&(a=a.toArray())));return e._search(a,c)};g.fn.dataTable.ext.search.push(this.s.searchFunction);if(this.c.clear)g(c).on("click",function(){e.dom.container.find(e.classes.search).each(function(){g(this).val("");g(this).trigger("input")});e.clearPane()});a.on("draw.dtsp",function(){e._adjustTopRow()});a.on("buttons-action",function(){e._adjustTopRow()});g(window).on("resize.dtsp",s.util.throttle(function(){e._adjustTopRow()}));a.on("column-reorder.dtsp",function(a,b,
c){e.s.index=c.mapping[e.s.index]});return this};n.prototype.clearData=function(){this.s.rowData={arrayFilter:[],arrayOriginal:[],arrayTotals:[],bins:{},binsOriginal:{},binsTotal:{},filterMap:new Map,totalOptions:0}};n.prototype.clearPane=function(){this.s.dtPane.rows({selected:!0}).deselect();this.updateTable();return this};n.prototype.destroy=function(){g(this.s.dtPane).off(".dtsp");g(this.s.dt).off(".dtsp");g(this.dom.nameButton).off(".dtsp");g(this.dom.countButton).off(".dtsp");g(this.dom.clear).off(".dtsp");
g(this.dom.searchButton).off(".dtsp");g(this.dom.container).remove();for(var a=g.fn.dataTable.ext.search.indexOf(this.s.searchFunction);-1!==a;)g.fn.dataTable.ext.search.splice(a,1),a=g.fn.dataTable.ext.search.indexOf(this.s.searchFunction);void 0!==this.s.dtPane&&this.s.dtPane.destroy();this.s.listSet=!1};n.prototype.getPaneCount=function(){return void 0!==this.s.dtPane?this.s.dtPane.rows({selected:!0}).data().toArray().length:0};n.prototype.rebuildPane=function(a,b,d,c){void 0===a&&(a=!1);void 0===
b&&(b=null);void 0===d&&(d=null);void 0===c&&(c=!1);this.clearData();var f=[];this.s.serverSelect=[];var h=null;void 0!==this.s.dtPane&&(c&&(this.s.dt.page.info().serverSide?this.s.serverSelect=this.s.dtPane.rows({selected:!0}).data().toArray():f=this.s.dtPane.rows({selected:!0}).data().toArray()),this.s.dtPane.clear().destroy(),h=g(this.dom.container).prev(),this.destroy(),this.s.dtPane=void 0,g.fn.dataTable.ext.search.push(this.s.searchFunction));this.dom.container.removeClass(this.classes.hidden);
this.s.displayed=!1;this._buildPane(!this.s.dt.page.info().serverSide?f:this.s.serverSelect,a,b,d,h);return this};n.prototype.removePane=function(){this.s.displayed=!1;g(this.dom.container).hide()};n.prototype.setCascadeRegen=function(a){this.s.cascadeRegen=a};n.prototype.setClear=function(a){this.s.clearing=a};n.prototype.updatePane=function(a){void 0===a&&(a=!1);this.s.updating=!0;this._updateCommon(a);this.s.updating=!1};n.prototype.updateTable=function(){this.selections=this.s.dtPane.rows({selected:!0}).data().toArray();
this._searchExtras();(this.c.cascadePanes||this.c.viewTotal)&&this.updatePane()};n.prototype._setListeners=function(){var a=this,b=this.s.rowData,d;this.s.dtPane.on("select.dtsp",function(){clearTimeout(d);a.s.dt.page.info().serverSide&&!a.s.updating?a.s.serverSelecting||(a.s.serverSelect=a.s.dtPane.rows({selected:!0}).data().toArray(),a.s.scrollTop=g(a.s.dtPane.table().node()).parent()[0].scrollTop,a.s.selectPresent=!0,a.s.dt.draw(!1)):(g(a.dom.clear).removeClass(a.classes.dull),a.s.selectPresent=
!0,a.s.updating||a._makeSelection(),a.s.selectPresent=!1)});this.s.dtPane.on("deselect.dtsp",function(){d=setTimeout(function(){a.s.dt.page.info().serverSide&&!a.s.updating?a.s.serverSelecting||(a.s.serverSelect=a.s.dtPane.rows({selected:!0}).data().toArray(),a.s.deselect=!0,a.s.dt.draw(!1)):(a.s.deselect=!0,0===a.s.dtPane.rows({selected:!0}).data().toArray().length&&g(a.dom.clear).addClass(a.classes.dull),a._makeSelection(),a.s.deselect=!1,a.s.dt.state.save())},50)});this.s.dt.on("stateSaveParams.dtsp",
function(c,d,h){if(g.isEmptyObject(h))a.s.dtPane.state.clear();else{var c=[],e,l,p,j;void 0!==a.s.dtPane&&(c=a.s.dtPane.rows({selected:!0}).data().map(function(a){return a.filter.toString()}).toArray(),e=g(a.dom.searchBox).val(),l=a.s.dtPane.order(),p=b.binsOriginal,j=b.arrayOriginal);void 0===h.searchPanes&&(h.searchPanes={});void 0===h.searchPanes.panes&&(h.searchPanes.panes=[]);for(d=0;dg(a[0]).width()||252>g(c[0]).width())&&0!==g(a[0]).width()?(g(a[0]).addClass(this.classes.narrow),g(b[0]).addClass(this.classes.narrowSub).removeClass(this.classes.narrowSearch),g(d[0]).addClass(this.classes.narrowSub).removeClass(this.classes.narrowButton)):(g(a[0]).removeClass(this.classes.narrow),
g(b[0]).removeClass(this.classes.narrowSub).addClass(this.classes.narrowSearch),g(d[0]).removeClass(this.classes.narrowSub).addClass(this.classes.narrowButton))};n.prototype._buildPane=function(a,b,d,c,f){var h=this;void 0===a&&(a=[]);void 0===b&&(b=!1);void 0===d&&(d=null);void 0===c&&(c=null);void 0===f&&(f=null);this.selections=[];var e=this.s.dt,l=e.column(this.colExists?this.s.index:0),p=this.s.colOpts,j=this.s.rowData,i=e.i18n("searchPanes.count","{total}"),n=e.i18n("searchPanes.countFiltered",
"{shown} ({total})"),k=e.state.loaded();this.s.listSet&&(k=e.state());if(this.colExists){var o=-1;if(k&&k.searchPanes&&k.searchPanes.panes)for(var m=0;mthis.c.threshold:b>p.threshold)||!0!==p.show&&1>=m)){this.dom.container.addClass(this.classes.hidden);
this.s.displayed=!1;return}this.c.viewTotal&&0===j.arrayTotals.length?(this.s.rowData.totalOptions=0,this._detailsPane()):j.binsTotal=j.bins;this.dom.container.addClass(this.classes.show);this.s.displayed=!0}else if(null!==d&&null!==d.searchPanes&&null!==d.searchPanes.options){if(void 0!==d.tableLength)this.s.tableLength=d.tableLength,this.s.rowData.totalOptions=this.s.tableLength;else if(null===this.s.tableLength||e.rows()[0].length>this.s.tableLength)this.s.tableLength=e.rows()[0].length,this.s.rowData.totalOptions=
this.s.tableLength;b=e.column(this.s.index).dataSrc();if(void 0!==d.searchPanes.options[b]){m=0;for(b=d.searchPanes.options[b];mthis.c.threshold:b>p.threshold)||!0!==p.show&&1>=m)){this.dom.container.addClass(this.classes.hidden);this.s.displayed=!1;return}this.s.rowData.arrayOriginal=this.s.rowData.arrayFilter;this.s.rowData.binsOriginal=this.s.rowData.bins;this.s.displayed=!0}}else this.s.displayed=!0;this._displayPane();if(!this.s.listSet)this.dom.dtP.on("stateLoadParams.dt",function(a,b,c){g.isEmptyObject(e.state.loaded())&&g.each(c,function(a){delete c[a]})});null!==f&&0'+c+"";if(h.c.hideCount||p.hideCount)b="";return']*>/)!==null?a.replace(/<[^>]*>/g,""):a)+'" class="'+h.classes.name+'">'+a+""+b+"
"},targets:0,type:void 0!==e.settings()[0].aoColumns[this.s.index]?e.settings()[0].aoColumns[this.s.index]._sManualType:null},{className:"dtsp-countColumn "+
this.classes.badgePill,data:"shown",orderData:[1,2],targets:1,visible:!1},{data:"total",targets:2,visible:!1}],deferRender:!0,dom:"t",info:!1,language:this.s.dt.settings()[0].oLanguage,paging:f?!0:!1,scrollX:!1,scrollY:"200px",scroller:f?!0:!1,select:!0,stateSave:e.settings()[0].oFeatures.bStateSave?!0:!1},this.c.dtOpts,void 0!==p?p.dtOpts:{},void 0!==this.s.colOpts.options||!this.colExists?{createdRow:function(a,b){g(a).addClass(b.className)}}:void 0,null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts?
this.customPaneSettings.dtOpts:{}));g(this.dom.dtP).addClass(this.classes.table);g(this.dom.searchBox).attr("placeholder",void 0!==p.header?p.header:this.colExists?e.settings()[0].aoColumns[this.s.index].sTitle:this.customPaneSettings.header||"Custom Pane");g.fn.dataTable.select.init(this.s.dtPane);g.fn.dataTable.ext.errMode=m;if(this.colExists){var l=(l=l.search())?l.substr(1,l.length-2).split("|"):[],q=0;j.arrayFilter.forEach(function(a){""===a.filter&&q++});m=0;for(f=j.arrayFilter.length;m]*>/g,""));this.s.rowData.filterMap.set(a,h);c[h]?c[h]++:(c[h]=1,this._addOption(h,d.oApi._fnGetCellData(d,a,this.s.index,f.orthogonal.display),d.oApi._fnGetCellData(d,a,this.s.index,f.orthogonal.sort),d.oApi._fnGetCellData(d,a,this.s.index,f.orthogonal.type),
b,c));this.s.rowData.totalOptions++}};n.prototype._reloadSelect=function(a){if(void 0!==a){for(var b,d=0;dNo Data",hideCount:!1,layout:"columns-3",name:void 0,orderable:!0,orthogonal:{display:"display",filter:"filter",hideCount:!1,search:"filter",
show:void 0,sort:"sort",threshold:0.6,type:"type"},preSelect:[],threshold:0.6,viewTotal:!1};t=n;var i,r,u,k=function(a,b,d){var c=this;void 0===d&&(d=!1);this.regenerating=!1;if(!r||!r.versionCheck||!r.versionCheck("1.10.0"))throw Error("SearchPane requires DataTables 1.10 or newer");if(!r.select)throw Error("SearchPane requires Select");var f=new r.Api(a);this.classes=i.extend(!0,{},k.classes);this.c=i.extend(!0,{},k.defaults,b);this.dom={clearAll:i('').addClass(this.classes.clearAll),
container:i("").addClass(this.classes.panes).text(f.i18n("searchPanes.loadMessage","Loading Search Panes...")),emptyMessage:i("").addClass(this.classes.emptyMessage),options:i("").addClass(this.classes.container),panes:i("").addClass(this.classes.container),title:i("").addClass(this.classes.title),titleRow:i("").addClass(this.classes.titleRow),wrapper:i("")};this.s={colOpts:[],dt:f,filterCount:0,filterPane:-1,page:0,panes:[],selectionList:[],serverData:{},
stateRead:!1,updating:!1};if(void 0===f.settings()[0]._searchPanes){this._getState();if(this.s.dt.page.info().serverSide)f.on("preXhr.dt",function(a,b,d){void 0===d.searchPanes&&(d.searchPanes={});a=0;for(b=c.s.selectionList;a0){if(a!==b.s.filterCount){e.start=0;b.s.page=0}else e.start=b.s.page*b.s.dt.page.len();
b.s.dt.page(b.s.page);b.s.filterCount=a}});else a.on("preXhr.dt",function(){for(var a=0,c=b.s.panes;a