Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

dataTables.searchPanes.min.js 48KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*!
  2. SearchPanes 1.3.0
  3. 2019-2020 SpryMedia Ltd - datatables.net/license
  4. */
  5. (function(){var h,s,t,l=function(a,b,c,e,f,d){var g=this;void 0===d&&(d=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=h.extend(!0,{},l.classes);this.c=h.extend(!0,{},l.defaults,b);void 0!==b&&(void 0!==b.hideCount&&void 0===b.viewCount)&&(this.c.viewCount=!this.c.hideCount);this.customPaneSettings=d;this.s={cascadeRegen:!1,clearing:!1,colOpts:[],
  6. deselect:!1,displayed:!1,dt:a,dtPane:void 0,filteringActive:!1,forceViewTotal:!1,index:c,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<b;this.c.layout=
  7. e;b=parseInt(e.split("-")[1],10);this.dom={buttonGroup:h("<div/>").addClass(this.classes.buttonGroup),clear:h('<button type="button">&#215;</button>').addClass(this.classes.disabledButton).attr("disabled","true").addClass(this.classes.paneButton).addClass(this.classes.clearButton),container:h("<div/>").addClass(this.classes.container).addClass(this.classes.layout+(10>b?e:e.split("-")[0]+"-9")),countButton:h('<button type="button"></button>').addClass(this.classes.paneButton).addClass(this.classes.countButton),
  8. dtP:h("<table><thead><tr><th>"+(this.colExists?h(a.column(this.colExists?this.s.index:0).header()).text():this.customPaneSettings.header||"Custom Pane")+"</th><th/></tr></thead></table>"),lower:h("<div/>").addClass(this.classes.subRow2).addClass(this.classes.narrowButton),nameButton:h('<button type="button"></button>').addClass(this.classes.paneButton).addClass(this.classes.nameButton),panesContainer:f,searchBox:h("<input/>").addClass(this.classes.paneInputButton).addClass(this.classes.search),searchButton:h('<button type = "button" class="'+
  9. this.classes.searchIcon+'"></button>').addClass(this.classes.paneButton),searchCont:h("<div/>").addClass(this.classes.searchCont),searchLabelCont:h("<div/>").addClass(this.classes.searchLabelCont),topRow:h("<div/>").addClass(this.classes.topRow),upper:h("<div/>").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 i=this.s.colOpts,e=h('<button type="button">X</button>').addClass(this.classes.paneButton);
  10. h(e).text(a.i18n("searchPanes.clearPane",this.c.i18n.clearPane));this.dom.container.addClass(i.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?h(a.column(this.s.index).header()).text():this.customPaneSettings.header||"Custom Pane";
  11. h(f).append(this.dom.container);var p=a.table(0).node();this.s.searchFunction=function(a,b,d){if(g.selections.length===0||a.nTable!==p)return true;a=null;if(g.colExists){a=b[g.s.index];if(i.orthogonal.filter!=="filter"){a=g.s.rowData.filterMap.get(d);a instanceof h.fn.dataTable.Api&&(a=a.toArray())}}return g._search(a,d)};h.fn.dataTable.ext.search.push(this.s.searchFunction);if(this.c.clear)h(e).on("click",function(){g.dom.container.find("."+g.classes.search.replace(/\s+/g,".")).each(function(){h(this).val("");
  12. h(this).trigger("input")});g.clearPane()});a.on("draw.dtsp",function(){g.adjustTopRow()});a.on("buttons-action",function(){g.adjustTopRow()});a.on("column-reorder.dtsp",function(a,b,d){g.s.index=d.mapping[g.s.index]});return this};l.prototype.addRow=function(a,b,c,e,f,d,g){for(var i,h=0,k=this.s.indexes;h<k.length;h++){var j=k[h];j.filter===b&&(i=j.index)}void 0===i&&(i=this.s.indexes.length,this.s.indexes.push({filter:b,index:i}));return this.s.dtPane.row.add({className:g,display:""!==a?a:this.emptyMessage(),
  13. filter:b,index:i,shown:c,sort:f,total:e,type:d})};l.prototype.adjustTopRow=function(){var a=this.dom.container.find("."+this.classes.subRowsContainer.replace(/\s+/g,".")),b=this.dom.container.find("."+this.classes.subRow1.replace(/\s+/g,".")),c=this.dom.container.find("."+this.classes.subRow2.replace(/\s+/g,".")),e=this.dom.container.find("."+this.classes.topRow.replace(/\s+/g,"."));(252>h(a[0]).width()||252>h(e[0]).width())&&0!==h(a[0]).width()?(h(a[0]).addClass(this.classes.narrow),h(b[0]).addClass(this.classes.narrowSub).removeClass(this.classes.narrowSearch),
  14. h(c[0]).addClass(this.classes.narrowSub).removeClass(this.classes.narrowButton)):(h(a[0]).removeClass(this.classes.narrow),h(b[0]).removeClass(this.classes.narrowSub).addClass(this.classes.narrowSearch),h(c[0]).removeClass(this.classes.narrowSub).addClass(this.classes.narrowButton))};l.prototype.clearData=function(){this.s.rowData={arrayFilter:[],arrayOriginal:[],arrayTotals:[],bins:{},binsOriginal:{},binsTotal:{},filterMap:new Map,totalOptions:0}};l.prototype.clearPane=function(){this.s.dtPane.rows({selected:!0}).deselect();
  15. this.updateTable();return this};l.prototype.destroy=function(){h(this.s.dtPane).off(".dtsp");h(this.s.dt).off(".dtsp");h(this.dom.nameButton).off(".dtsp");h(this.dom.countButton).off(".dtsp");h(this.dom.clear).off(".dtsp");h(this.dom.searchButton).off(".dtsp");h(this.dom.container).remove();for(var a=h.fn.dataTable.ext.search.indexOf(this.s.searchFunction);-1!==a;)h.fn.dataTable.ext.search.splice(a,1),a=h.fn.dataTable.ext.search.indexOf(this.s.searchFunction);void 0!==this.s.dtPane&&this.s.dtPane.destroy();
  16. this.s.listSet=!1};l.prototype.emptyMessage=function(){var a=this.c.i18n.emptyMessage;this.c.emptyMessage&&(a=this.c.emptyMessage);!1!==this.s.colOpts.emptyMessage&&null!==this.s.colOpts.emptyMessage&&(a=this.s.colOpts.emptyMessage);return this.s.dt.i18n("searchPanes.emptyMessage",a)};l.prototype.getPaneCount=function(){return void 0!==this.s.dtPane?this.s.dtPane.rows({selected:!0}).data().toArray().length:0};l.prototype.rebuildPane=function(a,b,c,e){void 0===a&&(a=!1);void 0===b&&(b=null);void 0===
  17. c&&(c=null);void 0===e&&(e=!1);this.clearData();var f=[];this.s.serverSelect=[];var d=null;void 0!==this.s.dtPane&&(e&&(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(),d=h(this.dom.container).prev(),this.destroy(),this.s.dtPane=void 0,h.fn.dataTable.ext.search.push(this.s.searchFunction));this.dom.container.removeClass(this.classes.hidden);this.s.displayed=
  18. !1;this._buildPane(!this.s.dt.page.info().serverSide?f:this.s.serverSelect,a,b,c,d);return this};l.prototype.removePane=function(){this.s.displayed=!1;h(this.dom.container).hide()};l.prototype.resize=function(a){this.c.layout=a;var b=parseInt(a.split("-")[1],10);h(this.dom.container).removeClass().addClass(this.classes.container).addClass(this.classes.layout+(10>b?a:a.split("-")[0]+"-9")).addClass(this.s.colOpts.className).addClass(null!==this.customPaneSettings&&void 0!==this.customPaneSettings.className?
  19. this.customPaneSettings.className:"").addClass(this.classes.show);this.adjustTopRow()};l.prototype.setCascadeRegen=function(a){this.s.cascadeRegen=a};l.prototype.setClear=function(a){this.s.clearing=a};l.prototype.updatePane=function(a){void 0===a&&(a=!1);this.s.updating=!0;this._updateCommon(a);this.s.updating=!1};l.prototype.updateTable=function(){this.selections=this.s.dtPane.rows({selected:!0}).data().toArray();this._searchExtras();(this.c.cascadePanes||this.c.viewTotal)&&this.updatePane()};l.prototype._setListeners=
  20. function(){var a=this,b=this.s.rowData,c;this.s.dtPane.on("select.dtsp",function(){clearTimeout(c);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=h(a.s.dtPane.table().node()).parent()[0].scrollTop,a.s.selectPresent=!0,a.s.dt.draw(!1)):(h(a.dom.clear).removeClass(a.classes.disabledButton).removeAttr("disabled"),a.s.updating||(a.s.selectPresent=!0,a._makeSelection(),a.s.selectPresent=!1))});this.s.dtPane.on("deselect.dtsp",
  21. function(){c=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&&h(a.dom.clear).addClass(a.classes.disabledButton).attr("disabled","true"),a._makeSelection(),a.s.deselect=!1,a.s.dt.state.save())},50)});this.s.dt.on("stateSaveParams.dtsp",function(e,c,d){if(h.isEmptyObject(d))a.s.dtPane.state.clear();
  22. else{var e=[],g,i,p,k;void 0!==a.s.dtPane&&(e=a.s.dtPane.rows({selected:!0}).data().map(function(a){return a.filter.toString()}).toArray(),g=h(a.dom.searchBox).val(),i=a.s.dtPane.order(),p=b.binsOriginal,k=b.arrayOriginal);void 0===d.searchPanes&&(d.searchPanes={});void 0===d.searchPanes.panes&&(d.searchPanes.panes=[]);for(c=0;c<d.searchPanes.panes.length;c++)d.searchPanes.panes[c].id===a.s.index&&(d.searchPanes.panes.splice(c,1),c--);d.searchPanes.panes.push({arrayFilter:k,bins:p,id:a.s.index,order:i,
  23. searchTerm:g,selected:e})}});this.s.dtPane.on("user-select.dtsp",function(a,b,d,g,c){c.stopPropagation()});this.s.dtPane.on("draw.dtsp",function(){a.adjustTopRow()});h(this.dom.nameButton).on("click.dtsp",function(){var b=a.s.dtPane.order()[0][1];a.s.dtPane.order([0,"asc"===b?"desc":"asc"]).draw();a.s.dt.state.save()});h(this.dom.countButton).on("click.dtsp",function(){var b=a.s.dtPane.order()[0][1];a.s.dtPane.order([1,"asc"===b?"desc":"asc"]).draw();a.s.dt.state.save()});h(this.dom.clear).on("click.dtsp",
  24. function(){a.dom.container.find("."+a.classes.search.replace(/ /g,".")).each(function(){h(this).val("");h(this).trigger("input")});a.clearPane()});h(this.dom.searchButton).on("click.dtsp",function(){h(a.dom.searchBox).focus()});h(this.dom.searchBox).on("input.dtsp",function(){var b=h(a.dom.searchBox).val();a.s.dtPane.search(b).draw();0<b.length||0===b.length&&0<a.s.dtPane.rows({selected:!0}).data().toArray().length?a.dom.clear.removeClass(a.classes.disabledButton).removeAttr("disabled"):a.dom.clear.addClass(a.classes.disabledButton).attr("disabled",
  25. "true");a.s.dt.state.save()});this.s.dt.state.save();return!0};l.prototype._addOption=function(a,b,c,e,f,d){if(Array.isArray(a)||a instanceof s.Api)if(a instanceof s.Api&&(a=a.toArray(),b=b.toArray()),a.length===b.length)for(var g=0;g<a.length;g++)d[a[g]]?d[a[g]]++:(d[a[g]]=1,f.push({display:b[g],filter:a[g],sort:c[g],type:e[g]})),this.s.rowData.totalOptions++;else throw Error("display and filter not the same length");else"string"===typeof this.s.colOpts.orthogonal?(d[a]?d[a]++:(d[a]=1,f.push({display:b,
  26. filter:a,sort:c,type:e})),this.s.rowData.totalOptions++):f.push({display:b,filter:a,sort:c,type:e})};l.prototype._buildPane=function(a,b,c,e,f){var d=this;void 0===a&&(a=[]);void 0===b&&(b=!1);void 0===c&&(c=null);void 0===e&&(e=null);void 0===f&&(f=null);this.selections=[];var g=this.s.dt,i=g.column(this.colExists?this.s.index:0),p=this.s.colOpts,k=this.s.rowData,j=g.i18n("searchPanes.count",this.c.i18n.count),l=g.i18n("searchPanes.countFiltered",this.c.i18n.countFiltered),q=g.state.loaded();this.s.listSet&&
  27. (q=g.state());if(this.colExists){var o=-1;if(q&&q.searchPanes&&q.searchPanes.panes)for(var m=0;m<q.searchPanes.panes.length;m++)if(q.searchPanes.panes[m].id===this.s.index){o=m;break}if((!1===p.show||void 0!==p.show&&!0!==p.show)&&-1===o)return this.dom.container.addClass(this.classes.hidden),this.s.displayed=!1;if(!0===p.show||-1!==o)this.s.displayed=!0;if(!this.s.dt.page.info().serverSide&&(null===c||null===c.searchPanes||null===c.searchPanes.options)){if(0===k.arrayFilter.length){this._populatePane(b);
  28. this.s.rowData.totalOptions=0;this._detailsPane();if(q&&q.searchPanes&&q.searchPanes.panes&&-1===o){this.dom.container.addClass(this.classes.hidden);this.s.displayed=!1;return}k.arrayOriginal=k.arrayTotals;k.binsOriginal=k.binsTotal}m=Object.keys(k.binsOriginal).length;b=this._uniqueRatio(m,g.rows()[0].length);if(!1===this.s.displayed&&((void 0===p.show&&null===p.threshold?b>this.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&&
  29. 0===k.arrayTotals.length?(this.s.rowData.totalOptions=0,this._detailsPane()):k.binsTotal=k.bins;this.dom.container.addClass(this.classes.show);this.s.displayed=!0}else if(null!==c&&null!==c.searchPanes&&null!==c.searchPanes.options){if(void 0!==c.tableLength)this.s.tableLength=c.tableLength,this.s.rowData.totalOptions=this.s.tableLength;else if(null===this.s.tableLength||g.rows()[0].length>this.s.tableLength)this.s.tableLength=g.rows()[0].length,this.s.rowData.totalOptions=this.s.tableLength;b=g.column(this.s.index).dataSrc();
  30. if(void 0!==c.searchPanes.options[b]){m=0;for(b=c.searchPanes.options[b];m<b.length;m++)o=b[m],this.s.rowData.arrayFilter.push({display:o.label,filter:o.value,sort:o.label,type:o.label}),this.s.rowData.bins[o.value]=this.c.viewTotal||this.c.cascadePanes?o.count:o.total,this.s.rowData.binsTotal[o.value]=o.total}m=Object.keys(k.binsTotal).length;b=this._uniqueRatio(m,this.s.tableLength);if(!1===this.s.displayed&&((void 0===p.show&&null===p.threshold?b>this.c.threshold:b>p.threshold)||!0!==p.show&&1>=
  31. 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,d){h.isEmptyObject(g.state.loaded())&&h.each(d,function(a){delete d[a]})});null!==f&&0<h(this.dom.panesContainer).has(f).length?h(this.dom.container).insertAfter(f):h(this.dom.panesContainer).prepend(this.dom.container);
  32. m=h.fn.dataTable.ext.errMode;h.fn.dataTable.ext.errMode="none";f=s.Scroller;this.s.dtPane=h(this.dom.dtP).DataTable(h.extend(!0,{columnDefs:[{className:"dtsp-nameColumn",data:"display",render:function(a,b,e){if(b==="sort")return e.sort;if(b==="type")return e.type;var g;g=(d.s.filteringActive||d.s.showFiltered)&&d.c.viewTotal||d.c.viewTotal&&d.s.forceViewTotal?l.replace(/{total}/,e.total):j.replace(/{total}/,e.total);for(g=g.replace(/{shown}/,e.shown);g.indexOf("{total}")!==-1;)g=g.replace(/{total}/,
  33. e.total);for(;g.indexOf("{shown}")!==-1;)g=g.replace(/{shown}/,e.shown);e='<span class="'+d.classes.pill+'">'+g+"</span>";if(!d.c.viewCount||!p.viewCount)e="";return b==="filter"?typeof a==="string"&&a.match(/<[^>]*>/)!==null?a.replace(/<[^>]*>/g,""):a:'<div class="'+d.classes.nameCont+'"><span title="'+(typeof a==="string"&&a.match(/<[^>]*>/)!==null?a.replace(/<[^>]*>/g,""):a)+'" class="'+d.classes.name+'">'+a+"</span>"+e+"</div>"},targets:0,type:void 0!==g.settings()[0].aoColumns[this.s.index]?
  34. g.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:g.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,
  35. b){h(a).addClass(b.className)}}:void 0,null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts?this.customPaneSettings.dtOpts:{},h.fn.dataTable.versionCheck("2")?{layout:{bottomLeft:null,bottomRight:null,topLeft:null,topRight:null}}:{}));h(this.dom.dtP).addClass(this.classes.table);f="Custom Pane";this.customPaneSettings&&this.customPaneSettings.header?f=this.customPaneSettings.header:p.header?f=p.header:this.colExists&&(f=h.fn.dataTable.versionCheck("2")?g.column(this.s.index).title():
  36. g.settings()[0].aoColumns[this.s.index].sTitle);this.dom.searchBox.attr("placeholder",f);h.fn.dataTable.select.init(this.s.dtPane);h.fn.dataTable.ext.errMode=m;if(this.colExists){var i=(i=i.search())?i.substr(1,i.length-2).split("|"):[],n=0;k.arrayFilter.forEach(function(a){""===a.filter&&n++});m=0;for(f=k.arrayFilter.length;m<f;m++){for(var i=!1,o=0,r=this.s.serverSelect;o<r.length;o++)b=r[o],b.filter===k.arrayFilter[m].filter&&(i=!0);if(this.s.dt.page.info().serverSide&&(!this.c.cascadePanes||this.c.cascadePanes&&
  37. 0!==k.bins[k.arrayFilter[m].filter]||this.c.cascadePanes&&null!==e||i)){i=this.addRow(k.arrayFilter[m].display,k.arrayFilter[m].filter,e?k.binsTotal[k.arrayFilter[m].filter]:k.bins[k.arrayFilter[m].filter],this.c.viewTotal||e?String(k.binsTotal[k.arrayFilter[m].filter]):k.bins[k.arrayFilter[m].filter],k.arrayFilter[m].sort,k.arrayFilter[m].type);o=0;for(r=this.s.serverSelect;o<r.length;o++)b=r[o],b.filter===k.arrayFilter[m].filter&&(this.s.serverSelecting=!0,i.select(),this.s.serverSelecting=!1)}else!this.s.dt.page.info().serverSide&&
  38. k.arrayFilter[m]&&(void 0!==k.bins[k.arrayFilter[m].filter]||!this.c.cascadePanes)?this.addRow(k.arrayFilter[m].display,k.arrayFilter[m].filter,k.bins[k.arrayFilter[m].filter],k.binsTotal[k.arrayFilter[m].filter],k.arrayFilter[m].sort,k.arrayFilter[m].type):this.s.dt.page.info().serverSide||this.addRow("",n,n,"","","")}}s.select.init(this.s.dtPane);(void 0!==p.options||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.options)&&this._getComparisonRows();this.s.dtPane.draw();this.adjustTopRow();
  39. this.s.listSet||(this._setListeners(),this.s.listSet=!0);for(e=0;e<a.length;e++)if(k=a[e],void 0!==k){m=0;for(f=this.s.dtPane.rows().indexes().toArray();m<f.length;m++)i=f[m],void 0!==this.s.dtPane.row(i).data()&&k.filter===this.s.dtPane.row(i).data().filter&&(this.s.dt.page.info().serverSide?(this.s.serverSelecting=!0,this.s.dtPane.row(i).select(),this.s.serverSelecting=!1):this.s.dtPane.row(i).select())}this.s.dt.page.info().serverSide&&this.s.dtPane.search(h(this.dom.searchBox).val()).draw();if(q&&
  40. q.searchPanes&&q.searchPanes.panes&&(null===c||1===c.draw)){this.c.cascadePanes||this._reloadSelect(q);c=0;for(q=q.searchPanes.panes;c<q.length;c++)a=q[c],a.id===this.s.index&&(h(this.dom.searchBox).val(a.searchTerm),h(this.dom.searchBox).trigger("input"),this.s.dtPane.order(a.order).draw())}this.s.dt.state.save();return!0};l.prototype._detailsPane=function(){var a=this.s.dt;this.s.rowData.arrayTotals=[];this.s.rowData.binsTotal={};var b=this.s.dt.settings()[0],a=a.rows().indexes();if(!this.s.dt.page.info().serverSide)for(var c=
  41. 0;c<a.length;c++)this._populatePaneArray(a[c],this.s.rowData.arrayTotals,b,this.s.rowData.binsTotal)};l.prototype._displayPane=function(){var a=this.dom.container,b=this.s.colOpts,c=parseInt(this.c.layout.split("-")[1],10);h(this.dom.topRow).empty();h(this.dom.dtP).empty();h(this.dom.topRow).addClass(this.classes.topRow);3<c&&h(this.dom.container).addClass(this.classes.smallGap);h(this.dom.topRow).addClass(this.classes.subRowsContainer);h(this.dom.upper).appendTo(this.dom.topRow);h(this.dom.lower).appendTo(this.dom.topRow);
  42. h(this.dom.searchCont).appendTo(this.dom.upper);h(this.dom.buttonGroup).appendTo(this.dom.lower);(!1===this.c.dtOpts.searching||void 0!==b.dtOpts&&!1===b.dtOpts.searching||!this.c.controls||!b.controls||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts&&void 0!==this.customPaneSettings.dtOpts.searching&&!this.customPaneSettings.dtOpts.searching)&&h(this.dom.searchBox).removeClass(this.classes.paneInputButton).addClass(this.classes.disabledButton).attr("disabled","true");h(this.dom.searchBox).appendTo(this.dom.searchCont);
  43. this._searchContSetup();this.c.clear&&(this.c.controls&&b.controls)&&h(this.dom.clear).appendTo(this.dom.buttonGroup);this.c.orderable&&(b.orderable&&this.c.controls&&b.controls)&&h(this.dom.nameButton).appendTo(this.dom.buttonGroup);this.c.viewCount&&(b.viewCount&&this.c.orderable&&b.orderable&&this.c.controls&&b.controls)&&h(this.dom.countButton).appendTo(this.dom.buttonGroup);h(this.dom.topRow).prependTo(this.dom.container);h(a).append(this.dom.dtP);h(a).show()};l.prototype._getBonusOptions=function(){return h.extend(!0,
  44. {},l.defaults,{orthogonal:{threshold:null},threshold:null},void 0!==this.c?this.c:{})};l.prototype._getComparisonRows=function(){var a=this.s.colOpts,a=void 0!==a.options?a.options:null!==this.customPaneSettings&&void 0!==this.customPaneSettings.options?this.customPaneSettings.options:void 0;if(void 0!==a){var b=this.s.dt.rows({search:"applied"}).data().toArray(),c=this.s.dt.rows({search:"applied"}),e=this.s.dt.rows().data().toArray(),f=this.s.dt.rows(),d=[];this.s.dtPane.clear();for(var g=0;g<a.length;g++){var i=
  45. a[g],h=""!==i.label?i.label:this.emptyMessage(),k=i.className,j=h,l="function"===typeof i.value?i.value:[],q=0,o=h,m=0;if("function"===typeof i.value){for(var n=0;n<b.length;n++)i.value.call(this.s.dt,b[n],c[0][n])&&q++;for(n=0;n<e.length;n++)i.value.call(this.s.dt,e[n],f[0][n])&&m++;"function"!==typeof l&&l.push(i.filter)}(!this.c.cascadePanes||this.c.cascadePanes&&0!==q)&&d.push(this.addRow(j,l,q,m,o,h,k))}return d}};l.prototype._getOptions=function(){var a=this.s.dt.settings()[0].aoColumns[this.s.index].searchPanes,
  46. b=h.extend(!0,{},l.defaults,{emptyMessage:!1,orthogonal:{threshold:null},threshold:null},a);void 0!==a&&(void 0!==a.hideCount&&void 0===a.viewCount)&&(b.viewCount=!a.hideCount);return b};l.prototype._makeSelection=function(){this.updateTable();this.s.updating=!0;this.s.dt.draw();this.s.updating=!1};l.prototype._populatePane=function(a){void 0===a&&(a=!1);var b=this.s.dt;this.s.rowData.arrayFilter=[];this.s.rowData.bins={};var c=this.s.dt.settings()[0];if(!this.s.dt.page.info().serverSide)for(var e=
  47. 0,a=((this.c.cascadePanes||this.c.viewTotal)&&!this.s.clearing&&!a?b.rows({search:"applied"}).indexes():b.rows().indexes()).toArray();e<a.length;e++)this._populatePaneArray(a[e],this.s.rowData.arrayFilter,c)};l.prototype._populatePaneArray=function(a,b,c,e){void 0===e&&(e=this.s.rowData.bins);var f=this.s.colOpts;if("string"===typeof f.orthogonal)c=c.oApi._fnGetCellData(c,a,this.s.index,f.orthogonal),this.s.rowData.filterMap.set(a,c),this._addOption(c,c,c,c,b,e);else{var d=c.oApi._fnGetCellData(c,
  48. a,this.s.index,f.orthogonal.search);null===d&&(d="");"string"===typeof d&&(d=d.replace(/<[^>]*>/g,""));this.s.rowData.filterMap.set(a,d);e[d]?e[d]++:(e[d]=1,this._addOption(d,c.oApi._fnGetCellData(c,a,this.s.index,f.orthogonal.display),c.oApi._fnGetCellData(c,a,this.s.index,f.orthogonal.sort),c.oApi._fnGetCellData(c,a,this.s.index,f.orthogonal.type),b,e));this.s.rowData.totalOptions++}};l.prototype._reloadSelect=function(a){if(void 0!==a){for(var b,c=0;c<a.searchPanes.panes.length;c++)if(a.searchPanes.panes[c].id===
  49. this.s.index){b=c;break}if(void 0!==b)for(var c=this.s.dtPane,e=c.rows({order:"index"}).data().map(function(a){return null!==a.filter?a.filter.toString():null}).toArray(),f=0,a=a.searchPanes.panes[b].selected;f<a.length;f++){b=a[f];var d=-1;null!==b&&(d=e.indexOf(b.toString()));-1<d&&(this.s.serverSelecting=!0,c.row(d).select(),this.s.serverSelecting=!1)}}};l.prototype._search=function(a,b){for(var c=this.s.colOpts,e=this.s.dt,f=0,d=this.selections;f<d.length;f++){var g=d[f];"string"===typeof g.filter&&
  50. "string"===typeof a&&(g.filter=g.filter.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"'));if(Array.isArray(a)){if(-1!==a.indexOf(g.filter))return!0}else if("function"===typeof g.filter)if(g.filter.call(e,e.row(b).data(),b)){if("or"===c.combiner)return!0}else{if("and"===c.combiner)return!1}else if(a===g.filter||!("string"===typeof a&&0===a.length)&&a==g.filter||null===g.filter&&"string"===typeof a&&""===a)return!0}return"and"===c.combiner?!0:!1};l.prototype._searchContSetup=
  51. function(){this.c.controls&&this.s.colOpts.controls&&h(this.dom.searchButton).appendTo(this.dom.searchLabelCont);!1===this.c.dtOpts.searching||(!1===this.s.colOpts.dtOpts.searching||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts&&void 0!==this.customPaneSettings.dtOpts.searching&&!this.customPaneSettings.dtOpts.searching)||h(this.dom.searchLabelCont).appendTo(this.dom.searchCont)};l.prototype._searchExtras=function(){var a=this.s.updating;this.s.updating=!0;var b=this.s.dtPane.rows({selected:!0}).data().pluck("filter").toArray(),
  52. c=b.indexOf(this.emptyMessage()),e=h(this.s.dtPane.table().container());-1<c&&(b[c]="");0<b.length?e.addClass(this.classes.selected):0===b.length&&e.removeClass(this.classes.selected);this.s.updating=a};l.prototype._uniqueRatio=function(a,b){return 0<b&&(0<this.s.rowData.totalOptions&&!this.s.dt.page.info().serverSide||this.s.dt.page.info().serverSide&&0<this.s.tableLength)?a/this.s.rowData.totalOptions:1};l.prototype._updateCommon=function(a){void 0===a&&(a=!1);if(!this.s.dt.page.info().serverSide&&
  53. void 0!==this.s.dtPane&&(!this.s.filteringActive||this.c.cascadePanes||!0===a)&&(!0!==this.c.cascadePanes||!0!==this.s.selectPresent)&&(!this.s.lastSelect||!this.s.lastCascade)){var b=this.s.colOpts,c=this.s.dtPane.rows({selected:!0}).data().toArray(),a=h(this.s.dtPane.table().node()).parent()[0].scrollTop,e=this.s.rowData;this.s.dtPane.clear();if(this.colExists){0===e.arrayFilter.length?this._populatePane(!this.s.filteringActive):this.c.cascadePanes&&this.s.dt.rows().data().toArray().length===this.s.dt.rows({search:"applied"}).data().toArray().length?
  54. (e.arrayFilter=e.arrayOriginal,e.bins=e.binsOriginal):(this.c.viewTotal||this.c.cascadePanes)&&this._populatePane(!this.s.filteringActive);this.c.viewTotal?this._detailsPane():e.binsTotal=e.bins;this.c.viewTotal&&!this.c.cascadePanes&&(e.arrayFilter=e.arrayTotals);for(var f=function(a){if(a&&(e.bins[a.filter]!==void 0&&e.bins[a.filter]!==0&&d.c.cascadePanes||!d.c.cascadePanes||d.s.clearing)){var b=d.addRow(a.display,a.filter,!d.c.viewTotal?e.bins[a.filter]:e.bins[a.filter]!==void 0?e.bins[a.filter]:
  55. 0,d.c.viewTotal?String(e.binsTotal[a.filter]):e.bins[a.filter],a.sort,a.type),g=c.findIndex(function(b){return b.filter===a.filter});if(g!==-1){b.select();c.splice(g,1)}}},d=this,g=0,i=e.arrayFilter;g<i.length;g++)f(i[g])}if(void 0!==b.searchPanes&&void 0!==b.searchPanes.options||void 0!==b.options||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.options){f=function(a){var b=c.findIndex(function(b){if(b.display===a.data().display)return!0});-1!==b&&(a.select(),c.splice(b,1))};g=0;
  56. for(i=this._getComparisonRows();g<i.length;g++)b=i[g],f(b)}for(f=0;f<c.length;f++)b=c[f],b=this.addRow(b.display,b.filter,0,this.c.viewTotal?b.total:0,b.display,b.display),this.s.updating=!0,b.select(),this.s.updating=!1;this.s.dtPane.draw();this.s.dtPane.table().node().parentNode.scrollTop=a}};l.version="1.3.0";l.classes={buttonGroup:"dtsp-buttonGroup",buttonSub:"dtsp-buttonSub",clear:"dtsp-clear",clearAll:"dtsp-clearAll",clearButton:"clearButton",container:"dtsp-searchPane",countButton:"dtsp-countButton",
  57. disabledButton:"dtsp-disabledButton",hidden:"dtsp-hidden",hide:"dtsp-hide",layout:"dtsp-",name:"dtsp-name",nameButton:"dtsp-nameButton",nameCont:"dtsp-nameCont",narrow:"dtsp-narrow",paneButton:"dtsp-paneButton",paneInputButton:"dtsp-paneInputButton",pill:"dtsp-pill",search:"dtsp-search",searchCont:"dtsp-searchCont",searchIcon:"dtsp-searchIcon",searchLabelCont:"dtsp-searchButtonCont",selected:"dtsp-selected",smallGap:"dtsp-smallGap",subRow1:"dtsp-subRow1",subRow2:"dtsp-subRow2",subRowsContainer:"dtsp-subRowsContainer",
  58. title:"dtsp-title",topRow:"dtsp-topRow"};l.defaults={cascadePanes:!1,clear:!0,combiner:"or",container:function(a){return a.table().container()},controls:!0,dtOpts:{},emptyMessage:null,hideCount:!1,i18n:{clearPane:"&times;",count:"{total}",countFiltered:"{shown} ({total})",emptyMessage:"<em>No data</em>"},layout:"auto",name:void 0,orderable:!0,orthogonal:{display:"display",filter:"filter",hideCount:!1,search:"filter",show:void 0,sort:"sort",threshold:0.6,type:"type",viewCount:!0},preSelect:[],threshold:0.6,
  59. viewCount:!0,viewTotal:!1};t=l;var j,r,u,n=function(a,b,c){var e=this;void 0===c&&(c=!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=j.extend(!0,{},n.classes);this.c=j.extend(!0,{},n.defaults,b);this.dom={clearAll:j('<button type="button">Clear All</button>').addClass(this.classes.clearAll),container:j("<div/>").addClass(this.classes.panes).text(f.i18n("searchPanes.loadMessage",
  60. this.c.i18n.loadMessage)),emptyMessage:j("<div/>").addClass(this.classes.emptyMessage),options:j("<div/>").addClass(this.classes.container),panes:j("<div/>").addClass(this.classes.container),title:j("<div/>").addClass(this.classes.title),titleRow:j("<div/>").addClass(this.classes.titleRow),wrapper:j("<div/>")};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",
  61. function(a,b,c){void 0===c.searchPanes&&(c.searchPanes={});void 0===c.searchPanes_null&&(c.searchPanes_null={});a=0;for(b=e.s.selectionList;a<b.length;a++){var f=b[a],h=e.s.dt.column(f.index).dataSrc();void 0===c.searchPanes[h]&&(c.searchPanes[h]={});void 0===c.searchPanes_null[h]&&(c.searchPanes_null[h]={});for(var j=0;j<f.rows.length;j++)c.searchPanes[h][j]=f.rows[j].filter,null===c.searchPanes[h][j]&&(c.searchPanes_null[h][j]=!0)}});f.on("xhr",function(a,b,c){c&&(c.searchPanes&&c.searchPanes.options)&&
  62. (e.s.serverData=c,e.s.serverData.tableLength=c.recordsTotal,e._serverTotals())});f.settings()[0]._searchPanes=this;this.dom.clearAll.text(f.i18n("searchPanes.clearMessage",this.c.i18n.clearMessage));if(this.s.dt.settings()[0]._bInitComplete||c)this._paneDeclare(f,a,b);else f.one("preInit.dt",function(){e._paneDeclare(f,a,b)});return this}};n.prototype.clearSelections=function(){this.dom.container.find("."+this.classes.search.replace(/\s+/g,".")).each(function(){j(this).val("");j(this).trigger("input")});
  63. for(var a=[],b=0,c=this.s.panes;b<c.length;b++){var e=c[b];void 0!==e.s.dtPane&&a.push(e.clearPane())}return a};n.prototype.getNode=function(){return this.dom.container};n.prototype.rebuild=function(a,b){void 0===a&&(a=!1);void 0===b&&(b=!1);j(this.dom.emptyMessage).remove();var c=[];!1===a&&j(this.dom.panes).empty();for(var e=0,f=this.s.panes;e<f.length;e++){var d=f[e];!1!==a&&d.s.index!==a||(d.clearData(),c.push(d.rebuildPane(void 0!==this.s.selectionList[this.s.selectionList.length-1]?d.s.index===
  64. this.s.selectionList[this.s.selectionList.length-1].index:!1,this.s.dt.page.info().serverSide?this.s.serverData:void 0,null,b)),j(this.dom.panes).append(d.dom.container))}this.c.cascadePanes||this.c.viewTotal?this.redrawPanes(!0):this._updateSelection();this._updateFilterCount();this._attachPaneContainer();this.s.dt.draw();this.resizePanes();return 1===c.length?c[0]:c};n.prototype.redrawPanes=function(a){void 0===a&&(a=!1);var b=this.s.dt;if(!this.s.updating&&!this.s.dt.page.info().serverSide){for(var c=
  65. !0,e=this.s.filterPane,f=null,d=0,g=this.s.panes;d<g.length;d++){var i=g[d];void 0!==i.s.dtPane&&(f+=i.s.dtPane.rows({selected:!0}).data().toArray().length)}if(0===f&&b.rows({search:"applied"}).data().toArray().length===b.rows().data().toArray().length)c=!1;else if(this.c.viewTotal){d=0;for(g=this.s.panes;d<g.length;d++)if(i=g[d],void 0!==i.s.dtPane){var h=i.s.dtPane.rows({selected:!0}).data().toArray().length;if(0===h)for(var k=0,j=this.s.selectionList;k<j.length;k++){var l=j[k];l.index===i.s.index&&
  66. 0!==l.rows.length&&(h=l.rows.length)}0<h&&-1===e?e=i.s.index:0<h&&(e=null)}0===f&&(e=null)}g=void 0;d=[];if(this.regenerating){b=-1;1===d.length&&(null!==f&&0!==f)&&(b=d[0].index);a=0;for(d=this.s.panes;a<d.length;a++)if(i=d[a],void 0!==i.s.dtPane){g=!0;i.s.filteringActive=!0;if(-1!==e&&null!==e&&e===i.s.index||!1===c||i.s.index===b)g=!1,i.s.filteringActive=!1;i.updatePane(!g?g:c)}this._updateFilterCount()}else{h=0;for(k=this.s.panes;h<k.length;h++)if(i=k[h],i.s.selectPresent){this.s.selectionList.push({index:i.s.index,
  67. protect:!1,rows:i.s.dtPane.rows({selected:!0}).data().toArray()});b.state.save();break}else i.s.deselect&&(g=i.s.index,j=i.s.dtPane.rows({selected:!0}).data().toArray(),0<j.length&&this.s.selectionList.push({index:i.s.index,protect:!0,rows:j}));if(0<this.s.selectionList.length){b=this.s.selectionList[this.s.selectionList.length-1].index;h=0;for(k=this.s.panes;h<k.length;h++)i=k[h],i.s.lastSelect=i.s.index===b}for(i=0;i<this.s.selectionList.length;i++)if(this.s.selectionList[i].index!==g||!0===this.s.selectionList[i].protect){b=
  68. !1;for(h=i+1;h<this.s.selectionList.length;h++)this.s.selectionList[h].index===this.s.selectionList[i].index&&(b=!0);b||(d.push(this.s.selectionList[i]),this.s.selectionList[i].protect=!1)}b=-1;1===d.length&&(null!==f&&0!==f)&&(b=d[0].index);h=0;for(k=this.s.panes;h<k.length;h++)if(i=k[h],void 0!==i.s.dtPane){g=!0;i.s.filteringActive=!0;if(-1!==e&&null!==e&&e===i.s.index||!1===c||i.s.index===b)g=!1,i.s.filteringActive=!1;i.updatePane(!g?!1:c)}this._updateFilterCount();if(0<d.length&&(d.length<this.s.selectionList.length||
  69. a)){this._cascadeRegen(d,f);b=d[d.length-1].index;e=0;for(a=this.s.panes;e<a.length;e++)i=a[e],i.s.lastSelect=i.s.index===b}else if(0<d.length){i=0;for(a=this.s.panes;i<a.length;i++)if(d=a[i],void 0!==d.s.dtPane){g=!0;d.s.filteringActive=!0;if(-1!==e&&null!==e&&e===d.s.index||!1===c||d.s.index===b)g=!1,d.s.filteringActive=!1;d.updatePane(!g?g:c)}}}if(!c||0===f)this.s.selectionList=[]}};n.prototype.resizePanes=function(){if("auto"===this.c.layout){for(var a=j(this.s.dt.searchPanes.container()).width(),
  70. b=Math.floor(a/260),a=1,c=0,e=[],f=0,d=this.s.panes;f<d.length;f++){var g=d[f];g.s.displayed&&e.push(g.s.index)}g=e.length;if(b===g)a=b;else for(;1<b;b--)if(f=g%b,0===f){a=b;c=0;break}else f>c&&(a=b,c=f);e=0!==c?e.slice(e.length-c,e.length):[];b=0;for(f=this.s.panes;b<f.length;b++)g=f[b],g.s.displayed&&(d="columns-"+(-1===e.indexOf(g.s.index)?a:c),g.resize(d))}else{a=0;for(c=this.s.panes;a<c.length;a++)g=c[a],g.adjustTopRow()}return this};n.prototype._attach=function(){var a=this;j(this.dom.container).removeClass(this.classes.hide);
  71. j(this.dom.titleRow).removeClass(this.classes.hide);j(this.dom.titleRow).remove();j(this.dom.title).appendTo(this.dom.titleRow);this.c.clear&&(j(this.dom.clearAll).appendTo(this.dom.titleRow),j(this.dom.clearAll).on("click.dtsps",function(){a.clearSelections()}));j(this.dom.titleRow).appendTo(this.dom.container);for(var b=0,c=this.s.panes;b<c.length;b++)j(c[b].dom.container).appendTo(this.dom.panes);j(this.dom.panes).appendTo(this.dom.container);0===j("div."+this.classes.container).length&&j(this.dom.container).prependTo(this.s.dt);
  72. return this.dom.container};n.prototype._attachExtras=function(){j(this.dom.container).removeClass(this.classes.hide);j(this.dom.titleRow).removeClass(this.classes.hide);j(this.dom.titleRow).remove();j(this.dom.title).appendTo(this.dom.titleRow);this.c.clear&&j(this.dom.clearAll).appendTo(this.dom.titleRow);j(this.dom.titleRow).appendTo(this.dom.container);return this.dom.container};n.prototype._attachMessage=function(){var a;try{a=this.s.dt.i18n("searchPanes.emptyPanes",this.c.i18n.emptyPanes)}catch(b){a=
  73. null}if(null===a)j(this.dom.container).addClass(this.classes.hide),j(this.dom.titleRow).removeClass(this.classes.hide);else return j(this.dom.container).removeClass(this.classes.hide),j(this.dom.titleRow).addClass(this.classes.hide),j(this.dom.emptyMessage).text(a),this.dom.emptyMessage.appendTo(this.dom.container),this.dom.container};n.prototype._attachPaneContainer=function(){for(var a=0,b=this.s.panes;a<b.length;a++)if(!0===b[a].s.displayed)return this._attach();return this._attachMessage()};n.prototype._cascadeRegen=
  74. function(a,b){this.regenerating=!0;var c=-1;1===a.length&&(null!==b&&0!==b)&&(c=a[0].index);for(var e=0,f=this.s.panes;e<f.length;e++){var d=f[e];d.setCascadeRegen(!0);d.setClear(!0);(void 0!==d.s.dtPane&&d.s.index===c||void 0!==d.s.dtPane)&&d.clearPane();d.setClear(!1)}this.s.dt.draw();c=this.s.dt.rows({search:"applied"}).data().toArray().length;e=this.s.dt.rows().data().toArray().length;if(e!==c)for(var f=0,g=this.s.panes;f<g.length;f++)d=g[f],d.s.forceViewTotal=!0;f=0;for(g=this.s.panes;f<g.length;f++)d=
  75. g[f],d.updatePane(!0);this._makeCascadeSelections(a);this.s.selectionList=a;f=0;for(g=this.s.panes;f<g.length;f++)d=g[f],d.setCascadeRegen(!1);this.regenerating=!1;if(e!==c){c=0;for(e=this.s.panes;c<e.length;c++)d=e[c],d.s.forceViewTotal=!1}};n.prototype._checkMessage=function(){for(var a=0,b=this.s.panes;a<b.length;a++)if(!0===b[a].s.displayed){j(this.dom.emptyMessage).remove();j(this.dom.titleRow).removeClass(this.classes.hide);return}return this._attachMessage()};n.prototype._getState=function(){var a=
  76. this.s.dt.state.loaded();a&&(a.searchPanes&&void 0!==a.searchPanes.selectionList)&&(this.s.selectionList=a.searchPanes.selectionList)};n.prototype._makeCascadeSelections=function(a){for(var b=0;b<a.length;b++)for(var c=function(d){if(d.s.index===a[b].index&&void 0!==d.s.dtPane){b===a.length-1&&(d.s.lastCascade=!0);0<d.s.dtPane.rows({selected:!0}).data().toArray().length&&void 0!==d.s.dtPane&&(d.setClear(!0),d.clearPane(),d.setClear(!1));for(var c=function(a){var b=false;d.s.dtPane.rows().every(function(c){if(d.s.dtPane.row(c).data()!==
  77. void 0&&a!==void 0&&d.s.dtPane.row(c).data().filter===a.filter){b=true;d.s.dtPane.row(c).select()}});b||d.addRow(a.display,a.filter,0,a.total,a.sort,a.type,a.className).select()},f=0,h=a[b].rows;f<h.length;f++)c(h[f]);d.s.dtPane.draw();e._updateFilterCount();d.s.lastCascade=!1}},e=this,f=0,d=this.s.panes;f<d.length;f++)c(d[f]);this.s.dt.state.save()};n.prototype._paneDeclare=function(a,b,c){var e=this;a.columns(0<this.c.columns.length?this.c.columns:void 0).eq(0).each(function(a){e.s.panes.push(new t(b,
  78. c,a,e.c.layout,e.dom.panes))});for(var f=a.columns().eq(0).toArray().length,d=this.c.panes.length,g=0;g<d;g++)this.s.panes.push(new t(b,c,f+g,this.c.layout,this.dom.panes,this.c.panes[g]));if(0<this.c.order.length){f=this.c.order.map(function(a){return e._findPane(a)});this.dom.panes.empty();this.s.panes=f;f=0;for(d=this.s.panes;f<d.length;f++)this.dom.panes.append(d[f].dom.container)}this.s.dt.settings()[0]._bInitComplete?this._startup(a):this.s.dt.settings()[0].aoInitComplete.push({fn:function(){e._startup(a)}})};
  79. n.prototype._findPane=function(a){for(var b=0,c=this.s.panes;b<c.length;b++){var e=c[b];if(a===e.s.name)return e}};n.prototype._serverTotals=function(){for(var a=!1,b=!1,c=this.s.dt,e=0,f=this.s.panes;e<f.length;e++){var d=f[e];if(d.s.selectPresent){this.s.selectionList.push({index:d.s.index,protect:!1,rows:d.s.dtPane.rows({selected:!0}).data().toArray()});c.state.save();d.s.selectPresent=!1;a=!0;break}else d.s.deselect&&(b=d.s.dtPane.rows({selected:!0}).data().toArray(),0<b.length&&this.s.selectionList.push({index:d.s.index,
  80. protect:!0,rows:b}),b=a=!0)}if(a){c=[];for(e=0;e<this.s.selectionList.length;e++){d=!1;for(f=e+1;f<this.s.selectionList.length;f++)this.s.selectionList[f].index===this.s.selectionList[e].index&&(d=!0);if(!d){for(var f=!1,a=0,g=this.s.panes;a<g.length;a++)d=g[a],d.s.index===this.s.selectionList[e].index&&0<d.s.dtPane.rows({selected:!0}).data().toArray().length&&(f=!0);f&&c.push(this.s.selectionList[e])}}this.s.selectionList=c}else this.s.selectionList=[];c=-1;if(b&&1===this.s.selectionList.length){b=
  81. 0;for(e=this.s.panes;b<e.length;b++)d=e[b],d.s.lastSelect=!1,d.s.deselect=!1,void 0!==d.s.dtPane&&0<d.s.dtPane.rows({selected:!0}).data().toArray().length&&(c=d.s.index)}else if(0<this.s.selectionList.length){b=this.s.selectionList[this.s.selectionList.length-1].index;e=0;for(f=this.s.panes;e<f.length;e++)d=f[e],d.s.lastSelect=d.s.index===b,d.s.deselect=!1}else if(0===this.s.selectionList.length){b=0;for(e=this.s.panes;b<e.length;b++)d=e[b],d.s.lastSelect=!1,d.s.deselect=!1}j(this.dom.panes).empty();
  82. b=0;for(e=this.s.panes;b<e.length;b++)d=e[b],d.s.lastSelect?d._setListeners():d.rebuildPane(void 0,this.s.dt.page.info().serverSide?this.s.serverData:void 0,d.s.index===c?!0:null,!0),j(this.dom.panes).append(d.dom.container),void 0!==d.s.dtPane&&(j(d.s.dtPane.table().node()).parent()[0].scrollTop=d.s.scrollTop,j.fn.dataTable.select.init(d.s.dtPane));this._updateSelection()};n.prototype._startup=function(a){var b=this;j(this.dom.container).text("");this._attachExtras();j(this.dom.container).append(this.dom.panes);
  83. j(this.dom.panes).empty();var c=this.s.dt.state.loaded();if(this.c.viewTotal&&!this.c.cascadePanes&&null!==c&&void 0!==c&&void 0!==c.searchPanes&&void 0!==c.searchPanes.panes){for(var e=!1,f=0,d=c.searchPanes.panes;f<d.length;f++){var g=d[f];if(0<g.selected.length){e=!0;break}}if(e){e=0;for(f=this.s.panes;e<f.length;e++)g=f[e],g.s.showFiltered=!0}}e=0;for(f=this.s.panes;e<f.length;e++)g=f[e],g.rebuildPane(void 0,0<Object.keys(this.s.serverData).length?this.s.serverData:void 0),j(this.dom.panes).append(g.dom.container);
  84. "auto"===this.c.layout&&this.resizePanes();!this.s.stateRead&&(null!==c&&void 0!==c)&&(this.s.dt.page(c.start/this.s.dt.page.len()),this.s.dt.draw("page"));this.s.stateRead=!0;if(this.c.viewTotal&&!this.c.cascadePanes){c=0;for(e=this.s.panes;c<e.length;c++)g=e[c],g.updatePane()}this._updateFilterCount();this._checkMessage();a.on("preDraw.dtsps",function(){if(!b.s.updating){b._updateFilterCount();(b.c.cascadePanes||b.c.viewTotal)&&!b.s.dt.page.info().serverSide?b.redrawPanes(b.c.viewTotal):b._updateSelection();
  85. b.s.filterPane=-1}});j(window).on("resize.dtsp",r.util.throttle(function(){b.resizePanes()}));this.s.dt.on("stateSaveParams.dtsp",function(a,d,c){if(c.searchPanes===void 0)c.searchPanes={};c.searchPanes.selectionList=b.s.selectionList});if(this.s.dt.page.info().serverSide)a.off("page"),a.on("page",function(){b.s.page=b.s.dt.page()}),a.off("preXhr.dt"),a.on("preXhr.dt",function(a,d,c){if(c.searchPanes===void 0)c.searchPanes={};if(c.searchPanes_null===void 0)c.searchPanes_null={};for(var d=a=0,e=b.s.panes;d<
  86. e.length;d++){var g=e[d],f=b.s.dt.column(g.s.index).dataSrc();c.searchPanes[f]===void 0&&(c.searchPanes[f]={});c.searchPanes_null[f]===void 0&&(c.searchPanes_null[f]={});if(g.s.dtPane!==void 0)for(var g=g.s.dtPane.rows({selected:true}).data().toArray(),h=0;h<g.length;h++){c.searchPanes[f][h]=g[h].filter;c.searchPanes[f][h]===null&&(c.searchPanes_null[f][h]=true);a++}}b.c.viewTotal&&b._prepViewTotal(a);if(a>0){if(a!==b.s.filterCount){c.start=0;b.s.page=0}else c.start=b.s.page*b.s.dt.page.len();b.s.dt.page(b.s.page);
  87. b.s.filterCount=a}});else a.on("preXhr.dt",function(){for(var a=0,d=b.s.panes;a<d.length;a++)d[a].clearData()});this.s.dt.on("xhr",function(a,d){if(d.nTable===b.s.dt.table().node()){var c=false;if(!b.s.dt.page.info().serverSide)b.s.dt.one("preDraw",function(){if(!c){var a=b.s.dt.page();c=true;b.s.updating=true;j(b.dom.panes).empty();for(var d=0,e=b.s.panes;d<e.length;d++){var g=e[d];g.clearData();g.rebuildPane(b.s.selectionList[b.s.selectionList.length-1]!==void 0?g.s.index===b.s.selectionList[b.s.selectionList.length-
  88. 1].index:false,void 0,void 0,true);j(b.dom.panes).append(g.dom.container)}b.s.dt.page.info().serverSide||b.s.dt.draw();b.s.updating=false;b.c.cascadePanes||b.c.viewTotal?b.redrawPanes(b.c.cascadePanes):b._updateSelection();b._checkMessage();b.s.dt.one("draw",function(){b.s.updating=true;b.s.dt.page(a).draw(false);b.s.updating=false})}})}});c=0;for(e=this.s.panes;c<e.length;c++)if(g=e[c],void 0!==g&&void 0!==g.s.dtPane&&(void 0!==g.s.colOpts.preSelect&&0<g.s.colOpts.preSelect.length||null!==g.customPaneSettings&&
  89. void 0!==g.customPaneSettings.preSelect&&0<g.customPaneSettings.preSelect.length)){f=g.s.dtPane.rows().data().toArray().length;for(d=0;d<f;d++)(-1!==g.s.colOpts.preSelect.indexOf(g.s.dtPane.cell(d,0).data())||null!==g.customPaneSettings&&void 0!==g.customPaneSettings.preSelect&&-1!==g.customPaneSettings.preSelect.indexOf(g.s.dtPane.cell(d,0).data()))&&g.s.dtPane.row(d).select();g.updateTable()}if(void 0!==this.s.selectionList&&0<this.s.selectionList.length){c=this.s.selectionList[this.s.selectionList.length-
  90. 1].index;e=0;for(f=this.s.panes;e<f.length;e++)g=f[e],g.s.lastSelect=g.s.index===c}0<this.s.selectionList.length&&this.c.cascadePanes&&this._cascadeRegen(this.s.selectionList,this.s.selectionList.length);this._updateFilterCount();a.on("destroy.dtsps",function(){for(var d=0,c=b.s.panes;d<c.length;d++)c[d].destroy();a.off(".dtsps");j(b.dom.clearAll).off(".dtsps");j(b.dom.container).remove();b.clearSelections()});if(this.c.clear)j(this.dom.clearAll).on("click.dtsps",function(){b.clearSelections()});
  91. a.settings()[0]._searchPanes=this;this.s.dt.state.save()};n.prototype._prepViewTotal=function(a){for(var b=this.s.filterPane,c=!1,e=0,f=this.s.panes;e<f.length;e++){var d=f[e];if(void 0!==d.s.dtPane){var g=d.s.dtPane.rows({selected:!0}).data().toArray().length;0<g&&-1===b?(b=d.s.index,c=!0):0<g&&(b=null)}}null!==a&&0!==a&&(b=null);a=0;for(e=this.s.panes;a<e.length;a++)if(d=e[a],void 0!==d.s.dtPane&&(d.s.filteringActive=!0,-1!==b&&null!==b&&b===d.s.index||!1===c))d.s.filteringActive=!1};n.prototype._updateFilterCount=
  92. function(){for(var a=0,b=0,c=this.s.panes;b<c.length;b++){var e=c[b];void 0!==e.s.dtPane&&(a+=e.getPaneCount())}b=this.s.dt.i18n("searchPanes.title",this.c.i18n.title,a);j(this.dom.title).text(b);void 0!==this.c.filterChanged&&"function"===typeof this.c.filterChanged&&this.c.filterChanged.call(this.s.dt,a);0===a?j(this.dom.clearAll).addClass(this.classes.disabledButton).attr("disabled","true"):j(this.dom.clearAll).removeClass(this.classes.disabledButton).removeAttr("disabled")};n.prototype._updateSelection=
  93. function(){this.s.selectionList=[];for(var a=0,b=this.s.panes;a<b.length;a++){var c=b[a];void 0!==c.s.dtPane&&this.s.selectionList.push({index:c.s.index,protect:!1,rows:c.s.dtPane.rows({selected:!0}).data().toArray()})}this.s.dt.state.save()};n.version="1.3.0";n.classes={clear:"dtsp-clear",clearAll:"dtsp-clearAll",container:"dtsp-searchPanes",disabledButton:"dtsp-disabledButton",emptyMessage:"dtsp-emptyMessage",hide:"dtsp-hidden",panes:"dtsp-panesContainer",search:"dtsp-search",title:"dtsp-title",
  94. titleRow:"dtsp-titleRow"};n.defaults={cascadePanes:!1,clear:!0,columns:[],container:function(a){return a.table().container()},filterChanged:void 0,i18n:{clearMessage:"Clear All",clearPane:"&times;",collapse:{"0":"SearchPanes",_:"SearchPanes (%d)"},count:"{total}",countFiltered:"{shown} ({total})",emptyMessage:"<em>No data</em>",emptyPanes:"No SearchPanes",loadMessage:"Loading Search Panes...",title:"Filters Active - %d"},layout:"auto",order:[],panes:[],viewTotal:!1};u=n;var v=function(a,b,c){function e(a,
  95. b,c){void 0===b&&(b=null);void 0===c&&(c=!1);a=new f.Api(a);b=b?b:a.init().searchPanes||f.defaults.searchPanes;return(new u(a,b,c)).getNode()}h=a;s=a.fn.dataTable;j=a;var f=r=a.fn.dataTable;a.fn.dataTable.SearchPanes=u;a.fn.DataTable.SearchPanes=u;a.fn.dataTable.SearchPane=t;a.fn.DataTable.SearchPane=t;b=a.fn.dataTable.Api.register;b("searchPanes()",function(){return this});b("searchPanes.clearSelections()",function(){return this.iterator("table",function(a){a._searchPanes&&a._searchPanes.clearSelections()})});
  96. b("searchPanes.rebuildPane()",function(a,b){return this.iterator("table",function(c){c._searchPanes&&c._searchPanes.rebuild(a,b)})});b("searchPanes.resizePanes()",function(){var a=this.context[0];return a._searchPanes?a._searchPanes.resizePanes():null});b("searchPanes.container()",function(){var a=this.context[0];return a._searchPanes?a._searchPanes.getNode():null});a.fn.dataTable.ext.buttons.searchPanesClear={action:function(a,b){b.searchPanes.clearSelections()},text:"Clear Panes"};a.fn.dataTable.ext.buttons.searchPanes=
  97. {action:function(a,b,c,e){a.stopPropagation();this.popover(e._panes.getNode(),{align:"dt-container"});e._panes.rebuild(void 0,!0)},config:{},init:function(b,c,e){var f=new a.fn.dataTable.SearchPanes(b,a.extend({filterChanged:function(a){b.button(c).text(b.i18n("searchPanes.collapse",f.c.i18n.collapse,a))}},e.config)),h=b.i18n("searchPanes.collapse",f.c.i18n.collapse,0);b.button(c).text(h);e._panes=f},text:"Search Panes"};a(c).on("preInit.dt.dtsp",function(a,b){if("dt"===a.namespace&&(b.oInit.searchPanes||
  98. f.defaults.searchPanes))b._searchPanes||e(b,null,!0)});f.ext.feature.push({cFeature:"P",fnInit:e});f.ext.features&&f.ext.features.register("searchPanes",e)};"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return v(a,window,document)}):"object"===typeof exports?module.exports=function(a,b){a||(a=window);if(!b||!b.fn.dataTable)b=require("datatables.net")(a,b).$;return v(b,a,a.document)}:v(window.jQuery,window,document)})();